Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.0] fixed error when we're launch new instance (clients) #411

Open
wants to merge 3 commits into
base: 10.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions saas_client/static/src/js/saas_client.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
openerp.saas_client = function(instance){
var _t = instance.web._t,
_lt = instance.web._lt;
odoo.define('saas_client', function (require) {

instance.web.WebClient.include({
var WebClient = require('web.WebClient');


WebClient.include({
_ab_location: function(dbuuid) {
var ab_register = _.str.sprintf('%s/%s', this._ab_register_value, dbuuid);
$('#announcement_bar_table').find('.url a').attr('href', ab_register);
Expand All @@ -26,4 +27,4 @@ openerp.saas_client = function(instance){
});
}
});
};
});
14 changes: 13 additions & 1 deletion saas_server/models/saas_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
from odoo.service import db
from odoo import api, models, fields, SUPERUSER_ID, exceptions
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
from odoo.tools import config

import psycopg2
import random
import string

from distutils.dir_util import copy_tree
import logging

_logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -41,6 +44,15 @@ class SaasServerClient(models.Model):
def create_database(self, template_db=None, demo=False, lang='en_US'):
self.ensure_one()
new_db = self.name
try:
path_file_store = config.filestore(template_db)
parent_paths = path_file_store.split(template_db)
if len(parent_paths) > 1:
parent_path = parent_paths[0]
new_db_filstore_path = parent_path + new_db
copy_tree(path_file_store, new_db_filstore_path)
except Exception, ex:
_logger.error(ex)
res = {}
if template_db:
odoo.service.db._drop_conn(self.env.cr, template_db)
Expand Down