Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
9079 มุมมอง

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.

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มี.ค. 15
4129
Cannot log in แก้ไขแล้ว
3
มี.ค. 15
4876
3
ส.ค. 24
2174
2
มิ.ย. 24
2183
2
พ.ค. 24
2755