Skip to Content
Menu
This question has been flagged
1 Reply
5730 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.

Avatar
Discard
Best Answer

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.

Avatar
Discard

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!

Have you updated the database with changed module?

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

Related Posts Replies Views Activity
0
Feb 23
4848
0
Jan 23
94
1
Oct 22
4182
0
Apr 22
2747
2
Mar 25
2790