Skip to content

Commit

Permalink
[UPD] Tryin some s***
Browse files Browse the repository at this point in the history
  • Loading branch information
IJOL committed Sep 27, 2024
1 parent d5cf77b commit d1f8fb0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sale_triple_discount/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def triple_discount_preprocess(self):
this method is called multiple times.
Updating the cache provides consistency through re-computations."""
prev_values = dict()
# self.invalidate_recordset(self._discount_fields())
for line in self:
prev_values[line] = {
fname: line[fname] for fname in self._discount_fields()
Expand All @@ -111,15 +110,16 @@ def triple_discount_preprocess(self):
vals = {fname: 0 for fname in self._discount_fields()}
vals["discount"] = line._get_final_discount()

line.invalidate_recordset(self._discount_fields())
line._cache.update(vals)
return prev_values

@api.model
def triple_discount_postprocess(self, prev_values):
"""Restore the discounts of the lines in the dictionary prev_values.
Updating the cache provides consistency through re-computations."""
# self.invalidate_recordset(self._discount_fields())
for line, prev_vals_dict in list(prev_values.items()):
line.invalidate_recordset(self._discount_fields())
line._cache.update(prev_vals_dict)

def _convert_to_tax_base_line_dict(self):
Expand Down

0 comments on commit d1f8fb0

Please sign in to comment.