优化功能刀具等注册接口

This commit is contained in:
yuxianghui
2024-03-08 17:31:11 +08:00
parent a7e43ad9af
commit 61b0b57b87
3 changed files with 6 additions and 3 deletions

View File

@@ -25,7 +25,8 @@ class StockLot(models.Model):
val = {
'name': item.name,
'tool_material_status': item.tool_material_status,
'location': item.quant_ids[-1].location_id.name
'location': item.quant_ids[-1].location_id.name,
'tool_material_search_code': item.tool_material_search_id.code,
}
tool_material_stock_list.append(val)
kw = json.dumps(tool_material_stock_list, ensure_ascii=False)
@@ -89,7 +90,7 @@ class ToolMaterial(models.Model):
kw = json.dumps(tool_material_list, ensure_ascii=False)
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
ret = r.json()
if r == 200:
if ret.get('code') == 200:
return '刀具物料注册成功'
else:
raise UserError("没有注册刀具物料信息")
@@ -116,6 +117,7 @@ class FunctionalCuttingToolEntity(models.Model):
'id': item.id,
'code': item.code,
'name': item.name,
'rfid': item.rfid,
'tool_groups_name': item.tool_groups_id.name,
'barcode': item.barcode_id.name,
'cutting_tool_type_code': item.sf_cutting_tool_type_id.code,

View File

@@ -311,7 +311,7 @@ class ToolMaterial(models.Model):
product_id = fields.Many2one('product.product', string='刀具物料产品')
name = fields.Char('名称', related='product_id.name')
code = fields.Char('编码', store=True)
code = fields.Char('编码', compute='_compute_code', store=True)
cutting_tool_material_id = fields.Many2one('sf.cutting.tool.material', '刀具物料',
related='product_id.cutting_tool_material_id',
store=True,

View File

@@ -62,6 +62,7 @@
<tree>
<field name="name"/>
<field name="tool_material_status"/>
<button name="enroll_tool_material_stock" string="序列号注册" type="object" class="btn-primary"/>
</tree>
</field>
</page>