[FIX] account: tax rounding
- Set 'Round Globally' - Create an excluded tax of 10 % - Create an invoice for a product costing 34.55, and apply the tax. The tax on the invoice is 3.46, while the tax on the tax line is 3.45. When rounded in `compute_all`, the tax amount is 3.455, which is the value expected. However, the `create` method won't round this value before storing, leading to the inconsistency. We make sure to round the amount to the currency precision, so the value 3.46 is recorded. opw-1819902
This commit is contained in:
committed by
Nicolas Martinelli
parent
0440e25380
commit
b522ab5772
@@ -1410,7 +1410,14 @@ class AccountInvoiceTax(models.Model):
|
||||
currency_id = fields.Many2one('res.currency', related='invoice_id.currency_id', store=True, readonly=True)
|
||||
base = fields.Monetary(string='Base', compute='_compute_base_amount')
|
||||
|
||||
|
||||
# DO NOT FORWARD-PORT!!! ONLY FOR v10
|
||||
def create(self, vals):
|
||||
inv_tax = super(AccountInvoiceTax, self).create(vals)
|
||||
# Workaround to make sure the tax amount is rounded to the currency precision since the ORM
|
||||
# won't round it automatically at creation.
|
||||
if inv_tax.company_id.tax_calculation_rounding_method == 'round_globally':
|
||||
inv_tax.amount = inv_tax.currency_id.round(inv_tax.amount)
|
||||
return inv_tax
|
||||
|
||||
|
||||
class AccountPaymentTerm(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user