From 8a2ff461dbbe0c6120e09617800b0d5f3dc7a334 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Fri, 24 Jul 2015 13:48:05 +0200 Subject: [PATCH] [FIX] point of sale: create account move line The method "_create_account_move_line" must take into account the rounding method when computing the taxes for each line. closes #7683 opw:645516 --- addons/point_of_sale/point_of_sale.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 25a62395be8..cc51b8823ea 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -1169,6 +1169,9 @@ class pos_order(osv.osv): # Create an move for each order line cur = order.pricelist_id.currency_id + round_per_line = True + if order.company_id.tax_calculation_rounding_method == 'round_globally': + round_per_line = False for line in order.lines: tax_amount = 0 taxes = [] @@ -1178,14 +1181,14 @@ class pos_order(osv.osv): computed_taxes = account_tax_obj.compute_all(cr, uid, taxes, line.price_unit * (100.0-line.discount) / 100.0, line.qty)['taxes'] for tax in computed_taxes: - tax_amount += cur_obj.round(cr, uid, cur, tax['amount']) + tax_amount += cur_obj.round(cr, uid, cur, tax['amount']) if round_per_line else tax['amount'] if tax_amount < 0: group_key = (tax['ref_tax_code_id'], tax['base_code_id'], tax['account_collected_id'], tax['id']) else: group_key = (tax['tax_code_id'], tax['base_code_id'], tax['account_collected_id'], tax['id']) group_tax.setdefault(group_key, 0) - group_tax[group_key] += cur_obj.round(cr, uid, cur, tax['amount']) + group_tax[group_key] += cur_obj.round(cr, uid, cur, tax['amount']) if round_per_line else tax['amount'] amount = line.price_subtotal