Hi,
I want create custom move lines in delivery orders of SO(WH/quality control, WH/stock, WH/OUT) at a time while updating lines in Quality control according to different purchase order & its qty while i click _force_assign() in quality control. Please help.
here is my code:
if purchase_order_line:
remained_qty = 0
stock_move = self.env['stock.move']
vals = {}
for line in purchase_order_line:
for move_line in self.move_lines:
if line.product_id.id == move_line.product_id.id:
if line.qty_received - line.whint_invoiced < move_line.product_uom_qty:
remained_qty = move_line.product_uom_qty - (line.qty_received - line.whint_invoiced)
move_line.update({'product_uom_qty' : line.qty_received - line.whint_invoiced})
vals = {
'name': move_line.name,
'product_id': move_line.product_id.id,
'product_uom_qty': remained_qty,
'product_uom': move_line.product_id.uom_id.id,
'picking_id': move_line.picking_id.id,
'location_id': self.location_id.id,
'location_dest_id': self.location_dest_id.id,
'picking_type_id': move_line.picking_type_id.id,
'group_id': move_line.group_id.id,
'procure_method': move_line.procure_method,
'partner_id': move_line.partner_id.id,
'picking_partner_id': move_line.picking_partner_id.id,
'move_dest_id': move_line.move_dest_id.id}
# stock_move.create(vals)
self.move_lines.create(vals)
self.mapped('move_lines').filtered(lambda move: move.state in ['draft']).force_assign()