Skip to content
Snippets Groups Projects

V1 imrpvements to CompanyEasyCreation wizard (CRM Lead execution):raising_hand:

Merged Benjamí Ramos requested to merge feature/create_company_from_crm into dev
9 unresolved threads
3 files
+ 114
36
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -209,7+209,7 @@
communities.append(company.id)
return communities
def send_reset_password_mail(self):
provider_id = self.env.ref('energy_communities.keycloak_admin_provider')
provider_id.validate_admin_provider()
headers = {
@@ -241,7+241,7 @@
"active": True,
"role_id": role.id,
})
def make_ce_member(self, company):
# Create role line with role, company and user
# Add company in allowed_company_ids
pass
def make_ce_admin(self, company):
pass
def make_coord_admin(self, company):
# Create role line with role, company and user
# Add company in allowed_company_ids
# Create a line for every company
# Add all companies in allowed_company_ids
pass
def make_coord_worker(self, company):
# Create role line with role, company and user
# Add company in allowed_company_ids
# Create a line for every company
# Add all companies in allowed_company_ids
pass
def add_energy_community_role(self, role, company_id):
# TODO: Refactor quan tingui més info de com queden els roles 😟
if role == 'role_ce_member':
self.make_ce_member(company_id)
elif role == 'role_ce_admin':
self.make_ce_admin(company_id)
elif role == 'role_coordination':
self.make_coord_admin(company_id)
elif role == 'role_platform_admin':
self.make_coord_worker(company_id)
else:
raise exceptions.UserError(
_('Role not found')
)
def create_energy_community_user(
cls, vat, first_name, last_name, lang_code, email, company_id
):
vals = {
"login": vat,
"firstname": first_name,
"lastname": last_name,
# "company_id": company_id, # TODO: Move!
# "company_ids": [(6, 0, [company_id])], # TODO: Move!
"lang": lang_code,
"email": email,
}
user = cls.create(vals)
user.make_internal_user()
# user.create_users_on_keycloak() # TEMPORAL
# user.send_reset_password_mail() # TEMPORAL
return user
Loading