On Thu, Jul 24, 2014 at 3:55 PM, Aristóbulo Meneses <aristob...@gmail.com> wrote:
> Hi, > > I have been banging my head against a wall for a while trying to make a > many2one field to work in a wizard, using a function and > selection=_sel_func parameter, but it doesn't work. > > Has this been changed? > > https://doc.odoo.com/trunk/server/03_module_dev_02/ > > *Example* > > Using relation fields many2one with selection. In fields definitions add: > > > ..., > 'my_field': fields.many2one( > 'mymodule.relation.model', > 'Title', > selection=_sel_func), > ..., > > And then define the _sel_func like this (but before the fields > definitions): > > def _sel_func(self, cr, uid, context=None): > obj = self.pool.get('mymodule.relation.model') > ids = obj.search(cr, uid, []) > res = obj.read(cr, uid, ids, ['name', 'id'], context) > res = [(r['id'], r['name']) for r in res] > return res > > > AFAIK it nevers works on >6.0 you can check column implementation, there is not that feature. Regards, https://github.com/odoo/odoo/blob/7.0/openerp/osv/fields.py#L87 > -- > La experiencia es la más dura maestra; > primero pone la prueba, luego dá la explicación... > ------------------------------------------------------------------------- > > _______________________________________________ > Mailing list: https://launchpad.net/~openerp-community > Post to : openerp-community@lists.launchpad.net > Unsubscribe : https://launchpad.net/~openerp-community > More help : https://help.launchpad.net/ListHelp > > -- [image: Cristian Salamea on about.me] Cristian Salamea about.me/ovnicraft <http://about.me/ovnicraft>
_______________________________________________ Mailing list: https://launchpad.net/~openerp-community Post to : openerp-community@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-community More help : https://help.launchpad.net/ListHelp