Skip to Content
Menu
This question has been flagged
4 Replies
7820 Views

Is there a way to automatically set ongoing customer ID's in openERP v.7?

Avatar
Discard

please explain what you mean by an "ongoing customer ID"

Author

OK. I would like to set a start value for my customers ID, like 00121. The first customer get this ID, the second 00122 (auto increment).

BTW: I'm new at openerp, is there a manual or sth. like that? I'm not a programmer as well and the backend looks very complicated..

Best Answer

You can use sequence.

Add sequence in sequence.xml file.

<record model="ir.sequence.type" id="seq_type_emp_id">
    <field name="name">Employee Number</field>
    <field name="code">hr.employee</field>
</record>
<record model="ir.sequence" id="seq_emp_id">
    <field name="name">Employee Number</field>
    <field name="code">hr.employee</field>
    <field name="prefix"></field>
    <field name="padding">3</field>
</record>

After that you can call the sequence:

my_sequence = self.pool['ir.sequence'].get(cr, uid, seq_obj_name)
self.write(cr, uid, [picking.id], {'ur_emp_no_field': my_sequence})

You can call this sequence either from create, your own function, write or from _defaults.

Avatar
Discard
Author

Thank you for your reply. I already told that I am new at openerp. So where I can insert this sequence.xml and also call it? EDIT: This sequence looks like Employee ID's, I have to modify it right? Thanks!

Yes, you have to modify as per your requirement. Create sequence.xml and put it in __openerp__.py same as you add your other xml files.

Author

I'm new at openerp. This will be the first time to add a new sequence :D Is there a manual or sth. like that? I start without any foreknowledge..

Best Answer

Hi cdn,

Yes, there is a way to set automatically customer ID's in openERP v7.

For that you have to create sequence.

Setting/Sequences & Identifiers/Sequences.

Thank You.

(SerpentCS Pvt. Ltd.)

Avatar
Discard

Is there any code required to use the Sequence for Customers?

I would like to know the rest of that conversation. Thanks.

Best Answer

In openERP version 7, the answer is yes; there is a way to automatically set customer IDs.
To accomplish this, you will need to create sequence. Setting/Sequences & Identifiers/Sequences.

Avatar
Discard

Is there a specific code that needs to be entered in order to use the Sequence for Customers?

Author Best Answer

OK. I would like to set a start value for my customers ID, like 00121. The first customer get this ID, the second 00122 (auto increment).

BTW: I'm new at openerp, is there a manual or sth. like that? I'm not a programmer as well and the backend looks very complicated..

Avatar
Discard