1.模型类型增加跟修改各字段

2.智能工厂成品名称优化
3.智能工厂产品根据产品类型增加默认筛选条件的优化(在筛选器内根据产品类型增加筛选条件)
4.智能工厂胚料名称的优化
5.自加工产品的制造订单优化
This commit is contained in:
jinling.yang
2023-01-29 17:48:45 +08:00
parent a7edb142c8
commit 271a5d4224
11 changed files with 102 additions and 124 deletions

View File

@@ -73,7 +73,7 @@ class ResProductTemplate(models.Model):
model_type = self.env['sf.model.type'].search([], limit=1)
attachment = self.attachment_create(item['model_name'], item['model_data'])
vals = {
'name': '%s-%s' % (order_id.name, i),
'name': '%s-%s-%s' % ('P', order_id.name, i),
'model_long': item['model_long'] + model_type.embryo_tolerance,
'model_width': item['model_width'] + model_type.embryo_tolerance,
'model_height': item['model_height'] + model_type.embryo_tolerance,
@@ -135,10 +135,11 @@ class ResProductTemplate(models.Model):
supplier = self.env['mrp.bom'].get_supplier(materials_type_id)
logging.info('no_bom_copy_product_supplier-vals:%s' % supplier)
vals = {
'name': '%s-%s %s %s %s * %s * %s' % (
order_id.name, i, materials_id.name, materials_type_id.name,
item['model_long'] + model_type.embryo_tolerance, item['model_width'] + model_type.embryo_tolerance,
item['model_height'] + model_type.embryo_tolerance),
'name': '%s-%s-%s [%s %s-%s * %s * %s]' % ('R',
order_id.name, i, materials_id.name, materials_type_id.name,
item['model_long'] + model_type.embryo_tolerance,
item['model_width'] + model_type.embryo_tolerance,
item['model_height'] + model_type.embryo_tolerance),
'length': item['model_long'] + model_type.embryo_tolerance,
'width': item['model_width'] + model_type.embryo_tolerance,
'height': item['model_height'] + model_type.embryo_tolerance,
@@ -208,7 +209,6 @@ class ResMrpBom(models.Model):
'product_qty': 1,
'product_uom_id': 1
}
logging.info('bom_create_line_has-vals:%s' % vals)
return self.env['mrp.bom.line'].create(vals)
# 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品后再次进行创建bom
@@ -223,7 +223,6 @@ class ResMrpBom(models.Model):
if bom_type == 'subcontract' and product_type != False:
subcontract = self.get_supplier(product.materials_type_id)
bom_id.subcontractor_id = subcontract.partner_id.id
logging.info('bom_create-vals:%s' % bom_id)
return bom_id
# 胚料BOM组件选取当前胚料原材料
@@ -239,7 +238,6 @@ class ResMrpBom(models.Model):
'product_qty': bom_line.volume * bom_line.materials_type_id.density * 1000,
'product_uom_id': bom_line.uom_id.id
}
logging.info('bom_create_line-vals1:%s' % vals)
return self.env['mrp.bom.line'].create(vals)
# 查询材料型号默认排第一的供应商