Merge branch 'develop' of ssh://gitlab.datenpol.at:122/odoo/tz-austria into develop

develop
Andreas Brückl 2017-11-27 14:16:17 +01:00
commit ebc1abc7cb
7 changed files with 59 additions and 8 deletions

View File

@ -31,7 +31,8 @@
(4,ref('sales_team.group_sale_manager')),
(4,ref('stock.group_stock_manager')),
(4,ref('base.group_system')),
(4,ref('base.group_partner_manager'))]"/>
(4,ref('base.group_partner_manager')),
(4,ref('account.group_account_user'))]"/>
</record>
<!--<function-->

View File

@ -11,7 +11,8 @@
(4,ref('sales_team.group_sale_manager')),
(4,ref('stock.group_stock_manager')),
(4,ref('base.group_system')),
(4,ref('base.group_partner_manager'))]"/>
(4,ref('base.group_partner_manager')),
(4,ref('account.group_account_user'))]"/>
</record>
</odoo>

View File

@ -117,6 +117,8 @@ def main():
#'stock_set_cost_method',
#'set_incoterms',
'set_company',
'enable_res_config_for_company', # muss bei multicompany ausgefuehrt werden
'set_multicompany_data', # set_multicompany_data
'set_uom',
'set_taxes',
'set_fiscal_position',

View File

@ -128,6 +128,7 @@ class Config():
'web_environment_ribbon',
'web_no_bubble',
'report_intrastat',
'dp_sale_hide_discount'
]

View File

@ -79,3 +79,7 @@ class ConfigGlaser(Config):
# },
}
self.multi_company_settings = {
'chart_template_id': ('xmlid', 'l10n_at.austria_chart_template')
}

View File

@ -31,7 +31,9 @@ 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', 'admin', 'x', 'admin'),
'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'),
# Remote environments are always listed without passwords!

View File

@ -93,6 +93,37 @@ class DatenpolFunctions:
vals['country_id'] = country_id
return self.odoo.env.ref(self.config.company_xmlid).write(vals)
def enable_res_config_for_company(self):
"""Setze beim portal_template_user die Company als zulässiges Unternehmen"""
portal_template_user = self.odoo.env.ref('auth_signup.default_template_user')
vals = {}
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"""
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"""
@ -745,6 +776,7 @@ class DatenpolFunctions:
def consume_tours(self):
"""Odoo-Touren auf konsumiert setzen"""
web_tour_obj = self.odoo.env['web_tour.tour']
tours = [
'crm_tour',
@ -758,13 +790,21 @@ class DatenpolFunctions:
'event',
]
already_set_tours = []
for uid in self.odoo.env['res.users'].search([]):
user_webtours = web_tour_obj.browse(web_tour_obj.search([('name', 'in', tours), ('user_id', '=', uid)]))
for user_webtour in user_webtours:
if user_webtour.name in tours:
already_set_tours.append(user_webtour.name)
for t in tours:
vals = {
'name': t,
'user_id': uid,
}
self.odoo.env['web_tour.tour'].create(vals)
if t not in already_set_tours:
vals = {
'name': t,
'user_id': uid,
}
web_tour_obj.create(vals)
already_set_tours = []
return True