diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 90aa06a9034..fec803d28a9 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -3401,7 +3401,15 @@ class AccountMoveLine(models.Model): currency = record.company_id.currency_id audit_str = '' for tag in record.tax_tag_ids: - tag_amount = (tag.tax_negate and -1 or 1) * (record.move_id.is_inbound() and -1 or 1) * record.balance + + # In case of cash basis entries, we need to consider the original invoice, not the current move + if record.move_id.tax_cash_basis_rec_id: + reconciled_amls = record.move_id.tax_cash_basis_rec_id.debit_move_id + record.move_id.tax_cash_basis_rec_id.credit_move_id + invoice_aml = reconciled_amls.filtered(lambda x: x.journal_id.type in ('sale', 'purchase')) # To exclude the payment + else: + invoice_aml = record + + tag_amount = (tag.tax_negate and -1 or 1) * (invoice_aml.move_id.is_inbound() and -1 or 1) * record.balance if tag.tax_report_line_ids: #Then, the tag comes from a report line, and hence has a + or - sign (also in its name)