Skip to content
Snippets Groups Projects
Commit 8523d429 authored by daniquilez's avatar daniquilez
Browse files

apply linter corrections

parent f7a9648c
No related branches found
No related tags found
2 merge requests!288[REL] Release Sprint + hotfix (11/12/23),!276Feature/close form
Pipeline #69612 passed
...@@ -326,8 +326,14 @@ class WebsiteCommunityData(http.Controller): ...@@ -326,8 +326,14 @@ class WebsiteCommunityData(http.Controller):
return legal_forms return legal_forms
def _get_lead_values(self, lead_id): def _get_lead_values(self, lead_id):
lead_values = {}
lead = request.env["crm.lead"].sudo().search([("id", "=", lead_id)])[0] lead = request.env["crm.lead"].sudo().search([("id", "=", lead_id)])[0]
lead_values = {
"lead_probability": lead.probability,
"lead_stage_won": False,
}
if lead.stage_id:
lead_values["lead_stage_won"] = lead.stage_id.is_won
for field_key in _COMMUNITY_DATA__GENERAL_FIELDS.keys(): for field_key in _COMMUNITY_DATA__GENERAL_FIELDS.keys():
meta_line = lead.metadata_line_ids.filtered( meta_line = lead.metadata_line_ids.filtered(
lambda meta_data_line: meta_data_line.key == field_key lambda meta_data_line: meta_data_line.key == field_key
...@@ -431,6 +437,14 @@ class WebsiteCommunityData(http.Controller): ...@@ -431,6 +437,14 @@ class WebsiteCommunityData(http.Controller):
# form/messages visibility # form/messages visibility
values["display_success"] = display_success values["display_success"] = display_success
values["display_form"] = display_form values["display_form"] = display_form
values["closed_form"] = False
# if lead is won close form
if "lead_probability" in values.keys():
if values["lead_probability"] >= 100:
values["closed_form"] = True
if "lead_stage_won" in values.keys():
if values["lead_stage_won"]:
values["closed_form"] = True
return values return values
# #
......
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
type="object" type="object"
string="Create community" string="Create community"
groups="energy_communities.group_platform_manager" groups="energy_communities.group_platform_manager"
attrs="{'invisible':['|',('source_id', '!=', %(ce_source_creation_ce_proposal)d),('probability','=',100)]}" attrs="{'invisible':['|',('source_id', '!=', %(ce_source_creation_ce_proposal)d),('probability','>=',100)]}"
/> />
</header> </header>
</xpath> </xpath>
......
...@@ -555,6 +555,13 @@ ...@@ -555,6 +555,13 @@
>web</a></h2> >web</a></h2>
</t> </t>
<br /> <br />
</template>
<!-- TODO: Make this description dynamic and db translatable -->
<template
id="community_data_headline_message_open"
name="community_data_headline_message_open"
>
<div class="alert alert-warning" t-if="not display_success"> <div class="alert alert-warning" t-if="not display_success">
<p><strong <p><strong
>Alert!</strong> The content you enter in this form is what we will show directly on your page within Som Comunitats.</p> >Alert!</strong> The content you enter in this form is what we will show directly on your page within Som Comunitats.</p>
...@@ -564,6 +571,21 @@ ...@@ -564,6 +571,21 @@
</div> </div>
</template> </template>
<!-- TODO: Make this description dynamic and db translatable -->
<template
id="community_data_headline_message_closed"
name="community_data_headline_message_closed"
>
<div class="alert alert-warning" t-if="not display_success">
<p>Necessary data for the integration of the Community: <strong><t
t-esc="ce_name"
/></strong> to the technology platform Som Comunitats has been successfully submitted.</p>
<p>You can contact <a
href="mailto:suport@somcomunitats.coop"
>suport@somcomunitats.coop</a> for further assistance.</p>
</div>
</template>
<template id="community_data_page" name="community_data_page"> <template id="community_data_page" name="community_data_page">
<t t-call="website.layout"> <t t-call="website.layout">
<div id="wrap" class="o_portal_wrap"> <div id="wrap" class="o_portal_wrap">
...@@ -572,15 +594,25 @@ ...@@ -572,15 +594,25 @@
<div class="col-xs-12 col-sm-10 col-md-8 col-lg-8"> <div class="col-xs-12 col-sm-10 col-md-8 col-lg-8">
<t t-call="energy_communities.community_data_headline" /> <t t-call="energy_communities.community_data_headline" />
<t t-call="energy_communities.community_data_error_message_template" /> <t t-if="closed_form">
<t <t
t-if="display_success" t-call="energy_communities.community_data_headline_message_closed"
t-call="energy_communities.community_data_form_successful_msg" />
/> </t>
<t <t t-if="not closed_form">
t-if="display_form" <t t-call="energy_communities.community_data_headline_message_open" />
t-call="energy_communities.community_data_form" <t
/> t-call="energy_communities.community_data_error_message_template"
/>
<t
t-if="display_success"
t-call="energy_communities.community_data_form_successful_msg"
/>
<t
t-if="display_form"
t-call="energy_communities.community_data_form"
/>
</t>
</div> </div>
</div> </div>
</div> </div>
......
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