1、解决功能刀具组装时,已使用刀具物料还能再选到的问题;2、解决功能刀具组装完成后的功能刀具注册到cloud没有编码的问题;3、刀具物料添加未入库状态;
This commit is contained in:
@@ -14,7 +14,7 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
_description = '功能刀具列表'
|
||||
|
||||
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id')
|
||||
code = fields.Char('编码', related='functional_tool_name_id.code')
|
||||
code = fields.Char('编码')
|
||||
rfid = fields.Char('rfid', readonly=True)
|
||||
name = fields.Char('名称')
|
||||
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具名称', readonly=True)
|
||||
|
||||
@@ -97,18 +97,21 @@ class StockLot(models.Model):
|
||||
_inherit = 'stock.lot'
|
||||
|
||||
tool_material_search_id = fields.Many2one('sf.tool.material.search', string='刀具物料搜索')
|
||||
tool_material_status = fields.Selection([('可用', '可用'), ('在用', '在用'), ('报废', '报废')], string='状态',
|
||||
compute='_compute_tool_material_status', store=True)
|
||||
tool_material_status = fields.Selection(
|
||||
[('未入库', '未入库'), ('可用', '可用'), ('在用', '在用'), ('报废', '报废')], string='状态',
|
||||
compute='_compute_tool_material_status', store=True)
|
||||
|
||||
@api.depends('quant_ids')
|
||||
def _compute_tool_material_status(self):
|
||||
for record in self:
|
||||
if record:
|
||||
if record.quant_ids:
|
||||
if record.quant_ids[-1].location_id.name == '刀具组装位置':
|
||||
if record.quant_ids[-1].location_id.name == '刀具房':
|
||||
record.tool_material_status = '可用'
|
||||
elif record.quant_ids[-1].location_id.name == '刀具组装位置':
|
||||
record.tool_material_status = '在用'
|
||||
else:
|
||||
record.tool_material_status = '可用'
|
||||
record.tool_material_status = '未入库'
|
||||
|
||||
@api.onchange('tool_material_status')
|
||||
def _onchange_tool_material_status(self):
|
||||
|
||||
Reference in New Issue
Block a user