Odoo Help

Welcome!

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.

2

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

By
Yann Papouin
on 8/1/14, 3:51 AM 800 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 ?

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

1 follower(s)

Stats

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