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

[MERGE][FIX] energy_communities: creation of company from wizard is put in a queue job

Merge branch 'fix/backround-jobs' into 'dev'

Put whole action inside backround job

See merge request !281
parents e84db80b 471528fd
No related branches found
No related tags found
2 merge requests!288[REL] Release Sprint + hotfix (11/12/23),!281Put whole action inside backround job
Pipeline #73910 passed
......@@ -109,7 +109,7 @@ class AccountMulticompanyEasyCreationWiz(models.TransientModel):
["role_coord_admin", "role_coord_worker"]
)
for manager in coord_members:
manager.make_ce_user(self.new_company_id, "role_ce_manager")
manager.make_ce_user(self.new_company_id.id, "role_ce_manager")
def add_company_log(self):
message = _(
......@@ -215,13 +215,10 @@ class AccountMulticompanyEasyCreationWiz(models.TransientModel):
)
def action_accept(self):
super().action_accept()
if self.hook_cron:
self.with_delay()._after_action_accept_hook()
self.with_delay().thread_action_accept()
else:
self._after_action_accept_hook()
if self.crm_lead_id:
self.crm_lead_id.action_set_won_rainbowman()
self.thread_action_accept()
return {
"type": "ir.actions.client",
"tag": "display_notification",
......@@ -234,6 +231,12 @@ class AccountMulticompanyEasyCreationWiz(models.TransientModel):
},
}
def thread_action_accept(self):
super().action_accept()
self._after_action_accept_hook()
if self.crm_lead_id:
self.crm_lead_id.action_set_won_rainbowman()
def _after_action_accept_hook(self):
if self.property_cooperator_account:
self.set_cooperative_account()
......
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