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

ex: show one2many form view, not tree view

<field name="job_data_ids">

<form>

​<group>

<field name="workflow_id"/>

<field name="job_id"/>

<field name="stage_id"/>

<field name="job_properties"/>

group>

form>

field>


Ảnh đại diện
Huỷ bỏ
Tác giả

​i mean show one2many field.
as usual it will display the records on the main form as a tree, can i display the records as a form.
Sorry for the inconvenience, I don't have enough points to reply to comments


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

To display a One2Many field as a list of form views instead of a tree view in a form view, you can use the `widget="many2many_tags"` attribute. Here's an example of how you can achieve this:

```xml
















```

In the above code, replace `'your_one2many_field'` with the actual name of your One2Many field. Inside the `

` tag, you can specify the fields you want to display in the form view for each record of the One2Many field.


By using the `widget="many2many_tags"`, the One2Many field will be displayed as a list of form views, where each record can be expanded and edited individually.


Note that the `widget="many2many_tags"` attribute is typically used for Many2Many fields, but it can also be applied to One2Many fields to achieve the desired form view display.

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

hi,
thanks for the new info, it seems the code is missing due to issue in code formatting, can you add the code part here in the comment section

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

Hi,

This is not possible, if you need like a form view, you can just remove the one2many field and add those field workflow_id, job_id etc directly into your main model and display it inside a notebook page.

If your flow need the one2many field itself, create a computed field in the main model which computes the value from the o2m lines and display those computed fields in the form view,

Thanks

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 11 23
3615
1
thg 9 23
1867
1
thg 4 24
3323
1
thg 1 24
1882
1
thg 12 22
2730