Skip to content
Snippets Groups Projects
Commit f07fb859 authored by Daniil Digtyar Vasilieva's avatar Daniil Digtyar Vasilieva :call_me:
Browse files

[FIX] energy_communities: post hook cron not loading data expected in demo data loading.

Using `hook_cron` to be able to call or not the proces in a cron job.
parent 7e1e6670
No related branches found
No related tags found
2 merge requests!277[REL] Release Sprint 27/11/23,!259[FIX] energy_communities: demo data not loading.
......@@ -36,6 +36,7 @@
name="property_cooperator_account"
ref="l10n_es.account_common_4300"
/>
<field name="hook_cron">False</field>
</record>
<!-- action_accept method expects singletons, so it must be called for every community company-->
......@@ -81,6 +82,7 @@
name="property_cooperator_account"
ref="l10n_es.account_common_4300"
/>
<field name="hook_cron">False</field>
</record>
<function
......@@ -123,6 +125,7 @@
name="property_cooperator_account"
ref="l10n_es.account_common_4300"
/>
<field name="hook_cron">False</field>
</record>
<function
......
......@@ -99,6 +99,10 @@ class AccountMulticompanyEasyCreationWiz(models.TransientModel):
selection=_CE_STATUS_VALUES,
string="Energy Community state",
)
# Used in demo data, so it can finish the process before continuing with the rest of the demo data.
hook_cron = fields.Boolean(
default=True, string="Run the post hook in a cron job or not"
)
def add_company_managers(self):
coord_members = self.parent_id.get_users(
......@@ -212,7 +216,10 @@ class AccountMulticompanyEasyCreationWiz(models.TransientModel):
def action_accept(self):
super().action_accept()
self.with_delay()._after_action_accept_hook()
if self.hook_cron:
self.with_delay()._after_action_accept_hook()
else:
self._after_action_accept_hook()
if self.crm_lead_id:
self.crm_lead_id.action_set_won_rainbowman()
return {
......
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