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

Hello,

Not sure how odoo thinks the following is 4 arguments when clearly only 3 are there. Note the vals['customer_code'] currently = "BBF".

 rec_count = self.env['res.partner'].search_count('customer_code', '=', vals['customer_code'])
TypeError: BaseModel.search_count() takes from 2 to 3 positional arguments but 4 were given

Anyone know what is going on here?

Thank you.


아바타
취소
베스트 답변

Hi, i think the issue is in the format of search_count you have defined. Try the code by changing to

rec_count = self.env['res.partner'].search_count([('customer_code', '=', vals['customer_code'])])

Regards.

아바타
취소
베스트 답변

Hi,

There is a syntax error in your code on the search_count method

Update the code like this

rec_count = self.env['res.partner'].search_count([('customer_code', '=', vals['customer_code'])])

Also please refer the blog to know more about ORM methods in odoo it may help you

https://www.cybrosys.com/blog/orm-methods-in-odoo-15

Regards

아바타
취소
작성자 베스트 답변

Ah, yes. what a silly mistake. Thank you.

아바타
취소
관련 게시물 답글 화면 활동
2
10월 25
447
1
5월 25
2045
1
3월 25
2043
MERGING CONTACTS 해결 완료
1
2월 25
8269
Use of external id 해결 완료
2
2월 25
4398