From d8c31bcef4041eab801eedffa21a27b4224a9e39 Mon Sep 17 00:00:00 2001 From: Victor Champonnois Date: Wed, 14 Feb 2024 16:56:52 +0100 Subject: [PATCH] [FIX] sign price_tax for refunds Although the subtotal price is negative for refunds in csv exports, the price_tax is still positive. This commit adds the computation of a "signed" price_tax based on the type of invoice. --- csv_export_invoice/models/csv_export_invoice.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/csv_export_invoice/models/csv_export_invoice.py b/csv_export_invoice/models/csv_export_invoice.py index 27a76f0..6bc58cf 100644 --- a/csv_export_invoice/models/csv_export_invoice.py +++ b/csv_export_invoice/models/csv_export_invoice.py @@ -63,6 +63,10 @@ def get_row(self, record): tax_code = tax.export_code if tax else "" + price_tax_signed = line.price_tax + if invoice.type == "out_refund" or invoice.type == "in_refund": + price_tax_signed = -line.price_tax + product_name = line.product_id.with_context(lang="fr_BE").name row = ( @@ -77,7 +81,7 @@ def get_row(self, record): line.account_id.code, str(line.price_subtotal_signed), tax_code, - str(line.price_tax), + str(price_tax_signed), product_name, invoice.department_id.bob_code, invoice.location_id.bob_code,