1、优化刀具物料序列号、刀具物料注册接口;2、优化功能刀具、功能刀具出入库记录接口;3、优化刀具物料搜索模型

This commit is contained in:
yuxianghui
2024-03-11 17:34:03 +08:00
parent 61b0b57b87
commit fbce395321
4 changed files with 55 additions and 51 deletions

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('编码', compute='_compute_code', store=True)
code = fields.Char('编码')
cutting_tool_material_id = fields.Many2one('sf.cutting.tool.material', '刀具物料',
related='product_id.cutting_tool_material_id',
store=True,
@@ -331,14 +331,6 @@ class ToolMaterial(models.Model):
active = fields.Boolean(string='已归档', default=True)
@api.depends('product_id')
def _compute_code(self):
for record in self:
if record:
code = '%s_%s' % (record.cutting_tool_standard_library_id.code, record.specification_id.name)
obj = self.search([('code', 'like', code)], limit=1, order="id desc")
record.code = '%s_%03d' % (code, 1 if obj else int(obj.code[-3:]) + 1)
@api.depends('barcode_ids')
def _compute_number(self):
for record in self: