1、解决功能刀具组装时,已使用刀具物料还能再选到的问题;2、解决功能刀具组装完成后的功能刀具注册到cloud没有编码的问题;3、刀具物料添加未入库状态;

This commit is contained in:
yuxianghui
2024-03-19 10:26:55 +08:00
parent d3e050bd21
commit 3458deef09
4 changed files with 16 additions and 18 deletions

View File

@@ -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):