Skip to content
Snippets Groups Projects
Commit b15a8258 authored by Benjami's avatar Benjami
Browse files

Crear a method to make internal user and some fixes

parent 5de1468c
No related branches found
No related tags found
2 merge requests!253[REL] Release 06/11/23,!191V1 imrpvements to CompanyEasyCreation wizard (CRM Lead execution)🙋‍
......@@ -22,7 +22,7 @@ class OAuthProvider(models.Model):
placeholder='admin', required=False)
superuser_pwd = fields.Char(string='Superuser password', help='"Superuser" user password',
placeholder='I hope is not "admin"', required=False)
admin_user_endpoint = fields.Char(string='User admin URL', required=True)
admin_user_endpoint = fields.Char(string='User admin URL')
root_endpoint = fields.Char(string='Root URL', required=True, default='http://keycloak-ccee.local:8080/auth/')
realm_name = fields.Char(string='Realm name', required=True, default='0')
reset_password_endpoint = fields.Char(string='Reset password URL')
......
......@@ -227,11 +227,17 @@ class ResUsers(models.Model):
)
def make_internal_user(self):
# TODO: Require rebase new roles branch
pass
# self.env["res.users.role.line"].sudo().create({
# "user_id": self.id,
# "active": True,
# "role_id": role.id,
# "company_id": self.id,
# })
\ No newline at end of file
already_user = self.env["res.users.role.line"].sudo().search([
("user_id.id", "=", self.id),
("active", "=", True),
("role_id.code", "=", "role_internal_user")
])
if not already_user:
role = self.env["res.users.role"].sudo().search([(
"code", "=", "role_internal_user"
)])
self.env["res.users.role.line"].sudo().create({
"user_id": self.id,
"active": True,
"role_id": role.id,
})
......@@ -43,7 +43,7 @@ class AssignAdminWizard(models.TransientModel):
"firstname": self.first_name,
"lastname": self.last_name,
"company_id": company_id,
"company_ids": [company_id],
"company_ids": [(6, 0, [company_id])],
"lang": self.lang.code,
"email": self.email,
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment