修改产品名称生成规则
This commit is contained in:
@@ -12,10 +12,10 @@ class ProductTemplate(models.Model):
|
|||||||
|
|
||||||
def generate_embryo_name(self, order_id, item, materials_id, materials_type_id, embryo_redundancy_id, i):
|
def generate_embryo_name(self, order_id, item, materials_id, materials_type_id, embryo_redundancy_id, i):
|
||||||
"""生成坯料名称"""
|
"""生成坯料名称"""
|
||||||
embryo_name = '%s-%s-%s [%s %s-%s * %s * %s]' % ('R',
|
embryo_name = '%s-%s[%s * %s * %s]%s' % (materials_id.name, materials_type_id.name,
|
||||||
order_id.name, i, materials_id.name, materials_type_id.name,
|
|
||||||
self.format_float(item['model_long'] + embryo_redundancy_id.long),
|
self.format_float(item['model_long'] + embryo_redundancy_id.long),
|
||||||
self.format_float(item['model_width'] + embryo_redundancy_id.width),
|
self.format_float(item['model_width'] + embryo_redundancy_id.width),
|
||||||
self.format_float(item['model_height'] + embryo_redundancy_id.height))
|
self.format_float(item['model_height'] + embryo_redundancy_id.height),
|
||||||
|
item['model_id'])
|
||||||
return embryo_name
|
return embryo_name
|
||||||
|
|
||||||
@@ -74,14 +74,17 @@ class SaleOrder(models.Model):
|
|||||||
'blank_area': product.model_area,
|
'blank_area': product.model_area,
|
||||||
'price': product.list_price,
|
'price': product.list_price,
|
||||||
'embryo_redundancy_id': line.embryo_redundancy_id,
|
'embryo_redundancy_id': line.embryo_redundancy_id,
|
||||||
|
'model_id': line.model_id
|
||||||
}
|
}
|
||||||
product_name = ''
|
product_name = ''
|
||||||
match = re.search(r'(S\d{5}-\d+)', product.name)
|
match = re.search(r'(S\d{5}-\d+)', product.name)
|
||||||
|
product_seria = 0
|
||||||
# 如果匹配成功,提取结果
|
# 如果匹配成功,提取结果
|
||||||
if match:
|
if match:
|
||||||
product_name = match.group(0)
|
product_name = match.group(0)
|
||||||
# 获取成品名结尾-n的n
|
# 获取成品名结尾-n的n
|
||||||
product_seria = int(product_name.split('-')[-1])
|
product_seria = int(product_name.split('-')[-1])
|
||||||
|
|
||||||
# 成品供货方式为采购则不生成bom
|
# 成品供货方式为采购则不生成bom
|
||||||
if line.supply_method != 'purchase':
|
if line.supply_method != 'purchase':
|
||||||
bom_data = self.env['mrp.bom'].with_user(self.env.ref("base.user_admin")).get_bom(product)
|
bom_data = self.env['mrp.bom'].with_user(self.env.ref("base.user_admin")).get_bom(product)
|
||||||
|
|||||||
Reference in New Issue
Block a user