Skip to content

Commit

Permalink
Merge PR OCA#1592 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by sergiocorato
  • Loading branch information
OCA-git-bot committed Nov 8, 2023
2 parents 6ec9b02 + 747083a commit 07b26bc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions account_invoice_triple_discount/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ def _recompute_tax_lines(self, **kwargs):
restored after the original process is done
"""
old_values_by_line_id = {}
digits = self.line_ids._fields["price_unit"]._digits
self.line_ids._fields["price_unit"]._digits = (16, 16)
for line in self.line_ids:
digits = self.invoice_line_ids._fields["price_unit"]._digits
self.invoice_line_ids._fields["price_unit"]._digits = (16, 16)
for line in self.invoice_line_ids:
aggregated_discount = line._compute_aggregated_discount(line.discount)
old_values_by_line_id[line.id] = {
"price_unit": line.price_unit,
"discount": line.discount,
}
price_unit = line.price_unit * (1 - aggregated_discount / 100)
line.update({"price_unit": price_unit, "discount": 0})
self.line_ids._fields["price_unit"]._digits = digits
self.invoice_line_ids._fields["price_unit"]._digits = digits
res = super(AccountMove, self)._recompute_tax_lines(**kwargs)
for line in self.line_ids:
for line in self.invoice_line_ids:
if line.id not in old_values_by_line_id:
continue
line.update(old_values_by_line_id[line.id])
Expand Down

0 comments on commit 07b26bc

Please sign in to comment.