From 1f9e92dfef325b6727e1bee3de55bff095ec6cf2 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 18 Oct 2016 15:49:45 +0200 Subject: [PATCH] [IMP] account: store tax base amount Storing the value is necessary in case tax definition is changed. Indeed, we want to keep the value for reporting purpose. opw-691177 --- addons/account/models/account_invoice.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 95ae08e8103..04488a6ea8e 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -1334,6 +1334,7 @@ class AccountInvoiceTax(models.Model): _description = "Invoice Tax" _order = 'sequence' + @api.depends('invoice_id.invoice_line_ids') def _compute_base_amount(self): for tax in self: base = 0.0 @@ -1355,7 +1356,7 @@ class AccountInvoiceTax(models.Model): sequence = fields.Integer(help="Gives the sequence order when displaying a list of invoice tax.") company_id = fields.Many2one('res.company', string='Company', related='account_id.company_id', store=True, readonly=True) currency_id = fields.Many2one('res.currency', related='invoice_id.currency_id', store=True, readonly=True) - base = fields.Monetary(string='Base', compute='_compute_base_amount') + base = fields.Monetary(string='Base', compute='_compute_base_amount', store=True)