[FIX] mrp_repair: calculation of taxes
- Correct tax management in tab "Operations": use unit_price in tax computation - Add tax calculation in tab "Invoicing" (Fees). opw-639660
This commit is contained in:
parent
6e2d610908
commit
fefc8e0574
|
@ -562,10 +562,12 @@ class mrp_repair_line(osv.osv, ProductChangeMixin):
|
|||
tax_obj = self.pool.get('account.tax')
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
res[line.id] = line.to_invoice and line.price_unit * line.product_uom_qty or 0
|
||||
taxes = tax_obj.compute_all(cr, uid, line.tax_id, res[line.id], line.product_uom_qty, line.product_id, line.repair_id.partner_id)
|
||||
cur = line.repair_id.pricelist_id.currency_id
|
||||
res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
|
||||
if line.to_invoice:
|
||||
taxes = tax_obj.compute_all(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, line.product_id, line.repair_id.partner_id)
|
||||
cur = line.repair_id.pricelist_id.currency_id
|
||||
res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
|
||||
else:
|
||||
res[line.id] = 0
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
|
@ -652,11 +654,15 @@ class mrp_repair_fee(osv.osv, ProductChangeMixin):
|
|||
@return: Dictionary of values.
|
||||
"""
|
||||
res = {}
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
res[line.id] = line.to_invoice and line.price_unit * line.product_uom_qty or 0
|
||||
cur = line.repair_id.pricelist_id.currency_id
|
||||
res[line.id] = cur_obj.round(cr, uid, cur, res[line.id])
|
||||
if line.to_invoice:
|
||||
taxes = tax_obj.compute_all(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, line.product_id, line.repair_id.partner_id)
|
||||
cur = line.repair_id.pricelist_id.currency_id
|
||||
res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
|
||||
else:
|
||||
res[line.id] = 0
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
|
|
Loading…
Reference in New Issue