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

I have made a qweb report for res.partner that should list all the projects for that customer. But i don't know how to take the id for the current res.partner so i can search the database. I want to do something like the following code(where self.id is the id for the current partner):

data=self.env['project.project'].search([('partner_id', '=', self.id)])
아바타
취소
작성자

It doesn't work as i want. It returns the id of the logged user in contacts. I want to return the current open contact. For example if i call the function from the contact menu of Delta PC, i want the id of the contact Delta PC.Sorry that i am writhing this here bu i can't write comments.

partner = self.env['res.users'].browse(self.env.uid).partner_id
data = self.env['project.project'].search([('partner_id', '=', partner.id)])

Hope this helps you !

베스트 답변

Hello, you can pass this on the " context " , of try to create a many2one field :), just add on the xml context = ''parnter_id'': partner_id

아바타
취소
관련 게시물 답글 화면 활동
4
3월 20
17872
3
4월 22
17343
1
4월 22
9858
2
7월 25
5269
2
12월 24
8134