Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/刀具产品调取Cloud刀具标准库(10.11)

# Conflicts:
#	sf_mrs_connect/models/sync_common.py
This commit is contained in:
jinling.yang
2023-10-11 17:41:19 +08:00
11 changed files with 406 additions and 140 deletions

View File

@@ -861,3 +861,43 @@ class ResMrpBomMo(models.Model):
raw_bom = self.env['product.product'].search(
[('categ_id.type', '=', '原材料'), ('materials_type_id', '=', product.materials_type_id.id)])
return raw_bom
class SfMaintenanceEquipmentAndProductTemplate(models.Model):
_inherit = 'maintenance.equipment'
_description = '设备'
product_template_ids = fields.One2many('maintenance.equipment.tool', 'equipment_id', string='机床刀位')
@api.model_create_multi
def create(self, vals_list):
vals = []
for value in vals_list:
res = super(SfMaintenanceEquipmentAndProductTemplate, self).create(value)
number = value.get('number_of_knife_library')
for i in range(1, number + 1):
self.env['maintenance.equipment.tool'].create({
'equipment_id': res.id,
'code': 'T' + str(i)
})
vals.append(res)
return vals[0]
class SfMaintenanceEquipmentTool(models.Model):
_name = 'maintenance.equipment.tool'
_description = '机床刀位'
equipment_id = fields.Many2one('maintenance.equipment', string='设备')
product_template_id = fields.Many2one('product.template', string='功能刀具名称', domain="[('categ_type', '=', '刀具')]")
image_1920 = fields.Binary('图片', related='product_template_id.image_1920')
categ_type = fields.Char(string='功能刀具类型')
diameter = fields.Char('直径')
precision = fields.Char('\\')
tool_code = fields.Char('功能刀具编码')
hilt_name = fields.Char('刀柄名称')
hilt_code = fields.Char('刀柄编码')
life_value_max = fields.Char('最大寿命值')
alarm_value = fields.Char('报警值')
used_value = fields.Char('已使用值')
code = fields.Char('机床刀位号')