Odoo Help

0

form view how to show parents fields from Many2one relation?

By
Samo Arko
on 3/13/18, 11:00 AM 425 views

I'm interested how to display fields from the parent model in a form view.

in my model I have a relation

parent_id = fields.Many2one('parent.model')

if I try to show them in the form view I get only a link! The opposite works from the parent model to display children with the tree.

This displays only link?! 

<field name="parent_id">
<field name="company_street"/>
<field name="company_zip"/>
<field name="company_city"/>
</field>
1

Hilar AK

--Hilar AK--
--Hilar AK--
  Blog:-
        https://hilarlive.wordpress.com/
  StackOverflow:
        http://stackoverflow.com/users/7561347/burmese-pythis

Qoura:
    

            https://www.quora.com/profile/Hilar-Ak-1



Hilar AK
On 3/14/18, 2:18 AM

you can use related fields.

eg:

company_street = fields.Char(related='parent_id.company_street')

Thanks, got it working! I remember reading about this when I started learning odoo but at the time didn't get why and how to use it.

Samo Arko
on 3/14/18, 3:10 AM
Good.

On Wed, Mar 14, 2018 at 12:40 PM, Samo Arko <samo.arko@tabla.si> wrote:

Thanks, got it working! I remember reading about this when I started learning odoo but at the time didn't get why and how to use it.

--
Samo Arko


Sent by Odoo S.A. using Odoo.




--
Hilar AK  Python / Odoo Developer

m: +917736617619
e: hilarak@gmail.com
Follow me:
twitteryoutubegithubstack-overflow


Hilar AK
on 3/14/18, 3:38 AM

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 3/13/18, 11:00 AM
Seen: 425 times
Last updated: 3/14/18, 3:08 AM