Odoo Help

0

Is it possible to call sequence from a function? if Yes! what is wrong in my below code

By
Rokon Uddin
on 9/11/14, 7:05 AM 908 views

def onchange_storage_device(self, cr, uid, ids, storage_device, context=None):
       return {'value': {'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid,storage_device)}}
    return {'value': {}}

1
Prakash
On 9/11/14, 7:59 AM

def onchange_storage_device(self, cr, uid, ids, storage_device, context=None):
    if storage_device:
        return {'value': {'name':self.pool.get('ir.sequence').get(cr, uid,'sequence.codename')}}
    return {'value': {}}

1
deep
On 9/11/14, 8:00 AM

yes you can.... Try this below code

    def onchange_storage_device(self, cr, uid, ids, storage_device, context=None):
        name = ''
        if storage_device:
            name = self.pool.get('ir.sequence').get(cr, uid, storage_device)
        return {'value': {'name': name}}

 

thnx

Rokon Uddin
on 9/13/14, 12:35 AM

Thnanx. It worked.

Rokon Uddin
on 9/13/14, 12:35 AM

About This Community

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

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 9/11/14, 7:05 AM
Seen: 908 times
Last updated: 3/16/15, 8:10 AM