From d60063e159ca07dcaef0766b17dbe29752d93cf0 Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Fri, 1 Oct 2021 09:08:53 +0000 Subject: [PATCH] [FIX] account: use refund repartition line when needed when applying a reconciliation model with a tax from a button The fix made in https://github.com/odoo/odoo/pull/74427 was mistakenly not forward-ported. We reintroduce it here together with the fix that was made for it by https://github.com/odoo/odoo/pull/77589 . Before this fix, the wrong repartition was used, and the tax_tag_invert computed for the move lines in this case was inconsistent, leading to wrong reporting. closes odoo/odoo#78546 X-original-commit: 663bc7c0a0c0d7d16cd754bba5cea34bdb6315bf Related: odoo/enterprise#21756 Signed-off-by: oco-odoo Signed-off-by: agr-odoo --- addons/account/models/account_reconcile_model.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_reconcile_model.py b/addons/account/models/account_reconcile_model.py index 729a4fb8411..004ea94e3f0 100644 --- a/addons/account/models/account_reconcile_model.py +++ b/addons/account/models/account_reconcile_model.py @@ -322,7 +322,9 @@ class AccountReconcileModel(models.Model): self.ensure_one() balance = base_line_dict['balance'] - res = tax.compute_all(balance) + tax_type = tax.type_tax_use + is_refund = (tax_type == 'sale' and balance > 0) or (tax_type == 'purchase' and balance < 0) + res = tax.compute_all(balance, is_refund=is_refund) new_aml_dicts = [] for tax_res in res['taxes']: