cur = repair.pricelist_id.currency_id
for line in repair.operations:
#manage prices with tax included use compute_all instead of compute
- tax_calculate = tax_obj.compute_all(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id)
if line.to_invoice:
+ tax_calculate = tax_obj.compute_all(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id)
for c in tax_calculate['taxes']:
val += c['amount']
for line in repair.fees_lines:
if line.to_invoice:
+ tax_calculate = tax_obj.compute_all(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id)
for c in tax_calculate['taxes']:
val += c['amount']
res[repair.id] = cur_obj.round(cr, uid, cur, val)
repair.write({'state': 'under_repair'})
return True
- def action_invoice_end(self, cr, uid, ids, context=None):
- """ Writes repair order state to 'Ready' if invoice method is Before repair.
- @return: True
- """
- repair_line = self.pool.get('mrp.repair.line')
- for order in self.browse(cr, uid, ids, context=context):
- val = {}
- if (order.invoice_method == 'b4repair'):
- val['state'] = 'ready'
- repair_line.write(cr, uid, [l.id for
- l in order.operations], {'state': 'confirmed'}, context=context)
- else:
- pass
- self.write(cr, uid, [order.id], val, context=context)
- return True
+# Remove this method because not use any where
+
+# def action_invoice_end(self, cr, uid, ids, context=None):
+# """ Writes repair order state to 'Ready' if invoice method is Before repair.
+# @return: True
+# """
+# repair_line = self.pool.get('mrp.repair.line')
+# for order in self.browse(cr, uid, ids, context=context):
+# val = {}
+# if (order.invoice_method == 'b4repair'):
+# val['state'] = 'ready'
+# repair_line.write(cr, uid, [l.id for
+# l in order.operations], {'state': 'confirmed'}, context=context)
+# else:
+# pass
+# self.write(cr, uid, [order.id], val, context=context)
+# return True
def action_repair_end(self, cr, uid, ids, context=None):
""" Writes repair order state to 'To be invoiced' if invoice method is
!python {model: mrp.repair}: |
self.action_invoice_cancel(cr, uid, [ref('mrp_repair_rma0')], context=None)
- |
- Writes repair order state to 'Ready' if invoice method is Before repair.
--
- !python {model: mrp.repair}: |
- self.action_invoice_end(cr, uid, [ref('mrp_repair_rma0')], context=None)
-- |
Creates stock move and picking for repair order
-
!python {model: mrp.repair}: |
-
!python {model: mrp.repair}: |
repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0]
- prod_id=False
- move_id=repair_id.move_id
- self.onchange_move_id(cr, uid, [ref('mrp_repair_rma0')], prod_id, move_id)
+ self.onchange_move_id(cr, uid, [ref('mrp_repair_rma0')], False, repair_id.move_id)
- |
On change of operation type it sets source location, destination location and to invoice field
-
!python {model: mrp.repair.line}: |
- guarantee_limit=False
- self.onchange_operation_type(cr, uid, [ref('mrp_repair_rma0')], type, guarantee_limit)
+ self.onchange_operation_type(cr, uid, [ref('mrp_repair_rma0')], type, False)
- |
On change of partner sets the values of partner address, partner invoice address and pricelist.
-
!python {model: mrp.repair}: |
repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0]
- part=False
- address_id=False
- self.onchange_partner_id(cr, uid, [ref('mrp_repair_rma0')], part, address_id)
+ self.onchange_partner_id(cr, uid, [ref('mrp_repair_rma0')], False, repair_id.address_id)
- |
On change of production lot sets the values of source location, destination location, move and guarantee limit
-
!python {model: mrp.repair}: |
repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0]
- lot=False
- product_id=repair_id.product_id
- self.onchange_lot_id(cr, uid, [ref('mrp_repair_rma0')], lot, product_id)
+ self.onchange_lot_id(cr, uid, [ref('mrp_repair_rma0')], False, repair_id.product_id)