Odoo Help

0

Oddo V8 : Inherited BaseModel browse() goes in recursion

By
Khatir Metahri
on 12/22/15, 1:33 PM 867 views

Hello

This is my Pb :

I have inherited the model hr.employee and I want to overload browse method to display only certain employees.

So I did this :

 class hr_employee(models.Model):
_name = 'hr.employee'
_inherit = 'hr.employee'
#...
@api.multi
def browse(self, arg):
return super(hr_employee, self).browse([5,6,7])

 

But as you can imagine, I have not the desired result.

Here is the log :

File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 362, in old_api
recs = self.browse(cr, uid, ids, context)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 241, in wrapper
return old_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 362, in old_api
recs = self.browse(cr, uid, ids, context)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 241, in wrapper
return old_api(self, *args, **kwargs)
RuntimeError: maximum recursion depth exceeded

 

Can you help me please ?


0
Khatir Metahri
On 12/23/15, 4:00 AM

Hi Axel,

I tried your solution, but I have the same error. 


hi, try : return self.env['res.employee'].browse(5, 6, 7)

Guillaume Seran
on 12/23/15, 9:14 AM

Hi Guillaume, I tried this but had the same error.

Khatir Metahri
on 12/23/15, 9:43 AM
0
Axel Mendoza
On 12/22/15, 2:36 PM

@Khatir Metahri
You need to call directly the browse method of models.Model, like:

class hr_employee(models.Model):

_name = 'hr.employee'

_inherit = 'hr.employee'

#...

@api.multi

def browse(self, arg):

return models.Model.browse(self,[5,6,7])

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 12/22/15, 1:33 PM
Seen: 867 times
Last updated: 12/23/15, 4:00 AM