跳至内容
菜单
此问题已终结
4 回复
3491 查看

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

形象
丢弃
最佳答案

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

形象
丢弃
最佳答案

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

形象
丢弃
最佳答案

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

形象
丢弃
编写者

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

编写者 最佳答案

Anyone?

形象
丢弃

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!

相关帖文 回复 查看 活动
3
3月 20
10069
0
7月 25
706
1
5月 25
1468
1
5月 25
1611
2
3月 25
1404