Skip to content

Commit c5cf87f

Browse files
committed
[FIX] mrp_project: assign parent MO project to child MO
When a project is modified in a MO that has child MOs, the changes are automatically applied to those child MOs as well. This only happens if the child MOs already exist; if they are generated later, the changes are not applied. This fix resolves that issue.
1 parent 03a498f commit c5cf87f

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

mrp_project/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
""",
88
"author": "Solvos",
99
"license": "LGPL-3",
10-
"version": "15.0.2.0.0",
10+
"version": "15.0.2.0.1",
1111
"category": "Manufacturing",
1212
"website": "https://github.com/solvosci/slv-manufacture",
1313
"depends": ["mrp", "project"],

mrp_project/models/mrp_production.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,11 @@ def _assign_project_to_children(self):
2626
@api.onchange("project_id")
2727
def _onchange_project_id_parent(self):
2828
self._assign_project_to_children()
29+
30+
@api.model
31+
def create(self, values):
32+
# This part of the code is triggered by another automated process and is executed by OdooBot with permissions
33+
production = super().create(values)
34+
if production._get_sources():
35+
production.project_id = production._get_sources().project_id
36+
return production

0 commit comments

Comments
 (0)