How to display a field from a different model?

I wrote a customer module and I want to display the website address of the partner in my view. I am storing partner_id in my custom module.

I realize that I could store the website in my custom module, but i think that is duplicative, a waste of hard drive space and gets much more complicated as you want to display more fields from different modules.

What can I put in my xml view for my custom module to retrieve the website of the partner_id I am presently viewing in the form?

1 答案
Best Answer

i couldn't get this to work exactly the way i wanted to, but i did come up with a solution. I added a function to my customer module which will retrieve the website from the partner record, but not store it.

    def _get_website(self, cr, uid, ids, partner_id, args, context=None):
        context = {}
        partner_obj = self.pool.get('res.partner')
        for record in self.browse(cr, uid, ids, context=context):
            res[] = {}
  , uid, [('id','=',])
            for website_brw in partner_obj.browse(cr, uid, website_ids, context=context):
                res[] =
        return res
_columns = {
        'website': fields.function(_get_website, type="char", string='Website', store=False),