Skip to Content
Menu
This question has been flagged
2 Replies
5485 Views

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. 

Avatar
Discard
Author Best Answer

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. 


Avatar
Discard
Best Answer

<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>

Avatar
Discard
Related Posts Replies Views Activity
2
Feb 21
2675
0
Feb 19
2570
1
Apr 22
18364
0
Jan 22
1352
2
Oct 21
7535