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

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 622 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

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

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

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

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

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/11/14, 7:05 AM
Seen: 622 times
Last updated: 3/16/15, 8:10 AM