跳至内容
菜单
此问题已终结
3 回复
1481 查看

Hi! 

I have created a model called "Cars", which contains a field many2one based on the Contact (car's owner).


In my Contact form, I've added my Cars model as a m2m field (a contact can have multiple cars). I want to filter my cars based on the Owner's. 


Presently, I see all cars, but I want to see only the cars where the Owner is the contact.

How can I do that?


Thanks!

形象
丢弃
最佳答案

Hi,


Here's an example of how you can achieve this in your Contact form view:

       

  1.        

    Open the XML file where you have defined the Contact form view (usually in the views folder of your module).

       

  2.    

  3.        

    Find the Many2many field for Cars in the Contact form view. It should look something like this:

       

   

       

<field name="cars" widget="many2many_tags" domain="[('owner', '=', active_id)]"/>

   


Hope it helps

形象
丢弃
编写者 最佳答案

Thank you very much! It worked!!

形象
丢弃
最佳答案

.This is fairly easy to do in Studio, but cannot be done directly in the UI.  You can see my previous answer here

形象
丢弃
相关帖文 回复 查看 活动
2
3月 23
3129
1
2月 24
2041
1
9月 23
1302
0
7月 24
3122
0
7月 22
60