夹具物料查询优化
This commit is contained in:
@@ -126,16 +126,16 @@ class StockLot(models.Model):
|
||||
tool_material_search_id = fields.Many2one('sf.tool.material.search', string='刀具物料搜索')
|
||||
fixture_material_search_id = fields.Many2one('sf.fixture.material.search', string='夹具物料搜索')
|
||||
tool_material_status = fields.Selection(
|
||||
[('未入库', '未入库'), ('可用', '可用'), ('在用', '空闲'), ('报废', '报废')], string='状态',
|
||||
[('未入库', '未入库'), ('可用', '空闲'), ('在用', '占用'), ('报废', '报废')], 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.product_id.categ_id.name in ['刀具', '夹具']:
|
||||
if record.product_id.categ_id.name in ['刀具']:
|
||||
if record.quant_ids:
|
||||
if record.quant_ids[-1].location_id.name in ['刀具房', '夹具房']:
|
||||
if record.quant_ids[-1].location_id.name in ['刀具房']:
|
||||
record.tool_material_status = '可用'
|
||||
elif record.quant_ids[-1].location_id.name == '刀具组装位置':
|
||||
record.tool_material_status = '在用'
|
||||
|
||||
Reference in New Issue
Block a user