Compare commits
No commits in common. "33c148e6a153b6067bb93fe5b0d268dff7ac420a" and "62a1c4e1e916bdddd4f8160dc47c29150121a955" have entirely different histories.
33c148e6a1
...
62a1c4e1e9
6 changed files with 21 additions and 131 deletions
|
|
@ -14,19 +14,6 @@ _logger = logging.getLogger(__name__)
|
||||||
class CustomerPortal(sale_portal.CustomerPortal):
|
class CustomerPortal(sale_portal.CustomerPortal):
|
||||||
"""Extend sale portal to include draft orders."""
|
"""Extend sale portal to include draft orders."""
|
||||||
|
|
||||||
def _get_weekday_names(self):
|
|
||||||
"""Return translated weekday names (Monday first, Sunday last)."""
|
|
||||||
_t = request.env._
|
|
||||||
return [
|
|
||||||
_t("Monday"),
|
|
||||||
_t("Tuesday"),
|
|
||||||
_t("Wednesday"),
|
|
||||||
_t("Thursday"),
|
|
||||||
_t("Friday"),
|
|
||||||
_t("Saturday"),
|
|
||||||
_t("Sunday"),
|
|
||||||
]
|
|
||||||
|
|
||||||
def _prepare_orders_domain(self, partner):
|
def _prepare_orders_domain(self, partner):
|
||||||
"""Override to include draft and done orders."""
|
"""Override to include draft and done orders."""
|
||||||
return [
|
return [
|
||||||
|
|
@ -48,7 +35,15 @@ class CustomerPortal(sale_portal.CustomerPortal):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add translated day names for pickup_day display
|
# Add translated day names for pickup_day display
|
||||||
values["day_names"] = self._get_weekday_names()
|
values["day_names"] = [
|
||||||
|
request.env._("Monday"),
|
||||||
|
request.env._("Tuesday"),
|
||||||
|
request.env._("Wednesday"),
|
||||||
|
request.env._("Thursday"),
|
||||||
|
request.env._("Friday"),
|
||||||
|
request.env._("Saturday"),
|
||||||
|
request.env._("Sunday"),
|
||||||
|
]
|
||||||
|
|
||||||
request.session["my_orders_history"] = values["orders"].ids[:100]
|
request.session["my_orders_history"] = values["orders"].ids[:100]
|
||||||
return request.render("sale.portal_my_orders", values)
|
return request.render("sale.portal_my_orders", values)
|
||||||
|
|
@ -63,6 +58,14 @@ class CustomerPortal(sale_portal.CustomerPortal):
|
||||||
|
|
||||||
# If it's a template render (not a redirect), add day_names to the context
|
# If it's a template render (not a redirect), add day_names to the context
|
||||||
if hasattr(response, "qcontext"):
|
if hasattr(response, "qcontext"):
|
||||||
response.qcontext["day_names"] = self._get_weekday_names()
|
response.qcontext["day_names"] = [
|
||||||
|
request.env._("Monday"),
|
||||||
|
request.env._("Tuesday"),
|
||||||
|
request.env._("Wednesday"),
|
||||||
|
request.env._("Thursday"),
|
||||||
|
request.env._("Friday"),
|
||||||
|
request.env._("Saturday"),
|
||||||
|
request.env._("Sunday"),
|
||||||
|
]
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,6 @@ class AplicoopWebsiteSale(WebsiteSale):
|
||||||
# ============ MISC ============
|
# ============ MISC ============
|
||||||
"items": env_lang._("items"),
|
"items": env_lang._("items"),
|
||||||
"added_to_cart": env_lang._("added to cart"),
|
"added_to_cart": env_lang._("added to cart"),
|
||||||
"out_of_stock": env_lang._("Out of stock"),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return labels
|
return labels
|
||||||
|
|
|
||||||
|
|
@ -13,48 +13,6 @@ msgstr ""
|
||||||
"Content-Transfer-Encoding: \n"
|
"Content-Transfer-Encoding: \n"
|
||||||
"Plural-Forms: \n"
|
"Plural-Forms: \n"
|
||||||
|
|
||||||
#. module: website_sale_aplicoop
|
|
||||||
#. odoo-python
|
|
||||||
#: code:addons/website_sale_aplicoop/controllers/portal.py:0
|
|
||||||
msgid "Monday"
|
|
||||||
msgstr "Lunes"
|
|
||||||
|
|
||||||
#. module: website_sale_aplicoop
|
|
||||||
#. odoo-python
|
|
||||||
#: code:addons/website_sale_aplicoop/controllers/portal.py:0
|
|
||||||
msgid "Tuesday"
|
|
||||||
msgstr "Martes"
|
|
||||||
|
|
||||||
#. module: website_sale_aplicoop
|
|
||||||
#. odoo-python
|
|
||||||
#: code:addons/website_sale_aplicoop/controllers/portal.py:0
|
|
||||||
msgid "Wednesday"
|
|
||||||
msgstr "Miércoles"
|
|
||||||
|
|
||||||
#. module: website_sale_aplicoop
|
|
||||||
#. odoo-python
|
|
||||||
#: code:addons/website_sale_aplicoop/controllers/portal.py:0
|
|
||||||
msgid "Thursday"
|
|
||||||
msgstr "Jueves"
|
|
||||||
|
|
||||||
#. module: website_sale_aplicoop
|
|
||||||
#. odoo-python
|
|
||||||
#: code:addons/website_sale_aplicoop/controllers/portal.py:0
|
|
||||||
msgid "Friday"
|
|
||||||
msgstr "Viernes"
|
|
||||||
|
|
||||||
#. module: website_sale_aplicoop
|
|
||||||
#. odoo-python
|
|
||||||
#: code:addons/website_sale_aplicoop/controllers/portal.py:0
|
|
||||||
msgid "Saturday"
|
|
||||||
msgstr "Sábado"
|
|
||||||
|
|
||||||
#. module: website_sale_aplicoop
|
|
||||||
#. odoo-python
|
|
||||||
#: code:addons/website_sale_aplicoop/controllers/portal.py:0
|
|
||||||
msgid "Sunday"
|
|
||||||
msgstr "Domingo"
|
|
||||||
|
|
||||||
#. module: base
|
#. module: base
|
||||||
#: model:ir.module.module,description:base.module_website_sale_aplicoop
|
#: model:ir.module.module,description:base.module_website_sale_aplicoop
|
||||||
msgid ""
|
msgid ""
|
||||||
|
|
|
||||||
|
|
@ -13,48 +13,6 @@ msgstr ""
|
||||||
"Content-Transfer-Encoding: \n"
|
"Content-Transfer-Encoding: \n"
|
||||||
"Plural-Forms: \n"
|
"Plural-Forms: \n"
|
||||||
|
|
||||||
#. module: website_sale_aplicoop
|
|
||||||
#. odoo-python
|
|
||||||
#: code:addons/website_sale_aplicoop/controllers/portal.py:0
|
|
||||||
msgid "Monday"
|
|
||||||
msgstr "Astelehena"
|
|
||||||
|
|
||||||
#. module: website_sale_aplicoop
|
|
||||||
#. odoo-python
|
|
||||||
#: code:addons/website_sale_aplicoop/controllers/portal.py:0
|
|
||||||
msgid "Tuesday"
|
|
||||||
msgstr "Asteartea"
|
|
||||||
|
|
||||||
#. module: website_sale_aplicoop
|
|
||||||
#. odoo-python
|
|
||||||
#: code:addons/website_sale_aplicoop/controllers/portal.py:0
|
|
||||||
msgid "Wednesday"
|
|
||||||
msgstr "Asteazkena"
|
|
||||||
|
|
||||||
#. module: website_sale_aplicoop
|
|
||||||
#. odoo-python
|
|
||||||
#: code:addons/website_sale_aplicoop/controllers/portal.py:0
|
|
||||||
msgid "Thursday"
|
|
||||||
msgstr "Osteguna"
|
|
||||||
|
|
||||||
#. module: website_sale_aplicoop
|
|
||||||
#. odoo-python
|
|
||||||
#: code:addons/website_sale_aplicoop/controllers/portal.py:0
|
|
||||||
msgid "Friday"
|
|
||||||
msgstr "Ostirala"
|
|
||||||
|
|
||||||
#. module: website_sale_aplicoop
|
|
||||||
#. odoo-python
|
|
||||||
#: code:addons/website_sale_aplicoop/controllers/portal.py:0
|
|
||||||
msgid "Saturday"
|
|
||||||
msgstr "Larunbata"
|
|
||||||
|
|
||||||
#. module: website_sale_aplicoop
|
|
||||||
#. odoo-python
|
|
||||||
#: code:addons/website_sale_aplicoop/controllers/portal.py:0
|
|
||||||
msgid "Sunday"
|
|
||||||
msgstr "Igandea"
|
|
||||||
|
|
||||||
#. module: base
|
#. module: base
|
||||||
#: model:ir.module.module,description:base.module_website_sale_aplicoop
|
#: model:ir.module.module,description:base.module_website_sale_aplicoop
|
||||||
msgid ""
|
msgid ""
|
||||||
|
|
|
||||||
|
|
@ -792,19 +792,6 @@
|
||||||
var quantityInput = form.querySelector(".product-qty");
|
var quantityInput = form.querySelector(".product-qty");
|
||||||
var quantity = quantityInput ? parseFloat(quantityInput.value) : 1;
|
var quantity = quantityInput ? parseFloat(quantityInput.value) : 1;
|
||||||
|
|
||||||
// Block add-to-cart if product is flagged out of stock (from template)
|
|
||||||
var isOutOfStock =
|
|
||||||
(form.getAttribute("data-out-of-stock") || "false") === "true" ||
|
|
||||||
(cartBtn.getAttribute("data-out-of-stock") || "false") === "true";
|
|
||||||
if (isOutOfStock) {
|
|
||||||
var labels = self._getLabels();
|
|
||||||
self._showNotification(
|
|
||||||
labels.out_of_stock || "Product is out of stock",
|
|
||||||
"warning"
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("Adding:", {
|
console.log("Adding:", {
|
||||||
productId: productId,
|
productId: productId,
|
||||||
productName: productName,
|
productName: productName,
|
||||||
|
|
|
||||||
|
|
@ -666,16 +666,7 @@
|
||||||
<t t-set="safe_uom_category" t-value="product_display_info.get(product.id, {}).get('safe_uom_category', '')" />
|
<t t-set="safe_uom_category" t-value="product_display_info.get(product.id, {}).get('safe_uom_category', '')" />
|
||||||
<t t-set="quantity_step" t-value="product_display_info.get(product.id, {}).get('quantity_step', 1)" />
|
<t t-set="quantity_step" t-value="product_display_info.get(product.id, {}).get('quantity_step', 1)" />
|
||||||
<t t-set="order_id_safe" t-value="group_order.id if group_order else ''" />
|
<t t-set="order_id_safe" t-value="group_order.id if group_order else ''" />
|
||||||
<form
|
<form class="add-to-cart-form" t-attf-data-order-id="{{ order_id_safe }}" t-attf-data-product-id="{{ product.id }}" t-attf-data-product-name="{{ product.name }}" t-attf-data-product-price="{{ display_price }}" t-attf-data-uom-category="{{ safe_uom_category }}" t-attf-data-quantity-step="{{ quantity_step }}">
|
||||||
class="add-to-cart-form"
|
|
||||||
t-attf-data-order-id="{{ order_id_safe }}"
|
|
||||||
t-attf-data-product-id="{{ product.id }}"
|
|
||||||
t-attf-data-product-name="{{ product.name }}"
|
|
||||||
t-attf-data-product-price="{{ display_price }}"
|
|
||||||
t-attf-data-uom-category="{{ safe_uom_category }}"
|
|
||||||
t-attf-data-quantity-step="{{ quantity_step }}"
|
|
||||||
t-att-data-out-of-stock="'true' if product.is_out_of_stock else 'false'"
|
|
||||||
>
|
|
||||||
<div class="qty-control">
|
<div class="qty-control">
|
||||||
<label t-attf-for="qty_{{ product.id }}" class="sr-only">Quantity of <t t-esc="product.name" />
|
<label t-attf-for="qty_{{ product.id }}" class="sr-only">Quantity of <t t-esc="product.name" />
|
||||||
</label>
|
</label>
|
||||||
|
|
@ -686,14 +677,8 @@
|
||||||
<button class="qty-increase" type="button" t-attf-data-product-id="{{ product.id }}" aria-label="Increase quantity">
|
<button class="qty-increase" type="button" t-attf-data-product-id="{{ product.id }}" aria-label="Increase quantity">
|
||||||
<i class="fa fa-plus" />
|
<i class="fa fa-plus" />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button class="add-to-cart-btn" type="button" t-attf-aria-label="{{ 'Add %s to cart' % product.name }}" t-attf-title="{{ 'Add %s to cart' % product.name }}">
|
||||||
class="add-to-cart-btn"
|
<i class="fa fa-shopping-cart" aria-hidden="true" />
|
||||||
type="button"
|
|
||||||
t-att-data-out-of-stock="'true' if product.is_out_of_stock else 'false'"
|
|
||||||
t-attf-aria-label="{{ 'Out of stock' if product.is_out_of_stock else 'Add %s to cart' % product.name }}"
|
|
||||||
t-attf-title="{{ 'Out of stock' if product.is_out_of_stock else 'Add %s to cart' % product.name }}"
|
|
||||||
>
|
|
||||||
<i t-attf-class="fa {{ 'fa-ban text-muted' if product.is_out_of_stock else 'fa-shopping-cart' }}" aria-hidden="true" />
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue