Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions l10n_it_split_payment/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@ def _compute_amount(self):
move.amount_sp = move.amount_tax
move.amount_tax = 0.0
move.amount_total = move.amount_untaxed
move._compute_split_payments()
# Because method _compute_amount is called many times, need to
# call method to compute split payment data only when the
# account move has a line which belong to split payment tax,
# otherwise the tax and refund line are duplicated
move_has_split_line = move.line_ids.filtered(
lambda aml: aml.tax_repartition_line_id.tax_id.is_split_payment
)
if move_has_split_line:
move._compute_split_payments()
else:
move.amount_sp = 0.0

Expand Down Expand Up @@ -158,7 +166,7 @@ def _compute_split_payments(self):
else:
self.set_receivable_line_ids()
if self.amount_sp:
self.invoice_line_ids = [(0, 0, write_off_line_vals)]
self.line_ids = [(0, 0, write_off_line_vals)]


class AccountMoveLine(models.Model):
Expand Down
Loading