İçereği Atla
Menü
Bu soru işaretlendi
4 Cevaplar
3477 Görünümler

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

Avatar
Vazgeç
En İyi Yanı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

Avatar
Vazgeç
En İyi Yanıt

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

Avatar
Vazgeç
En İyi Yanı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

Avatar
Vazgeç
Üretici

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

Üretici En İyi Yanıt

Anyone?

Avatar
Vazgeç

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!

İlgili Gönderiler Cevaplar Görünümler Aktivite
3
Mar 20
10062
0
Tem 25
651
1
May 25
1424
ADD PROPERTIES Çözüldü
1
May 25
1531
2
Mar 25
1372