跳至内容
菜单
此问题已终结
250 查看

I have a model "A". This model includes has a onetomany field called "model_b_ids" which references model "B".

Model "B" has a boolean field called "special"

I have a form view for model "A". I would like to include two tree views on this form view - one to display the model "B" records where "special" = True, and one to display the model "B" records where "special" = False.

I tried adding the following to the XML:

  ​<field name = "model_b_ids" domain="[('special','=',True)]">

​<tree>

​<field name="special"/>

​</tree>

​</field>

This displays all records from "model_b_ids", regardless of the "special" field value.

I also tried adding another onetomany field on model "A" called "special_model_b_ids" and setting a domain on that field. I then added this new field to the XML, but I still get all records from model "B".

How can I achieve this?

 

形象
丢弃