Technical mailing list archives


Re: How to create an auto increment ID Number field in HR Employee?

Mohamed Mtloob
- 01/28/2015 02:08:33
you can create sequence @ ir.sequence

<record id="seq_type_op_admission" model="ir.sequence.type">
            <field name="name">Admission</field>
            <field name="code">op.admission</field>
        <record id="seq_op_admission" model="ir.sequence">
            <field name="name">Admission</field>
            <field name="code">op.admission</field>
            <field name="prefix">AD</field>
            <field name="padding">5</field>
            <field name="company_id" eval="False" />

and in py file
field definition : 'application_number': fields.char(size=16, string='Application Number', required=True, states={'done': [('readonly', True)]},track_visibility='onchange'),
default value : 'application_number': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'op.admission'),

for any inquires add me on skype : mohamed.mtloob

On Wed, Jan 28, 2015 at 8:43 AM, Franz Bautista <> wrote:

How to create an auto increment ID Number field in HR Employee? So that everytime I create an employee, the id number of an employee will automatically increment + 1 in a custom field (readonly). anyone can help? thank you in advance.


Franz Bautista, CEH
NABI Computer Systems
Tel     : 632-985-6755
Fax    : 632-854-2643
skype/ym id: nabicom

Post to:

Mohamed Mtloob
Sr.Odoo Developer @ Techorg CO