Skip to content

Commit

Permalink
[FIX] ddmrp: adu field needs to be explicity written when adu_fixed i…
Browse files Browse the repository at this point in the history
…s set

The onchange only has a visual effect. Actual changes to adu must be made in
the create and write methods.
  • Loading branch information
JordiBForgeFlow authored and sebalix committed Jul 5, 2023
1 parent 8058689 commit a39c8a4
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ddmrp/models/stock_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1333,11 +1333,6 @@ def _search_distributed_source_location_qty(self, operator, value):
)
return [("id", "in", buffers.ids)]

@api.onchange("adu_fixed", "adu_calculation_method")
def onchange_adu(self):
if self.adu_calculation_method.method == "fixed":
self._calc_adu()

def _search_open_stock_moves_domain(self):
self.ensure_one()
return [
Expand Down Expand Up @@ -1741,6 +1736,8 @@ def _calc_execution_priority(self):
@api.model_create_multi
def create(self, vals_list):
records = super().create(vals_list)
if not self.env.context.get("skip_adu_calculation", False):
records._calc_adu()
records._calc_distributed_source_location()
return records

Expand Down

0 comments on commit a39c8a4

Please sign in to comment.