This question has been flagged
1 Reply
12191 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

fields.reference

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..?

Avatar
Discard
Best Answer

You can see the good answer here. https://accounts.openerp.com/forum/Help-1/question/4114

Avatar
Discard
Author

thanks Amit :-)

This answer exits the scope of question.