在我的情况下,当我打开表单时会显示 +1 序列号。但是当我保存记录时,它又增加了 1。这意味着我的序列号现在看起来像这样:
- EMP0010
- EMP0012
- EMP0014
这是 openerp 的问题还是我的代码中缺少某些内容?
'register_no': fields.char('Register No', size=32, help='Register No', readonly=True), # employer wise ,estate wise
'employer_no': fields.char('Employer No', type='char', readonly=True),
_defaults = {
'register_no': lambda obj, cr, uid, context: '/',
'employer_no': lambda obj, cr, uid, context: '/',
}
您可以在这里查看我的代码
我评论了
def create(self, cr, uid, values, context=None):
values['register_no'] = self.pool.get('ir.sequence').get(cr, uid, 'bpl.worker')
values['employer_no'] = self.pool.get('ir.sequence').get(cr, uid, 'bpl.employer')
return super(bpl_worker_registration, self).create(cr, uid, values, context=context)