1、优化刀具物料序列号、刀具物料注册接口;2、优化功能刀具、功能刀具出入库记录接口;3、优化刀具物料搜索模型
This commit is contained in:
@@ -109,6 +109,8 @@ class StockLot(models.Model):
|
||||
record.tool_material_status = '在用'
|
||||
else:
|
||||
record.tool_material_status = '可用'
|
||||
# 注册刀具物料状态到cloud平台
|
||||
record.enroll_tool_material_stock()
|
||||
|
||||
@api.model
|
||||
def name_search(self, name='', args=None, operator='ilike', limit=100):
|
||||
@@ -137,9 +139,7 @@ class StockLot(models.Model):
|
||||
for record in records:
|
||||
if record.product_id.categ_id.name == '刀具':
|
||||
tool_material_search = self.env['sf.tool.material.search'].sudo().search(
|
||||
[('cutting_tool_material_id', '=', record.product_id.cutting_tool_material_id.id),
|
||||
('cutting_tool_standard_library_id', '=', record.product_id.cutting_tool_model_id.id),
|
||||
('specification_id', '=', record.product_id.specification_id.id)])
|
||||
[('id', '=', record.product_id.tool_material_id)])
|
||||
if tool_material_search:
|
||||
record.tool_material_search_id = tool_material_search
|
||||
return records
|
||||
@@ -148,12 +148,15 @@ class StockLot(models.Model):
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = 'product.product'
|
||||
|
||||
tool_material_id = fields.Char('刀具物料搜索模型ID')
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
records = super(ProductProduct, self).create(vals_list)
|
||||
for record in records:
|
||||
if record.categ_id.name == '刀具':
|
||||
self.env['sf.tool.material.search'].sudo().create({
|
||||
tool_material = self.env['sf.tool.material.search'].sudo().create({
|
||||
'product_id': record.id
|
||||
})
|
||||
record.tool_material_id = tool_material.id
|
||||
return records
|
||||
|
||||
Reference in New Issue
Block a user