Reputation: 319
OpenERP gives a sequence number when we saved a record. i have done that module.as per that module when i create a worker then load employee number as EMP001,EMP002..
My requirment is this. When I'm going to create a new employee then need to show next sequence number as a read only field. for ex : when i'm going to create a 9th employee then need to show EMP009 in my emp no field.
my current codes uploaded to below location https://github.com/priyankahdp/openerp/tree/openerp
NOW ITS SORTED I ADDED BELOW THERE
_defaults = {
'register_no': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'bpl.worker'),
}
Upvotes: 3
Views: 1635
Reputation: 21243
You can make your field as readonly
'register_no': fields.char('Register No', size=32, help='Register No', readonly=True),
and mention that in _default
Please check in existing module like sale.py
how they are getting default sequence for the next sales order number.
http://bazaar.launchpad.net/~openerp/openobject-addons/trunk/view/head:/sale/sale.py
Upvotes: 1