Skip to content

Commit

Permalink
fix code to group dependancies when we create new db
Browse files Browse the repository at this point in the history
  • Loading branch information
gaelTorrecillas committed Apr 27, 2023
1 parent da15f62 commit 21e94af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 2 additions & 0 deletions saas/models/saas_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from collections import defaultdict
import string
import logging

import psycopg2
from odoo import models, fields
import odoo.addons.saas_cluster_simple.main as cluster
from odoo.addons.queue_job.exception import RetryableJobError
_logger = logging.getLogger(__name__)


class SAASOperator(models.Model):
Expand Down
11 changes: 4 additions & 7 deletions saas/models/saas_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,15 @@ def create_db(self, key_values=None, db_name=None, with_delay=True, draft_build_

self.env['saas.log'].log_db_creating(build, self.operator_db_id)
if with_delay:
job_create = build.with_delay().create_db(
job_create = build.delayable().create_db(
self.operator_db_name, self.template_id.template_demo,
)
job_install_modules = group(job_create).on_done(
build.with_delay().action_install_missing_mandatory_modules()
)
job_install_modules = build.delayable().action_install_missing_mandatory_modules()

group(job_install_modules).on_done(
self.operator_id.with_delay().build_post_init(
job_build_post_init= self.operator_id.delayable().build_post_init(
build, self.template_id.build_post_init, key_values
)
)
job_create.on_done(job_install_modules.on_done(job_build_post_init)).delay()
else:
build.create_db(
self.operator_db_name,
Expand Down

0 comments on commit 21e94af

Please sign in to comment.