Community mailing list archives

community@mail.odoo.com

Re: related field in odoo v8

by
Abhishek
- 09/05/2014 07:47:28
Thanks for repy
i have a situation custom module where customer had a many adress and when printing a for i have to select whic address to print in pdf,
i know i can achieve this throuch wizard but  when i did this as field. related with many3many and in view many2one widget it did'nt worked

can you please throw some light ho to do it

and also how to update self._context

Thanks happy Odooing


On Fri, Sep 5, 2014 at 3:09 PM, Paul Catinean <paulcatinean@gmail.com> wrote:
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


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




--
With Warm Regards
Abhishek Jaiswal