[FIX] point_of_sale: invalid tax amount on grouped entries
If "Group Journal Items" option is checked, the generated accounting entries may get an invalid tax amout. This will happen when several entries for the same product do not use the same tax amout (e.g. discount). Avoid grouping products with different taxes under the same line by creating one line per tax_code_id. opw 626695
This commit is contained in:
parent
b6a528fbf0
commit
d117bad18c
|
@ -1108,11 +1108,16 @@ class pos_order(osv.osv):
|
|||
if not grouped_data[key]:
|
||||
grouped_data[key].append(values)
|
||||
else:
|
||||
current_value = grouped_data[key][0]
|
||||
current_value['quantity'] = current_value.get('quantity', 0.0) + values.get('quantity', 0.0)
|
||||
current_value['credit'] = current_value.get('credit', 0.0) + values.get('credit', 0.0)
|
||||
current_value['debit'] = current_value.get('debit', 0.0) + values.get('debit', 0.0)
|
||||
current_value['tax_amount'] = current_value.get('tax_amount', 0.0) + values.get('tax_amount', 0.0)
|
||||
for line in grouped_data[key]:
|
||||
if line.get('tax_code_id') == values.get('tax_code_id'):
|
||||
current_value = line
|
||||
current_value['quantity'] = current_value.get('quantity', 0.0) + values.get('quantity', 0.0)
|
||||
current_value['credit'] = current_value.get('credit', 0.0) + values.get('credit', 0.0)
|
||||
current_value['debit'] = current_value.get('debit', 0.0) + values.get('debit', 0.0)
|
||||
current_value['tax_amount'] = current_value.get('tax_amount', 0.0) + values.get('tax_amount', 0.0)
|
||||
break
|
||||
else:
|
||||
grouped_data[key].append(values)
|
||||
else:
|
||||
grouped_data[key].append(values)
|
||||
|
||||
|
|
Loading…
Reference in New Issue