diff --git a/ext/custom-addons/dp_custom/data/glaser_company_data.xml b/ext/custom-addons/dp_custom/data/glaser_company_data.xml index 15222c20..d8de0f1c 100644 --- a/ext/custom-addons/dp_custom/data/glaser_company_data.xml +++ b/ext/custom-addons/dp_custom/data/glaser_company_data.xml @@ -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'))]"/> diff --git a/ext/custom-addons/dp_custom/data/tz_austria_company_data.xml b/ext/custom-addons/dp_custom/data/tz_austria_company_data.xml index b9d43ca2..5b8cafe9 100644 --- a/ext/custom-addons/dp_custom/data/tz_austria_company_data.xml +++ b/ext/custom-addons/dp_custom/data/tz_austria_company_data.xml @@ -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'))]"/> diff --git a/setup/lib/cli.py b/setup/lib/cli.py index 41ea240f..e1986a2d 100755 --- a/setup/lib/cli.py +++ b/setup/lib/cli.py @@ -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', diff --git a/setup/lib/config.py b/setup/lib/config.py index 9ac53d61..fc492c3f 100644 --- a/setup/lib/config.py +++ b/setup/lib/config.py @@ -128,6 +128,7 @@ class Config(): 'web_environment_ribbon', 'web_no_bubble', 'report_intrastat', + 'dp_sale_hide_discount' ] diff --git a/setup/lib/config_glaser.py b/setup/lib/config_glaser.py index cd1120dd..d5e3ff7f 100644 --- a/setup/lib/config_glaser.py +++ b/setup/lib/config_glaser.py @@ -79,3 +79,7 @@ class ConfigGlaser(Config): # }, } + self.multi_company_settings = { + 'chart_template_id': ('xmlid', 'l10n_at.austria_chart_template') + } + diff --git a/setup/lib/environments.py b/setup/lib/environments.py index a6a5f420..2c831f95 100644 --- a/setup/lib/environments.py +++ b/setup/lib/environments.py @@ -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! diff --git a/setup/lib/functions.py b/setup/lib/functions.py index acac9212..6943e18b 100644 --- a/setup/lib/functions.py +++ b/setup/lib/functions.py @@ -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