From e2c13a819453e5cdc665d0c5446f6d67b0a42f81 Mon Sep 17 00:00:00 2001 From: yuxianghui <1608204036@qq.com> Date: Wed, 18 Oct 2023 17:34:19 +0800 Subject: [PATCH 1/7] =?UTF-8?q?1=E3=80=81=E5=8A=9F=E8=83=BD=E5=88=80?= =?UTF-8?q?=E5=85=B7=E7=BB=84=E8=A3=85=E7=BB=84=E8=A3=85=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E7=9A=84=E5=85=AD=E4=B8=AA=E5=88=80=E5=85=B7?= =?UTF-8?q?=E7=89=A9=E6=96=99=E5=AF=B9=E8=B1=A1=E7=9A=84=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8F=B7=E7=BB=91=E5=AE=9A=E5=BA=93=E5=AD=98=E7=9A=84=E5=88=80?= =?UTF-8?q?=E5=85=B7=E7=89=A9=E6=96=99=E5=BA=8F=E5=88=97=E5=8F=B7=EF=BC=8C?= =?UTF-8?q?2=E3=80=81=E4=BC=98=E5=8C=96=E5=8A=9F=E8=83=BD=E5=88=80?= =?UTF-8?q?=E5=85=B7=E7=BB=84=E8=A3=85=E5=92=8C=E5=8A=9F=E8=83=BD=E5=88=80?= =?UTF-8?q?=E5=85=B7=E7=BB=84=E8=A3=85=E7=BB=84=E8=A3=85=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E7=9A=84=E5=88=80=E5=85=B7=E7=89=A9=E6=96=99=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_tool_management/models/base.py | 36 ++- sf_tool_management/views/tool_base_views.xml | 248 ++++++++++++----- sf_tool_management/wizard/wizard.py | 264 ++++++------------- sf_tool_management/wizard/wizard_view.xml | 185 +++++++++---- 4 files changed, 418 insertions(+), 315 deletions(-) diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index 664876b1..a55f4f17 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -752,40 +752,38 @@ class FunctionalToolAssembly(models.Model): functional_tool_cutting_type = fields.Char(string='功能刀具切削类型', readonly=False) # 整体式刀具型号 - cutting_tool_integral_model_id = fields.Many2one('product.product', string='整体式刀具型号', readonly=True, - domain=[('cutting_tool_material_id', '=', '整体式刀具')]) - integral_code = fields.Char('整体式刀具序列号', readonly=True) + integral_code_id = fields.Many2one('stock.lot', string='整体式刀具序列号', readonly=True) + cutting_tool_integral_model_id = fields.Many2one('sf.cutting.tool.material', string='整体式刀具型号', readonly=True) integral_name = fields.Char('整体式刀具名称', readonly=True) - sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', '整体式刀具品牌', readonly=True, domain="[('tag_ids.name', 'ilike', '刀具')]") + sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌', readonly=True) + # 刀片型号 - cutting_tool_blade_model_id = fields.Many2one('product.product', string='刀片型号', readonly=True, - domain=[('cutting_tool_material_id', '=', '刀片')]) - blade_code = fields.Char('刀片序列号', readonly=True) + blade_code_id = fields.Many2one('stock.lot', '刀片序列号', readonly=True) + cutting_tool_blade_model_id = fields.Many2one('sf.cutting.tool.material', string='刀片型号', readonly=True) blade_name = fields.Char('刀片名称', readonly=True) sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True) + # 刀杆型号 - cutting_tool_cutterbar_model_id = fields.Many2one('product.product', string='刀杆型号', readonly=True, - domain=[('cutting_tool_material_id', '=', '刀杆')]) - bar_code = fields.Char('刀杆序列号', readonly=True) + bar_code_id = fields.Many2one('stock.lot', '刀杆序列号', readonly=True) + cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting.tool.material', string='刀杆型号', readonly=True) bar_name = fields.Char('刀杆名称', readonly=True) sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', readonly=True) + # 刀盘型号 - cutting_tool_cutterpad_model_id = fields.Many2one('product.product', string='刀盘型号', readonly=True, - domain=[('cutting_tool_material_id', '=', '刀盘')]) - pad_code = fields.Char('刀盘序列号', readonly=True) + pad_code_id = fields.Many2one('stock.lot', '刀盘序列号', readonly=True) + cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting.tool.material', string='刀盘型号', readonly=True) pad_name = fields.Char('刀盘名称', readonly=True) sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True) # 刀柄型号 - cutting_tool_cutterhandle_model_id = fields.Many2one('product.product', string='刀柄型号', readonly=True, - domain=[('cutting_tool_material_id', '=', '刀柄')]) - handle_code = fields.Char('刀柄序列号', readonly=True) + handle_code_id = fields.Many2one('stock.lot', '刀柄序列号', readonly=True) + cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting.tool.material', string='刀柄型号', readonly=True) handle_name = fields.Char('刀柄名称', readonly=True) sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True) + # 夹头型号 - cutting_tool_cutterhead_model_id = fields.Many2one('product.product', string='夹头型号', readonly=True, - domain=[('cutting_tool_material_id', '=', '夹头')]) - chuck_code = fields.Char('夹头序列号', readonly=True) + chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', readonly=True) + cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting.tool.material', string='夹头型号', readonly=True) chuck_name = fields.Char('夹头名称', readonly=True) sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True) diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml index aba086ca..1e079896 100644 --- a/sf_tool_management/views/tool_base_views.xml +++ b/sf_tool_management/views/tool_base_views.xml @@ -1106,72 +1106,192 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
+ +
+ + + + + + + + + + + + + + + + +
+
+
+ + + +
+ +
+ + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py index 37f39760..791f30ac 100644 --- a/sf_tool_management/wizard/wizard.py +++ b/sf_tool_management/wizard/wizard.py @@ -137,196 +137,98 @@ class FunctionalToolAssemblyOrder(models.TransientModel): # 功能刀具组装信息 # 整体式刀具型号 - cutting_tool_integral_model_id = fields.Many2one('product.product', string='整体式刀具型号', readonly=False, - domain=[('cutting_tool_material_id', '=', '整体式刀具')]) - integral_code = fields.Char('整体式刀具序列号', readonly=True, compute='_compute_integral_code') - integral_name = fields.Char('整体式刀具名称', readonly=True, compute='_compute_integral_name') - sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', '整体式刀具品牌', readonly=True, - compute='_compute_sf_tool_brand_id_1') - - @api.depends('cutting_tool_integral_model_id') - def _compute_integral_code(self): - for record in self: - if record.cutting_tool_integral_model_id: - self.integral_code = record.cutting_tool_integral_model_id.code - else: - self.integral_code = None - - @api.depends('cutting_tool_integral_model_id') - def _compute_integral_name(self): - for record in self: - if record.cutting_tool_integral_model_id: - self.integral_name = record.cutting_tool_integral_model_id.name - else: - self.integral_name = None - - @api.depends('cutting_tool_integral_model_id') - def _compute_sf_tool_brand_id_1(self): - for record in self: - if record.cutting_tool_integral_model_id: - self.sf_tool_brand_id_1 = record.cutting_tool_integral_model_id.brand_id.id - else: - self.sf_tool_brand_id_1 = None + integral_code_id = fields.Many2one('stock.lot', string='整体式刀具序列号', + domain=[('product_id.cutting_tool_material_id.name', '=', '整体式刀具')]) + cutting_tool_integral_model_id = fields.Many2one('sf.cutting.tool.material', string='整体式刀具型号', readonly=True) + integral_name = fields.Char('整体式刀具名称', readonly=True) + sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌', readonly=True) # 刀片型号 - cutting_tool_blade_model_id = fields.Many2one('product.product', string='刀片型号', readonly=False, - domain=[('cutting_tool_material_id', '=', '刀片')]) - blade_code = fields.Char('刀片序列号', readonly=True, compute='_compute_blade_code') - blade_name = fields.Char('刀片名称', readonly=True, compute='_compute_blade_name') - sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True, - compute='_compute_sf_tool_brand_id_2') - - @api.depends('cutting_tool_blade_model_id') - def _compute_blade_code(self): - for record in self: - if record.cutting_tool_blade_model_id: - self.blade_code = self.cutting_tool_blade_model_id.code - else: - self.blade_code = None - - @api.depends('cutting_tool_blade_model_id') - def _compute_blade_name(self): - for record in self: - if record.cutting_tool_blade_model_id: - self.blade_name = self.cutting_tool_blade_model_id.name - else: - self.blade_name = None - - @api.depends('cutting_tool_blade_model_id') - def _compute_sf_tool_brand_id_2(self): - for record in self: - if record.cutting_tool_blade_model_id: - self.sf_tool_brand_id_2 = self.cutting_tool_blade_model_id.brand_id.id - else: - self.sf_tool_brand_id_2 = None + blade_code_id = fields.Many2one('stock.lot', '刀片序列号', + domain=[('product_id.cutting_tool_material_id.name', '=', '刀片')]) + cutting_tool_blade_model_id = fields.Many2one('sf.cutting.tool.material', string='刀片型号', readonly=True) + blade_name = fields.Char('刀片名称', readonly=True) + sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True) # 刀杆型号 - cutting_tool_cutterbar_model_id = fields.Many2one('product.product', string='刀杆型号', readonly=False, - domain=[('cutting_tool_material_id', '=', '刀杆')]) - bar_code = fields.Char('刀杆序列号', readonly=True, compute='_compute_bar_code') - bar_name = fields.Char('刀杆名称', readonly=True, compute='_compute_bar_name') - sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', readonly=True, - compute='_compute_sf_tool_brand_id_3') - - @api.depends('cutting_tool_cutterbar_model_id') - def _compute_bar_code(self): - for record in self: - if record.cutting_tool_cutterbar_model_id: - self.bar_code = self.cutting_tool_cutterbar_model_id.code - else: - self.bar_code = None - - @api.depends('cutting_tool_cutterbar_model_id') - def _compute_bar_name(self): - for record in self: - if record.cutting_tool_cutterbar_model_id: - self.bar_name = self.cutting_tool_cutterbar_model_id.name - else: - self.bar_name = None - - @api.depends('cutting_tool_cutterbar_model_id') - def _compute_sf_tool_brand_id_3(self): - for record in self: - if record.cutting_tool_cutterbar_model_id: - self.sf_tool_brand_id_3 = self.cutting_tool_cutterbar_model_id.brand_id.id - else: - self.sf_tool_brand_id_3 = None + bar_code_id = fields.Many2one('stock.lot', '刀杆序列号', + domain=[('product_id.cutting_tool_material_id.name', '=', '刀杆')]) + cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting.tool.material', string='刀杆型号', readonly=True) + bar_name = fields.Char('刀杆名称', readonly=True) + sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', readonly=True) # 刀盘型号 - cutting_tool_cutterpad_model_id = fields.Many2one('product.product', string='刀盘型号', readonly=False, - domain=[('cutting_tool_material_id', '=', '刀盘')]) - pad_code = fields.Char('刀盘序列号', readonly=True, compute='_compute_pad_code') - pad_name = fields.Char('刀盘名称', readonly=True, compute='_compute_pad_name') - sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True, - compute='_compute_sf_tool_brand_id_4') - - @api.depends('cutting_tool_cutterpad_model_id') - def _compute_pad_code(self): - for record in self: - if record.cutting_tool_cutterpad_model_id: - self.pad_code = self.cutting_tool_cutterpad_model_id.code - else: - self.pad_code = None - - @api.depends('cutting_tool_cutterpad_model_id') - def _compute_pad_name(self): - for record in self: - if record.cutting_tool_cutterpad_model_id: - self.pad_name = self.cutting_tool_cutterpad_model_id.name - else: - self.pad_name = None - - @api.depends('cutting_tool_cutterpad_model_id') - def _compute_sf_tool_brand_id_4(self): - for record in self: - if record.cutting_tool_cutterpad_model_id: - self.sf_tool_brand_id_4 = self.cutting_tool_cutterpad_model_id.brand_id.id - else: - self.sf_tool_brand_id_4 = None + pad_code_id = fields.Many2one('stock.lot', '刀盘序列号', + domain=[('product_id.cutting_tool_material_id.name', '=', '刀盘')]) + cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting.tool.material', string='刀盘型号', readonly=True) + pad_name = fields.Char('刀盘名称', readonly=True) + sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True) # 刀柄型号 - cutting_tool_cutterhandle_model_id = fields.Many2one('product.product', string='刀柄型号', readonly=False, - domain=[('cutting_tool_material_id', '=', '刀柄')]) - handle_code = fields.Char('刀柄序列号', readonly=True, compute='_compute_handle_code') - handle_name = fields.Char('刀柄名称', readonly=True, compute='_compute_handle_name') - sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True, - compute='_compute_sf_tool_brand_id_5') - - @api.depends('cutting_tool_cutterhandle_model_id') - def _compute_handle_code(self): - for record in self: - if record.cutting_tool_cutterhandle_model_id: - self.handle_code = self.cutting_tool_cutterhandle_model_id.code - else: - self.handle_code = None - - @api.depends('cutting_tool_cutterhandle_model_id') - def _compute_handle_name(self): - for record in self: - if record.cutting_tool_cutterhandle_model_id: - self.handle_name = self.cutting_tool_cutterhandle_model_id.name - else: - self.handle_name = None - - @api.depends('cutting_tool_cutterhandle_model_id') - def _compute_sf_tool_brand_id_5(self): - for record in self: - if record.cutting_tool_cutterhandle_model_id: - self.sf_tool_brand_id_5 = self.cutting_tool_cutterhandle_model_id.brand_id.id - else: - self.sf_tool_brand_id_5 = None + handle_code_id = fields.Many2one('stock.lot', '刀柄序列号', + domain=[('product_id.cutting_tool_material_id.name', '=', '刀柄')]) + cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting.tool.material', string='刀柄型号', readonly=True) + handle_name = fields.Char('刀柄名称', readonly=True) + sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True) # 夹头型号 - cutting_tool_cutterhead_model_id = fields.Many2one('product.product', string='夹头型号', readonly=False, - domain=[('cutting_tool_material_id', '=', '夹头')]) - chuck_code = fields.Char('夹头序列号', readonly=True, compute='_compute_chuck_code') - chuck_name = fields.Char('夹头名称', readonly=True, compute='_compute_chuck_name') - sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True, - compute='_compute_sf_tool_brand_id_6') + chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', + domain=[('product_id.cutting_tool_material_id.name', '=', '夹头')]) + cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting.tool.material', string='夹头型号', readonly=True) + chuck_name = fields.Char('夹头名称', readonly=True) + sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True) - @api.depends('cutting_tool_cutterhead_model_id') - def _compute_chuck_code(self): + @api.depends('integral_code_id', 'blade_code_id', 'bar_code_id', 'pad_code_id', 'handle_code_id', 'chuck_code_id') + def _compute_auto_fill(self): for record in self: - if record.cutting_tool_cutterhead_model_id: - self.chuck_code = self.cutting_tool_cutterhead_model_id.code + if record.integral_code_id: + record.cutting_tool_integral_model_id = record.integral_code_id.product_id.cutting_tool_material_id.id + record.integral_name = record.integral_code_id.product_id.name + record.sf_tool_brand_id_1 = record.integral_code_id.product_id.brand_id.id else: - self.chuck_code = None - - @api.depends('cutting_tool_cutterhead_model_id') - def _compute_chuck_name(self): - for record in self: - if record.cutting_tool_cutterhead_model_id: - self.chuck_name = self.cutting_tool_cutterhead_model_id.name + record.cutting_tool_integral_model_id = None + record.integral_name = None + record.sf_tool_brand_id_1 = None + if record.blade_code_id: + record.cutting_tool_blade_model_id = record.blade_code_id.product_id.cutting_tool_material_id.id + record.blade_name = record.blade_code_id.product_id.name + record.sf_tool_brand_id_2 = record.blade_code_id.product_id.brand_id.id else: - self.chuck_name = None - - @api.depends('cutting_tool_cutterhead_model_id') - def _compute_sf_tool_brand_id_6(self): - for record in self: - if record.cutting_tool_cutterhead_model_id: - self.sf_tool_brand_id_6 = self.cutting_tool_cutterhead_model_id.brand_id.id + record.cutting_tool_blade_model_id = None + record.blade_name = None + record.sf_tool_brand_id_2 = None + if record.bar_code_id: + record.cutting_tool_cutterbar_model_id = record.bar_code_id.product_id.cutting_tool_material_id.id + record.bar_name = record.bar_code_id.product_id.name + record.sf_tool_brand_id_3 = record.bar_code_id.product_id.brand_id.id else: - self.sf_tool_brand_id_6 = None + record.cutting_tool_cutterbar_model_id = None + record.bar_name = None + record.sf_tool_brand_id_3 = None + if record.pad_code_id: + record.cutting_tool_cutterpad_model_id = record.pad_code_id.product_id.cutting_tool_material_id.id + record.pad_name = record.pad_code_id.product_id.name + record.sf_tool_brand_id_4 = record.pad_code_id.product_id.brand_id.id + else: + record.cutting_tool_cutterpad_model_id = None + record.pad_name = None + record.sf_tool_brand_id_4 = None + if record.handle_code_id: + record.cutting_tool_cutterhandle_model_id = record.handle_code_id.product_id.cutting_tool_material_id.id + record.handle_name = record.handle_code_id.product_id.name + record.sf_tool_brand_id_5 = record.handle_code_id.product_id.brand_id.id + else: + record.cutting_tool_cutterhandle_model_id = None + record.handle_name = None + record.sf_tool_brand_id_5 = None + if record.chuck_code_id: + record.cutting_tool_cutterhead_model_id = record.chuck_code_id.product_id.cutting_tool_material_id.id + record.chuck_name = record.chuck_code_id.product_id.name + record.sf_tool_brand_id_6 = record.chuck_code_id.product_id.brand_id.id + else: + record.cutting_tool_cutterhead_model_id = None + record.chuck_name = None + record.sf_tool_brand_id_6 = None coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', default='1') tool_loading_length = fields.Char(string='装刀长') @@ -343,27 +245,27 @@ class FunctionalToolAssemblyOrder(models.TransientModel): """ desc_1 = { 'cutting_tool_integral_model_id': self.cutting_tool_integral_model_id.id, - 'integral_code': self.integral_code, + 'integral_code_id': self.integral_code_id.id, 'integral_name': self.integral_name, 'sf_tool_brand_id_1': self.sf_tool_brand_id_1, 'cutting_tool_blade_model_id': self.cutting_tool_blade_model_id.id, - 'blade_code': self.blade_code, + 'blade_code_id': self.blade_code_id.id, 'blade_name': self.blade_name, 'sf_tool_brand_id_2': self.sf_tool_brand_id_2, 'cutting_tool_cutterbar_model_id': self.cutting_tool_cutterbar_model_id.id, - 'bar_code': self.bar_code, + 'bar_code_id': self.bar_code_id.id, 'bar_name': self.bar_name, 'sf_tool_brand_id_3': self.sf_tool_brand_id_3, 'cutting_tool_cutterpad_model_id': self.cutting_tool_cutterpad_model_id.id, - 'pad_code': self.pad_code, + 'pad_code_id': self.pad_code_id.id, 'pad_name': self.pad_name, 'sf_tool_brand_id_4': self.sf_tool_brand_id_4, 'cutting_tool_cutterhandle_model_id': self.cutting_tool_cutterhandle_model_id.id, - 'handle_code': self.handle_code, + 'handle_code_id': self.handle_code_id.id, 'handle_name': self.handle_name, 'sf_tool_brand_id_5': self.sf_tool_brand_id_5, 'cutting_tool_cutterhead_model_id': self.cutting_tool_cutterhead_model_id.id, - 'chuck_code': self.chuck_code, + 'chuck_code_id': self.chuck_code_id.id, 'chuck_name': self.chuck_name, 'sf_tool_brand_id_6': self.sf_tool_brand_id_6, 'coarse_middle_thin': self.coarse_middle_thin, diff --git a/sf_tool_management/wizard/wizard_view.xml b/sf_tool_management/wizard/wizard_view.xml index 6398b362..0c85cb66 100644 --- a/sf_tool_management/wizard/wizard_view.xml +++ b/sf_tool_management/wizard/wizard_view.xml @@ -140,58 +140,141 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
+ +
+ + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + + + + + + + + + + + +
+ From 587e2a4e3e3e8a71fc726c94c13cadef086ed1d1 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Fri, 20 Oct 2023 10:50:35 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dsequence=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=AD=97=E6=AE=B5=E5=80=BC=E7=A7=BB=E5=8A=A8=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/__manifest__.py | 2 +- .../views/operations_rename_menu.xml | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py index bcb25c81..6febb711 100644 --- a/sf_base/__manifest__.py +++ b/sf_base/__manifest__.py @@ -10,7 +10,7 @@ """, 'category': 'sf', 'website': 'https://www.sf.jikimo.com', - 'depends': ['account', 'base', 'mrp_workorder','sale'], + 'depends': ['account', 'base', 'mrp_workorder', 'sale', 'purchase'], 'data': [ 'security/group_security.xml', 'security/ir.model.access.csv', diff --git a/sf_plan_management/views/operations_rename_menu.xml b/sf_plan_management/views/operations_rename_menu.xml index 28bc5c6c..659df6dd 100644 --- a/sf_plan_management/views/operations_rename_menu.xml +++ b/sf_plan_management/views/operations_rename_menu.xml @@ -84,6 +84,29 @@ + + + sale.order.form.inherited + sale.order + + + + + + + + + + purchase.order.form.inherited + purchase.order + + + + + + + + From 749473f9dc52e26963152748272a0bb8d4362e63 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Mon, 23 Oct 2023 00:17:05 +0800 Subject: [PATCH 3/7] =?UTF-8?q?form=E8=A7=86=E5=9B=BE=E7=9A=84=E4=B8=A2?= =?UTF-8?q?=E5=BC=83=E6=8C=89=E9=92=AE=E5=A2=9E=E5=8A=A0=E4=BA=8C=E6=AC=A1?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jikimo_frontend/__manifest__.py | 1 + .../src/js/custom_form_status_indicator.js | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 jikimo_frontend/static/src/js/custom_form_status_indicator.js diff --git a/jikimo_frontend/__manifest__.py b/jikimo_frontend/__manifest__.py index f2096eea..4165a503 100644 --- a/jikimo_frontend/__manifest__.py +++ b/jikimo_frontend/__manifest__.py @@ -27,6 +27,7 @@ 'jikimo_frontend/static/src/views/list_nums/list_nums.xml', 'jikimo_frontend/static/src/views/list_nums/list_nums2.xml', 'jikimo_frontend/static/src/views/list_nums/list_nums3.xml', + 'jikimo_frontend/static/src/js/custom_form_status_indicator.js', ], }, diff --git a/jikimo_frontend/static/src/js/custom_form_status_indicator.js b/jikimo_frontend/static/src/js/custom_form_status_indicator.js new file mode 100644 index 00000000..fd06fe75 --- /dev/null +++ b/jikimo_frontend/static/src/js/custom_form_status_indicator.js @@ -0,0 +1,49 @@ +/** @odoo-module */ + +import {patch} from '@web/core/utils/patch'; +// import { Dialog } from "@web/core/dialog/dialog"; +import {_t} from "@web/core/l10n/translation"; +import {FormStatusIndicator} from "@web/views/form/form_status_indicator/form_status_indicator" + +var Dialog = require('web.Dialog'); +// var {patch} = require("web.utils") 这句话也行 + +patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', { + // 你可以重写或者添加一些方法和属性 + async _onDiscardChanges() { + var self = this; + Dialog.confirm(this, _t("Are you sure you want to discard changes?"), { + title: _t("Discard Changes"), + + // confirm_callback: function () { + // self.model.discardChanges(self.handle); + // }, + }); + }, + + async discard() { + // if (window.confirm("Are you sure you want to discard changes?")) { + // await this.props.discard(); + // } + const result = await this._confirmDiscardChange(); + await this.props.discard(); + }, + + _confirmDiscardChange(){ + var self = this; + var def = new Promise(function (resolve, reject) { + var message = _t("请确认是否要舍弃之前的更改?"); + var dialog = Dialog.confirm(self, message, { + title: _t("Warning"), + confirm_callback: resolve.bind(self, true), + cancel_callback: reject, + }); + dialog.on('closed', self, reject); + }); + return def; + }, + +} +); + + From 1e243e450053fffa213e495c761c649b9d69c5a4 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 23 Oct 2023 09:59:25 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=87=8A=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_sale/models/auto_quatotion_common.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sf_sale/models/auto_quatotion_common.py b/sf_sale/models/auto_quatotion_common.py index d1bdb65a..09ea3f0f 100644 --- a/sf_sale/models/auto_quatotion_common.py +++ b/sf_sale/models/auto_quatotion_common.py @@ -2,7 +2,7 @@ import logging from odoo.modules import get_resource_path from odoo import fields, models, api -# from quatotion import readSql, feature_recognize, auto_quatotion +from quatotion import readSql, feature_recognize, auto_quatotion __author__ = 'jinling.yang' _logger = logging.getLogger(__name__) @@ -24,14 +24,14 @@ class AutoQuatotion(models.Model): def get_process_time_db_path(self): return get_resource_path('sf_sale', 'models', 'process_time.db') - # def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code): - # ''' - # 通过打包好的.so库, - # 以调用autoQuatotion库中Quatotion类, - # 初始化后调用类的analyseShape方法对模型文件进行价格预测 - # ''' - # # 初始化自动报价类(输入特征数据库和加工时间数据库) - # reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path) - # # 获取价格、加工时间、尺寸、XYZ、翻面次数 - # feature_info = reader.analyseShape(stp_url, InfoJson={}) - # return feature_info + def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code): + ''' + 通过打包好的.so库, + 以调用autoQuatotion库中Quatotion类, + 初始化后调用类的analyseShape方法对模型文件进行价格预测 + ''' + # 初始化自动报价类(输入特征数据库和加工时间数据库) + reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path) + # 获取价格、加工时间、尺寸、XYZ、翻面次数 + feature_info = reader.analyseShape(stp_url, InfoJson={}) + return feature_info From 27259fb8f7a9f6c2b6052297311bc6204d5a26eb Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 23 Oct 2023 11:34:56 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=8A=A5=E4=BB=B7=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_sale/models/quick_easy_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index 0a20a676..e4467a13 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -132,7 +132,7 @@ class QuickEasyOrder(models.Model): item.model_height = boxshape[2] # 高 item.model_volume = boxshape[0] * boxshape[1] * boxshape[2] item.model_feature = json.dumps(ret['feature_infos'], ensure_ascii=False) - self._get_price(item) + # self._get_price(item) else: item.model_file = False item.model_feature = False From 13555d91e2adc4257880b5bc4915738048558708 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 23 Oct 2023 14:30:46 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=B8=8A=E8=89=B2?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_sale/models/quick_easy_order.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index e4467a13..b81c3b5e 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -82,17 +82,15 @@ class QuickEasyOrder(models.Model): # logging.info('create-model_file:%s' % len(vals['model_file'])) obj = super(QuickEasyOrder, self).create(vals) - self.model_coloring(obj) + # self.model_coloring(obj) self.distribute_to_factory(obj) obj.state = '待接单' return obj # 将attach的datas内容转为glb文件 def transition_glb_file(self, report_path, model_code): - shapes = read_step_file(report_path) # output_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.stl') output_file = os.path.join('/tmp', str(model_code) + '.stl') - write_stl_file(shapes, output_file, 'binary', 0.03, 0.5) # 转化为glb # output_glb_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.glb') output_glb_file = os.path.join('/tmp', str(model_code) + '.glb') From 845d606b365039136b4fe6d63c3b28bc2a45731d Mon Sep 17 00:00:00 2001 From: yuxianghui <1608204036@qq.com> Date: Mon, 23 Oct 2023 17:36:27 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=88=80=E5=85=B7?= =?UTF-8?q?=E7=BB=84=E8=A3=85=E5=8D=95=E6=89=AB=E6=8F=8F=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E5=88=80=E5=85=B7=E7=89=A9=E6=96=99=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_tool_management/wizard/wizard.py | 28 ++++++++++++++++++++++- sf_tool_management/wizard/wizard_view.xml | 1 + 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py index 791f30ac..c9dd4eb9 100644 --- a/sf_tool_management/wizard/wizard.py +++ b/sf_tool_management/wizard/wizard.py @@ -118,6 +118,7 @@ class ToolTransferRequestInformation(models.TransientModel): class FunctionalToolAssemblyOrder(models.TransientModel): _name = 'sf.functional.tool.assembly.order' + _inherit = ["barcodes.barcode_events_mixin"] _description = '功能刀具组装单' # 功能刀具申请信息 @@ -175,9 +176,34 @@ class FunctionalToolAssemblyOrder(models.TransientModel): chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', domain=[('product_id.cutting_tool_material_id.name', '=', '夹头')]) cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting.tool.material', string='夹头型号', readonly=True) - chuck_name = fields.Char('夹头名称', readonly=True) + chuck_name = fields.Char('夹头名称', readonly=True, compute='_compute_auto_fill') sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True) + def on_barcode_scanned(self, barcode): + """ + 智能工厂组装单处扫码绑定刀具物料') + """ + for record in self: + records = record.env['stock.lot'].search([('name', '=', barcode)]) + if not records: + raise ValidationError('扫描的条形码数据不存在,请重新扫描!') + for record_stock_lot in records: + tool_material_name = record_stock_lot.product_id.cutting_tool_material_id.name + if tool_material_name == '整体式刀具': + record.integral_code_id = record_stock_lot.id + elif tool_material_name == '刀片': + record.blade_code_id = record_stock_lot.id + elif tool_material_name == '刀杆': + record.bar_code_id = record_stock_lot.id + elif tool_material_name == '刀盘': + record.pad_code_id = record_stock_lot.id + elif tool_material_name == '刀柄': + record.handle_code_id = record_stock_lot.id + elif tool_material_name == '夹头': + record.chuck_code_id = record_stock_lot.id + else: + raise ValidationError('扫描的刀具物料不存在,请重新扫描!') + @api.depends('integral_code_id', 'blade_code_id', 'bar_code_id', 'pad_code_id', 'handle_code_id', 'chuck_code_id') def _compute_auto_fill(self): for record in self: diff --git a/sf_tool_management/wizard/wizard_view.xml b/sf_tool_management/wizard/wizard_view.xml index 0c85cb66..e90599e6 100644 --- a/sf_tool_management/wizard/wizard_view.xml +++ b/sf_tool_management/wizard/wizard_view.xml @@ -141,6 +141,7 @@ +