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

Hello there,

I am trying to connect Calendar events with specific tasks. For that I added 2 one2Many fields, one to select the project and one to select the task.

I can select the project.

When selecting the tasks I can see all the tasks of every project in Odoo

If I change the domain for the Task fields and put something like [["project_id","=","Project1 SO0001"]] they get filtered by only the tasks in "Project1 SO0001"

Now when I refer to the Project field that I created as [["project_id","=","x_studio_many2one_field_d6imT"]] it simply doesn't work. I tried many variations from similar things I've seen in the forums, but I don't manage to make it work.


And also, where could I find documentation about this?


Thanks in advance

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

If you can edit the code editor of the domain view, you can try it this way:

[["project_id", "=", x_studio_many2one_field_d6imT.id]]

I think this approach may meet your requirements.

Note: It may not be affected directly by using Studio. You can give it a try.

Hope it helps

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi Pablo: The domain editor built into Studio currently does not support referencing another field in the domain.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello, Syntax of the domain should be [["project_id", "=", x_studio_many2one_field_d6imT]] not [["project_id","=","x_studio_many2one_field_d6imT"]]  , but this syntax not compatible with Studio, So it would better you will do this using custom development/ module.

Thanks let me know if we can help

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

I tried that and indeed it didn't work. I'm surprised about that. Thank you for sharing, I was driving myself crazy

Tác giả Câu trả lời hay nhất

Anyone?

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

Hi Pablo,

I wanted to share a workaround I discovered for editing the Studio custom view, as the standard syntax isn't compatible in this case.

Here's what I found:

1. **Edit the Studio custom view on XML.**
2. **Locate the XPath expression related to your field.**
3. **Add the following code snippet:**

```xml
<xpath expr="/form[1]/sheet[1]/group[1]/group[2]/field[4]" position="attributes">
<attribute name="domain">[("project_id", "=", x_studio_many2one_field_d6imT)]</attribute>
</xpath>
```

**Important Note:** Make sure to use a tuple, not a list, inside the list for the "domain" attribute.

Apologies for the delay!

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 3 20
10068
0
thg 7 25
692
1
thg 5 25
1450
ADD PROPERTIES Đã xử lý
1
thg 5 25
1596
2
thg 3 25
1396