[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
This commit is contained in:
Goffin Simon 2015-07-24 13:48:05 +02:00
parent af9393d505
commit 8a2ff461db
1 changed files with 5 additions and 2 deletions

View File

@ -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