From e09226e966d5dc15a240bd384a4ead4c6cbe8d18 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Tue, 8 Apr 2025 09:44:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AF=B9=E5=AF=BF=E5=91=BD?= =?UTF-8?q?=E6=9C=AA=E5=88=B0=E6=9C=9F=E4=B8=94=E4=BD=8D=E7=BD=AE=E5=9C=A8?= =?UTF-8?q?=E7=BA=BF=E8=BE=B9=E5=88=80=E5=BA=93=E7=9A=84=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=88=80=E5=85=B7=E8=BF=9B=E8=A1=8C=E6=8B=86=E8=A7=A3=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E7=9B=B4=E6=8E=A5=E6=8A=A5=E9=94=99=EF=BC=8C?= =?UTF-8?q?=E8=80=8C=E6=98=AF=E8=BF=9B=E8=A1=8C=E4=BA=8C=E6=AC=A1=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E6=98=AF=E5=90=A6=E8=BF=9B=E8=A1=8C=E6=8B=86=E9=99=A4?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_tool_management/models/base.py | 14 +++++++++++++- sf_tool_management/security/ir.model.access.csv | 5 ++++- sf_tool_management/wizard/wizard.py | 9 +++++++++ sf_tool_management/wizard/wizard_view.xml | 15 +++++++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index 40100a93..2fcc40d9 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -1437,14 +1437,26 @@ class FunctionalToolDismantle(models.Model): def confirmation_disassembly(self): logging.info('%s刀具确认开始拆解' % self.dismantle_cause) code = self.code + context = self.env.context if self.functional_tool_id.functional_tool_status == '已拆除': raise ValidationError('Rfid为【%s】名称为【%s】的功能刀具已经拆解,请勿重复操作!' % ( self.functional_tool_id.rfid_dismantle, self.name)) # 对拆解的功能刀具进行校验,只有在刀具房的功能刀具才能拆解 elif self.functional_tool_id.functional_tool_status != '报警': - if self.functional_tool_id.tool_room_num == 0: + if self.functional_tool_id.current_location == '机内刀库': raise ValidationError('Rfid为【%s】的功能刀具当前位置为【%s】,不能进行拆解!' % ( self.rfid, self.functional_tool_id.current_location)) + elif not context.get('TRUE_DISASSEMBLE') and self.functional_tool_id.current_location == '线边刀库': + return { + 'type': 'ir.actions.act_window', + 'res_model': 'sf.functional.tool.dismantle.wiard', + 'name': '刀具寿命未到期', + 'view_mode': 'form', + 'target': 'new', + 'context': { + 'default_functional_tool_dismantle_id': self.id, + 'TRUE_DISASSEMBLE': True} + } # 目标重复校验 self.location_duplicate_check() datas = {'scrap': [], 'picking': []} diff --git a/sf_tool_management/security/ir.model.access.csv b/sf_tool_management/security/ir.model.access.csv index 8c188464..1ad8a439 100644 --- a/sf_tool_management/security/ir.model.access.csv +++ b/sf_tool_management/security/ir.model.access.csv @@ -40,4 +40,7 @@ access_sf_functional_tool_dismantle_group_sf_tool_user,sf.functional.tool.disman access_sf_functional_tool_dismantle_group_plan_dispatch,sf.functional.tool.dismantle_group_plan_dispatch,model_sf_functional_tool_dismantle,sf_base.group_plan_dispatch,1,0,0,0 access_jikimo_bom,jikimo.bom,model_jikimo_bom,base.group_user,1,1,1,1 -access_jikimo_bom_wizard,jikimo.bom.wizard,model_jikimo_bom_wizard,base.group_user,1,1,1,1 \ No newline at end of file +access_jikimo_bom_wizard,jikimo.bom.wizard,model_jikimo_bom_wizard,base.group_user,1,1,1,1 + +access_sf_functional_tool_dismantle_wiard,sf.functional.tool.dismantle.wiard,model_sf_functional_tool_dismantle_wiard,sf_base.group_sf_tool_user,1,1,1,0 +access_sf_functional_tool_dismantle_wiard_group_plan_dispatch,sf.functional.tool.dismantle.wiard,model_sf_functional_tool_dismantle_wiard,sf_base.group_plan_dispatch,1,0,0,0 diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py index d1797855..633901d8 100644 --- a/sf_tool_management/wizard/wizard.py +++ b/sf_tool_management/wizard/wizard.py @@ -770,3 +770,12 @@ class FunctionalToolAssemblyOrder(models.TransientModel): # } +class FunctionalToolDismantle(models.TransientModel): + _name = 'sf.functional.tool.dismantle.wiard' + _description = '功能刀具拆解二次确认' + + functional_tool_dismantle_id = fields.Many2one('sf.functional.tool.dismantle', '拆解单') + + def confirm(self): + self.functional_tool_dismantle_id.confirmation_disassembly() + return True diff --git a/sf_tool_management/wizard/wizard_view.xml b/sf_tool_management/wizard/wizard_view.xml index 53a45d85..73770342 100644 --- a/sf_tool_management/wizard/wizard_view.xml +++ b/sf_tool_management/wizard/wizard_view.xml @@ -444,4 +444,19 @@ new + + + + 刀具拆解 + sf.functional.tool.dismantle.wiard + +
+
刀具寿命未到期,是否继续拆解?
+ +
+
+
\ No newline at end of file