Skip to content
Snippets Groups Projects
Commit 11e82eca authored by daniquilez's avatar daniquilez
Browse files

Merge branch 'dev' of...

Merge branch 'dev' of git.coopdevs.org:coopdevs/comunitats-energetiques/odoo-ce into feature/cm-fetcher
parents 5641aada cd12adc4
No related branches found
No related tags found
3 merge requests!253[REL] Release 06/11/23,!238Feature/energy communities translations,!224Community maps fetcher v1
This commit is part of merge request !238. Comments created here will be created in the context of that merge request.
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
"views/subscription_request_view.xml", "views/subscription_request_view.xml",
"views/res_users_view.xml", "views/res_users_view.xml",
"views/res_users_role_view.xml", "views/res_users_role_view.xml",
"views/mailing_mailing_views_menus.xml",
"views/menus.xml", "views/menus.xml",
"data/mail_template_data.xml", "data/mail_template_data.xml",
"data/mail_template_update_data.xml", "data/mail_template_update_data.xml",
......
...@@ -563,6 +563,11 @@ msgstr "Autoritza nous membres" ...@@ -563,6 +563,11 @@ msgstr "Autoritza nous membres"
msgid "Allows new members" msgid "Allows new members"
msgstr "Autoritza nous membres" msgstr "Autoritza nous membres"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__wp_lastupdate_datetime
msgid "Last wordpress update date"
msgstr "Data darrera actualització a wordpress"
#. module: energy_communities #. module: energy_communities
#: code:addons/energy_communities/models/res_company.py:0 #: code:addons/energy_communities/models/res_company.py:0
#, python-format #, python-format
...@@ -890,6 +895,11 @@ msgstr "Crear desde CRM Lead" ...@@ -890,6 +895,11 @@ msgstr "Crear desde CRM Lead"
msgid "Create landing page" msgid "Create landing page"
msgstr "Crear pàgina de Landing" msgstr "Crear pàgina de Landing"
#. module: energy_communities
#: model_terms:ir.ui.view,arch_db:energy_communities.landing_page_form_view
msgid "Update wordpress data"
msgstr "Actualizar dades wordpress"
#. module: energy_communities #. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_account_multicompany_easy_creation_wiz__create_user #: model:ir.model.fields,field_description:energy_communities.field_account_multicompany_easy_creation_wiz__create_user
msgid "Create user for cooperator" msgid "Create user for cooperator"
......
...@@ -310,6 +310,11 @@ msgstr "" ...@@ -310,6 +310,11 @@ msgstr ""
msgid "Allows new members" msgid "Allows new members"
msgstr "" msgstr ""
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__wp_lastupdate_datetime
msgid "Last wordpress update date"
msgstr ""
#. module: energy_communities #. module: energy_communities
#: code:addons/energy_communities/models/res_company.py:0 #: code:addons/energy_communities/models/res_company.py:0
#: code:addons/energy_communities/models/res_company.py:0 #: code:addons/energy_communities/models/res_company.py:0
...@@ -632,6 +637,11 @@ msgstr "" ...@@ -632,6 +637,11 @@ msgstr ""
msgid "Create landing page" msgid "Create landing page"
msgstr "" msgstr ""
#. module: energy_communities
#: model_terms:ir.ui.view,arch_db:energy_communities.landing_page_form_view
msgid "Update wordpress data"
msgstr ""
#. module: energy_communities #. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_account_multicompany_easy_creation_wiz__create_user #: model:ir.model.fields,field_description:energy_communities.field_account_multicompany_easy_creation_wiz__create_user
msgid "Create user for cooperator" msgid "Create user for cooperator"
......
...@@ -498,6 +498,11 @@ msgstr "Autoriza nuevos miembros" ...@@ -498,6 +498,11 @@ msgstr "Autoriza nuevos miembros"
msgid "Allows new members" msgid "Allows new members"
msgstr "" msgstr ""
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__wp_lastupdate_datetime
msgid "Last wordpress update date"
msgstr "Fecha última actualización de wordpress"
#. module: energy_communities #. module: energy_communities
#: code:addons/energy_communities/models/res_company.py:0 #: code:addons/energy_communities/models/res_company.py:0
#, python-format #, python-format
...@@ -768,6 +773,11 @@ msgstr "Crear desde CRM Lead" ...@@ -768,6 +773,11 @@ msgstr "Crear desde CRM Lead"
msgid "Create landing page" msgid "Create landing page"
msgstr "Crear página de Landing" msgstr "Crear página de Landing"
#. module: energy_communities
#: model_terms:ir.ui.view,arch_db:energy_communities.landing_page_form_view
msgid "Update wordpress data"
msgstr "Actualizar datos wordpress"
#. module: energy_communities #. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_account_multicompany_easy_creation_wiz__create_user #: model:ir.model.fields,field_description:energy_communities.field_account_multicompany_easy_creation_wiz__create_user
msgid "Create user for cooperator" msgid "Create user for cooperator"
......
...@@ -570,6 +570,11 @@ msgstr "Onartu kide berriak" ...@@ -570,6 +570,11 @@ msgstr "Onartu kide berriak"
msgid "Allows new members" msgid "Allows new members"
msgstr "Kide berriei baimena ematea" msgstr "Kide berriei baimena ematea"
#. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_landing_page__wp_lastupdate_datetime
msgid "Last wordpress update date"
msgstr "Wordpress eguneratzearen azken data"
#. module: energy_communities #. module: energy_communities
#: code:addons/energy_communities/models/res_company.py:0 #: code:addons/energy_communities/models/res_company.py:0
#, python-format #, python-format
...@@ -895,6 +900,11 @@ msgstr "Sortu CRM Lead-etik" ...@@ -895,6 +900,11 @@ msgstr "Sortu CRM Lead-etik"
msgid "Create landing page" msgid "Create landing page"
msgstr "Sortu helmuga orria" msgstr "Sortu helmuga orria"
#. module: energy_communities
#: model_terms:ir.ui.view,arch_db:energy_communities.landing_page_form_view
msgid "Update wordpress data"
msgstr "Eguneratu wordpress datuak"
#. module: energy_communities #. module: energy_communities
#: model:ir.model.fields,field_description:energy_communities.field_account_multicompany_easy_creation_wiz__create_user #: model:ir.model.fields,field_description:energy_communities.field_account_multicompany_easy_creation_wiz__create_user
msgid "Create user for cooperator" msgid "Create user for cooperator"
......
from datetime import datetime
from odoo import _, api, fields, models from odoo import _, api, fields, models
from ..pywordpress_client.resources.authenticate import Authenticate from ..pywordpress_client.resources.authenticate import Authenticate
...@@ -72,6 +74,7 @@ class LandingPage(models.Model): ...@@ -72,6 +74,7 @@ class LandingPage(models.Model):
required=True, required=True,
string="Community status", string="Community status",
) )
wp_lastupdate_datetime = fields.Datetime(string="Last wordpress update date")
def _get_image_attachment(self, field_name): def _get_image_attachment(self, field_name):
file_attachment = self.env["ir.attachment"].search( file_attachment = self.env["ir.attachment"].search(
...@@ -181,23 +184,22 @@ class LandingPage(models.Model): ...@@ -181,23 +184,22 @@ class LandingPage(models.Model):
new_status = "draft" if record.status == "publish" else "publish" new_status = "draft" if record.status == "publish" else "publish"
record.write({"status": new_status}) record.write({"status": new_status})
def _update_wordpress(self): def action_update_wp(self):
for record in self: for record in self:
instance_company = self.env["res.company"].search( record._update_wordpress()
[("hierarchy_level", "=", "instance")]
)
if instance_company:
baseurl = instance_company.wordpress_base_url
username = instance_company.wordpress_db_username
password = instance_company.wordpress_db_password
auth = Authenticate(baseurl, username, password).authenticate()
token = "Bearer %s" % auth["token"]
landing_page_data = record.to_dict()
LandingPageResource(token, baseurl, record.wp_landing_page_id).update(
landing_page_data
)
def write(self, vals): def _update_wordpress(self):
res = super().write(vals) instance_company = self.env["res.company"].search(
self._update_wordpress() [("hierarchy_level", "=", "instance")]
return res )
if instance_company:
baseurl = instance_company.wordpress_base_url
username = instance_company.wordpress_db_username
password = instance_company.wordpress_db_password
auth = Authenticate(baseurl, username, password).authenticate()
token = "Bearer %s" % auth["token"]
landing_page_data = self.to_dict()
LandingPageResource(token, baseurl, self.wp_landing_page_id).update(
landing_page_data
)
self.write({"wp_lastupdate_datetime": datetime.now()})
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
(4, ref('account.group_account_manager')), (4, ref('account.group_account_manager')),
(4, ref('account_payment_order.group_account_payment')), (4, ref('account_payment_order.group_account_payment')),
(4, ref('crm.group_use_lead')), (4, ref('crm.group_use_lead')),
(4, ref('mass_mailing.group_mass_mailing_user')),
(4, ref('l10n_es_aeat.group_account_aeat')), (4, ref('l10n_es_aeat.group_account_aeat')),
]" ]"
/> />
...@@ -86,7 +85,6 @@ ...@@ -86,7 +85,6 @@
(4, ref('account.group_account_manager')), (4, ref('account.group_account_manager')),
(4, ref('account_payment_order.group_account_payment')), (4, ref('account_payment_order.group_account_payment')),
(4, ref('crm.group_use_lead')), (4, ref('crm.group_use_lead')),
(4, ref('mass_mailing.group_mass_mailing_user')),
(4, ref('l10n_es_aeat.group_account_aeat')), (4, ref('l10n_es_aeat.group_account_aeat')),
]" ]"
/> />
...@@ -113,7 +111,6 @@ ...@@ -113,7 +111,6 @@
(4, ref('account.group_account_manager')), (4, ref('account.group_account_manager')),
(4, ref('account_payment_order.group_account_payment')), (4, ref('account_payment_order.group_account_payment')),
(4, ref('crm.group_use_lead')), (4, ref('crm.group_use_lead')),
(4, ref('mass_mailing.group_mass_mailing_user')),
(4, ref('l10n_es_aeat.group_account_aeat')), (4, ref('l10n_es_aeat.group_account_aeat')),
]" ]"
/> />
...@@ -140,7 +137,6 @@ ...@@ -140,7 +137,6 @@
(4, ref('account.group_account_manager')), (4, ref('account.group_account_manager')),
(4, ref('account_payment_order.group_account_payment')), (4, ref('account_payment_order.group_account_payment')),
(4, ref('crm.group_use_lead')), (4, ref('crm.group_use_lead')),
(4, ref('mass_mailing.group_mass_mailing_user')),
(4, ref('l10n_es_aeat.group_account_aeat')), (4, ref('l10n_es_aeat.group_account_aeat')),
]" ]"
/> />
......
...@@ -17,6 +17,11 @@ ...@@ -17,6 +17,11 @@
type="object" type="object"
string="Unpublish" string="Unpublish"
attrs="{'invisible': [('status','!=','publish')]}" attrs="{'invisible': [('status','!=','publish')]}"
/>
<button
name="action_update_wp"
type="object"
string="Update wordpress data"
/> />
<field name="status" widget="statusbar" /> <field name="status" widget="statusbar" />
</header> </header>
...@@ -31,6 +36,7 @@ ...@@ -31,6 +36,7 @@
>Draft</h4> >Draft</h4>
</group> </group>
<group> <group>
<field name="wp_lastupdate_datetime" readonly="True" />
<field name="wp_landing_page_id" readonly="True" /> <field name="wp_landing_page_id" readonly="True" />
<field name="name" /> <field name="name" />
<field name="allow_new_members" /> <field name="allow_new_members" />
......
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record model="ir.ui.menu" id="mass_mailing.mass_mailing_menu_root">
<field
name="groups_id"
eval="[(6,0,[ref('mass_mailing.group_mass_mailing_user')])]"
/>
</record>
</data>
</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