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
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
as for coded example...
1. create your own module, models and views in it.
2. in xml file create a custom sequence like:
<record id="some_sequence_type_id" model="ir.sequence.type">
<field name="name">Name of Sequence Type</field>
<record id="some_sequence_id" model="ir.sequence">
<field name="name">Name of Sequence</field>
<field name="padding">5</field> <!-- number of zeroes when starting from 1 -.>
<field name="company_id" eval="False"/>
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?
take a look at create methods in sale, stock invoice models... there name is fetched in simmilar way...
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
|Asked: 9/16/14, 9:23 AM|
|Seen: 2960 times|
|Last updated: 3/28/15, 3:13 AM|