From d7c0c5c127b9bc80a447768370c7915487e7292f Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Thu, 2 May 2019 07:46:31 +0000 Subject: [PATCH] [FIX] account: sign columns amount_untax and amount_tax In the tree view for account.invoice, two columns are signed (amount_total and residual) and two columns are not signed (amount_untaxed and amount_tax). Now, all the columns with numeric values are signed. This commit reverts the commit : 622af0b7cc1d2366c0a5c6b98d0cb727b65189eb opw-1964348 closes odoo/odoo#33097 Signed-off-by: Nicolas Martinelli (nim) --- addons/account/models/account_invoice.py | 10 ++++++++++ addons/account/views/account_invoice_view.xml | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index f0cf43a4687..97d94065137 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -70,6 +70,12 @@ class AccountInvoice(models.Model): self.amount_total_signed = self.amount_total * sign self.amount_untaxed_signed = amount_untaxed_signed * sign + def _compute_sign_taxes(self): + for invoice in self: + sign = invoice.type in ['in_refund', 'out_refund'] and -1 or 1 + invoice.amount_untaxed_invoice_signed = invoice.amount_untaxed * sign + invoice.amount_tax_signed = invoice.amount_tax * sign + @api.onchange('amount_total') def _onchange_amount_total(self): for inv in self: @@ -324,8 +330,12 @@ class AccountInvoice(models.Model): store=True, readonly=True, compute='_compute_amount', track_visibility='always') amount_untaxed_signed = fields.Monetary(string='Untaxed Amount in Company Currency', currency_field='company_currency_id', store=True, readonly=True, compute='_compute_amount') + amount_untaxed_invoice_signed = fields.Monetary(string='Untaxed Amount in Invoice Currency', currency_field='currency_id', + readonly=True, compute='_compute_sign_taxes') amount_tax = fields.Monetary(string='Tax', store=True, readonly=True, compute='_compute_amount') + amount_tax_signed = fields.Monetary(string='Tax in Invoice Currency', currency_field='currency_id', + readonly=True, compute='_compute_sign_taxes') amount_total = fields.Monetary(string='Total', store=True, readonly=True, compute='_compute_amount') amount_total_signed = fields.Monetary(string='Total in Invoice Currency', currency_field='currency_id', diff --git a/addons/account/views/account_invoice_view.xml b/addons/account/views/account_invoice_view.xml index 97a3a6164c9..4c261accd01 100644 --- a/addons/account/views/account_invoice_view.xml +++ b/addons/account/views/account_invoice_view.xml @@ -163,10 +163,10 @@ - - - - + + + +