1、优化功能刀具组装和功能刀具组装弹窗界面的刀具物料信息,添加刀具物料规格字段;2、优化功能刀具组装确认功能,创建刀具组装入库作业时新增name字段内容,新增作业自动验证;3、优化自动生成功能刀具序列号方法
This commit is contained in:
@@ -657,91 +657,52 @@ class FunctionalToolAssembly(models.Model):
|
|||||||
# 整体式刀具型号
|
# 整体式刀具型号
|
||||||
integral_code_id = fields.Many2one('stock.lot', string='整体式刀具序列号', readonly=True)
|
integral_code_id = fields.Many2one('stock.lot', string='整体式刀具序列号', readonly=True)
|
||||||
cutting_tool_integral_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='整体式刀具型号',
|
cutting_tool_integral_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='整体式刀具型号',
|
||||||
readonly=True)
|
related='integral_code_id.product_id.cutting_tool_model_id')
|
||||||
integral_name = fields.Char('整体式刀具名称', readonly=True, compute='_compute_auto_fill')
|
integral_name = fields.Char('整体式刀具名称', related='integral_code_id.product_id.name')
|
||||||
sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌', readonly=True)
|
integral_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='整体式刀具规格',
|
||||||
|
related='integral_code_id.product_id.specification_id')
|
||||||
|
sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌',
|
||||||
|
related='integral_code_id.product_id.brand_id')
|
||||||
# 刀片型号
|
# 刀片型号
|
||||||
blade_code_id = fields.Many2one('stock.lot', '刀片序列号', readonly=True)
|
blade_code_id = fields.Many2one('stock.lot', '刀片序列号', readonly=True)
|
||||||
cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号', readonly=True)
|
cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号',
|
||||||
blade_name = fields.Char('刀片名称', readonly=True, compute='_compute_auto_fill')
|
related='blade_code_id.product_id.cutting_tool_model_id')
|
||||||
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True)
|
blade_name = fields.Char('刀片名称', related='blade_code_id.product_id.name')
|
||||||
|
blade_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='刀片规格',
|
||||||
|
related='blade_code_id.product_id.specification_id')
|
||||||
|
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', related='blade_code_id.product_id.brand_id')
|
||||||
# 刀杆型号
|
# 刀杆型号
|
||||||
bar_code_id = fields.Many2one('stock.lot', '刀杆序列号', readonly=True)
|
bar_code_id = fields.Many2one('stock.lot', '刀杆序列号', readonly=True)
|
||||||
cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号',
|
cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号',
|
||||||
readonly=True)
|
related='bar_code_id.product_id.cutting_tool_model_id')
|
||||||
bar_name = fields.Char('刀杆名称', readonly=True, compute='_compute_auto_fill')
|
bar_name = fields.Char('刀杆名称', related='bar_code_id.product_id.name')
|
||||||
sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', readonly=True)
|
bar_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='刀杆规格',
|
||||||
|
related='bar_code_id.product_id.specification_id')
|
||||||
|
sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', related='bar_code_id.product_id.brand_id')
|
||||||
# 刀盘型号
|
# 刀盘型号
|
||||||
pad_code_id = fields.Many2one('stock.lot', '刀盘序列号', readonly=True)
|
pad_code_id = fields.Many2one('stock.lot', '刀盘序列号', readonly=True)
|
||||||
cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号',
|
cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号',
|
||||||
readonly=True)
|
related='pad_code_id.product_id.cutting_tool_model_id')
|
||||||
pad_name = fields.Char('刀盘名称', readonly=True, compute='_compute_auto_fill')
|
pad_name = fields.Char('刀盘名称', related='pad_code_id.product_id.name')
|
||||||
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True)
|
pad_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='刀盘规格',
|
||||||
|
related='pad_code_id.product_id.specification_id')
|
||||||
|
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', related='pad_code_id.product_id.brand_id')
|
||||||
# 刀柄型号
|
# 刀柄型号
|
||||||
handle_code_id = fields.Many2one('stock.lot', '刀柄序列号', readonly=True)
|
handle_code_id = fields.Many2one('stock.lot', '刀柄序列号', readonly=True)
|
||||||
cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀柄型号',
|
cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀柄型号',
|
||||||
readonly=True)
|
related='handle_code_id.product_id.cutting_tool_model_id')
|
||||||
handle_name = fields.Char('刀柄名称', readonly=True, compute='_compute_auto_fill')
|
handle_name = fields.Char('刀柄名称', related='handle_code_id.product_id.name')
|
||||||
sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True)
|
handle_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='刀柄规格',
|
||||||
|
related='handle_code_id.product_id.specification_id')
|
||||||
|
sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', related='handle_code_id.product_id.brand_id')
|
||||||
# 夹头型号
|
# 夹头型号
|
||||||
chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', readonly=True)
|
chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', readonly=True)
|
||||||
cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号',
|
cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号',
|
||||||
readonly=True)
|
related='chuck_code_id.product_id.cutting_tool_model_id')
|
||||||
chuck_name = fields.Char('夹头名称', readonly=True, compute='_compute_auto_fill')
|
chuck_name = fields.Char('夹头名称', related='chuck_code_id.product_id.name')
|
||||||
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True)
|
chuck_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='夹头规格',
|
||||||
|
related='chuck_code_id.product_id.specification_id')
|
||||||
@api.depends('integral_code_id', 'blade_code_id', 'bar_code_id', 'pad_code_id', 'handle_code_id', 'chuck_code_id')
|
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', related='chuck_code_id.product_id.brand_id')
|
||||||
def _compute_auto_fill(self):
|
|
||||||
for record in self:
|
|
||||||
if record.integral_code_id:
|
|
||||||
print(record.integral_code_id.product_id)
|
|
||||||
record.cutting_tool_integral_model_id = record.integral_code_id.product_id.cutting_tool_model_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:
|
|
||||||
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_model_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:
|
|
||||||
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_model_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:
|
|
||||||
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_model_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_model_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_model_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
|
|
||||||
|
|
||||||
# 组装功能刀具参数信息
|
# 组装功能刀具参数信息
|
||||||
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', readonly=True)
|
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', readonly=True)
|
||||||
|
|||||||
@@ -1012,6 +1012,7 @@
|
|||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
<field name="handle_name" string="名称"/>
|
<field name="handle_name" string="名称"/>
|
||||||
<field name="cutting_tool_cutterhandle_model_id" string="型号"/>
|
<field name="cutting_tool_cutterhandle_model_id" string="型号"/>
|
||||||
|
<field name="handle_specification_id" string="规格"/>
|
||||||
<field name="sf_tool_brand_id_5" string="品牌"/>
|
<field name="sf_tool_brand_id_5" string="品牌"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
@@ -1024,6 +1025,7 @@
|
|||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
<field name="integral_name" string="名称"/>
|
<field name="integral_name" string="名称"/>
|
||||||
<field name="cutting_tool_integral_model_id" string="型号"/>
|
<field name="cutting_tool_integral_model_id" string="型号"/>
|
||||||
|
<field name="integral_specification_id" string="规格"/>
|
||||||
<field name="sf_tool_brand_id_1" string="品牌"/>
|
<field name="sf_tool_brand_id_1" string="品牌"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
@@ -1036,6 +1038,7 @@
|
|||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
<field name="blade_name" string="名称"/>
|
<field name="blade_name" string="名称"/>
|
||||||
<field name="cutting_tool_blade_model_id" string="型号"/>
|
<field name="cutting_tool_blade_model_id" string="型号"/>
|
||||||
|
<field name="blade_specification_id" string="规格"/>
|
||||||
<field name="sf_tool_brand_id_2" string="品牌"/>
|
<field name="sf_tool_brand_id_2" string="品牌"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
@@ -1051,6 +1054,7 @@
|
|||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
<field name="chuck_name" string="名称"/>
|
<field name="chuck_name" string="名称"/>
|
||||||
<field name="cutting_tool_cutterhead_model_id" string="型号"/>
|
<field name="cutting_tool_cutterhead_model_id" string="型号"/>
|
||||||
|
<field name="chuck_specification_id" string="规格"/>
|
||||||
<field name="sf_tool_brand_id_6" string="品牌"/>
|
<field name="sf_tool_brand_id_6" string="品牌"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
@@ -1065,6 +1069,7 @@
|
|||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
<field name="bar_name" string="名称"/>
|
<field name="bar_name" string="名称"/>
|
||||||
<field name="cutting_tool_cutterbar_model_id" string="型号"/>
|
<field name="cutting_tool_cutterbar_model_id" string="型号"/>
|
||||||
|
<field name="bar_specification_id" string="规格"/>
|
||||||
<field name="sf_tool_brand_id_3" string="品牌"/>
|
<field name="sf_tool_brand_id_3" string="品牌"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
@@ -1079,6 +1084,7 @@
|
|||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
<field name="pad_name" string="名称"/>
|
<field name="pad_name" string="名称"/>
|
||||||
<field name="cutting_tool_cutterpad_model_id" string="型号"/>
|
<field name="cutting_tool_cutterpad_model_id" string="型号"/>
|
||||||
|
<field name="pad_specification_id" string="规格"/>
|
||||||
<field name="sf_tool_brand_id_4" string="品牌"/>
|
<field name="sf_tool_brand_id_4" string="品牌"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from datetime import timedelta
|
from datetime import timedelta, datetime
|
||||||
|
|
||||||
from odoo import fields, models, api
|
from odoo import fields, models, api
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
@@ -213,18 +213,24 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
('quant_ids.location_id.name', 'in', ['刀具房']),
|
('quant_ids.location_id.name', 'in', ['刀具房']),
|
||||||
('quant_ids.quantity', '>', 0)])
|
('quant_ids.quantity', '>', 0)])
|
||||||
cutting_tool_integral_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='整体式刀具型号',
|
cutting_tool_integral_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='整体式刀具型号',
|
||||||
readonly=True)
|
related='integral_code_id.product_id.cutting_tool_model_id')
|
||||||
integral_name = fields.Char('整体式刀具名称', readonly=True)
|
integral_name = fields.Char('整体式刀具名称', related='integral_code_id.product_id.name')
|
||||||
sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌', readonly=True)
|
integral_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='整体式刀具规格',
|
||||||
|
related='integral_code_id.product_id.specification_id')
|
||||||
|
sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌',
|
||||||
|
related='integral_code_id.product_id.brand_id')
|
||||||
|
|
||||||
# 刀片型号
|
# 刀片型号
|
||||||
blade_code_id = fields.Many2one('stock.lot', '刀片序列号',
|
blade_code_id = fields.Many2one('stock.lot', '刀片序列号',
|
||||||
domain=[('product_id.cutting_tool_material_id.name', '=', '刀片'),
|
domain=[('product_id.cutting_tool_material_id.name', '=', '刀片'),
|
||||||
('quant_ids.location_id.name', 'in', ['刀具房']),
|
('quant_ids.location_id.name', 'in', ['刀具房']),
|
||||||
('quant_ids.quantity', '>', 0)])
|
('quant_ids.quantity', '>', 0)])
|
||||||
cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号', readonly=True)
|
cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号',
|
||||||
blade_name = fields.Char('刀片名称', readonly=True)
|
related='blade_code_id.product_id.cutting_tool_model_id')
|
||||||
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True)
|
blade_name = fields.Char('刀片名称', related='blade_code_id.product_id.name')
|
||||||
|
blade_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='刀片规格',
|
||||||
|
related='blade_code_id.product_id.specification_id')
|
||||||
|
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', related='blade_code_id.product_id.brand_id')
|
||||||
|
|
||||||
# 刀杆型号
|
# 刀杆型号
|
||||||
bar_code_id = fields.Many2one('stock.lot', '刀杆序列号',
|
bar_code_id = fields.Many2one('stock.lot', '刀杆序列号',
|
||||||
@@ -232,9 +238,11 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
('quant_ids.location_id.name', 'in', ['刀具房']),
|
('quant_ids.location_id.name', 'in', ['刀具房']),
|
||||||
('quant_ids.quantity', '>', 0)])
|
('quant_ids.quantity', '>', 0)])
|
||||||
cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号',
|
cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号',
|
||||||
readonly=True)
|
related='bar_code_id.product_id.cutting_tool_model_id')
|
||||||
bar_name = fields.Char('刀杆名称', readonly=True)
|
bar_name = fields.Char('刀杆名称', related='bar_code_id.product_id.name')
|
||||||
sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', readonly=True)
|
bar_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='刀杆规格',
|
||||||
|
related='bar_code_id.product_id.specification_id')
|
||||||
|
sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', related='bar_code_id.product_id.brand_id')
|
||||||
|
|
||||||
# 刀盘型号
|
# 刀盘型号
|
||||||
pad_code_id = fields.Many2one('stock.lot', '刀盘序列号',
|
pad_code_id = fields.Many2one('stock.lot', '刀盘序列号',
|
||||||
@@ -242,9 +250,11 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
('quant_ids.location_id.name', 'in', ['刀具房']),
|
('quant_ids.location_id.name', 'in', ['刀具房']),
|
||||||
('quant_ids.quantity', '>', 0)])
|
('quant_ids.quantity', '>', 0)])
|
||||||
cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号',
|
cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号',
|
||||||
readonly=True)
|
related='pad_code_id.product_id.cutting_tool_model_id')
|
||||||
pad_name = fields.Char('刀盘名称', readonly=True)
|
pad_name = fields.Char('刀盘名称', related='pad_code_id.product_id.name')
|
||||||
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True)
|
pad_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='刀盘规格',
|
||||||
|
related='pad_code_id.product_id.specification_id')
|
||||||
|
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', related='pad_code_id.product_id.brand_id')
|
||||||
|
|
||||||
# 刀柄型号
|
# 刀柄型号
|
||||||
handle_code_id = fields.Many2one('stock.lot', '刀柄序列号', required=True,
|
handle_code_id = fields.Many2one('stock.lot', '刀柄序列号', required=True,
|
||||||
@@ -252,9 +262,11 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
('quant_ids.location_id.name', 'in', ['刀具房']),
|
('quant_ids.location_id.name', 'in', ['刀具房']),
|
||||||
('quant_ids.quantity', '>', 0)])
|
('quant_ids.quantity', '>', 0)])
|
||||||
cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀柄型号',
|
cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀柄型号',
|
||||||
readonly=True)
|
related='handle_code_id.product_id.cutting_tool_model_id')
|
||||||
handle_name = fields.Char('刀柄名称', readonly=True)
|
handle_name = fields.Char('刀柄名称', related='handle_code_id.product_id.name')
|
||||||
sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True)
|
handle_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='刀柄规格',
|
||||||
|
related='handle_code_id.product_id.specification_id')
|
||||||
|
sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', related='handle_code_id.product_id.brand_id')
|
||||||
|
|
||||||
# 夹头型号
|
# 夹头型号
|
||||||
chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', required=True,
|
chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', required=True,
|
||||||
@@ -262,9 +274,11 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
('quant_ids.location_id.name', 'in', ['刀具房']),
|
('quant_ids.location_id.name', 'in', ['刀具房']),
|
||||||
('quant_ids.quantity', '>', 0)])
|
('quant_ids.quantity', '>', 0)])
|
||||||
cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号',
|
cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号',
|
||||||
readonly=True)
|
related='chuck_code_id.product_id.cutting_tool_model_id')
|
||||||
chuck_name = fields.Char('夹头名称', readonly=True, compute='_compute_auto_fill')
|
chuck_name = fields.Char('夹头名称', related='chuck_code_id.product_id.name')
|
||||||
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True)
|
chuck_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='夹头规格',
|
||||||
|
related='chuck_code_id.product_id.specification_id')
|
||||||
|
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', related='chuck_code_id.product_id.brand_id')
|
||||||
|
|
||||||
def on_barcode_scanned(self, barcode):
|
def on_barcode_scanned(self, barcode):
|
||||||
"""
|
"""
|
||||||
@@ -291,58 +305,6 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
else:
|
else:
|
||||||
raise ValidationError('扫描的刀具物料不存在,请重新扫描!')
|
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:
|
|
||||||
if record.integral_code_id:
|
|
||||||
record.cutting_tool_integral_model_id = record.integral_code_id.product_id.cutting_tool_model_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:
|
|
||||||
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_model_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:
|
|
||||||
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_model_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:
|
|
||||||
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_model_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_model_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_model_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
|
|
||||||
|
|
||||||
# 组装功能刀具参数信息
|
# 组装功能刀具参数信息
|
||||||
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号')
|
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号')
|
||||||
after_assembly_functional_tool_name = fields.Char(string='组装后功能刀具名称', required=True)
|
after_assembly_functional_tool_name = fields.Char(string='组装后功能刀具名称', required=True)
|
||||||
@@ -430,7 +392,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
# 创建功能刀具批次/序列号记录
|
# 创建功能刀具批次/序列号记录
|
||||||
stock_lot = product_id.create_assemble_warehouse_receipt(self.id, functional_tool_assembly)
|
stock_lot = product_id.create_assemble_warehouse_receipt(self.id, functional_tool_assembly)
|
||||||
# 创建刀具组装入库单
|
# 创建刀具组装入库单
|
||||||
self.create_stocking_picking(stock_lot, functional_tool_assembly)
|
self.env['stock.picking'].create_stocking_picking(stock_lot, functional_tool_assembly)
|
||||||
# 刀具物料出库
|
# 刀具物料出库
|
||||||
if self.integral_code_id:
|
if self.integral_code_id:
|
||||||
product_id.tool_material_stock_moves(self.integral_code_id)
|
product_id.tool_material_stock_moves(self.integral_code_id)
|
||||||
@@ -488,26 +450,6 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
if not self.bar_code_id and not self.pad_code_id:
|
if not self.bar_code_id and not self.pad_code_id:
|
||||||
raise ValidationError('【刀盘】和【刀杆】必须填写一个!')
|
raise ValidationError('【刀盘】和【刀杆】必须填写一个!')
|
||||||
|
|
||||||
def create_stocking_picking(self, stock_lot, functional_tool_assembly):
|
|
||||||
"""
|
|
||||||
创建刀具组装入库单
|
|
||||||
"""
|
|
||||||
# 获取名称为刀具组装入库的作业类型
|
|
||||||
picking_type_id = self.env['stock.picking.type'].sudo().search([('name', '=', '刀具组装入库')])
|
|
||||||
# 创建刀具组装入库单
|
|
||||||
picking_id = self.env['stock.picking'].create({
|
|
||||||
'picking_type_id': picking_type_id.id
|
|
||||||
})
|
|
||||||
# 创建作业详情对象记录,并绑定到刀具组装入库单
|
|
||||||
self.env['stock.move.line'].create({
|
|
||||||
'picking_id': picking_id.id,
|
|
||||||
'product_id': stock_lot.product_id.id,
|
|
||||||
'lot_id': stock_lot.id,
|
|
||||||
'functional_tool_name_id': functional_tool_assembly.id
|
|
||||||
})
|
|
||||||
# 将刀具组装入库单的状态更改为就绪
|
|
||||||
picking_id.action_confirm()
|
|
||||||
|
|
||||||
def get_desc_1(self, stock_lot):
|
def get_desc_1(self, stock_lot):
|
||||||
return {
|
return {
|
||||||
'barcode_id': stock_lot.id,
|
'barcode_id': stock_lot.id,
|
||||||
@@ -575,6 +517,50 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class StockPicking(models.Model):
|
||||||
|
_inherit = 'stock.picking'
|
||||||
|
|
||||||
|
def create_stocking_picking(self, stock_lot, functional_tool_assembly):
|
||||||
|
"""
|
||||||
|
创建刀具组装入库单
|
||||||
|
"""
|
||||||
|
# 获取名称为刀具组装入库的作业类型
|
||||||
|
picking_type_id = self.env['stock.picking.type'].sudo().search([('name', '=', '刀具组装入库')])
|
||||||
|
# 创建刀具组装入库单
|
||||||
|
picking_id = self.env['stock.picking'].create({
|
||||||
|
'name': self._get_name_stock(picking_type_id),
|
||||||
|
'picking_type_id': picking_type_id.id,
|
||||||
|
'location_id': picking_type_id.default_location_src_id.id,
|
||||||
|
'location_dest_id': picking_type_id.default_location_dest_id.id,
|
||||||
|
})
|
||||||
|
# 创建作业详情对象记录,并绑定到刀具组装入库单
|
||||||
|
self.env['stock.move.line'].create({
|
||||||
|
'picking_id': picking_id.id,
|
||||||
|
'product_id': stock_lot.product_id.id,
|
||||||
|
'lot_id': stock_lot.id,
|
||||||
|
'qty_done': 1,
|
||||||
|
'functional_tool_name_id': functional_tool_assembly.id
|
||||||
|
})
|
||||||
|
# 将刀具组装入库单的状态更改为就绪
|
||||||
|
picking_id.action_confirm()
|
||||||
|
picking_id.button_validate()
|
||||||
|
|
||||||
|
def _get_name_stock(self, picking_type_id):
|
||||||
|
name = picking_type_id.sequence_id.prefix + str(
|
||||||
|
datetime.strptime(str(fields.Date.today()), "%Y-%m-%d").strftime("%Y%m%d"))
|
||||||
|
stock_id = self.env['stock.picking'].sudo().search(
|
||||||
|
[('name', 'like', name), ('picking_type_id', '=', picking_type_id.id)],
|
||||||
|
limit=1,
|
||||||
|
order="id desc"
|
||||||
|
)
|
||||||
|
if not stock_id:
|
||||||
|
num = "%03d" % 1
|
||||||
|
else:
|
||||||
|
m = int(stock_id.name[-3:]) + 1
|
||||||
|
num = "%03d" % m
|
||||||
|
return name + str(num)
|
||||||
|
|
||||||
|
|
||||||
class ProductProduct(models.Model):
|
class ProductProduct(models.Model):
|
||||||
_inherit = 'product.product'
|
_inherit = 'product.product'
|
||||||
|
|
||||||
@@ -605,7 +591,7 @@ class ProductProduct(models.Model):
|
|||||||
[('id', '=', tool_assembly_order_id)])
|
[('id', '=', tool_assembly_order_id)])
|
||||||
code = 'JKM-T-' + str(tool_assembly_order.after_assembly_functional_tool_type_id.code) + '-' + str(
|
code = 'JKM-T-' + str(tool_assembly_order.after_assembly_functional_tool_type_id.code) + '-' + str(
|
||||||
tool_assembly_order.after_assembly_functional_tool_diameter) + '-'
|
tool_assembly_order.after_assembly_functional_tool_diameter) + '-'
|
||||||
new_time = fields.Date.today()
|
new_time = datetime.strptime(str(fields.Date.today()), "%Y-%m-%d").strftime("%Y%m%d")
|
||||||
code += str(new_time) + '-'
|
code += str(new_time) + '-'
|
||||||
stock_lot_id = self.env['stock.lot'].sudo().search(
|
stock_lot_id = self.env['stock.lot'].sudo().search(
|
||||||
[('name', 'like', new_time), ('product_id.name', '=', '功能刀具')],
|
[('name', 'like', new_time), ('product_id.name', '=', '功能刀具')],
|
||||||
|
|||||||
@@ -206,14 +206,13 @@
|
|||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group col="3">
|
<group col="2">
|
||||||
<group>
|
<group>
|
||||||
<field name="integral_name" string="名称"/>
|
<field name="integral_name" string="名称"/>
|
||||||
|
<field name="integral_specification_id" string="规格"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="cutting_tool_integral_model_id" string="型号"/>
|
<field name="cutting_tool_integral_model_id" string="型号"/>
|
||||||
</group>
|
|
||||||
<group>
|
|
||||||
<field name="sf_tool_brand_id_1" string="品牌"/>
|
<field name="sf_tool_brand_id_1" string="品牌"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
@@ -228,14 +227,13 @@
|
|||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group col="3">
|
<group col="2">
|
||||||
<group>
|
<group>
|
||||||
<field name="blade_name" string="名称"/>
|
<field name="blade_name" string="名称"/>
|
||||||
|
<field name="blade_specification_id" string="规格"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="cutting_tool_blade_model_id" string="型号"/>
|
<field name="cutting_tool_blade_model_id" string="型号"/>
|
||||||
</group>
|
|
||||||
<group>
|
|
||||||
<field name="sf_tool_brand_id_2" string="品牌"/>
|
<field name="sf_tool_brand_id_2" string="品牌"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
@@ -251,14 +249,13 @@
|
|||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group col="3">
|
<group col="2">
|
||||||
<group>
|
<group>
|
||||||
<field name="bar_name" string="名称"/>
|
<field name="bar_name" string="名称"/>
|
||||||
|
<field name="bar_specification_id" string="规格"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="cutting_tool_cutterbar_model_id" string="型号"/>
|
<field name="cutting_tool_cutterbar_model_id" string="型号"/>
|
||||||
</group>
|
|
||||||
<group>
|
|
||||||
<field name="sf_tool_brand_id_3" string="品牌"/>
|
<field name="sf_tool_brand_id_3" string="品牌"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
@@ -274,14 +271,13 @@
|
|||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group col="3">
|
<group col="2">
|
||||||
<group>
|
<group>
|
||||||
<field name="pad_name" string="名称"/>
|
<field name="pad_name" string="名称"/>
|
||||||
|
<field name="pad_specification_id" string="规格"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="cutting_tool_cutterpad_model_id" string="型号"/>
|
<field name="cutting_tool_cutterpad_model_id" string="型号"/>
|
||||||
</group>
|
|
||||||
<group>
|
|
||||||
<field name="sf_tool_brand_id_4" string="品牌"/>
|
<field name="sf_tool_brand_id_4" string="品牌"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
@@ -296,14 +292,13 @@
|
|||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group col="3">
|
<group col="2">
|
||||||
<group>
|
<group>
|
||||||
<field name="handle_name" string="名称"/>
|
<field name="handle_name" string="名称"/>
|
||||||
|
<field name="handle_specification_id" string="规格"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="cutting_tool_cutterhandle_model_id" string="型号"/>
|
<field name="cutting_tool_cutterhandle_model_id" string="型号"/>
|
||||||
</group>
|
|
||||||
<group>
|
|
||||||
<field name="sf_tool_brand_id_5" string="品牌"/>
|
<field name="sf_tool_brand_id_5" string="品牌"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
@@ -318,14 +313,13 @@
|
|||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group col="3">
|
<group col="2">
|
||||||
<group>
|
<group>
|
||||||
<field name="chuck_name" string="名称"/>
|
<field name="chuck_name" string="名称"/>
|
||||||
|
<field name="chuck_specification_id" string="规格"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="cutting_tool_cutterhead_model_id" string="型号"/>
|
<field name="cutting_tool_cutterhead_model_id" string="型号"/>
|
||||||
</group>
|
|
||||||
<group>
|
|
||||||
<field name="sf_tool_brand_id_6" string="品牌"/>
|
<field name="sf_tool_brand_id_6" string="品牌"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|||||||
Reference in New Issue
Block a user