Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion addons/auth_oauth/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,17 @@ def wrapper(self, *a, **kw):
#----------------------------------------------------------
class OAuthLogin(Home):
def list_providers(self):
# Reduce the queries to res_user and res_partner tables only to know the create_uid and write_uid
fields = set(request.env['auth.oauth.provider']._fields.keys()) - {"create_uid", "write_uid"}
try:
providers = request.env['auth.oauth.provider'].sudo().search_read([('enabled', '=', True)])
providers = request.env['auth.oauth.provider'].sudo().search_read([('enabled', '=', True)], fields)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may be achieved without a patch:

  1. Extra fields may be added by inheriting search_read andd adding them there.
  2. Providers may be updated by inheriting list_providers in this controller.

except Exception:
providers = []
for provider in providers:
provider.update({
"create_uid": (1, 'OdooBot'),
"write_uid": (1, 'OdooBot'),
})
return_url = request.httprequest.url_root + 'auth_oauth/signin'
state = self.get_state(provider)
params = dict(
Expand Down