From 46d446fd478541c2423042c15d0dd671ae8a23fd Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 11 May 2015 13:39:51 +0200 Subject: [PATCH] [FIX] mrp_repair: add calculation of taxes in subtotal, reset taxes after invoice creation The calculation of the taxes is added in the calculation of the subtotal. When the invoice is created, a reset of the taxes is performed so the user does not have to do it himself. opw-634711 --- addons/mrp_repair/mrp_repair.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 28751df910e..305f5056fdd 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -408,6 +408,7 @@ class mrp_repair(osv.osv): 'price_subtotal': fee.product_uom_qty * fee.price_unit }) repair_fee_obj.write(cr, uid, [fee.id], {'invoiced': True, 'invoice_line_id': invoice_fee_id}) + inv_obj.button_reset_taxes(cr, uid, inv_id, context=context) res[repair.id] = inv_id return res @@ -558,11 +559,13 @@ class mrp_repair_line(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 + 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, res[line.id]) + res[line.id] = cur_obj.round(cr, uid, cur, taxes['total']) return res _columns = {