diff --git a/nfu_ecommerce/README.rst b/nfu_ecommerce/README.rst index ecc4d2c..959ac00 100644 --- a/nfu_ecommerce/README.rst +++ b/nfu_ecommerce/README.rst @@ -38,9 +38,10 @@ Changelog :0.0.1: Initial module. :1.0.0: Live :1.1.0: Add Open Packagings Filter and fix rounding issue -:1.1.1: Make publish on website multi company -:1.1.2: Pass arguemnts to super again +:1.1.1: Pass arguments to super again +:1.1.2: Make publish on website multi company :1.2.0: Add Open Packages to Product list +:1.3.0: Adapt new Open Packages format and add indicators Bug Tracker =========== diff --git a/nfu_ecommerce/__manifest__.py b/nfu_ecommerce/__manifest__.py index 66fca5a..0b692d4 100644 --- a/nfu_ecommerce/__manifest__.py +++ b/nfu_ecommerce/__manifest__.py @@ -4,7 +4,7 @@ "author": "BAKEUP", "website": "https://www.bakeup.org", "category": "website", - "version": "16.0.1.2.0", + "version": "16.0.1.3.0", "depends": [ "sale_product_configurator", "website_sale", diff --git a/nfu_ecommerce/controllers/main.py b/nfu_ecommerce/controllers/main.py index cc96bae..925a21e 100644 --- a/nfu_ecommerce/controllers/main.py +++ b/nfu_ecommerce/controllers/main.py @@ -26,12 +26,9 @@ class WebsiteSale(WebsiteSale): batch_product = batch_products.filtered(lambda p: p.product_template_id == product) if batch_product: batch_product = batch_product[0] - if batch_product.open_packaging_state == "full": + state_color = batch_product.get_state_color() + if state_color == "inherit": state_color = "green" - elif batch_product.open_packaging_state == "last_open": - state_color = "#ff6700" - else: - state_color = "red" packaging_info[product.id] = { "state_color": state_color, "open_qty": batch_product.open_packaging_qty, @@ -51,15 +48,13 @@ class WebsiteSale(WebsiteSale): packaging_info = {} if batch_product: batch_product = batch_product[0] + state_color = batch_product.get_state_color() packaging_info = { - "state": batch_product.open_packaging_state, + "state_color": state_color, "open_qty": batch_product.open_packaging_qty, + "open_max_qty": batch_product.open_packaging_max_qty, "package_qty": batch_product.product_packaging_qty, } - else: - packaging = product.sudo()._get_nfu_packaging() - if packaging and packaging.qty > 1: - packaging_info = {"state": False, "open_qty": 0, "package_qty": packaging.qty} new_values["packaging_info"] = packaging_info return new_values @@ -103,3 +98,9 @@ class WebsiteSale(WebsiteSale): page=page, category=category, search=search, min_price=min_price, max_price=max_price, ppg=ppg, **post ) return res + + # ToDo: add qntitiy do confiuration modal + # def show_advanced_configurator(self, product_id, variant_values, pricelist_id, **kw): + # batch = request.website.sale_get_order(force_create=True).batch_id + # kw['custom_attribute'] = {'batch_id': batch.id} + # return super().show_advanced_configurator(product_id, variant_values, pricelist_id, **kw) diff --git a/nfu_ecommerce/models/__init__.py b/nfu_ecommerce/models/__init__.py index b48bb2d..8cd19eb 100644 --- a/nfu_ecommerce/models/__init__.py +++ b/nfu_ecommerce/models/__init__.py @@ -1,2 +1,3 @@ from . import product_template from . import sale_order +from . import sale_order_batch_product diff --git a/nfu_ecommerce/models/sale_order_batch_product.py b/nfu_ecommerce/models/sale_order_batch_product.py new file mode 100644 index 0000000..4dbcb6a --- /dev/null +++ b/nfu_ecommerce/models/sale_order_batch_product.py @@ -0,0 +1,13 @@ +from odoo import models + + +class SaleOrderBatchProduct(models.Model): + _inherit = "sale.order.batch.product" + + def get_state_color(self): + self.ensure_one() + if self.open_packaging_state == "open": + return "red" + elif self.open_packaging_state == "last_open": + return "orange" + return "inherit" diff --git a/nfu_ecommerce/readme/HISTORY.rst b/nfu_ecommerce/readme/HISTORY.rst index f680a1a..2f4106d 100644 --- a/nfu_ecommerce/readme/HISTORY.rst +++ b/nfu_ecommerce/readme/HISTORY.rst @@ -3,4 +3,5 @@ :1.1.0: Add Open Packagings Filter and fix rounding issue :1.1.1: Pass arguments to super again :1.1.2: Make publish on website multi company -:1.2.0: Add Open Packages to Product list \ No newline at end of file +:1.2.0: Add Open Packages to Product list +:1.3.0: Adapt new Open Packages format and add indicators diff --git a/nfu_ecommerce/static/description/index.html b/nfu_ecommerce/static/description/index.html index da69fbb..945ad4a 100644 --- a/nfu_ecommerce/static/description/index.html +++ b/nfu_ecommerce/static/description/index.html @@ -401,10 +401,12 @@ and after the current order.

1.1.1:Pass arguments to super again -1.1.1:Make publish on website multi company +1.1.2:Make publish on website multi company 1.2.0:Add Open Packages to Product list +1.3.0:Adapt new Open Packages format and add indicators + diff --git a/nfu_ecommerce/views/templates.xml b/nfu_ecommerce/views/templates.xml index dccd1d9..c801434 100644 --- a/nfu_ecommerce/views/templates.xml +++ b/nfu_ecommerce/views/templates.xml @@ -39,50 +39,53 @@ active="True" name="Show Extra Fields" > - - -

- - : - - - - - - - - -
-
- - Open Qty: /
- - State: -
-
-
-

+ + + + + +

+ + : + + + + + + + + +
+
+

+
-