Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
4 Răspunsuri
3530 Vizualizări

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

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Autor

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

Autor Cel mai bun răspuns

Anyone?

Imagine profil
Abandonează

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!

Related Posts Răspunsuri Vizualizări Activitate
3
mar. 20
10107
0
iul. 25
766
1
mai 25
1512
1
mai 25
1684
2
mar. 25
1437