跳至內容
選單
此問題已被標幟
3 回覆
8570 瀏覽次數

Getting this error on the last line. I am not sure what to pass in the first argument...


File "/custom_modules/res_users_login_lowercase/res_users.py", line 16, in _login

    return super(Users, cls)._login(cls, db, login, password)

TypeError: unbound method _login() must be called with res.users instance as first argument (got MetaModel instance instead)


-----------------CODE BELOW-------------

08 from openerp import models, api, fields class Users(models.Model):

09    _inherit = 'res.users'

10     login = fields.Char(help='Used to log into the system. Case insensitive.',)

11 

12    @classmethod

13    def _login(cls, db, login, password):

14       """ Overload _login to lowercase the `login` before passing to the super """

15       login = login.lower()

16       return super(Users, cls)._login(cls, db, login, password)


---------------------------------------------


頭像
捨棄
最佳答案

Dear grayson,

try to add self parameter like this:

def _login(self,cls, db, login, password):
I hope I helped you...
頭像
捨棄
作者

thank you for the response, I will give that a try.

相關帖文 回覆 瀏覽次數 活動
1
3月 15
3705
Cannot log in 已解決
3
3月 15
4311
3
8月 24
1360
2
6月 24
1411
2
5月 24
1964