Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
5743 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona

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.

Post correlati Risposte Visualizzazioni Attività
0
feb 23
4885
0
gen 23
94
1
ott 22
4227
0
apr 22
2771
2
mar 25
2812