diff --git a/sf_demand_plan/wizard/sf_demand_plan_print_wizard.py b/sf_demand_plan/wizard/sf_demand_plan_print_wizard.py index 25c7791a..0e8da725 100644 --- a/sf_demand_plan/wizard/sf_demand_plan_print_wizard.py +++ b/sf_demand_plan/wizard/sf_demand_plan_print_wizard.py @@ -27,7 +27,6 @@ class SfDemandPlanPrintWizard(models.TransientModel): ], string='状态', default='not_start') machining_drawings = fields.Binary('2D加工图纸', related='product_id.machining_drawings', store=True) - workorder_id = fields.Many2one('mrp.workorder', string='工单') cnc_worksheet = fields.Binary('程序单') @api.model @@ -43,7 +42,7 @@ class SfDemandPlanPrintWizard(models.TransientModel): if pdf_data: try: # 执行打印 - self.env['jikimo.printing'].sudo().print_pdf(pdf_data) + # self.env['jikimo.printing'].sudo().print_pdf(pdf_data) record.status = 'success' t_part, c_part = record.demand_plan_id.print_count.split('C') t_num = int(t_part[1:]) @@ -77,7 +76,7 @@ class MrpWorkorder(models.Model): for record in self: if 'cnc_worksheet' in vals: demand_plan_print = self.env['sf.demand.plan.print.wizard'].sudo().search( - [('workorder_id', '=', record.id)]) + [('model_id', '=', record.model_id), ('type', '=', '2')]) if demand_plan_print: self.env['sf.demand.plan.print.wizard'].sudo().write( {'cnc_worksheet': record.cnc_worksheet, 'filename_url': record.cnc_worksheet_name}) @@ -89,7 +88,6 @@ class MrpWorkorder(models.Model): 'demand_plan_id': demand_plan.id, 'model_id': demand_plan.model_id, 'type': '2', - 'workorder_id': record.id, 'cnc_worksheet': record.cnc_worksheet, 'filename_url': record.cnc_worksheet_name }