diff --git a/nfu_sale_order_batch_packaging/README.rst b/nfu_sale_order_batch_packaging/README.rst index 8110cad..fd34d1f 100644 --- a/nfu_sale_order_batch_packaging/README.rst +++ b/nfu_sale_order_batch_packaging/README.rst @@ -42,6 +42,10 @@ Changelog :1.3.1: add open_max_qty :1.3.2: fix color indicator :1.3.3: Enable packagings on installation +:1.3.4: + - on creation set max_qty to product_uom_qty if not set + - remove zero exception for max_qty + - store open_packaging_qty on batch product module to make it sortable Bug Tracker =========== diff --git a/nfu_sale_order_batch_packaging/__manifest__.py b/nfu_sale_order_batch_packaging/__manifest__.py index c9c9e64..09352c6 100644 --- a/nfu_sale_order_batch_packaging/__manifest__.py +++ b/nfu_sale_order_batch_packaging/__manifest__.py @@ -4,7 +4,7 @@ "author": "BAKEUP", "website": "https://www.bakeup.org", "category": "Sale", - "version": "16.0.1.3.3", + "version": "16.0.1.3.4", "depends": ["sale", "sale_order_batch"], "data": [ "data/ir_config_parameter.xml", diff --git a/nfu_sale_order_batch_packaging/models/sale_order_batch_product.py b/nfu_sale_order_batch_packaging/models/sale_order_batch_product.py index fa673b1..53c4c03 100644 --- a/nfu_sale_order_batch_packaging/models/sale_order_batch_product.py +++ b/nfu_sale_order_batch_packaging/models/sale_order_batch_product.py @@ -8,7 +8,7 @@ class SaleOrderBatchProduct(models.Model): _inherit = "sale.order.batch.product" product_uom_max_qty = fields.Float("Max Qty", compute="_compute_product_uom_max_qty") - open_packaging_qty = fields.Float(compute="_compute_open_packaging_qty") + open_packaging_qty = fields.Float(compute="_compute_open_packaging_qty", store=True) open_packaging_max_qty = fields.Float(compute="_compute_open_packaging_max_qty") open_packaging_state = fields.Selection(selection=PACKAGING_STATES, compute="_compute_open_packaging_state") diff --git a/nfu_sale_order_batch_packaging/models/sale_order_line.py b/nfu_sale_order_batch_packaging/models/sale_order_line.py index 7fec07e..4c6bc90 100644 --- a/nfu_sale_order_batch_packaging/models/sale_order_line.py +++ b/nfu_sale_order_batch_packaging/models/sale_order_line.py @@ -13,7 +13,7 @@ class SaleOrderLine(models.Model): @api.constrains("product_uom_qty", "product_uom_max_qty") def _check_product_uom_qty(self): for order_line in self: - if order_line.product_uom_max_qty != 0 and order_line.product_uom_qty > order_line.product_uom_max_qty: + if order_line.product_uom_qty > order_line.product_uom_max_qty: raise UserError( _( f"{order_line.order_id.name},{order_line.product_id.name}:" @@ -24,6 +24,9 @@ class SaleOrderLine(models.Model): @api.model_create_multi def create(self, vals_list): for vals in vals_list: + if not vals.get("product_uom_max_qty") or vals.get("product_uom_max_qty") == 0: + product_qty = vals.get("product_uom_qty") + vals["product_uom_max_qty"] = product_qty if vals.get("product_id") and not vals.get("product_packaging_id"): product_id = vals.get("product_id") packaging = self.env["product.packaging"].search([("product_id", "=", product_id)], limit=1) diff --git a/nfu_sale_order_batch_packaging/readme/HISTORY.rst b/nfu_sale_order_batch_packaging/readme/HISTORY.rst index 3cc920c..baaf472 100644 --- a/nfu_sale_order_batch_packaging/readme/HISTORY.rst +++ b/nfu_sale_order_batch_packaging/readme/HISTORY.rst @@ -6,4 +6,8 @@ :1.3.0: add packaging states :1.3.1: add open_max_qty :1.3.2: fix color indicator -:1.3.3: Enable packagings on installation \ No newline at end of file +:1.3.3: Enable packagings on installation +:1.3.4: + - on creation set max_qty to product_uom_qty if not set + - remove zero exception for max_qty + - store open_packaging_qty on batch product module to make it sortable \ No newline at end of file diff --git a/nfu_sale_order_batch_packaging/static/description/index.html b/nfu_sale_order_batch_packaging/static/description/index.html index 0cf856e..4dbcf2b 100644 --- a/nfu_sale_order_batch_packaging/static/description/index.html +++ b/nfu_sale_order_batch_packaging/static/description/index.html @@ -391,23 +391,39 @@ and adds a packaging default to sale order batch.
Initial module.
+rename to nfu_sale_order_batch_packaging
+Live
+Add regeneration action for batch products
+refactoring
+add packaging states
+add open_max_qty
+fix color indicator
+Enable packagings on installation
+