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

please help to solve the problem below, in GUI it is showing field "category_id" in res.partner but when querying through psql it is showing error, check both screenshots below:

connected with same db (odb), here is postgresql session screenshot where it says "category_id" does not exist


Settings -> Technical -> Database Structure -> Models

searched for partner, then selected res.partner, it shows as below


regards

아바타
취소
베스트 답변

Hi ,

The category_id is not stored in the res_partner table.


category_id = fields.Many2many('res.partner.category', column1='partner_id',
column2='category_id', string='Tags', default=_default_category)

Since it's a many2many field , it is stored in a relational table ,

Odoo will create a new relational table linking the two models res_partner and res_partner_category. The table will have a name like this.


 'res_partner_res_partner_category_rel'


select p.id,p.name,rel.category_id from res_partner p left join res_partner_res_partner_category_rel rel on p.id = rel.partner_id


Hope it Helps ,

Kiran K

아바타
취소
작성자

thanks @Kiran Mohan... so, it is misleading in gui which is showing it under res.partner model or i misunderstood for many2many type fields? how i can reference it in my query above?

작성자

thanks @Kiran Mohan, when i posted my last comment on your answer, after it i saw your completed post which includes all things i need. thanks again :)

관련 게시물 답글 화면 활동
1
5월 22
4020
0
1월 21
3307
1
4월 23
3000
0
9월 22
2728
3
9월 25
3067