1、功能刀具组装组装功能对象的六个刀具物料对象的序列号绑定库存的刀具物料序列号,2、优化功能刀具组装和功能刀具组装组装弹窗的刀具物料布局
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user