修改子制造订单的销售订单

This commit is contained in:
胡尧
2024-11-26 11:26:17 +08:00
parent 430a628e18
commit 09a476ffa5

View File

@@ -286,6 +286,8 @@ class StockRule(models.Model):
mrp_production = self.env['mrp.production'].sudo().search([('name', '=', production.origin)], limit=1)
if mrp_production:
sale_order = self.env['sale.order'].sudo().search([('name', '=', mrp_production.origin)])
else:
mrp_production = production
if sale_order:
# sale_order.write({'schedule_status': 'to schedule'})
self.env['sf.production.plan'].sudo().with_company(company_id).create({
@@ -293,7 +295,7 @@ class StockRule(models.Model):
'order_deadline': sale_order.deadline_of_delivery,
'production_id': production.id,
'date_planned_start': production.date_planned_start,
'origin': production.origin,
'origin': mrp_production.origin,
'product_qty': production.product_qty,
'product_id': production.product_id.id,
'state': 'draft',