Odoo Help


How to create sequence on OpenERP 6.1?

Dave Pang
on 7/25/13, 1:21 PM 2,995 views

I want to create an opportunity number with auto sequence.

I already created a new field x_opp_num. How can I create a new sequence code ? Thanks.


Hiral Patel (hip)

--Hiral Patel (hip)--
| 2 1 5
--Hiral Patel (hip)--

Hiral Patel (hip)
On 7/26/13, 8:59 AM

In xml file write :

<record id="seq_type_1" model="ir.sequence.type"> <field name="name">Test Type</field> <field name="code">test</field> </record> <record id="seq_1" model="ir.sequence"> <field name="name">Test</field> <field name="code">test</field> <field name="prefix">test</field> <field name="padding">3</field> </record>

In .py file all default in object where you want to add sequence :

_defaults = { 'x_opp_num': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'test'), }

In default 'test' is same name as code in xml.

Want to create a sequence for an existing field - Payment Ref (under Customer Invoices). Copied above code to account_voucher_sequence.xml, however, cant see new entry under Settings>Configuration>Sequence&Identifiers>Sequences

Also tried renaming 'name' and 'code' of Purchase Entry in the same XML file, however, unable to see any changes under Settings>Configuration>Sequence&Identifiers>Sequences

Please let me know where m i going wrong. thanks!

on 9/9/13, 12:32 AM

Have you updated the database with changed module?

Hiral Patel (hip)
on 9/12/13, 5:07 AM

i m afraid i dont know how to update db with changed module, could you please help me. thanks.

on 9/14/13, 1:09 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 7/25/13, 1:21 PM
Seen: 2995 times
Last updated: 3/16/15, 8:10 AM