'move_id': mid,
})
procurement_obj.signal_button_confirm(cr, uid, [proc_id])
-
+
move_obj.write(cr, uid, [move.id], {
- 'location_dest_id': move.location_id.id, # dummy move for the kit
+ 'location_dest_id': move.location_id.id, # dummy move for the kit
'picking_id': False,
'state': 'confirmed'
})
- procurement_ids = procurement_obj.search(cr, uid, [('move_id','=',move.id)], context)
+ procurement_ids = procurement_obj.search(cr, uid, [('move_id', '=', move.id)], context)
procurement_obj.signal_button_confirm(cr, uid, procurement_ids)
procurement_obj.signal_button_wait_done(cr, uid, procurement_ids)
return processed_ids
-
+
def action_consume(self, cr, uid, ids, product_qty, location_id=False, context=None):
""" Consumed product with specific quatity from specific source location.
@param product_qty: Consumed product quantity
@param location_id: Source location
@return: Consumed lines
- """
+ """
res = []
production_obj = self.pool.get('mrp.production')
- for move in self.browse(cr, uid, ids):
- move.action_confirm(context)
+ for move in self.browse(cr, uid, ids, context=context):
+ self.action_confirm(cr, uid, [move.id], context=context)
new_moves = super(StockMove, self).action_consume(cr, uid, [move.id], product_qty, location_id, context=context)
production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])])
for prod in production_obj.browse(cr, uid, production_ids, context=context):
production_obj.write(cr, uid, production_ids, {'move_lines': [(4, new_move)]})
res.append(new_move)
return res
-
+
def action_scrap(self, cr, uid, ids, product_qty, location_id, context=None):
""" Move the scrap/damaged product into scrap location
@param product_qty: Scraped product quantity
@param location_id: Scrap location
@return: Scraped lines
- """
+ """
res = []
production_obj = self.pool.get('mrp.production')
for move in self.browse(cr, uid, ids, context=context):
uos_qty = quantity / move_qty * move.product_uos_qty
if quantity_rest > 0:
default_val = {
- 'product_qty': quantity,
+ 'product_uom_qty': quantity,
'product_uos_qty': uos_qty,
'state': move.state,
'location_id': location_id or move.location_id.id,
current_move = self.copy(cr, uid, move.id, default_val)
res += [current_move]
update_val = {}
- update_val['product_qty'] = quantity_rest
+ update_val['product_uom_qty'] = quantity_rest
update_val['product_uos_qty'] = uos_qty_rest
self.write(cr, uid, [move.id], update_val)
uos_qty_rest = uos_qty
res += [move.id]
update_val = {
- 'product_qty' : quantity_rest,
+ 'product_uom_qty' : quantity_rest,
'product_uos_qty' : uos_qty_rest,
'location_id': location_id or move.location_id.id,
}