Odoo Help


How fields.related works when used with fields.one2many ?

Yann Papouin
on 8/1/14, 3:51 AM 1,335 views

In OpenERP 6.1, there were res.partner and res.partner.address.

A lot of fields.related exists in res.partner to get data from res.partner.address.

eg from res_partner class:

        'address': fields.one2many('res.partner.address', 'partner_id', 'Contacts'),

        'city': fields.related('address', 'city', type='char', string='City'),
        'function': fields.related('address', 'function', type='char', string='function'),
        'subname': fields.related('address', 'name', type='char', string='Contact Name'),
        'phone': fields.related('address', 'phone', type='char', string='Phone'),
        'mobile': fields.related('address', 'mobile', type='char', string='Mobile'),

So, how the ORM engine knows from which 'address' all these data should be get since 'address' can be filled with multiple records ?

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

1 follower(s)


Asked: 8/1/14, 3:51 AM
Seen: 1335 times
Last updated: 3/16/15, 8:10 AM