Accept Merge Request #1661: (feature/夹具物料查询优化 -> develop)

Merge Request: 夹具物料查询优化

Created By: @禹翔辉
Reviewed By: @马广威
Approved By: @马广威 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1661
This commit is contained in:
禹翔辉
2024-12-30 08:42:16 +08:00
committed by Coding

View File

@@ -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 = '在用'