Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
4601 Prikazi

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 ?


Avatar
Opusti
Avtor Best Answer

Hi Axel,

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


Avatar
Opusti

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

Avtor

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

Best Answer

@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])

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
4
mar. 20
38834
2
mar. 15
7920
3
jul. 25
8626
1
maj 25
920
0
jan. 24
1657