multicompany dp_script functions fix

develop
Ahmed Aly 2017-11-27 14:12:31 +01:00
parent 549beeb41e
commit 757ac884ed
2 changed files with 23 additions and 15 deletions

View File

@ -31,7 +31,8 @@ ENVIRONMENTS = {
'br': Environment('http://localhost', '8080', 'tz-austria_1', 'tz-admin', 'x', 'admin', config=ConfigTZA()), 'br': Environment('http://localhost', '8080', 'tz-austria_1', 'tz-admin', 'x', 'admin', config=ConfigTZA()),
'br-glaser': Environment('http://localhost', '8080', 'tz-austria_1', 'glaser-admin', 'x', 'admin', config=ConfigGlaser()), 'br-glaser': Environment('http://localhost', '8080', 'tz-austria_1', 'glaser-admin', 'x', 'admin', config=ConfigGlaser()),
'aa': Environment('http://localhost', '8080', 'tz-austria_1', 'tz-admin', 'x', 'admin', config=ConfigTZA()), 'aa': Environment('http://localhost', '8080', 'tz-austria_1', 'admin', 'x', 'admin', config=ConfigTZA()),
'aa-tz': Environment('http://localhost', '8080', 'tz-austria_1', 'tz-admin', 'x', 'admin', config=ConfigTZA()),
'aa-glaser': Environment('http://localhost', '8080', 'tz-austria_1', 'glaser-admin', 'x', 'admin', config=ConfigGlaser()), 'aa-glaser': Environment('http://localhost', '8080', 'tz-austria_1', 'glaser-admin', 'x', 'admin', config=ConfigGlaser()),
'oa': Environment('http://localhost', '8080', 'tz-austria_1', 'admin', 'x', 'admin'), 'oa': Environment('http://localhost', '8080', 'tz-austria_1', 'admin', 'x', 'admin'),

View File

@ -97,25 +97,32 @@ class DatenpolFunctions:
"""Setze beim portal_template_user die Company als zulässiges Unternehmen""" """Setze beim portal_template_user die Company als zulässiges Unternehmen"""
portal_template_user = self.odoo.env.ref('auth_signup.default_template_user') portal_template_user = self.odoo.env.ref('auth_signup.default_template_user')
vals = {} vals = {}
if self.odoo.env.ref(self.config.company_xmlid) not in portal_template_user.company_ids: companies = self.odoo.env['res.company'].search([])
vals = {'company_ids': [(4, self.odoo.env.ref(self.config.company_xmlid).id)]} vals_company = []
for company in companies:
if company not in portal_template_user.company_ids.ids:
vals_company.append((4, company))
vals = {'company_ids': vals_company}
return portal_template_user.write(vals) return portal_template_user.write(vals)
def set_multicompany_data(self): def set_multicompany_data(self):
"""Multicompany Systemeinstellungen konfigurieren""" """Multicompany Systemeinstellungen konfigurieren"""
res_settings = self.odoo.env['res.config.settings'] if hasattr(self.config, 'multi_company_settings'):
vals = res_settings.default_get([]) res_settings = self.odoo.env['res.config.settings']
newvals = {} vals = res_settings.default_get([])
for key, value in self.config.multi_company_settings.items(): newvals = {}
if isinstance(value, tuple): for key, value in self.config.multi_company_settings.items():
if value[0] == 'xmlid': if isinstance(value, tuple):
newvals.update({key: self.odoo.env.ref(value[1]).id}) if value[0] == 'xmlid':
else: newvals.update({key: self.odoo.env.ref(value[1]).id})
newvals.update({key: value}) else:
vals.update(newvals) newvals.update({key: value})
wizard_id = res_settings.create(vals) vals.update(newvals)
return res_settings.browse(wizard_id).execute() wizard_id = res_settings.create(vals)
return res_settings.browse(wizard_id).execute()
return True
def load_languages(self): def load_languages(self):
"""Lade zusätzliche Sprachen""" """Lade zusätzliche Sprachen"""