[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
This commit is contained in:
parent
bff6dffbb4
commit
46d446fd47
|
@ -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 = {
|
||||
|
|
Loading…
Reference in New Issue