diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 8934711f..970cab6e 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -222,7 +222,7 @@ class ResMrpWorkOrder(models.Model): material_width = fields.Float(string='宽') material_height = fields.Float(string='高') # 零件图号 - part_number = fields.Char(string='零件图号') + part_number = fields.Char(related='production_id.part_number', string='零件图号') # 工序状态 process_state = fields.Selection([ ('待装夹', '待装夹'), diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 9d4e3161..9f6206cb 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -267,6 +267,10 @@ class StockRule(models.Model): workorder_duration += workorder.duration_expected sale_order = self.env['sale.order'].sudo().search([('name', '=', production.origin)]) + # 根据销售订单号查询快速订单 + quick_easy_order = self.env['quick.easy.order'].sudo().search([('sale_order_id', '=', sale_order.id)]) + production.write({'part_number': quick_easy_order.part_drawing_number, + 'part_drawing': quick_easy_order.machining_drawings}) if sale_order: # sale_order.write({'schedule_status': 'to schedule'}) self.env['sf.production.plan'].sudo().with_company(company_id).create({ @@ -288,6 +292,7 @@ class StockRule(models.Model): # 为同一个product_id创建一个生产订单名称列表 product_id_to_production_names[product_id] = [production.name for production in all_production] for production_item in productions: + production_programming = self.env['mrp.production'].search( [('product_id.id', '=', production_item.product_id.id), ('origin', '=', production_item.origin)],