def create(self,cr,uid,vals,context=None):
if context is None:
context ={}
print 111111
print vals
[]
if vals.get(‘lx_origin‘, ‘/‘) == ‘/‘ :
vals[‘lx_origin‘] = self.pool.get(‘ir.sequence‘).get(cr, uid, ‘demo.contract.lx‘, context=context) or ‘/‘
if vals[‘lx_origin‘] and vals[‘lx_type‘]==‘3‘:
vals[‘lx_origin‘]=vals[‘lx_origin‘]+‘S‘
elif vals[‘lx_origin‘] and vals[‘lx_type‘]==‘4‘ :
vals[‘lx_origin‘]=vals[‘lx_origin‘]+‘S(LX)‘
elif vals[‘lx_origin‘] and vals[‘lx_type‘]==‘5‘ :
vals[‘lx_origin‘]=vals[‘lx_origin‘]+‘C‘
elif vals[‘lx_origin‘] and vals[‘lx_type‘]==‘6‘ :
vals[‘lx_origin‘]=vals[‘lx_origin‘]+‘C(LX)‘
else:
vals[‘lx_origin‘]=vals[‘lx_origin‘]
if vals[‘lx_origin‘] and vals[‘display_name‘]==14:
vals[‘lx_origin‘]=‘HL‘+vals[‘lx_origin‘]
elif vals[‘lx_origin‘] and vals[‘display_name‘]==19:
vals[‘lx_origin‘]=‘TZRL‘+vals[‘lx_origin‘]
elif vals[‘lx_origin‘] and vals[‘display_name‘]==18:
vals[‘lx_origin‘]=‘JT‘+vals[‘lx_origin‘]
elif vals[‘lx_origin‘] and vals[‘display_name‘]==17:
vals[‘lx_origin‘]=‘YC‘+vals[‘lx_origin‘]
elif vals[‘lx_origin‘] and vals[‘display_name‘]==22:
vals[‘lx_origin‘]=‘XN‘+vals[‘lx_origin‘]
elif vals[‘lx_origin‘] and vals[‘display_name‘]==3 or vals[‘display_name‘]==13 or vals[‘display_name‘]==11:
vals[‘lx_origin‘]=‘FSD‘+vals[‘lx_origin‘]
else:
vals[‘lx_origin‘]=vals[‘lx_origin‘]
new_id=super(demo_contract_lx,self).create(cr,uid,vals,context=context)
return new_id
FSDLX2017-070S(LX)
原文:http://www.cnblogs.com/1314520xh/p/6970817.html