コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
4618 ビュー

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 ?


アバター
破棄
著作者 最善の回答

Hi Axel,

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


アバター
破棄

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

著作者

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

最善の回答

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

アバター
破棄
関連投稿 返信 ビュー 活動
4
3月 20
38843
2
3月 15
7922
3
7月 25
8637
1
5月 25
930
0
1月 24
1669