mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Add auth_admin for 11.0 from https://github.com/hibou-io/odoo-auth-admin
This commit is contained in:
committed by
Salomon Chambi
parent
13f40721d8
commit
a8eba7c95d
2
auth_admin/wizard/__init__.py
Executable file
2
auth_admin/wizard/__init__.py
Executable file
@@ -0,0 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import portal_wizard
|
||||
27
auth_admin/wizard/portal_wizard.py
Executable file
27
auth_admin/wizard/portal_wizard.py
Executable file
@@ -0,0 +1,27 @@
|
||||
from odoo import api, fields, models
|
||||
from ..models.res_users import admin_auth_generate_login
|
||||
|
||||
|
||||
class PortalWizard(models.TransientModel):
|
||||
_inherit = 'portal.wizard'
|
||||
|
||||
@api.multi
|
||||
def admin_auth_generate_login(self):
|
||||
self.ensure_one()
|
||||
self.user_ids.admin_auth_generate_login()
|
||||
return {'type': 'ir.actions.do_nothing'}
|
||||
|
||||
|
||||
class PortalWizardUser(models.TransientModel):
|
||||
_inherit = 'portal.wizard.user'
|
||||
|
||||
force_login_url = fields.Char(string='Force Login URL')
|
||||
|
||||
@api.multi
|
||||
def admin_auth_generate_login(self):
|
||||
ir_model_access = self.env['ir.model.access']
|
||||
for row in self:
|
||||
row.force_login_url = ''
|
||||
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 row.in_portal and user:
|
||||
row.force_login_url = admin_auth_generate_login(self.env, user)
|
||||
18
auth_admin/wizard/portal_wizard_views.xml
Executable file
18
auth_admin/wizard/portal_wizard_views.xml
Executable file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="portal_wizard" model="ir.ui.view">
|
||||
<field name="name">Portal Access Management - Auth Admin</field>
|
||||
<field name="model">portal.wizard</field>
|
||||
<field name="inherit_id" ref="portal.wizard_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='in_portal']" position="after">
|
||||
<field name="force_login_url" readonly="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//button[last()]" position="after">
|
||||
<button string="Generate Login URL" type="object" name="admin_auth_generate_login" class="btn-default" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user