此按钮
class SkylineJobOrder(models.Model):
_name = 'skyline.job.order'
_inherit = 'purchase.order'
@api.multi
def action_workorder_out(self):
x = 0
""" This opens the xml view specified in xml_id for the current Work Order in Manufacturing """
self.ensure_one()
xml_id = self.env.context.get('xml_id')
if xml_id:
res = self.env['ir.actions.act_window'].for_xml_id('stock', xml_id)
production = self.env['mrp.production'].search([('product_id','=',self.product_id.id)])
for item in production:
x = item.bom_id.id
bomline = self.env['mrp.bom.line'].search([('bom_id','=',x)])
for record in bomline:
res.update(
context={'default_states':'draft','default_partner_id': self.partner_id.id,'default_move_lines': [(0,0, {'address_in_id':self.partner_id.id,'product_id':record.product_id.id,'product_uom': record.product_uom_id.id,'product_uom_qty':record.product_qty,'scrapped':False,'state':'draft','picking_id':False,'name': 'test','procurement_id': record.operation_id.id,'split_from': self.id,'no_open': True,'no_create':True,'availability':1,'location_dest_id':8,'picking_id':35})]}
)
print res
return res
return False
function validate(event) {
if (event.shiftKey == true) {
event.preventDefault();
}
if ((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 96 && event.keyCode <= 105) || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 46 || event.keyCode == 190) {
} else {
event.preventDefault();
}
if($(this).val().indexOf('.') !== -1 && event.keyCode == 190)
event.preventDefault();
}
我继承了purchase.order并创建了一个按钮并放置了动作 stock.picking。按钮的工作是缺少原始值 产品的材料。当点击保存按钮时显示 以下字段无效stock.move。
答案 0 :(得分:0)
块引用 将值从bom.line.ids插入stock.move通过stock.picking使用pickup_id,location_id,lication_dest_id和'purchase = ok,在purchase_id中。