summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoren Van Onder <jov@odoo.com>2017-01-30 14:42:20 -0800
committerJoren Van Onder <jov@odoo.com>2017-02-08 10:28:33 -0800
commit0556bc6d9e780e1d7100dc3f85d3fc4eee18502f (patch)
tree0b055ebb5da7ccf03f4747b469c191b39319de2e
parent00cf180862785da1cb0c78f7169754e21f45a7f4 (diff)
[FIX] point_of_sale: properly round taxes with round_globally
When tax_calculation_rounding_method is configured to round_globally the compute_all method of account.tax will not round the taxes based on the currency. The result of the compute_all function is used when creating the tax parts of a pos.order account.move. Taxes are aggregated per session, so 2 orders with orderlines in them with the same tax will turn into 1 single tax account.move.line. To correctly handle round_globally, we round all tax values we have after processing each order. Fixes #14672 Fixes #14673
-rw-r--r--addons/point_of_sale/point_of_sale.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py
index 86a2764a005..3380208b484 100644
--- a/addons/point_of_sale/point_of_sale.py
+++ b/addons/point_of_sale/point_of_sale.py
@@ -1295,6 +1295,7 @@ class pos_order(osv.osv):
grouped_data = {}
have_to_group_by = session and session.config_id.group_by or False
+ rounding_method = session and session.config_id.company_id.tax_calculation_rounding_method
for order in self.browse(cr, uid, ids, context=context):
if order.account_move:
@@ -1420,6 +1421,14 @@ class pos_order(osv.osv):
'partner_id': order.partner_id and self.pool.get("res.partner")._find_accounting_partner(order.partner_id).id or False
})
+ # round tax lines per order
+ if rounding_method == 'round_globally':
+ for group_key, group_value in grouped_data.iteritems():
+ if group_key[0] == 'tax':
+ for line in group_value:
+ line['credit'] = cur.round(line['credit'])
+ line['debit'] = cur.round(line['debit'])
+
# counterpart
insert_data('counter_part', {
'name': _("Trade Receivables"), #order.name,