Skip to content
Snippets Groups Projects
Commit dc163d60 authored by Dani Quilez's avatar Dani Quilez
Browse files

first MVP

parent 9e03a6e2
No related branches found
No related tags found
2 merge requests!187Release 14.0.1.1.13,!165Landings V2
Pipeline #36943 passed
This commit is part of merge request !165. Comments created here will be created in the context of that merge request.
......@@ -1028,11 +1028,6 @@ msgstr "Contacte"
msgid "Contact a existing CE"
msgstr "Contactar una CE existent"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__contact_form
msgid "Contact form"
msgstr "Formulari de contacte"
#. module: energy_communities
#: model:mail.template,subject:energy_communities.email_template_confirmation_voluntary_share
msgid "Contribute to ${object.company_id.name} Ref. ACSV${object.id}"
......@@ -1266,11 +1261,6 @@ msgstr ""
msgid "General Information"
msgstr "Informació general"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__group_image_link
msgid "Group image link"
msgstr ""
#. module: energy_communities
#: model_terms:ir.ui.view,arch_db:energy_communities.voluntary_share_text_template
msgid "Hello,"
......@@ -1476,11 +1466,6 @@ msgstr ""
msgid "Name"
msgstr ""
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__new_cooperator_form_link
msgid "New cooperator form link"
msgstr ""
#. module: energy_communities
#: model:ir.module.category,description:energy_communities.energy_communities_category
msgid ""
......@@ -1724,11 +1709,6 @@ msgstr "Tipus d'aportació"
msgid "Short description"
msgstr ""
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__social_media_link
msgid "Social media link"
msgstr ""
#. module: energy_communities
#: code:addons/energy_communities/controllers/website_subscription_main.py:0
#, python-format
......@@ -1783,16 +1763,6 @@ msgstr "Diari de subscripcions"
msgid "Subscription Request"
msgstr "Sol·licitud de Subscripció"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__subscription_information
msgid "Subscription information"
msgstr ""
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__subscription_link
msgid "Subscription link"
msgstr ""
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_auth_oauth_provider__superuser
msgid "Superuser"
......@@ -2093,11 +2063,6 @@ msgstr ""
msgid "VAT"
msgstr "NIF"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__virtual_office_link
msgid "Virtual office link"
msgstr ""
#. module: energy_communities
#: model:product.template,name:energy_communities.voluntary_share_capital_product_template
msgid "Voluntary Contribution to Share Capital"
......
......@@ -1029,11 +1029,6 @@ msgstr "Contacte"
msgid "Contact a existing CE"
msgstr "Contactar una CE existente"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__contact_form
msgid "Contact form"
msgstr "Formulario de contacto"
#. module: energy_communities
#: model:mail.template,subject:energy_communities.email_template_confirmation_voluntary_share
msgid "Contribute to ${object.company_id.name} Ref. ACSV${object.id}"
......@@ -1266,11 +1261,6 @@ msgstr ""
msgid "General Information"
msgstr "InformacióN general"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__group_image_link
msgid "Group image link"
msgstr ""
#. module: energy_communities
#: model_terms:ir.ui.view,arch_db:energy_communities.voluntary_share_text_template
msgid "Hello,"
......@@ -1476,11 +1466,6 @@ msgstr ""
msgid "Name"
msgstr ""
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__new_cooperator_form_link
msgid "New cooperator form link"
msgstr ""
#. module: energy_communities
#: model:ir.module.category,description:energy_communities.energy_communities_category
msgid ""
......@@ -1732,11 +1717,6 @@ msgstr "Tipo de aportación"
msgid "Short description"
msgstr ""
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__social_media_link
msgid "Social media link"
msgstr ""
#. module: energy_communities
#: code:addons/energy_communities/controllers/website_subscription_main.py:0
#, python-format
......@@ -1791,16 +1771,6 @@ msgstr "Diario de subscripciones"
msgid "Subscription Request"
msgstr "Sol·licitud de Suscripción"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__subscription_information
msgid "Subscription information"
msgstr ""
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__subscription_link
msgid "Subscription link"
msgstr ""
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_auth_oauth_provider__superuser
msgid "Superuser"
......@@ -2100,11 +2070,6 @@ msgstr ""
msgid "VAT"
msgstr "NIF"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__virtual_office_link
msgid "Virtual office link"
msgstr ""
#. module: energy_communities
#: model:product.template,name:energy_communities.voluntary_share_capital_product_template
msgid "Voluntary Contribution to Share Capital"
......
......@@ -1031,11 +1031,6 @@ msgstr "Kontaktua"
msgid "Contact a existing CE"
msgstr "Contactar una CE existente"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__contact_form
msgid "Contact form"
msgstr "Harremanetarako formularioa"
#. module: energy_communities
#: model:mail.template,subject:energy_communities.email_template_confirmation_voluntary_share
msgid "Contribute to ${object.company_id.name} Ref. ACSV${object.id}"
......@@ -1269,11 +1264,6 @@ msgstr ""
msgid "General Information"
msgstr "InformacióN general"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__group_image_link
msgid "Group image link"
msgstr "Taldeko irudiaren esteka"
#. module: energy_communities
#: model_terms:ir.ui.view,arch_db:energy_communities.voluntary_share_text_template
msgid "Hello,"
......@@ -1481,11 +1471,6 @@ msgstr "Hire helmuga orria"
msgid "Name"
msgstr "Izena"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__new_cooperator_form_link
msgid "New cooperator form link"
msgstr "Kolaboratzaile-inprimakiaren esteka berria"
#. module: energy_communities
#: model:ir.module.category,description:energy_communities.energy_communities_category
msgid ""
......@@ -1737,11 +1722,6 @@ msgstr "Ekarpen mota"
msgid "Short description"
msgstr "Deskribapen laburra"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__social_media_link
msgid "Social media link"
msgstr "Sare sozialen esteka"
#. module: energy_communities
#: code:addons/energy_communities/controllers/website_subscription_main.py:0
#, python-format
......@@ -1796,16 +1776,6 @@ msgstr "Diario de subscripciones"
msgid "Subscription Request"
msgstr "Sol·licitud de Suscripción"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__subscription_information
msgid "Subscription information"
msgstr "Harpidetzaren informazioa"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__subscription_link
msgid "Subscription link"
msgstr "Harpidetza esteka"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_auth_oauth_provider__superuser
msgid "Superuser"
......@@ -2103,11 +2073,6 @@ msgstr ""
msgid "VAT"
msgstr "IFZ"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__virtual_office_link
msgid "Virtual office link"
msgstr "Bulego birtualeko esteka"
#. module: energy_communities
#: model:product.template,name:energy_communities.voluntary_share_capital_product_template
msgid "Voluntary Contribution to Share Capital"
......
......@@ -20,56 +20,99 @@ class LandingPage(models.Model):
string="Allows new members", related="company_id.allow_new_members"
)
number_of_members = fields.Integer(string="Number of members")
virtual_office_link = fields.Char(string="Virtual office link")
external_website_link = fields.Char(string="External website link")
twitter_link = fields.Char(string="Twitter link")
telegram_link = fields.Char(string="Telegram link")
instagram_link = fields.Char(string="Instagram link")
# TODO: group_image_link Left for backward compatibility. To be removed
group_image_link = fields.Char(string="Group image link")
primary_image_file = fields.Image(
"Primary Image")
secondary_image_file = fields.Image(
"Secondary Image")
short_description = fields.Char(string="Short description")
short_description = fields.Text(string="Short description")
long_description = fields.Text(string="Long description")
why_become_cooperator = fields.Text(string="Why become cooperator")
become_cooperator_process = fields.Text(string="Become cooperator process")
subscription_information = fields.Text(string="Subscription information")
new_cooperator_form_link = fields.Char(string="New cooperator form link")
contact_form = fields.Char(string="Contact form")
subscription_link = fields.Char(string="Subscription link")
social_media_link = fields.Char(string="Social media link")
why_become_cooperator = fields.Html(string="Why become cooperator")
become_cooperator_process = fields.Html(string="Become cooperator process")
# TODO: remove this one
map_geolocation = fields.Char(string="Map geolocation")
map_place_id = fields.Many2one('cm.place', "Place reference")
street = fields.Char(string="Street")
postal_code = fields.Char(string="Postal code")
city = fields.Char(string="City")
community_active_services = fields.Many2many(
string="Community active services", related="company_id.ce_tag_ids"
)
community_type = fields.Selection(
selection=[("citizen", _("Citizen")), ("industrial", _("Industrial"))],
default="citizen",
required=True,
string="Community type",
)
community_secondary_type = fields.Selection(
selection=[("cooperative", _("Cooperative"))],
default="cooperative",
required=True,
string="Community secondary type",
)
community_status = fields.Selection(
selection=[("open", _("Open")), ("closed", _("Closed"))],
default="open",
required=True,
string="Community status",
)
def to_dict(self):
data = {
"title": self.name or "",
"odoo_company_id": self.company_id.id,
"status": self.status,
"allow_new_members": self.allow_new_members,
"number_of_members": self.number_of_members,
"virtual_office_link": self.virtual_office_link or "",
"external_website_link": self.external_website_link or "",
"community_active_services": self.community_active_services,
"group_image_link": self.group_image_link or "",
"short_description": self.short_description or "",
"long_description": self.long_description or "",
"why_become_cooperator": self.why_become_cooperator or "",
"become_cooperator_process": self.become_cooperator_process or "",
"subscription_information": self.subscription_information or "",
"new_cooperator_form_link": self.new_cooperator_form_link or "",
"contact_form": self.contact_form or "",
"subscription_link": self.subscription_link or "",
"social_media_link": self.social_media_link or "",
"map_geolocation": self.map_geolocation or "",
"street": self.street or "",
"postal_code": self.postal_code or "",
"city": self.city or "",
base_url = self.env['ir.config_parameter'].get_param(
'web.base.url')
if self.primary_image_file:
primary_image_file = base_url+'/web/image/landing.page/' + \
str(self.id)+'/primary_image_file'
else:
primary_image_file = ""
if self.secondary_image_file:
secondary_image_file = base_url+'/web/image/landing.page/' + \
str(self.id)+'/secondary_image_file'
else:
secondary_image_file = ""
if self.map_place_id:
map_reference = self.map_place_id.slug_id
else:
map_reference = ""
return {
"landing": {
"id": self.id,
"name": self.name,
"title": self.name,
"odoo_company_id": self.company_id.id,
"company_id": self.company_id.id,
"wp_landing_page_id": self.wp_landing_page_id,
"status": self.status,
"community_type": self.community_type,
"community_secondary_type": self.community_secondary_type,
"community_status": self.community_status,
"allow_new_members": self.allow_new_members,
"number_of_members": self.number_of_members,
"external_website_link": self.external_website_link or "",
"twitter_link": self.twitter_link or "",
"instagram_link": self.instagram_link or "",
"telegram_link": self.telegram_link or "",
"community_active_services": self.company_id.get_active_services(),
# TODO: group_image_link Left for backward compatibility. To be removed
"group_image_link": self.group_image_link or "",
"primary_image_file": primary_image_file,
"secondary_image_file": secondary_image_file,
"short_description": self.short_description or "",
"long_description": self.long_description or "",
"why_become_cooperator": self.why_become_cooperator or "",
"become_cooperator_process": self.become_cooperator_process or "",
"map_geolocation": self.map_geolocation or "",
"map_reference": map_reference,
"street": self.street or "",
"postal_code": self.postal_code or "",
"city": self.city or ""
}
}
return data
def action_landing_page_status(self):
for record in self:
......@@ -82,7 +125,8 @@ class LandingPage(models.Model):
password = instance_company.wordpress_db_password
auth = Authenticate(baseurl, username, password).authenticate()
token = "Bearer %s" % auth["token"]
landing_page_data = record.to_dict()
landing_page_data_dict = record.to_dict()
landing_page_data = landing_page_data_dict['landing_page']
landing_page_data["status"] = new_status
LandingPageResource(
token,
......
......@@ -21,51 +21,7 @@ class LandingService(Component):
@staticmethod
def _to_dict(landing_page):
# TODO: move this method to model method?
# return landing.to_dict()
base_url = landing_page.env['ir.config_parameter'].get_param(
'web.base.url')
if landing_page.primary_image_file:
primary_image_file = base_url+'/web/image/landing.page/' + \
str(landing_page.id)+'/primary_image_file'
else:
primary_image_file = ""
if landing_page.secondary_image_file:
secondary_image_file = base_url+'/web/image/landing.page/' + \
str(landing_page.id)+'/secondary_image_file'
else:
secondary_image_file = ""
return {
"landing": {
"id": landing_page.id,
"name": landing_page.name,
"company_id": landing_page.company_id.id,
"wp_landing_page_id": landing_page.wp_landing_page_id,
"status": landing_page.status,
"allow_new_members": landing_page.allow_new_members,
"number_of_members": landing_page.number_of_members,
"virtual_office_link": landing_page.virtual_office_link or "",
"external_website_link": landing_page.external_website_link or "",
"community_active_services": landing_page.company_id.get_active_services(),
"group_image_link": landing_page.group_image_link or "",
"primary_image_file": primary_image_file,
"secondary_image_file": secondary_image_file,
"short_description": landing_page.short_description or "",
"long_description": landing_page.long_description or "",
"why_become_cooperator": landing_page.why_become_cooperator or "",
"become_cooperator_process": landing_page.become_cooperator_process or "",
"subscription_information": landing_page.subscription_information or "",
"new_cooperator_form_link": landing_page.new_cooperator_form_link or "",
"contact_form": landing_page.contact_form or "",
"subscription_link": landing_page.subscription_link or "",
"social_media_link": landing_page.social_media_link or "",
"map_geolocation": landing_page.map_geolocation or "",
"street": landing_page.street or "",
"postal_code": landing_page.postal_code or "",
"city": landing_page.city or ""
}
}
return landing_page.to_dict()
def _validator_get(self):
return {}
......
......@@ -198,34 +198,40 @@ S_COMMUNITY_RETURN_GET = {
"email": {"type": "string"},
"telegram": {"type": "string"},
},
},
},
"active_services": {
"type": "list",
"schema": {
"type": "dict",
"schema": S_COMMUNITY_SERVICE
},
},
},
"allow_new_members": {"type": "boolean"},
"public_web_landing_url": {"type": "string"},
"keycloak_odoo_login_url": {"type": "string"},
}
}
}
S_LANDING_PAGE_CREATE = {
"landing": {
"type": "dict",
"schema": {
"id": {"type": "integer"},
"name": {"type": "string"},
"title": {"type": "string"},
"company_id": {"type": "integer"},
"odoo_company_id": {"type": "integer"},
"wp_landing_page_id": {"type": "integer"},
"status": {"type": "string"},
"community_type": {"type": "string"},
"community_secondary_type": {"type": "string"},
"community_status": {"type": "string"},
"allow_new_members": {"type": "boolean"},
"number_of_members": {"type": "integer"},
"virtual_office_link": {"type": "string"},
"external_website_link": {"type": "string"},
"twitter_link": {"type": "string"},
"instagram_link": {"type": "string"},
"telegram_link": {"type": "string"},
"community_active_services": {
"type": "list",
"schema": {
......@@ -240,12 +246,8 @@ S_LANDING_PAGE_CREATE = {
"long_description": {"type": "string"},
"why_become_cooperator": {"type": "string"},
"become_cooperator_process": {"type": "string"},
"subscription_information": {"type": "string"},
"new_cooperator_form_link": {"type": "string"},
"contact_form": {"type": "string"},
"subscription_link": {"type": "string"},
"social_media_link": {"type": "string"},
"map_geolocation": {"type": "string"},
"map_reference": {"type": "string"},
"street": {"type": "string"},
"postal_code": {"type": "string"},
"city": {"type": "string"},
......
......@@ -10,7 +10,6 @@
<button name="action_landing_page_status" type="object" string="Unpublish" attrs="{'invisible': [('status','!=','publish')]}"/>
<field name="status" widget="statusbar"/>
</header>
<group style="width:40px;">
<h4 style="color:green;" attrs="{'invisible': [('status','!=','publish')]}">Published</h4>
<h4 style="color:orange;" attrs="{'invisible': [('status','!=','draft')]}">Draft</h4>
......@@ -20,34 +19,38 @@
<field name="name"/>
<field name="allow_new_members"/>
<field name="number_of_members"/>
<field name="virtual_office_link"/>
<field name="external_website_link"/>
<field name="community_type"/>
<field name="community_secondary_type"/>
<field name="community_status"/>
</group>
<group>
<field name="primary_image_file" widget="image"/>
<field name="secondary_image_file" widget="image"/>
<field name="external_website_link"/>
<field name="twitter_link"/>
<field name="instagram_link"/>
<field name="telegram_link"/>
<field name="group_image_link"/>
<field name="short_description"/>
<field name="long_description"/>
<field name="why_become_cooperator"/>
<field name="become_cooperator_process"/>
<field name="subscription_information"/>
</group>
<group col="4">
<field name="primary_image_file" widget="image"/>
<field name="secondary_image_file" widget="image"/>
</group>
<group>
<field name="short_description"/>
<field name="long_description"/>
<field name="why_become_cooperator" widget="html"/>
<field name="become_cooperator_process" widget="html"/>
</group>
<group>
<field name="new_cooperator_form_link"/>
<field name="contact_form"/>
<field name="subscription_link"/>
<field name="social_media_link"/>
<field name="map_geolocation"/>
<field name="map_place_id"/>
<field name="street"/>
<field name="postal_code"/>
<field name="city"/>
</group>
<group>
<field name="map_geolocation"/>
<field name="street"/>
<field name="postal_code"/>
<field name="city"/>
<field name="community_active_services"/>
<field name="community_active_services"/>
</group>
</form>
</field>
</record>
</odoo>
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