def update_base(self, cr, uid, vals, context=None): res = super(saas_base, self).update_base(cr, uid, vals, context) context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid}) if vals['apptype_name'] == 'odoo': try: execute.log( "client = erppeek.Client('http://" + vals['server_domain'] + ":" + vals['service_options']['port']['hostport'] + "," + "db=" + vals['base_unique_name_'] + "," + "user="******", password="******")", context) client = erppeek.Client( 'http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport'], db=vals['base_unique_name_'], user=vals['apptype_admin_name'], password=vals['base_admin_passwd']) # execute.log("module_ids = client.model('ir.module.module').search([('state','in',['installed','to upgrade'])])", context) # module_ids = client.model('ir.module.module').search([('state','in',['installed','to upgrade'])]) execute.log("client.upgrade('base')", context) client.upgrade('base') except: pass return res
def deploy_test(self, cr, uid, vals, context=None): res = super(saas_base, self).deploy_test(cr, uid, vals, context) context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid}) if vals['apptype_name'] == 'odoo': execute.log( "client = erppeek.Client('http://" + vals['server_domain'] + ":" + vals['service_options']['port']['hostport'] + "," + "db=" + vals['base_unique_name_'] + "," + "user="******", password="******")", context) client = erppeek.Client( 'http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport'], db=vals['base_unique_name_'], user=vals['apptype_admin_name'], password=vals['base_admin_passwd']) if vals['app_options']['test_install_modules']['value']: modules = vals['app_options']['test_install_modules'][ 'value'].split(',') for module in modules: execute.log("client.install(" + module + ")", context) client.install(module) return
def deploy_create_database(self, cr, uid, vals, context=None): res = super(saas_base, self).deploy_create_database(cr, uid, vals, context) context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid}) if vals['apptype_name'] == 'odoo': ssh, sftp = execute.connect(vals['container_fullname'], username=vals['apptype_system_user'], context=context) execute.execute(ssh, ['mkdir', '-p', '/opt/odoo/' + vals['service_name'] + '/filestore/' + vals['base_unique_name_']], context) ssh.close() sftp.close() if vals['base_build'] == 'build': #I had to go in /usr/local/lib/python2.7/dist-packages/erppeek.py and replace def create_database line 610. More specifically, db.create and db.get_progress used here aren't working anymore, see why in odoo/services/db.py, check dispatch function. # def create_database(self, passwd, database, demo=False, lang='en_US', # user_password='******'): # thread_id = self.db.create_database(passwd, database, demo, lang, user_password) # self.login('admin', user_password, # database=database) execute.log("client = erppeek.Client('http://" + vals['server_domain'] + ":" + vals['service_options']['port']['hostport'] + "')", context) client = erppeek.Client('http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport']) execute.log("client.create_database('" + vals['service_db_password'] + "','" + vals['base_unique_name_'] + "'," + "demo=" + str(vals['base_test']) + "," + "lang='" + vals['base_lang'] + "'," + "user_password='******'base_admin_passwd'] + "')", context) client.create_database(vals['service_db_password'], vals['base_unique_name_'], demo=vals['base_test'], lang=vals['base_lang'], user_password=vals['base_admin_passwd']) # cmd = ['/usr/local/bin/erppeek', '--server', 'http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport']] # stdin = ["client.create_database('" + vals['service_db_password'] + "', '" + vals['base_unique_name_'] + "', demo=" + str(vals['base_test']) + ", lang='fr_FR', user_password='******'base_admin_passwd'] + "')"] # execute.execute_local(cmd, context, stdin_arg=stdin) return True return res
def post_reset(self, cr, uid, vals, context=None): res = super(saas_base, self).post_reset(cr, uid, vals, context) context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid}) if vals['apptype_name'] == 'odoo': execute.log( "client = erppeek.Client('http://" + vals['server_domain'] + ":" + vals['service_options']['port']['hostport'] + "," + "db=" + vals['base_unique_name_'] + "," + "user="******", password="******")", context) client = erppeek.Client( 'http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport'], db=vals['base_unique_name_'], user=vals['apptype_admin_name'], password=vals['base_admin_passwd']) execute.log( "server_id = client.model('ir.model.data').get_object_reference('base', 'ir_mail_server_localhost0')[1]", context) server_id = client.model('ir.model.data').get_object_reference( 'base', 'ir_mail_server_localhost0')[1] execute.log( "client.model('ir.mail_server').write([" + str(server_id) + "], {'smtp_host': 'mail.disabled.lol'})", context) client.model('ir.mail_server').write( [server_id], {'smtp_host': 'mail.disabled.lol'}) execute.log( "cron_ids = client.model('ir.cron').search(['|',('active','=',True),('active','=',False)])", context) cron_ids = client.model('ir.cron').search( ['|', ('active', '=', True), ('active', '=', False)]) execute.log( "client.model('ir.cron').write(" + str(cron_ids) + ", {'active': False})", context) client.model('ir.cron').write(cron_ids, {'active': False}) ssh, sftp = execute.connect(vals['container_fullname'], username=vals['apptype_system_user'], context=context) execute.execute(ssh, [ 'cp', '-R', '/opt/odoo/' + vals['service_parent_name'] + '/filestore/' + vals['base_parent_unique_name_'], '/opt/odoo/' + vals['service_name'] + '/filestore/' + vals['base_unique_name_'] ], context) ssh.close() sftp.close() return res
def update_base(self, cr, uid, vals, context=None): res = super(saas_base, self).update_base(cr, uid, vals, context) context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid}) if vals['apptype_name'] == 'odoo': try: execute.log("client = erppeek.Client('http://" + vals['server_domain'] + ":" + vals['service_options']['port']['hostport'] + "," + "db=" + vals['base_unique_name_'] + "," + "user="******", password="******")", context) client = erppeek.Client('http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport'], db=vals['base_unique_name_'], user=vals['apptype_admin_name'], password=vals['base_admin_passwd']) # execute.log("module_ids = client.model('ir.module.module').search([('state','in',['installed','to upgrade'])])", context) # module_ids = client.model('ir.module.module').search([('state','in',['installed','to upgrade'])]) execute.log("client.upgrade('base')", context) client.upgrade('base') except: pass return res
def deploy_test(self, cr, uid, vals, context=None): res = super(saas_base, self).deploy_test(cr, uid, vals, context) context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid}) if vals['apptype_name'] == 'odoo': execute.log("client = erppeek.Client('http://" + vals['server_domain'] + ":" + vals['service_options']['port']['hostport'] + "," + "db=" + vals['base_unique_name_'] + "," + "user="******", password="******")", context) client = erppeek.Client('http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport'], db=vals['base_unique_name_'], user=vals['apptype_admin_name'], password=vals['base_admin_passwd']) if vals['app_options']['test_install_modules']['value']: modules = vals['app_options']['test_install_modules']['value'].split(',') for module in modules: execute.log("client.install(" + module + ")", context) client.install(module) return
def deploy_create_database(self, cr, uid, vals, context=None): res = super(saas_base, self).deploy_create_database(cr, uid, vals, context) context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid}) if vals['apptype_name'] == 'odoo': ssh, sftp = execute.connect(vals['container_fullname'], username=vals['apptype_system_user'], context=context) execute.execute(ssh, [ 'mkdir', '-p', '/opt/odoo/' + vals['service_name'] + '/filestore/' + vals['base_unique_name_'] ], context) ssh.close() sftp.close() if vals['base_build'] == 'build': #I had to go in /usr/local/lib/python2.7/dist-packages/erppeek.py and replace def create_database line 610. More specifically, db.create and db.get_progress used here aren't working anymore, see why in odoo/services/db.py, check dispatch function. # def create_database(self, passwd, database, demo=False, lang='en_US', # user_password='******'): # thread_id = self.db.create_database(passwd, database, demo, lang, user_password) # self.login('admin', user_password, # database=database) execute.log( "client = erppeek.Client('http://" + vals['server_domain'] + ":" + vals['service_options']['port']['hostport'] + "')", context) client = erppeek.Client( 'http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport']) execute.log( "client.create_database('" + vals['service_db_password'] + "','" + vals['base_unique_name_'] + "'," + "demo=" + str(vals['base_test']) + "," + "lang='" + vals['base_lang'] + "'," + "user_password='******'base_admin_passwd'] + "')", context) client.create_database(vals['service_db_password'], vals['base_unique_name_'], demo=vals['base_test'], lang=vals['base_lang'], user_password=vals['base_admin_passwd']) # cmd = ['/usr/local/bin/erppeek', '--server', 'http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport']] # stdin = ["client.create_database('" + vals['service_db_password'] + "', '" + vals['base_unique_name_'] + "', demo=" + str(vals['base_test']) + ", lang='fr_FR', user_password='******'base_admin_passwd'] + "')"] # execute.execute_local(cmd, context, stdin_arg=stdin) return True return res
def deploy_build(self, cr, uid, vals, context=None): res = super(saas_base, self).deploy_build(cr, uid, vals, context) context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid}) if vals['apptype_name'] == 'seafile': ssh, sftp = execute.connect(vals['container_fullname'], username=vals['apptype_system_user'], context=context) install_args = [ '\n', vals['base_title'] + '\n', vals['base_fulldomain'] + '\n', '\n', '\n', '\n', '\n', '2\n', 'mysql\n', '\n', vals['service_db_user'] + '\n', vals['service_db_password'] + '\n', vals['base_databases']['ccnet'] + '\n', vals['base_databases']['seafile'] + '\n', vals['base_databases']['seahub'] + '\n', '\n' ] seahub_args = [ vals['apptype_admin_email'] + '\n', vals['base_admin_passwd'] + '\n', vals['base_admin_passwd'] + '\n' ] if not vals['base_options']['manual_install']['value']: #Be cautious, the install may crash because of the server name (title). Use only alphanumeric, less than 15 letter without space execute.execute(ssh, ['./setup-seafile-mysql.sh'], context, stdin_arg=install_args, path=vals['service_full_localpath_files']) execute.execute(ssh, [ vals['service_full_localpath_files'] + '/seafile.sh', 'start' ], context) execute.execute(ssh, [ vals['service_full_localpath_files'] + '/seahub.sh', 'start' ], context, stdin_arg=seahub_args) else: for arg in install_args: execute.log(arg, context) for arg in seahub_args: execute.log(arg, context) return res
def post_reset(self, cr, uid, vals, context=None): res = super(saas_base, self).post_reset(cr, uid, vals, context) context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid}) if vals['apptype_name'] == 'odoo': execute.log("client = erppeek.Client('http://" + vals['server_domain'] + ":" + vals['service_options']['port']['hostport'] + "," + "db=" + vals['base_unique_name_'] + "," + "user="******", password="******")", context) client = erppeek.Client('http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport'], db=vals['base_unique_name_'], user=vals['apptype_admin_name'], password=vals['base_admin_passwd']) execute.log("server_id = client.model('ir.model.data').get_object_reference('base', 'ir_mail_server_localhost0')[1]", context) server_id = client.model('ir.model.data').get_object_reference('base', 'ir_mail_server_localhost0')[1] execute.log("client.model('ir.mail_server').write([" + str(server_id) + "], {'smtp_host': 'mail.disabled.lol'})", context) client.model('ir.mail_server').write([server_id], {'smtp_host': 'mail.disabled.lol'}) execute.log("cron_ids = client.model('ir.cron').search(['|',('active','=',True),('active','=',False)])", context) cron_ids = client.model('ir.cron').search(['|',('active','=',True),('active','=',False)]) execute.log("client.model('ir.cron').write(" + str(cron_ids) +", {'active': False})", context) client.model('ir.cron').write(cron_ids, {'active': False}) ssh, sftp = execute.connect(vals['container_fullname'], username=vals['apptype_system_user'], context=context) execute.execute(ssh, ['cp', '-R', '/opt/odoo/' + vals['service_parent_name'] + '/filestore/' + vals['base_parent_unique_name_'], '/opt/odoo/' + vals['service_name'] + '/filestore/' + vals['base_unique_name_']], context) ssh.close() sftp.close() return res
def deploy_build(self, cr, uid, vals, context=None): res = super(saas_base, self).deploy_build(cr, uid, vals, context) context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid}) if vals['apptype_name'] == 'seafile': ssh, sftp = execute.connect(vals['container_fullname'], username=vals['apptype_system_user'], context=context) install_args = ['\n', vals['base_title'] + '\n', vals['base_fulldomain'] + '\n', '\n','\n','\n','\n', '2\n', 'mysql\n', '\n', vals['service_db_user'] + '\n', vals['service_db_password'] + '\n', vals['base_databases']['ccnet'] + '\n', vals['base_databases']['seafile'] + '\n', vals['base_databases']['seahub'] + '\n', '\n'] seahub_args = [vals['apptype_admin_email'] + '\n', vals['base_admin_passwd'] + '\n', vals['base_admin_passwd'] + '\n'] if not vals['base_options']['manual_install']['value']: #Be cautious, the install may crash because of the server name (title). Use only alphanumeric, less than 15 letter without space execute.execute(ssh, ['./setup-seafile-mysql.sh'],context, stdin_arg=install_args, path=vals['service_full_localpath_files']) execute.execute(ssh, [vals['service_full_localpath_files'] + '/seafile.sh', 'start'], context) execute.execute(ssh, [vals['service_full_localpath_files'] + '/seahub.sh', 'start'], context, stdin_arg=seahub_args) else: for arg in install_args: execute.log(arg, context) for arg in seahub_args: execute.log(arg, context) return res
def deploy_link(self, cr, uid, vals, context={}): super(saas_base_link, self).deploy_link(cr, uid, vals, context=context) if vals['link_target_app_code'] == 'postfix' and vals['apptype_name'] == 'odoo': try: execute.log("client = erppeek.Client('http://" + vals['server_domain'] + ":" + vals['service_options']['port']['hostport'] + "," + "db=" + vals['base_unique_name_'] + "," + "user="******", password="******")", context) client = erppeek.Client('http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport'], db=vals['base_unique_name_'], user=vals['apptype_admin_name'], password=vals['base_admin_passwd']) execute.log("server_id = client.model('ir.model.data').get_object_reference('base', 'ir_mail_server_localhost0')[1]", context) server_id = client.model('ir.model.data').get_object_reference('base', 'ir_mail_server_localhost0')[1] execute.log("client.model('ir.mail_server').write([" + str(server_id) + "], {'name': 'postfix', 'smtp_host': 'postfix'})", context) client.model('ir.mail_server').write([server_id], {'name': 'postfix', 'smtp_host': 'postfix'}) except: pass ssh, sftp = execute.connect(vals['link_target_container_fullname'], context=context) execute.execute(ssh, ['sed', '-i', '"/^mydestination =/ s/$/, ' + vals['base_fulldomain'] + '/"', '/etc/postfix/main.cf'], context) execute.execute(ssh, ['echo "@' + vals['base_fulldomain'] + ' ' + vals['base_unique_name_'] + '@localhost" >> /etc/postfix/virtual_aliases'], context) execute.execute(ssh, ['postmap', '/etc/postfix/virtual_aliases'], context) execute.execute(ssh, ["echo '" + vals['base_unique_name_'] + ": \"|openerp_mailgate.py --host=" + vals['server_domain'] + " --port=" + vals['service_options']['port']['hostport'] + " -u 1 -p " + vals['base_admin_passwd'] + " -d " + vals['base_unique_name_'] + "\"' >> /etc/aliases"], context) execute.execute(ssh, ['newaliases'], context) execute.execute(ssh, ['/etc/init.d/postfix', 'reload'], context) ssh.close() sftp.close()
def deploy_create_poweruser(self, cr, uid, vals, context=None): res = super(saas_base, self).deploy_create_poweruser(cr, uid, vals, context) context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid}) if vals['apptype_name'] == 'odoo': if vals['base_poweruser_name'] and vals['base_poweruser_email'] and vals['apptype_admin_name'] != vals['base_poweruser_name']: execute.log("client = erppeek.Client('http://" + vals['server_domain'] + ":" + vals['service_options']['port']['hostport'] + "," + "db=" + vals['base_unique_name_'] + "," + "user="******", password="******")", context) client = erppeek.Client('http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport'], db=vals['base_unique_name_'], user=vals['apptype_admin_name'], password=vals['base_admin_passwd']) if vals['base_test']: execute.log("demo_id = client.model('ir.model.data').get_object_reference('base', 'user_demo')[1]", context) demo_id = client.model('ir.model.data').get_object_reference('base', 'user_demo')[1] execute.log("client.model('res.users').write([" + str(demo_id) + "], {'login': '******', 'password': '******'})", context) client.model('res.users').write([demo_id], {'login': '******', 'password': '******'}) execute.log("user_id = client.model('res.users').create({'login':'******'base_poweruser_email'] + "', 'name':'" + vals['base_poweruser_name'] + "', 'email':'" + vals['base_poweruser_email'] + "', 'password':'******'base_poweruser_password'] + "'})", context) user = client.model('res.users').create({'login': vals['base_poweruser_email'], 'name': vals['base_poweruser_name'], 'email': vals['base_poweruser_email'], 'password': vals['base_poweruser_password']}) if vals['app_options']['poweruser_group']['value']: group = vals['app_options']['poweruser_group']['value'].split('.') execute.log("group_id = client.model('ir.model.data').get_object_reference('" + group[0] + "','" + group[1] + "')[1]", context) group_id = client.model('ir.model.data').get_object_reference(group[0], group[1])[1] execute.log("client.model('res.groups').write([" + str(group_id) + "], {'users': [(4, " + str(user.id) + ")]})", context) client.model('res.groups').write([group_id], {'users': [(4, user.id)]}) return res
def deploy_post(self, cr, uid, vals, context=None): res = super(saas_base, self).deploy_post(cr, uid, vals, context) context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid}) if vals['apptype_name'] == 'odoo': execute.log("client = erppeek.Client('http://" + vals['server_domain'] + ":" + vals['service_options']['port']['hostport'] + "," + "db=" + vals['base_unique_name_'] + "," + "user="******", password="******")", context) client = erppeek.Client('http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport'], db=vals['base_unique_name_'], user=vals['apptype_admin_name'], password=vals['base_admin_passwd']) execute.log("company_id = client.model('ir.model.data').get_object_reference('base', 'main_company')[1]", context) company_id = client.model('ir.model.data').get_object_reference('base', 'main_company')[1] execute.log("client.model('res.company').write([" + str(company_id) + "], {'name':" + vals['base_title'] + "})", context) client.model('res.company').write([company_id], {'name': vals['base_title']}) execute.log("config_ids = client.model('ir.config_parameter').search([('key','=','web.base.url')])", context) config_ids = client.model('ir.config_parameter').search([('key','=','web.base.url')]) if config_ids: execute.log("client.model('ir.config_parameter').write(" + str(config_ids) + ", {'value': 'http://" + vals['base_fulldomain'] + "})", context) client.model('ir.config_parameter').write(config_ids, {'value': 'http://' + vals['base_fulldomain']}) else: execute.log("client.model('ir.config_parameter').create({'key': 'web.base.url', 'value': 'http://" + vals['base_fulldomain'] + "})", context) client.model('ir.config_parameter').create({'key': 'web.base.url', 'value': 'http://' + vals['base_fulldomain']}) execute.log("config_ids = client.model('ir.config_parameter').search([('key','=','ir_attachment.location')])", context) config_ids = client.model('ir.config_parameter').search([('key','=','ir_attachment.location')]) if config_ids: execute.log("client.model('ir.config_parameter').write(" + str(config_ids) + ", {'value': 'file:///filestore'})", context) client.model('ir.config_parameter').write(config_ids, {'value': 'file:///filestore'}) else: execute.log("client.model('ir.config_parameter').create({'key': 'ir_attachment.location', 'value': 'file:///filestore'})", context) client.model('ir.config_parameter').create({'key': 'ir_attachment.location', 'value': 'file:///filestore'})
def deploy_build(self, cr, uid, vals, context=None): res = super(saas_base, self).deploy_build(cr, uid, vals, context) context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid}) if vals['apptype_name'] == 'odoo': execute.log("client = erppeek.Client('http://" + vals['server_domain'] + ":" + vals['service_options']['port']['hostport'] + "," + "db=" + vals['base_unique_name_'] + "," + "user='******', password="******")", context) client = erppeek.Client('http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport'], db=vals['base_unique_name_'], user='******', password=vals['base_admin_passwd']) execute.log("admin_id = client.model('ir.model.data').get_object_reference('base', 'user_root')[1]", context) admin_id = client.model('ir.model.data').get_object_reference('base', 'user_root')[1] execute.log("client.model('res.users').write([" + str(admin_id) + "], {'login': "******"})", context) client.model('res.users').write([admin_id], {'login': vals['apptype_admin_name']}) execute.log("extended_group_id = client.model('ir.model.data').get_object_reference('base', 'group_no_one')[1]", context) extended_group_id = client.model('ir.model.data').get_object_reference('base', 'group_no_one')[1] execute.log("client.model('res.groups').write([" + str(extended_group_id) + "], {'users': [(4, 1)]})", context) client.model('res.groups').write([extended_group_id], {'users': [(4, 1)]}) if vals['app_options']['default_account_chart']['value'] or vals['base_options']['account_chart']['value']: account_chart = vals['base_options']['account_chart']['value'] or vals['app_options']['default_account_chart']['value'] execute.log("client.install('account_accountant', 'account_chart_install', '" + account_chart + "')", context) client.install('account_accountant', 'account_chart_install', account_chart) execute.log("client.execute('account.chart.template', 'install_chart', '" + account_chart + "', '" + account_chart + "_pcg_chart_template', 1, 1)", context) client.execute('account.chart.template', 'install_chart', account_chart, account_chart + '_pcg_chart_template', 1, 1) if vals['app_options']['install_modules']['value']: modules = vals['app_options']['install_modules']['value'].split(',') for module in modules: execute.log("client.install(" + module + ")", context) client.install(module) return res
def deploy_build(self, cr, uid, vals, context=None): res = super(saas_base, self).deploy_build(cr, uid, vals, context) context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid}) if vals['apptype_name'] == 'odoo': execute.log( "client = erppeek.Client('http://" + vals['server_domain'] + ":" + vals['service_options']['port']['hostport'] + "," + "db=" + vals['base_unique_name_'] + "," + "user='******', password="******")", context) client = erppeek.Client( 'http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport'], db=vals['base_unique_name_'], user='******', password=vals['base_admin_passwd']) execute.log( "admin_id = client.model('ir.model.data').get_object_reference('base', 'user_root')[1]", context) admin_id = client.model('ir.model.data').get_object_reference( 'base', 'user_root')[1] execute.log( "client.model('res.users').write([" + str(admin_id) + "], {'login': "******"})", context) client.model('res.users').write( [admin_id], {'login': vals['apptype_admin_name']}) execute.log( "extended_group_id = client.model('ir.model.data').get_object_reference('base', 'group_no_one')[1]", context) extended_group_id = client.model( 'ir.model.data').get_object_reference('base', 'group_no_one')[1] execute.log( "client.model('res.groups').write([" + str(extended_group_id) + "], {'users': [(4, 1)]})", context) client.model('res.groups').write([extended_group_id], {'users': [(4, 1)]}) if vals['app_options']['default_account_chart']['value'] or vals[ 'base_options']['account_chart']['value']: account_chart = vals['base_options']['account_chart'][ 'value'] or vals['app_options']['default_account_chart'][ 'value'] execute.log( "client.install('account_accountant', 'account_chart_install', '" + account_chart + "')", context) client.install('account_accountant', 'account_chart_install', account_chart) execute.log( "client.execute('account.chart.template', 'install_chart', '" + account_chart + "', '" + account_chart + "_pcg_chart_template', 1, 1)", context) client.execute('account.chart.template', 'install_chart', account_chart, account_chart + '_pcg_chart_template', 1, 1) if vals['app_options']['install_modules']['value']: modules = vals['app_options']['install_modules'][ 'value'].split(',') for module in modules: execute.log("client.install(" + module + ")", context) client.install(module) return res
def deploy_create_poweruser(self, cr, uid, vals, context=None): res = super(saas_base, self).deploy_create_poweruser(cr, uid, vals, context) context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid}) if vals['apptype_name'] == 'odoo': if vals['base_poweruser_name'] and vals[ 'base_poweruser_email'] and vals[ 'apptype_admin_name'] != vals['base_poweruser_name']: execute.log( "client = erppeek.Client('http://" + vals['server_domain'] + ":" + vals['service_options']['port']['hostport'] + "," + "db=" + vals['base_unique_name_'] + "," + "user="******", password="******")", context) client = erppeek.Client( 'http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport'], db=vals['base_unique_name_'], user=vals['apptype_admin_name'], password=vals['base_admin_passwd']) if vals['base_test']: execute.log( "demo_id = client.model('ir.model.data').get_object_reference('base', 'user_demo')[1]", context) demo_id = client.model( 'ir.model.data').get_object_reference( 'base', 'user_demo')[1] execute.log( "client.model('res.users').write([" + str(demo_id) + "], {'login': '******', 'password': '******'})", context) client.model('res.users').write([demo_id], { 'login': '******', 'password': '******' }) execute.log( "user_id = client.model('res.users').create({'login':'******'base_poweruser_email'] + "', 'name':'" + vals['base_poweruser_name'] + "', 'email':'" + vals['base_poweruser_email'] + "', 'password':'******'base_poweruser_password'] + "'})", context) user = client.model('res.users').create({ 'login': vals['base_poweruser_email'], 'name': vals['base_poweruser_name'], 'email': vals['base_poweruser_email'], 'password': vals['base_poweruser_password'] }) if vals['app_options']['poweruser_group']['value']: group = vals['app_options']['poweruser_group'][ 'value'].split('.') execute.log( "group_id = client.model('ir.model.data').get_object_reference('" + group[0] + "','" + group[1] + "')[1]", context) group_id = client.model( 'ir.model.data').get_object_reference( group[0], group[1])[1] execute.log( "client.model('res.groups').write([" + str(group_id) + "], {'users': [(4, " + str(user.id) + ")]})", context) client.model('res.groups').write([group_id], {'users': [(4, user.id)]}) return res
def deploy_post(self, cr, uid, vals, context=None): res = super(saas_base, self).deploy_post(cr, uid, vals, context) context.update({'saas-self': self, 'saas-cr': cr, 'saas-uid': uid}) if vals['apptype_name'] == 'odoo': execute.log( "client = erppeek.Client('http://" + vals['server_domain'] + ":" + vals['service_options']['port']['hostport'] + "," + "db=" + vals['base_unique_name_'] + "," + "user="******", password="******")", context) client = erppeek.Client( 'http://' + vals['server_domain'] + ':' + vals['service_options']['port']['hostport'], db=vals['base_unique_name_'], user=vals['apptype_admin_name'], password=vals['base_admin_passwd']) execute.log( "company_id = client.model('ir.model.data').get_object_reference('base', 'main_company')[1]", context) company_id = client.model('ir.model.data').get_object_reference( 'base', 'main_company')[1] execute.log( "client.model('res.company').write([" + str(company_id) + "], {'name':" + vals['base_title'] + "})", context) client.model('res.company').write([company_id], {'name': vals['base_title']}) execute.log( "config_ids = client.model('ir.config_parameter').search([('key','=','web.base.url')])", context) config_ids = client.model('ir.config_parameter').search([ ('key', '=', 'web.base.url') ]) if config_ids: execute.log( "client.model('ir.config_parameter').write(" + str(config_ids) + ", {'value': 'http://" + vals['base_fulldomain'] + "})", context) client.model('ir.config_parameter').write( config_ids, {'value': 'http://' + vals['base_fulldomain']}) else: execute.log( "client.model('ir.config_parameter').create({'key': 'web.base.url', 'value': 'http://" + vals['base_fulldomain'] + "})", context) client.model('ir.config_parameter').create({ 'key': 'web.base.url', 'value': 'http://' + vals['base_fulldomain'] }) execute.log( "config_ids = client.model('ir.config_parameter').search([('key','=','ir_attachment.location')])", context) config_ids = client.model('ir.config_parameter').search([ ('key', '=', 'ir_attachment.location') ]) if config_ids: execute.log( "client.model('ir.config_parameter').write(" + str(config_ids) + ", {'value': 'file:///filestore'})", context) client.model('ir.config_parameter').write( config_ids, {'value': 'file:///filestore'}) else: execute.log( "client.model('ir.config_parameter').create({'key': 'ir_attachment.location', 'value': 'file:///filestore'})", context) client.model('ir.config_parameter').create({ 'key': 'ir_attachment.location', 'value': 'file:///filestore' })