تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
3216 أدوات العرض

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
أكتوبر 25
441
1
مايو 25
2043
1
مارس 25
2043
MERGING CONTACTS تم الحل
1
فبراير 25
8242
Use of external id تم الحل
2
فبراير 25
4384