Odoo Help


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.


What is meant by OpenERP fields.reference ?

on 8/7/13, 2:28 AM 5,392 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

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

0 follower(s)


Asked: 8/7/13, 2:28 AM
Seen: 5392 times
Last updated: 5/11/15, 11:37 AM