From 99a7b88ee2d7e09731d37b35a44565b2cf8aafe8 Mon Sep 17 00:00:00 2001 From: Ahmed Aly Date: Mon, 27 Nov 2017 13:10:46 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Feedback=201099:=20Account=5FSetup=20f?= =?UTF-8?q?=C3=BCr=20Glaser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dp_custom/data/glaser_company_data.xml | 3 ++- .../data/tz_austria_company_data.xml | 3 ++- setup/lib/cli.py | 2 ++ setup/lib/config.py | 1 + setup/lib/config_glaser.py | 4 ++++ setup/lib/environments.py | 3 ++- setup/lib/functions.py | 24 +++++++++++++++++++ 7 files changed, 37 insertions(+), 3 deletions(-) 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 bc15bbbc..b63fb620 100644 --- a/setup/lib/config.py +++ b/setup/lib/config.py @@ -125,6 +125,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..8c641f5f 100644 --- a/setup/lib/environments.py +++ b/setup/lib/environments.py @@ -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', 'admin', 'x', 'admin'), + 'aa': 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..dd680f15 100644 --- a/setup/lib/functions.py +++ b/setup/lib/functions.py @@ -93,6 +93,30 @@ 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 = {} + 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)]} + + 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() + def load_languages(self): """Lade zusätzliche Sprachen""" From 549beeb41e65a02aa9341517a153c7f2a370c051 Mon Sep 17 00:00:00 2001 From: Ahmed Aly Date: Mon, 27 Nov 2017 13:40:58 +0100 Subject: [PATCH 2/3] config_at: Konsumiere Tour erstellt jetzt nur ein Eintrag pro User und Tour --- setup/lib/functions.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/setup/lib/functions.py b/setup/lib/functions.py index dd680f15..36077f76 100644 --- a/setup/lib/functions.py +++ b/setup/lib/functions.py @@ -769,6 +769,7 @@ class DatenpolFunctions: def consume_tours(self): """Odoo-Touren auf konsumiert setzen""" + web_tour_obj = self.odoo.env['web_tour.tour'] tours = [ 'crm_tour', @@ -782,13 +783,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 From 757ac884edbefb4a4447d05911f2241131329741 Mon Sep 17 00:00:00 2001 From: Ahmed Aly Date: Mon, 27 Nov 2017 14:12:31 +0100 Subject: [PATCH 3/3] multicompany dp_script functions fix --- setup/lib/environments.py | 3 ++- setup/lib/functions.py | 35 +++++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/setup/lib/environments.py b/setup/lib/environments.py index 8c641f5f..2c831f95 100644 --- a/setup/lib/environments.py +++ b/setup/lib/environments.py @@ -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'), diff --git a/setup/lib/functions.py b/setup/lib/functions.py index 36077f76..6943e18b 100644 --- a/setup/lib/functions.py +++ b/setup/lib/functions.py @@ -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"""