From 8ad0c0f3abe77221e9ade5b60f59e8026405acd6 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 10 May 2016 11:11:07 +0200 Subject: [PATCH] [FIX] account: base field in account.invoice.tax The field base is obligatory according to a european law. This field existed in saas-6. opw:674713 --- addons/account/models/account_invoice.py | 11 +++++++++++ addons/account/views/account_invoice_view.xml | 2 ++ addons/account/views/report_invoice.xml | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 5f415d71b4b..89a6dcd1cb0 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -1233,6 +1233,14 @@ class AccountInvoiceTax(models.Model): _description = "Invoice Tax" _order = 'sequence' + def _compute_base_amount(self): + for tax in self: + base = 0.0 + for line in tax.invoice_id.invoice_line_ids: + if tax.tax_id in line.invoice_line_tax_ids: + base += line.price_subtotal + tax.base = base + invoice_id = fields.Many2one('account.invoice', string='Invoice', ondelete='cascade', index=True) name = fields.Char(string='Tax Description', required=True) tax_id = fields.Many2one('account.tax', string='Tax') @@ -1243,6 +1251,9 @@ 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') + + class AccountPaymentTerm(models.Model): diff --git a/addons/account/views/account_invoice_view.xml b/addons/account/views/account_invoice_view.xml index 19721159224..732fa72388b 100644 --- a/addons/account/views/account_invoice_view.xml +++ b/addons/account/views/account_invoice_view.xml @@ -93,6 +93,7 @@ + @@ -111,6 +112,7 @@ + diff --git a/addons/account/views/report_invoice.xml b/addons/account/views/report_invoice.xml index 1bccecfca4a..b16413aae0d 100644 --- a/addons/account/views/report_invoice.xml +++ b/addons/account/views/report_invoice.xml @@ -122,12 +122,17 @@ Tax + Base Amount + + +