将在按钮上调用以下功能单击目标是为尝试保存时已实现的拾取创建拾取和库存移动,或者当我单击任何按钮时将显示“以下字段无效” :股票移动移动线“
@api.multi
def request_done(self):
values = {
'picking_type_id' : self.picking_type_id.id,
'location_id' : self.source_location_id.id,
'location_dest_id' : self.dest_location_id.id,
'move_type' : self.env['stock.picking']._defaults.get('move_type','direct'),
'priority' : self.env['stock.picking']._defaults.get('priority','1'),
'move_lines': ''
}
picking_obj = self.env['stock.picking'].create(values)
move_ids = []
for line in self.product_line_ids:
vals = {
'product_id' : line.product_id.id,
'product_uom_qty' : line.approved_qty,
'picking_id' : picking_obj.id,
'product_uom' : line.product_id.uom_id.id,
'location_id' : picking_obj.location_id.id,
'location_dest_id' : picking_obj.location_dest_id.id,
'name' : '',
'reserved_quant_ids': False,
}
move = self.env['stock.move'].create(vals)
move_ids.append(move.id)
return{
'name': 'Stock Quotation',
'view_type': 'form',
'view_mode':'form',
'res_model': 'stock.picking',
'type':'ir.actions.act_window',
'res_id': picking_obj.id,
'nodeystroy': 'True',
'context' : {'voucher': True, 'picking_id' : picking_obj.id}
}