[FIX] account: Fix is_refund for manual reconciliation widget

Create an misc journal entry with 1000 as debit and a tax.
The tax line is linked to a refund tax repartition line.

Open the manual reconciliation widget and do the same.
The tax line is linked to an invoice tax repartition line.

When dealing with tax grids, the resulting tags set on the journal items are not the same.
This is because the given price_unit is not following the sign of the debit/credit column.
Indeed, a positive amount means you are adding something on the credit column.

opw-3236208

closes odoo/odoo#116433

X-original-commit: a70f804d7da68d5cc7cdd79b75d73359c41b9367
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Signed-off-by: Laurent Smet <las@odoo.com>
This commit is contained in:
Laurent Smet
2023-03-27 13:48:07 +02:00
parent c3085b0011
commit 35e333822d
+1 -1
View File
@@ -420,7 +420,7 @@ class AccountTax(models.Model):
# We first need to find out whether this tax computation is made for a refund
tax_type = self and self[0].type_tax_use
is_refund = is_refund or (tax_type == 'sale' and price_unit < 0) or (tax_type == 'purchase' and price_unit > 0)
is_refund = is_refund or (tax_type == 'sale' and price_unit > 0) or (tax_type == 'purchase' and price_unit < 0)
rslt = self.with_context(caba_no_transition_account=True)\
.compute_all(price_unit, currency=currency_id, quantity=quantity, product=product_id, partner=partner_id, is_refund=is_refund, include_caba_tags=include_caba_tags)