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

Hello.

I have a field that works for the domain attribute, but doesn't work for attrs and options.

It seems to me that this is some sort of special use case of views (maybe mixed).

This is the XML for the domain:

<attribute name="domain">[('product_id', '=', parent.product_id), (picking_type_use_existing_lots, '=', True)]</attribute>

This is the XML for attrs:

<attribute name="attrs">{'can_create': [(picking_type_use_create_lots, '=', True)]}</attribute>

If I pass the field as string ('picking_type_use_create_lots') it seems like the UI engine evaluates it as such, not as the field value. If I try to run it as field (picking_type_use_create_lots) I get this error:

<class 'NameError'>: "name 'picking_type_use_create_lots' is not defined" while evaluating

"{'can_create': [(picking_type_use_create_lots, '=', True)]}"

Any ideas?

Thanks. 

Imagine profil
Abandonează
Autor Cel mai bun răspuns

Hi, since I can't comment o your answer I'm gonna comment here. 

As mentioned in the question, if I pass the field with quotes, it is evaluated as a string. Also, the domain attribute works,l the way it is on my code. I'm referring to it in the question so people can try to figure out why it doesn't work in the other attributes. 

I know that the context of domain is somewhat different from the other contexts; you can use the 'parent.field' notation for example. To be clear, what I don't understand here is why this field is referrable in the domain attribute and not referrable at the attrs and options. 


Imagine profil
Abandonează
Cel mai bun răspuns

<attribute name="domain">[('product_id', '=', parent.product_id), ('picking_type_use_existing_lots', '=', True)]</attribute>

<attribute name="attrs">{'can_create': [('picking_type_use_create_lots', '=', True)]}</attribute>

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
feb. 21
3725
0
feb. 19
3606
1
apr. 22
18364
0
ian. 22
2517
2
oct. 21
9245