mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
#5 Migrate to 12.0
Additionally, allowing the field to be written to improves the UI by automatically highlighting it and doesn't really have any negative side effects. (how could you alter the hmac?)
This commit is contained in:
@@ -1,2 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import portal_wizard
|
||||
|
||||
@@ -9,7 +9,13 @@ class PortalWizard(models.TransientModel):
|
||||
def admin_auth_generate_login(self):
|
||||
self.ensure_one()
|
||||
self.user_ids.admin_auth_generate_login()
|
||||
return {'type': 'ir.actions.do_nothing'}
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
"res_model": self._name,
|
||||
"views": [[False, "form"]],
|
||||
"res_id": self.id,
|
||||
"target": "new",
|
||||
}
|
||||
|
||||
|
||||
class PortalWizardUser(models.TransientModel):
|
||||
@@ -20,8 +26,8 @@ class PortalWizardUser(models.TransientModel):
|
||||
@api.multi
|
||||
def admin_auth_generate_login(self):
|
||||
ir_model_access = self.env['ir.model.access']
|
||||
for row in self:
|
||||
row.force_login_url = ''
|
||||
for row in self.filtered(lambda r: r.in_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 row.in_portal and user:
|
||||
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': ''})
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
<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"/>
|
||||
<field name="force_login_url"/>
|
||||
</xpath>
|
||||
<xpath expr="//button[last()]" position="after">
|
||||
<button string="Generate Login URL" type="object" name="admin_auth_generate_login" class="btn-default" />
|
||||
<button string="Generate Login URL" type="object" name="admin_auth_generate_login" class="btn-primary" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user