Odoo Help

Welcome!

This community 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.

0

what is the code for auto increment (sequence) in openerp-7.0?

By
louie
on 9/16/14, 9:23 AM 3,170 views

what is the code for auto increment in openerp-7.0?? can anyone give me sample code. something like mrp or manufacturing module? Manufacturing Order MO/00077. Please help me

0

Sudhir Arya (SA)

--Sudhir Arya (SA)--
10150
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow

LinkedIn

Blog

Stackoverflow

Sudhir Arya (SA)
On 9/16/14, 2:28 PM

Hi Louie,

Here is your answer: Generate sequence from code.

hello, i try the code but its not working and can you step by step it. i add the detail in sequences also. i dont know if im doing it correctly.. kind you pls put it in step by step since i am new to openerp. i really appreciate if you gonna help me and put it in step by step procedure.. please help me. thanks.

louie
on 9/19/14, 6:58 AM
0

Bole

--Bole--
2385
| 5 4 6
Zagreb | Karlovac, Croatia
--Bole--

there is only 10 kind of people the ones that understand binary ... and others

Bole
On 9/16/14, 9:37 AM

It is called sequences in odoo/openerp world :) 
first check that your user has enabled Technical features under user's acces rights

check Setting -> Technical -> Sequences & identifiers -> Sequences
----> here you can find and modify all defined sequences on current database

edit:
as for coded example... 
1. create your own module, models and views in it.
2. in xml file create a custom sequence like:

<openerp>
    <data noupdate="1">
        <record id="some_sequence_type_id" model="ir.sequence.type">
            <field name="name">Name of Sequence Type</field>
            <field name="code">CODE</field>
        </record>
        <record id="some_sequence_id" model="ir.sequence">
            <field name="name">Name of Sequence</field>
            <field name="code">SEQ-CODE</field>
            <field name="prefix">PRE/%(y)s/</field>
            <field name="padding">5</field> <!-- number of zeroes when starting from 1 -.>
            <field name="company_id" eval="False"/>
        </record>
    </data>
</openerp>

3. from your code you can get next seq nubmer like:
...
...     seq_no = self.pool.get('ir.sequence').get(cr, uid, 'SEQ-CODE')

does it help now? 
p.s. 
take a look at create methods in sale, stock invoice models... there name is fetched in simmilar way...

i want a coded one. do you have code? something like mrp code module. but since i dont know where is the exact code there. because i've tried to get the code and make a new one module just to know if working but its nothing display on that field. please2 help me

louie
on 9/16/14, 10:13 AM

hello, i try the code but its not working and can you step by step it. i add the detail in sequences also. i dont know if im doing it correctly.. kind you pls put it in step by step since i am new to openerp. i really appreciate if you gonna help me and put it in step by step procedure.. please help me. thanks.

louie
on 9/19/14, 1:42 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/16/14, 9:23 AM
Seen: 3170 times
Last updated: 3/28/15, 3:13 AM