Skip to Content
Menu
This question has been flagged
2 Replies
4739 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?

Avatar
Discard
Best Answer

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',

],

Avatar
Discard
Best Answer

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.

 

Avatar
Discard