summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfja-odoo <fja@odoo.com>2020-07-10 09:05:50 +0000
committerArnold Moyaux <arm@odoo.com>2020-07-16 13:02:14 +0000
commiteedbcfbef54ac51caf8b732ce5fad71aa30b4cd8 (patch)
tree323bbd8207c670df5f5827ca49dc310a1835fcc0
parent8a8d5eba09867ca8dc8ebdbdcf13f67d56fc1b7e (diff)
[FIX] mrp: fix _set_qty_producing
On a MO which product_id has a serial tracking, some components and 2 or more WO: The method _set_qty_producing of a WO will call the MO _set_qty_producing method even if no changes is made on qty_producing which can produce an undesired aditional move line when creating the MO. On a MO which product_id has a serial tracking and some components: Changing the qty_producing on a MO was adding a line on the component move. Since the _set_qty_producing method is called when creating a WO it sets the qty_producing of the MO to 0. As it does not make sense to have a WO set the qty_producing of a MO to 0 we will not replicate it. task-2278147 closes odoo/odoo#54579 X-original-commit: ca8275aa28010b73cad14f667068e9cfc6c651a5 Related: odoo/enterprise#11896 Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
-rw-r--r--addons/mrp/models/mrp_workorder.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py
index d9e89060c5c..96cb3fd5d3e 100644
--- a/addons/mrp/models/mrp_workorder.py
+++ b/addons/mrp/models/mrp_workorder.py
@@ -221,8 +221,9 @@ class MrpWorkorder(models.Model):
def _set_qty_producing(self):
for workorder in self:
- workorder.production_id.qty_producing = workorder.qty_producing
- workorder.production_id._set_qty_producing()
+ if workorder.qty_producing != 0 and workorder.production_id.qty_producing != workorder.qty_producing:
+ workorder.production_id.qty_producing = workorder.qty_producing
+ workorder.production_id._set_qty_producing()
# Both `date_planned_start` and `date_planned_finished` are related fields on `leave_id`. Let's say
# we slide a workorder on a gantt view, a single call to write is made with both