From 94fd8b99757ddb3d5902039f8e28e665d720bb04 Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Thu, 7 Oct 2021 12:24:54 -0700 Subject: [PATCH] [MIG] auth_admin: to Odoo 15.0 --- auth_admin/__manifest__.py | 2 +- auth_admin/controllers/main.py | 4 ++-- auth_admin/wizard/portal_wizard.py | 14 +++++++++++--- auth_admin/wizard/portal_wizard_views.xml | 4 ++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/auth_admin/__manifest__.py b/auth_admin/__manifest__.py index 1420a7a3..1b628cf3 100755 --- a/auth_admin/__manifest__.py +++ b/auth_admin/__manifest__.py @@ -2,7 +2,7 @@ 'name': 'Auth Admin', 'author': 'Hibou Corp. ', 'category': 'Hidden', - 'version': '13.0.1.0.0', + 'version': '15.0.1.0.0', 'description': """ Login as other user diff --git a/auth_admin/controllers/main.py b/auth_admin/controllers/main.py index cf0ac9df..5c7b83a9 100755 --- a/auth_admin/controllers/main.py +++ b/auth_admin/controllers/main.py @@ -33,7 +33,7 @@ class AuthAdmin(http.Controller): uid = http.request.session.authenticate(http.request.session.db, user.login, 'x') if uid is not False: http.request.params['login_success'] = True - return http.redirect_with_hash('/my/home') - return http.local_redirect('/my/home') + return http.request.redirect('/my/home') + return http.request.redirect('/my/home') except (exceptions.Warning, ) as e: return http.Response(e.message, status=400) diff --git a/auth_admin/wizard/portal_wizard.py b/auth_admin/wizard/portal_wizard.py index e2e9486c..ed0b5cd0 100755 --- a/auth_admin/wizard/portal_wizard.py +++ b/auth_admin/wizard/portal_wizard.py @@ -1,4 +1,4 @@ -from odoo import api, fields, models +from odoo import api, fields, models, _ from ..models.res_users import admin_auth_generate_login @@ -24,8 +24,16 @@ class PortalWizardUser(models.TransientModel): def admin_auth_generate_login(self): ir_model_access = self.env['ir.model.access'] - for row in self.filtered(lambda r: r.in_portal): + for row in self.filtered(lambda r: r.is_portal): user = row.partner_id.user_ids[0] if row.partner_id.user_ids else None if ir_model_access.check('res.partner', mode='unlink') and user: row.force_login_url = admin_auth_generate_login(self.env, user) - self.filtered(lambda r: not r.in_portal).update({'force_login_url': ''}) + self.filtered(lambda r: not r.is_portal).update({'force_login_url': ''}) + return { + 'name': _('Portal Access Management'), + 'type': 'ir.actions.act_window', + 'view_mode': 'form', + 'res_model': 'portal.wizard', + 'res_id': self.wizard_id.id, + 'target': 'new', + } diff --git a/auth_admin/wizard/portal_wizard_views.xml b/auth_admin/wizard/portal_wizard_views.xml index 6389e4ca..18984818 100755 --- a/auth_admin/wizard/portal_wizard_views.xml +++ b/auth_admin/wizard/portal_wizard_views.xml @@ -6,10 +6,10 @@ portal.wizard - + - +