[FIX] mrp_repair: tax calculation and subtotal

Following commit 5b380e13, the the taxes on the fees are not calculated
correctly. Moreover, setting the subtotal in the onchange is misleading
since it will be set to zero if the line is not invoiced. We just set
the price to zero by default, and the click on 'update' will set it
correctly afterwards.

opw-673984
This commit is contained in:
Nicolas Martinelli
2016-04-08 08:35:54 +02:00
parent 2948acfa56
commit 653221e5a4
+2 -2
View File
@@ -525,7 +525,7 @@ class ProductChangeMixin(object):
"You have to change either the product, the quantity or the pricelist.")
}
else:
result.update({'price_unit': price, 'price_subtotal': price * product_uom_qty})
result.update({'price_unit': price, 'price_subtotal': 0.0})
return {'value': result, 'warning': warning}
@@ -643,7 +643,7 @@ class mrp_repair_fee(osv.osv, ProductChangeMixin):
if line.to_invoice:
cur = line.repair_id.pricelist_id.currency_id
taxes = tax_obj.compute_all(cr, uid, line.tax_id.ids, line.price_unit, cur.id, line.product_uom_qty, line.product_id.id, line.repair_id.partner_id.id)
res[line.id] = taxes['total_included']
res[line.id] = taxes['total_excluded']
else:
res[line.id] = 0
return res