sf_同步cloud表面工艺可选参数创建产品,修改产品名命名规则
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
<record id="sequence_production_process_parameter" model="ir.sequence">
|
||||
<field name="name">工艺可选参数编码序列</field>
|
||||
<field name="code">sf.production.process.parameter</field>
|
||||
<field name="prefix">WKSP</field>
|
||||
<field name="padding">9</field>
|
||||
<field name="padding">3</field>
|
||||
<field name="number_increment">1</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -11,20 +11,23 @@ class SfProductionProcessParameter(models.Model):
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
if vals.get('code', '/') == '/' or vals.get('code', '/') is False:
|
||||
vals['code'] = self.env['ir.sequence'].next_by_code('sf.production.process.parameter') or '/'
|
||||
# if vals.get('code', '/') == '/' or vals.get('code', '/') is False:
|
||||
# vals['code'] = '101'+self.routing_id.code +self.env['ir.sequence'].next_by_code('sf.production.process.parameter')
|
||||
if not vals.get('process_id') and vals.get('routing_id'):
|
||||
vals['gain_way'] = '外协'
|
||||
routing_id = self.env['mrp.routing.workcenter'].browse(vals.get('routing_id'))
|
||||
if routing_id.surface_technics_id:
|
||||
vals['process_id'] = routing_id.surface_technics_id.id
|
||||
if vals.get('code', '/') == '/' or vals.get('code', '/') is False:
|
||||
vals['code'] = '101' + routing_id.code + self.env['ir.sequence'].next_by_code(
|
||||
'sf.production.process.parameter')
|
||||
obj = super(SfProductionProcessParameter, self).create(vals)
|
||||
return obj
|
||||
def create_service_product(self):
|
||||
service_categ = self.env.ref(
|
||||
'sf_dlm.product_category_surface_technics_sf').sudo()
|
||||
|
||||
product_name = f"{self.process_id.name}{self.name}"
|
||||
product_name = f"{self.process_id.name}_{self.name}"
|
||||
product_id = self.env['product.template'].search(
|
||||
[("name", '=', product_name)])
|
||||
if product_id:
|
||||
|
||||
Reference in New Issue
Block a user