コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
6862 ビュー

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. 

アバター
破棄
著作者 最善の回答

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. 


アバター
破棄
最善の回答

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

アバター
破棄
関連投稿 返信 ビュー 活動
2
2月 21
3881
0
2月 19
3769
1
4月 22
18364
0
1月 22
2637
2
10月 21
9484