odoo创建编号
Posted 行走在云端
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了odoo创建编号相关的知识,希望对你有一定的参考价值。
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)
以上是关于odoo创建编号的主要内容,如果未能解决你的问题,请参考以下文章