[FIX] point_of_sale: Bad tax code
The tax code used for a return product must be the refund tax code. Tax/Base Amount amount must be positive. opw:631303
This commit is contained in:
parent
d1031c34ac
commit
cb86fefc3a
|
@ -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
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue