Odoo Help


How to create a method that will display values from database to a selection type field?

on 9/30/13, 6:51 AM 780 views

def _sel_warehouse(self, cr, uid, context=None): obj = self.pool.get('stock.warehouse') ids = obj.search(cr, uid, []) res = obj.read(cr, uid, ids, ['id','name'], context) res = [(r['id'],r['name']) for r in res] return res

This is the closest code that I found but it lacks the flexibility of a sql query. Is there any other approach or do I have to add some line of code to get the desired output? Ex. query that I would like to use "select name from stock_location where usage = 'internal'".

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.


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

0 follower(s)


Asked: 9/30/13, 6:51 AM
Seen: 780 times
Last updated: 3/16/15, 8:10 AM