Skip to content

Commit

Permalink
[FIX] sale_triple_discount: Remove call to deprecated
Browse files Browse the repository at this point in the history
Method 'invalidate_cache' is deprecated. To invalidate specific field's value into the cache for a recordset we must use the 'invalidate_recordset' method on the recordset itself.
  • Loading branch information
lmignon committed Sep 25, 2024
1 parent 0c6a02d commit e496515
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions sale_triple_discount/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def triple_discount_preprocess(self):
this method is called multiple times.
Updating the cache provides consistency through re-computations."""
prev_values = dict()
self.invalidate_cache(fnames=self._discount_fields(), ids=self.ids)
self.invalidate_recordset(self._discount_fields())
for line in self:
prev_values[line] = {
fname: line[fname] for fname in self._discount_fields()
Expand All @@ -118,10 +118,7 @@ def triple_discount_preprocess(self):
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_cache(
fnames=self._discount_fields(),
ids=[line.id for line in list(prev_values.keys())],
)
self.invalidate_recordset(self._discount_fields())
for line, prev_vals_dict in list(prev_values.items()):
line.update(prev_vals_dict)

Expand Down

0 comments on commit e496515

Please sign in to comment.