Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
6407 Tampilan

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
Buang
Penulis Jawaban Terbai

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
Buang
Jawaban Terbai

<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
Buang
Post Terkait Replies Tampilan Aktivitas
2
Feb 21
3435
0
Feb 19
3383
1
Apr 22
18364
0
Jan 22
2288
2
Okt 21
9000