diff --git a/rma_put_away/__init__.py b/rma_put_away/__init__.py index 976591c9..7851bb74 100644 --- a/rma_put_away/__init__.py +++ b/rma_put_away/__init__.py @@ -1,2 +1,3 @@ from . import wizards from . import models + diff --git a/rma_put_away/models/rma_order_line.py b/rma_put_away/models/rma_order_line.py index ba5b84f7..2cb7a24c 100644 --- a/rma_put_away/models/rma_order_line.py +++ b/rma_put_away/models/rma_order_line.py @@ -13,7 +13,6 @@ class RmaOrderLine(models.Model): qty_put_away = fields.Float( string="Qty Put Away", - copy=False, digits="Product Unit of Measure", readonly=True, compute="_compute_qty_put_away", @@ -32,17 +31,19 @@ class RmaOrderLine(models.Model): required=True, ) + @api.depends("qty_to_receive", "qty_put_away") def _compute_qty_to_put_away(self): for rec in self: rec.qty_to_put_away = 0.0 if rec.put_away_policy == "ordered": - rec.qty_to_put_away = rec.product_qty - rec.qty_put_away + rec.qty_to_put_away = max(rec.product_qty - rec.qty_put_away, 0) elif rec.put_away_policy == "received": - rec.qty_to_put_away = rec.qty_received - rec.qty_put_away + rec.qty_to_put_away = max(rec.qty_received - rec.qty_put_away, 0) + @api.depends("qty_to_receive") def _compute_qty_put_away(self): for rec in self: - rec.qty_put_away = 0.0 + rec.qty_put_away = 0 @api.onchange("operation_id") def _onchange_operation_id(self): @@ -50,3 +51,4 @@ class RmaOrderLine(models.Model): if self.operation_id: self.put_away_policy = self.operation_id.put_away_policy or "no" return result + diff --git a/rma_put_away/views/rma_order_line_view.xml b/rma_put_away/views/rma_order_line_view.xml index efcb5760..91989698 100644 --- a/rma_put_away/views/rma_order_line_view.xml +++ b/rma_put_away/views/rma_order_line_view.xml @@ -9,6 +9,12 @@ + + + + + +