diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2016-09-09 11:05:08 +0200 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2016-09-12 08:31:47 +0200 |
| commit | dd1eb03af5aa5ed9bec2c8ede8d4d2f4106c505d (patch) | |
| tree | efc5ac9ce7b79d66b9705884efa14e8552ada425 /addons | |
| parent | 043144ce42e204ea797016a984de23d36e54fdff (diff) | |
[FIX] account: base amount when tax calculated
Commit 8ad0c0f3 introduces back the base amount taken into account for
tax calculation. However, the way it calculates the amount is wrong in
several cases:
- the tax amount is a percentage
- the tax is calculated thanks to Python code
opw-686846
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/models/account_invoice.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 47e5da9af7c..eb3d5cde5e3 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -1287,9 +1287,10 @@ class AccountInvoiceTax(models.Model): 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 - # To add include base amount taxes - base += sum((line.invoice_line_tax_ids.filtered(lambda t: t.include_base_amount) - tax.tax_id).mapped('amount')) + price_unit = line.price_unit * (1 - (line.discount or 0.0) / 100.0) + base += (line.invoice_line_tax_ids - tax.tax_id).compute_all( + price_unit, line.invoice_id.currency_id, line.quantity, line.product_id, line.invoice_id.partner_id + )['base'] tax.base = base invoice_id = fields.Many2one('account.invoice', string='Invoice', ondelete='cascade', index=True) |
