外协工艺合并采购单处理
This commit is contained in:
@@ -44,18 +44,18 @@ class PurchaseOrder(models.Model):
|
||||
production_id = self.env['mrp.production'].search([('origin', 'in', origins)])
|
||||
purchase.production_count = len(production_id)
|
||||
|
||||
def button_confirm(self):
|
||||
super().button_confirm()
|
||||
workorders = self.env['mrp.workorder'].search([('purchase_id', '=', self.id), ('state', '!=', 'cancel')])
|
||||
for workorder in workorders:
|
||||
if workorder.routing_type == '表面工艺' and workorder.is_subcontract is True:
|
||||
move_out = workorder.move_subcontract_workorder_ids[1]
|
||||
for mo in move_out:
|
||||
if mo.state != 'done':
|
||||
mo.write({'state': 'assigned', 'production_id': False})
|
||||
if not mo.move_line_ids:
|
||||
self.env['stock.move.line'].create(mo.get_move_line(workorder.production_id, workorder))
|
||||
return True
|
||||
# def button_confirm(self):
|
||||
# super().button_confirm()
|
||||
# workorders = self.env['mrp.workorder'].search([('purchase_id', '=', self.id), ('state', '!=', 'cancel')])
|
||||
# for workorder in workorders:
|
||||
# if workorder.routing_type == '表面工艺' and workorder.is_subcontract is True:
|
||||
# move_out = workorder.move_subcontract_workorder_ids[1]
|
||||
# for mo in move_out:
|
||||
# if mo.state != 'done':
|
||||
# mo.write({'state': 'assigned', 'production_id': False})
|
||||
# if not mo.move_line_ids:
|
||||
# self.env['stock.move.line'].create(mo.get_move_line(workorder.production_id, workorder))
|
||||
# return True
|
||||
|
||||
origin_sale_id = fields.Many2one('sale.order', string='销售订单号', store=True, compute='_compute_origin_sale_id')
|
||||
origin_sale_ids = fields.Many2many('sale.order', string='销售订单号(多个)', store=True,
|
||||
|
||||
Reference in New Issue
Block a user