Community mailing list archives

community@mail.odoo.com

Re: related field in odoo v8

by
Paul Catinean
- 09/05/2014 05:21:52
Hello,

You can use the account_invoice.py in the standard addons as reference as it is the first module migrated to the new API

You fill find examples there concerning your problem:

partner_id = fields.Many2one('res.partner', string='Partner',
        related='invoice_id.partner_id', store=True, readonly=True)

In your case it would be something like:
'company_id': fields.Many2one('res.company', string="Company', 
        related="invoice_id.company_id', store=True, readonly=True)

Also I think it would be a better idea to refer to http://help.odoo.com for questions instead of the community list

P.S
A few resources regarding the new api:

Best,
Paul


On Fri, Sep 5, 2014 at 12:05 PM, abhishek jaiswal <ia.malhotra@gmail.com> wrote:
how can i use fields.related in Odoo V8

i am perting a module and i got stucked with field.related

hoe to change this
'company_id': fields.related('invoice_id','company_id',type='many2one',relation='res.company',string='Company', store=True, readonly=True),

into new api
--
With Warm Regards
Abhishek Jaiswal

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe