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.

1

how to show a field from parent object in view window ?

By
Bonnet Denis
on 5/14/13, 11:19 AM 2,433 views

We have :

  • task.parent_ids(the project)
  • task.partner_id (the customer)
  • work.task_id

I want something like this in work.view.xml

<field name="task_id.partner_id" modifiers="{}"/>
<field name="task_id.parent_ids" modifiers="{}"/>

But he don't understand task_id.customer and task_id.parent_ids

How can i put this information in tree, calendar or form view ?

2
Shelton
On 5/14/13, 11:26 AM

Use related fields, for eg:

'partner_id': fields.related('task_id','partner_id',type='many2one',relation='res.partner',string='Partner')

there is no solution without writing in database ? the information is in database, can't I read it directly ?

Bonnet Denis
on 5/14/13, 11:44 AM

Fields related are not stored in DB by default unless parameter store=True is not defined.

nazarii
on 5/14/13, 12:12 PM

thanks a lot

Bonnet Denis
on 5/14/13, 12:15 PM

another question: how can I set the partner_id field with the project.partner_id field by default ?

Bonnet Denis
on 5/14/13, 12:34 PM

You need to use default_get method and update it's result with with value that you need. More reference on http://doc.openerp.com/v6.0/developer/2_5_Objects_Fields_Methods/methods.html

nazarii
on 5/14/13, 12:39 PM

thanks but I don't understand how to use this method. thanks again

Bonnet Denis
on 5/14/13, 12:44 PM

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

0 follower(s)

Stats

Asked: 5/14/13, 11:19 AM
Seen: 2433 times
Last updated: 3/16/15, 8:10 AM