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 + + +