From 9b49edb290cca73637ee87efdabd1bfec0a8da7a Mon Sep 17 00:00:00 2001 From: guanhuan Date: Thu, 23 Jan 2025 13:55:35 +0800 Subject: [PATCH 01/54] =?UTF-8?q?=E8=A3=85=E5=A4=B9=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E8=BF=94=E5=B7=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 26 +++++++++++++++++++ sf_manufacturing/views/mrp_workorder_view.xml | 4 +++ 2 files changed, 30 insertions(+) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index f8197783..8d4dcaa4 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -455,6 +455,32 @@ class ResMrpWorkOrder(models.Model): ("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因", tracking=True) detailed_reason = fields.Text('详细原因') is_rework = fields.Boolean(string='是否返工', default=False) + rework_flag = fields.Boolean(string='返工标志', compute='_compute_rework_flag') + + @api.depends('state', 'production_line_state') + def _compute_rework_flag(self): + for record in self: + if record.state == 'done' and record.routing_type == '装夹预调': + next_workorder = record.production_id.workorder_ids.filtered( + lambda w: w.sequence == record.sequence + 1) + if next_workorder and next_workorder.routing_type == 'CNC加工' and next_workorder.state in ['ready', + 'waiting', + 'pending'] and next_workorder.production_line_state == '待上产线': + record.rework_flag = False + elif next_workorder and next_workorder.routing_type == '表面工艺' and next_workorder.state in ['ready', + 'waiting', + 'pending']: + record.rework_flag = False + else: + record.rework_flag = True + else: + record.rework_flag = True + + def button_rework(self): + for item in self: + item.state = 'progress' + for time_id in item.time_ids: + time_id.write({'date_end': None}) def button_change_env(self): self.is_test_env = not self.is_test_env diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index 971a39ad..07449124 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -163,6 +163,7 @@ + @@ -211,6 +212,9 @@ attrs="{'invisible': ['|', '|', '|', ('routing_type','!=','装夹预调'),('state','!=','progress'), ('is_trayed', '=', False), ('state', 'in', ('done'))]}"/> + diff --git a/sf_sale/views/purchase_requisition_view.xml b/sf_sale/views/purchase_requisition_view.xml new file mode 100644 index 00000000..e96e5c31 --- /dev/null +++ b/sf_sale/views/purchase_requisition_view.xml @@ -0,0 +1,75 @@ + + + + + purchase.requisition.form.inherit.sf + purchase.requisition + + + + + - diff --git a/sf_sale/views/purchase_requisition_view.xml b/sf_sale/views/purchase_requisition_view.xml deleted file mode 100644 index e96e5c31..00000000 --- a/sf_sale/views/purchase_requisition_view.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - purchase.requisition.form.inherit.sf - purchase.requisition - - - - -