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-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()),
'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"""
portal_template_user = self.odoo.env.ref('auth_signup.default_template_user')
vals = {}
if self.odoo.env.ref(self.config.company_xmlid) not in portal_template_user.company_ids:
vals = {'company_ids': [(4, self.odoo.env.ref(self.config.company_xmlid).id)]}
companies = self.odoo.env['res.company'].search([])
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)
def set_multicompany_data(self):
"""Multicompany Systemeinstellungen konfigurieren"""
res_settings = self.odoo.env['res.config.settings']
vals = res_settings.default_get([])
newvals = {}
for key, value in self.config.multi_company_settings.items():
if isinstance(value, tuple):
if value[0] == 'xmlid':
newvals.update({key: self.odoo.env.ref(value[1]).id})
else:
newvals.update({key: value})
vals.update(newvals)
wizard_id = res_settings.create(vals)
return res_settings.browse(wizard_id).execute()
if hasattr(self.config, 'multi_company_settings'):
res_settings = self.odoo.env['res.config.settings']
vals = res_settings.default_get([])
newvals = {}
for key, value in self.config.multi_company_settings.items():
if isinstance(value, tuple):
if value[0] == 'xmlid':
newvals.update({key: self.odoo.env.ref(value[1]).id})
else:
newvals.update({key: value})
vals.update(newvals)
wizard_id = res_settings.create(vals)
return res_settings.browse(wizard_id).execute()
return True
def load_languages(self):
"""Lade zusätzliche Sprachen"""