Odoo Help


What is meant by OpenERP fields.reference ?

on 8/7/13, 2:28 AM 7,987 views

I saw this code segment in subscription.py class. It gives selection and many2one fields together for users. I found in openerp documentation and another modules also but i never found any details or other samples for this

here is the its view


here is the code related to that field

'doc_source': fields.reference('Source Document', required=True, selection=_get_document_types, size=128),

here is the selection part function code

def _get_document_types(self, cr, uid, context=None):
    cr.execute('select m.model, s.name from subscription_document s, ir_model m WHERE s.model = m.id order by s.name')
    return cr.fetchall()

I Need to know that; can we make our own fields.reference type fields.?

another combination instead of MODEL,NAME..?

Amit Parik (amp)
On 8/7/13, 3:28 AM

thanks Amit :-)

on 8/7/13, 3:53 AM

This answer exits the scope of question.

Rui Andrada
on 12/11/14, 8:23 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.


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: 8/7/13, 2:28 AM
Seen: 7987 times
Last updated: 2/6/17, 8:19 AM