更新时间:2022-02-07 22:33:01
我不知道是否可以使用选择字段来完成此操作,但是当另一个字段发生更改时,您可以更改多对一字段的域价值.您也许还可以只使用BlockArea字段的域中的其他字段,而不必完全更改它.看看此相关问题很有帮助.
I don't know if you can do it with a selection field, but you can change the domain of a many-to-one field when another field changes value. You might also be able to just use the other fields in your BlockArea field's domain, and not have to change it at all. Look at the way the partner address screen sets the domain for the state_id field. You might find this related question helpful.
如果确实需要在另一个字段更改时更改域,请 on_change
事件可以在它返回的字典中包含一个domain
条目.
If you do need to change the domain when another field changes, then the on_change
event can include a domain
entry in the dictionary it returns.
我发现了一个讨论线程,说您可以在多对一字段,因此如果您为该字段设置domain
,则可能对您有用.我自己还没有尝试过.
I found a discussion thread that says you can use the selection widget on a many-to-one field, so that might work for you if you set a domain
for the field. I haven't tried it myself.