[FIX] sale, purchase: tax computation

Set the company rounding policy to "Round Globally". Create the
following SO (or PO), with a 7 % excluded tax:
- Qty      Price
- 880.000  5.79
- 120.000  4.36
- 28.000   2.88
- 68.000   11.09
- 35.000   5.20
- 35.000   5.32

The total tax on the SO is 477.48, while it is 477.50 on the invoice
generated from the SO.

Fixes #13687
opw-690090
This commit is contained in:
Nicolas Martinelli
2016-10-11 15:27:19 +02:00
parent db312e97b2
commit 4dcf54e23f
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -509,7 +509,7 @@ class PurchaseOrderLine(models.Model):
for line in self:
taxes = line.taxes_id.compute_all(line.price_unit, line.order_id.currency_id, line.product_qty, product=line.product_id, partner=line.order_id.partner_id)
line.update({
'price_tax': taxes['total_included'] - taxes['total_excluded'],
'price_tax': sum(t.get('amount', 0.0) for t in taxes.get('taxes', [])),
'price_total': taxes['total_included'],
'price_subtotal': taxes['total_excluded'],
})
@@ -567,7 +567,7 @@ class PurchaseOrderLine(models.Model):
price_subtotal = fields.Monetary(compute='_compute_amount', string='Subtotal', store=True)
price_total = fields.Monetary(compute='_compute_amount', string='Total', store=True)
price_tax = fields.Monetary(compute='_compute_amount', string='Tax', store=True)
price_tax = fields.Float(compute='_compute_amount', string='Tax', store=True)
order_id = fields.Many2one('purchase.order', string='Order Reference', index=True, required=True, ondelete='cascade')
account_analytic_id = fields.Many2one('account.analytic.account', string='Analytic Account')
+2 -2
View File
@@ -557,7 +557,7 @@ class SaleOrderLine(models.Model):
price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
taxes = line.tax_id.compute_all(price, line.order_id.currency_id, line.product_uom_qty, product=line.product_id, partner=line.order_id.partner_id)
line.update({
'price_tax': taxes['total_included'] - taxes['total_excluded'],
'price_tax': sum(t.get('amount', 0.0) for t in taxes.get('taxes', [])),
'price_total': taxes['total_included'],
'price_subtotal': taxes['total_excluded'],
})
@@ -710,7 +710,7 @@ class SaleOrderLine(models.Model):
price_unit = fields.Float('Unit Price', required=True, digits=dp.get_precision('Product Price'), default=0.0)
price_subtotal = fields.Monetary(compute='_compute_amount', string='Subtotal', readonly=True, store=True)
price_tax = fields.Monetary(compute='_compute_amount', string='Taxes', readonly=True, store=True)
price_tax = fields.Float(compute='_compute_amount', string='Taxes', readonly=True, store=True)
price_total = fields.Monetary(compute='_compute_amount', string='Total', readonly=True, store=True)
price_reduce = fields.Monetary(compute='_get_price_reduce', string='Price Reduce', readonly=True, store=True)