Skip to content

Commit

Permalink
TA#67493 [FIX] project_material: Double call of _run_procurements (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
majouda authored Aug 13, 2024
1 parent 441c818 commit 871fe8f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion project_material/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Project Material",
"version": "14.0.1.2.0",
"version": "14.0.1.2.1",
"author": "Numigi",
"maintainer": "Numigi",
"website": "https://bit.ly/numigi-com",
Expand Down
20 changes: 9 additions & 11 deletions project_material/models/project_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class TaskWithMaterialLines(models.Model):
compute="_compute_show_material_prepared_qty"
)

procurement_disabled = fields.Boolean(default=False)
procurement_disabled = fields.Boolean()

def _compute_preparation_pickings(self):
tasks_with_procurement_group = self.filtered(lambda t: t.procurement_group_id)
Expand Down Expand Up @@ -89,18 +89,16 @@ def _compute_show_material_prepared_qty(self):
def write(self, vals):
super().write(vals)
for task in self:
procurement_disabled = vals.get(
"procurement_disabled", task.procurement_disabled
)
if procurement_disabled is False:
task._run_procurements()

if procurement_disabled is True:
task._cancel_procurements()

if "procurement_disabled" in vals or "material_line_ids" in vals:
procurement_disabled = (
vals.get("procurement_disabled") or self.procurement_disabled
)
if procurement_disabled:
task._cancel_procurements()
else:
task._run_procurements()
if "date_planned" in vals:
task._propagate_planned_date_to_stock_moves()

return True

def copy(self, vals=None):
Expand Down

0 comments on commit 871fe8f

Please sign in to comment.