Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
4 Respostas
3487 Visualizações

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
Cancelar
Melhor resposta

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
Cancelar
Melhor resposta

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

Avatar
Cancelar
Melhor resposta

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
Cancelar
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 Melhor resposta

Anyone?

Avatar
Cancelar

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!

Publicações relacionadas Respostas Visualizações Atividade
3
mar. 20
10068
0
jul. 25
702
1
mai. 25
1467
1
mai. 25
1608
2
mar. 25
1403