تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
8626 أدوات العرض

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
مارس 15
3788
Cannot log in تم الحل
3
مارس 15
4401
3
أغسطس 24
1488
2
يونيو 24
1556
2
مايو 24
2112