Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odpovědi
3236 Zobrazení

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.


Avatar
Zrušit
Nejlepší odpověď

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.

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Autor Nejlepší odpověď

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

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
říj 25
64
2
říj 25
464
1
kvě 25
2054
1
bře 25
2049
1
úno 25
8419