콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
1619 화면

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
4월 23
3235
1
2월 24
2228
1
9월 23
1398
0
7월 24
3322
0
7월 22
60