diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index ff662645a62..aac025f38d6 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -1044,7 +1044,7 @@ class pos_order(osv.osv): tax_amount = line.price_subtotal * tax['base_sign'] else: tax_code_id = tax['ref_base_code_id'] - tax_amount = line.price_subtotal * tax['ref_base_sign'] + tax_amount = -line.price_subtotal * tax['ref_base_sign'] return (tax_code_id, tax_amount,) @@ -1140,7 +1140,10 @@ class pos_order(osv.osv): for tax in computed_taxes: tax_amount += cur_obj.round(cr, uid, cur, tax['amount']) - group_key = (tax['tax_code_id'], tax['base_code_id'], tax['account_collected_id'], tax['id']) + 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']) @@ -1213,7 +1216,7 @@ class pos_order(osv.osv): 'credit': ((tax_amount>0) and tax_amount) or 0.0, 'debit': ((tax_amount<0) and -tax_amount) or 0.0, 'tax_code_id': key[tax_code_pos], - 'tax_amount': tax_amount, + 'tax_amount': abs(tax_amount), 'partner_id': order.partner_id and self.pool.get("res.partner")._find_accounting_partner(order.partner_id).id or False })