Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
10705 Lượt xem

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

Ảnh đại diện
Huỷ bỏ

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

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

Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 9 21
2331
2
thg 11 17
9223
V17 Tree, Form view Đã xử lý
1
thg 3 25
1289
5
thg 8 24
46754
2
thg 4 24
2592