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

Facing problem getting sequence value. Can any one help me please?

By
samba
on 9/4/14, 2:12 AM 817 views

sequence code

bankreconcile_ref_sequence= self.pool.get('ir.sequence').get(cr, uid, 'bankreconcile_ref_sequence_code'),

sequence output: (u'04 / 09 /2014/10',)

I want to show only 04 / 09 /2014/10 value how can i overcome this?

2
Janarthanan
On 7/5/16, 9:18 AM

use this if you are using odoo v9 

bankreconcile= fields.Char(default=lambda obj:obj.env['ir.sequence'].next_by_code('bankreconcile_model_code'))

and add in sequence.xml in view as


<openerp>

<data noupdate="0">

<record id="seq_autogenerate" model="ir.sequence">

<field name="name">sequence</field>

<field name="code">bankreconcile_model_code</field>

<field name="implementation">standard</field>

<field name="active">TRUE</field>

<field name="prefix">A</field>

<field name="padding">4</field>

<field name="number_increment">1</field>

<field name="number_next_actual">1000</field>

</record>

</data>

</openerp>

in openerp add 



'data': [ 

'view/sequence.xml',

],

0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 9/4/14, 2:25 AM

Note from server/openerp/addons/base/ir/ir_sequence.py line 294 and 295 ir_sequence.get() and ir_sequence.get_id() are deprecated. Please use ir_sequence.next_by_code() or ir_sequence.next_by_id().

So you should be writing bankreconcile_ref_sequence= self.pool.get('ir.sequence').next_by_code(cr, uid, 'bankreconcile_ref_sequence_code')

However, if you insist on using get, add the following: bankreconcile_ref_sequence = bankreconcile_ref_sequence and bankreconcile_ref_sequence[0] after the line of code above.

 

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/4/14, 2:12 AM
Seen: 817 times
Last updated: 7/5/16, 9:18 AM