Trợ giúp

2

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

Avatar
Yann Papouin

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 ?

Ảnh đại diện
Huỷ bỏ