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.

0

multiple models in one view (form view inside form view)

By
Mohamed
on 10/20/16, 8:54 AM 291 views

I have 3 models representing 3 levels of data but when viewing these models it has to be one view 

models are "Group Match", "Match" and "Match Details", group match is like a small league which has number of matches and each match has its details, group match and match has to be form views not tree in form

So I need to view all of these 3 models in one view (may be nested view)

note: group match has field one2many to match and match has one2many field to match details

use ir.actions.client to show any values in single view

https://www.odoo.com/documentation/9.0/howtos/web.html#exercise

shameem@aχoncoms
on 10/21/16, 5:27 AM
1

Bejaoui Souheil

--Bejaoui Souheil--
808
| 2 1 4
Sousse, Tunisia
--Bejaoui Souheil--

Odoo developer,  functional and technical consultant

souheil_bejaoui@hotmail.fr

Bejaoui Souheil
On 10/20/16, 12:34 PM

Hi Mohamed,

I don't think this is a good idea to concept you solution like that as by default you can open form view wizard from one2many relations.

But you may need this for some specific reasons, so I propose to do it using related fields.

In your model "Match Details" create related fields to the model "Match" and "Group Match".

class match_details(models.Model)    
    _name="match"
    [..]
    group_id = fields.Many2one('match.group')
    field_from_match = fields.Char()

class match_details(models.Model)
    _name="match"
    [..]
    group_id = fields.Many2one('match.group')
    field_from_match_group = fields.Char()

class match_details(models.Model)
    _name="match.details"
      [..]
    match_id = fields.Many2one('match')
    field_from_match = fields.Char(related="match_id.field_from_match")
    field_from_match_group = fields.Char(related="match_id.group_id.field_from_match_group")

When you create a form view for "Match Details", you can edit the two other models using this related fields.

Hope this help you.

best regards.

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

1 follower(s)

Stats

Asked: 10/20/16, 8:54 AM
Seen: 291 times
Last updated: 10/20/16, 12:34 PM