get next sequence number

Asked by Fabrizio M

and thanks for your works, oerplib is great!
I'm trying to get the next number from a sequence, but i'm not able to get it.
In openerp code you get it doing this

self.pool.get('ir.sequence').get(cr, uid, 'product.product')

Is there a way to achieve the same result in oerplib? i haven't found anything in the docs.
thanks for any answer.

Question information

English Edit question
OERPLib Edit question
No assignee Edit question
Solved by:
Fabrizio M
Last query:
Last reply:
Revision history for this message
S├ębastien Alix (sebastien-alix) said :

Hi Fabrizio, thanks for your support.
And good job, you have discover a nice bug :)

In a wonderful world, it should be as simplier as that:

>>> oerp.config['auto_context'] = False # 'get()' method of 'ir.sequence' does not support context parameter, only relevant for OpenERP >= 6.1
>>> next_seq = oerp.get('ir.sequence').get('stock.lot.serial')
>>> oerp.config['auto_context'] = True

BUT, as said, it seems there is a bug in OERPLib because OSV/Model instances returned by "oerp.get('ir.sequence')" has a dictionary interface which defined its own 'get()' method, and the above request does not work as expected.

Until the bug is fixed, you can perform your request with the low level access API :

>>> oerp.execute('ir.sequence', 'get', 'stock.lot.serial')


Revision history for this message
Fabrizio M (mr-file) said :

Hi Sebastien,
and thanks for your quick answer and for your work!

>>> oerp.execute('ir.sequence', 'get', 'stock.lot.serial')
this is great!!! cool!!
Thank you very much
oerplib is great!