Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
8522 Lượt xem

    def check_credentials(self, cr, uid, password):
        """ Override this method to plug additional authentication methods"""
        res = self.search(cr, SUPERUSER_ID, [('id','=',uid),('password','=',password)])
        print "ppppppppppppppppppppppppppppppppppppppppppppppppppp",res
        if not res:
            raise openerp.exceptions.AccessDenied()

please let me know to how to solve this.

it is returning blank list =  ppppppppppppppppppppppppppppppppppppppppppppppppppp []

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello Apoorv Soral,


If you want to override res.users method then You need to used super method for this.

For Ex:


class res_users(osv.osv):
    _inherit = "res.users"

     

     def check_credentials(self, cr, uid, password):
         res = super(res_users, self).check_credentials(cr, uid, password)  //For Override existing method
         print "res ========= ", res
         user_id = self.search(cr, SUPERUSER_ID, [('id','=',uid),('password','=',password)])
         print "user_id !!!!!!! ", user_id

         if user_id:

             return user_id

         else:

             return res


Hope this will helps you.

Thanks,

     

Ảnh đại diện
Huỷ bỏ
Tác giả

Hi Jignesh,

I have also try in this way but it is returning blank list : []

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 17
9935
0
thg 4 15
4500
7
thg 10 24
7660
1
thg 9 24
1298
1
thg 4 24
1881