Community: Framework mailing list archives

expert-framework@mail.odoo.com

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

by
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>
        <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" />
        </record>

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 <fmbautista@nabisystems.net> 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.

Regards,

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

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Thanks
Mohamed Mtloob
Sr.Odoo Developer @ Techorg CO
Linkedin