From 653221e5a40e328c2742f19fdb6c00ae41751d8a Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 8 Apr 2016 08:35:54 +0200 Subject: [PATCH] [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 --- addons/mrp_repair/mrp_repair.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index afcf75c0bcf..16994c3ced6 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -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