diff --git a/dev/INSTANCE Update cam_custom.launch b/dev/INSTANCE Update cam_custom.launch deleted file mode 100644 index 8d50033c..00000000 --- a/dev/INSTANCE Update cam_custom.launch +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/dev/Server.launch b/dev/Server.launch deleted file mode 100644 index 42252cac..00000000 --- a/dev/Server.launch +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/dev/odoo-server-dev-ha.conf b/dev/odoo-server-dev-ha.conf deleted file mode 100644 index abad481e..00000000 --- a/dev/odoo-server-dev-ha.conf +++ /dev/null @@ -1,15 +0,0 @@ -[options] - -xmlrpc_port = 8080 -; This is the password that allows database operations: -; admin_passwd = admin -db_host = False -db_port = 5432 -db_user = False -db_password = False - -addons_path = ext/odoo/addons,ext/custom-addons,dmi/run1 -timezone = Europe/Brussels - -#dbfilter_test = ['.*',] -show_debug = 1 \ No newline at end of file diff --git a/dev/odoo-server-dev-sk.conf b/dev/odoo-server-dev-sk.conf deleted file mode 100644 index abad481e..00000000 --- a/dev/odoo-server-dev-sk.conf +++ /dev/null @@ -1,15 +0,0 @@ -[options] - -xmlrpc_port = 8080 -; This is the password that allows database operations: -; admin_passwd = admin -db_host = False -db_port = 5432 -db_user = False -db_password = False - -addons_path = ext/odoo/addons,ext/custom-addons,dmi/run1 -timezone = Europe/Brussels - -#dbfilter_test = ['.*',] -show_debug = 1 \ No newline at end of file diff --git a/dev/odoo-server-dev-br.conf b/dev/odoo-server-dev-xx.conf similarity index 100% rename from dev/odoo-server-dev-br.conf rename to dev/odoo-server-dev-xx.conf diff --git a/dmi/run1/cam_dmi/__init__.py b/dmi/run1/dp_dmi/__init__.py similarity index 100% rename from dmi/run1/cam_dmi/__init__.py rename to dmi/run1/dp_dmi/__init__.py diff --git a/dmi/run1/cam_dmi/__openerp__.py b/dmi/run1/dp_dmi/__openerp__.py similarity index 100% rename from dmi/run1/cam_dmi/__openerp__.py rename to dmi/run1/dp_dmi/__openerp__.py diff --git a/dmi/run1/cam_dmi/res.users.csv b/dmi/run1/dp_dmi/res.users.csv similarity index 100% rename from dmi/run1/cam_dmi/res.users.csv rename to dmi/run1/dp_dmi/res.users.csv diff --git a/dmi/run1/cam_dmi/static/description/icon.png b/dmi/run1/dp_dmi/static/description/icon.png similarity index 100% rename from dmi/run1/cam_dmi/static/description/icon.png rename to dmi/run1/dp_dmi/static/description/icon.png diff --git a/patches/gevent_eclipse_patch.patch b/patches/gevent_eclipse_patch.patch deleted file mode 100644 index 0ada5b26..00000000 --- a/patches/gevent_eclipse_patch.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ext/odoo/odoo-dev.py 2015-04-08 10:11:02.000000000 +0200 -+++ ext/odoo/odoo-dev.py 2015-04-08 10:11:02.000000000 +0200 -@@ -0,0 +1,10 @@ -+#!/usr/bin/env python -+import sys -+if sys.modules.get("gevent") is not None: -+ del sys.modules['gevent'] -+import openerp -+ -+if __name__ == "__main__": -+ openerp.cli.main() -+ -+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/patches/report_header.patch b/patches/report_header.patch deleted file mode 100644 index 3b9c7d53..00000000 --- a/patches/report_header.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ext/odoo/openerp/report/report_sxw.py 2015-04-15 12:18:30.132784074 +0200 -+++ ext/odoo/openerp/report/report_sxw.py 2015-04-15 11:48:21.743518606 +0200 -@@ -476,6 +476,8 @@ - processed_rml = etree.XML(rml) - if report_xml.use_global_header: - rml_parser._add_header(processed_rml, self.header) -+ else: -+ rml_parser._add_header(processed_rml, 'internal') - processed_rml = self.preprocess_rml(processed_rml,report_xml.report_type) - if rml_parser.logo: - logo = base64.decodestring(rml_parser.logo) \ No newline at end of file diff --git a/patches/rml_align.patch b/patches/rml_align.patch deleted file mode 100644 index 4a688bf1..00000000 --- a/patches/rml_align.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ext/odoo/openerp/report/render/rml2pdf/trml2pdf.py 2014-01-14 14:18:12.302306370 +0100 -+++ ext/odoo/openerp/report/render/rml2pdf/trml2pdf.py 2014-01-14 14:18:16.770419846 +0100 -@@ -740,7 +740,7 @@ - rowheights = [utils.unit_get(f.strip()) for f in node.get('rowHeights').split(',')] - if len(rowheights) == 1: - rowheights = rowheights[0] -- table = platypus.LongTable(data = data, colWidths=colwidths, rowHeights=rowheights, **(utils.attr_get(node, ['splitByRow'] ,{'repeatRows':'int','repeatCols':'int'}))) -+ table = platypus.LongTable(data = data, colWidths=colwidths, rowHeights=rowheights, **(utils.attr_get(node, ['splitByRow'] ,{'repeatRows':'int','repeatCols':'int', 'hAlign':'str'}))) - if node.get('style'): - table.setStyle(self.styles.table_styles[node.get('style')]) - for s in styles: diff --git a/setup/cam b/setup/dp similarity index 100% rename from setup/cam rename to setup/dp diff --git a/setup/lib/cli.py b/setup/lib/cli.py index 44026a37..8cf73576 100755 --- a/setup/lib/cli.py +++ b/setup/lib/cli.py @@ -5,18 +5,18 @@ import urlparse from config_at import Config from environments import ENVIRONMENTS, Environment -from functions import CamadeusFunctions +from functions import DatenpolFunctions def main(): def _usage(): - print '\nVerwendung: cam.py [/]\n' + print '\nVerwendung: dp.py [/]\n' print 'Commands:\n' print ' create Neue Datenbank erstellen' print ' create_from_dump Neue Datenbank von Dump erstellen' print ' setup Modulinstallation, Konfigurationen' print ' setup_part setup_function Aufruf eines einzelnen Setup-Schrittes' print ' "setup_part info" listet die verfügbaren Setup-Schritte auf' - print ' rollout Setzt Dokumentnummern, importiert Benutzer, setzt cam_dmi auf noupdate, ...' + print ' rollout Setzt Dokumentnummern, importiert Benutzer, setzt dp_dmi auf noupdate, ...' print ' update module_name Modul updaten' print ' install module_name Modul installieren' print ' uninstall module_name Modul deinstallieren' @@ -35,7 +35,7 @@ def main(): _usage() # RUNBOT - # ./cam runbot create [db] [port] [working-dir] + # ./dp runbot create [db] [port] [working-dir] if argv[0] == 'runbot': import os @@ -67,7 +67,7 @@ def main(): print 'Unbekannte Umgebung' _usage() - instance = CamadeusFunctions(env, config) + instance = DatenpolFunctions(env, config) methods = None @@ -81,8 +81,8 @@ def main(): 'create_db', 'login', 'install_module_sale', - 'setup_accounting', - 'setup_accounting2', + #'setup_accounting', + #'setup_accounting2', 'set_admin_rights', ] @@ -101,32 +101,32 @@ def main(): 'uninstall_chat', 'install_modules', 'set_warehouse', - 'base_config', - 'sale_config', + #'base_config', + #'sale_config', #'finance_config', - 'hr_config', - 'stock_config', - 'mrp_config', - 'stock_set_cost_method', - 'set_incoterms', - 'purchase_config', + #'hr_config', + #'stock_config', + #'mrp_config', + #'stock_set_cost_method', + #'set_incoterms', + #'purchase_config', 'set_date_format', 'set_company', 'set_taxes', 'set_uom', 'set_steuerzuordnung', - 'setup_journals', + #'setup_journals', 'set_currencies', 'set_decimal_price', - 'set_default_values', - 'set_translations', - 'set_default_removal_strategy', - 'default_set_order_policy', - 'delete_mail_server', - 'update_values', - 'update_special_values', + #'set_default_values', + #'set_translations', + #'set_default_removal_strategy', + #'default_set_order_policy', + #'delete_mail_server', + #'update_values', + #'update_special_values', 'set_sys_params', - 'setup_reports', + #'setup_reports', ] if cmd == 'setup': @@ -135,10 +135,10 @@ def main(): if cmd == 'rollout': methods = [ 'login', - 'set_dokumentennummern', - 'set_dmi_noupdate', - 'dmi_confirm_inventory', - 'import_users', + #'set_dokumentennummern', + #'set_dmi_noupdate', + #'dmi_confirm_inventory', + #'import_users', ] if cmd == 'update': diff --git a/setup/lib/config_at.py b/setup/lib/config_at.py index 757b9056..00f1f29b 100644 --- a/setup/lib/config_at.py +++ b/setup/lib/config_at.py @@ -2,7 +2,7 @@ class Config(): def __init__(self): - self.dump_file = 'upgraded_file_name.dump' + self.dump_file = 'odoo_backup.dump' self.module_name = None self.lang = 'de_DE' # de_DE, en_US @@ -14,23 +14,23 @@ class Config(): self.uom_decimals = 3 # Nachkommastellen Mengeneinheiten self.company_data = { - 'name': 'Camadeus GmbH', - 'street': 'Wiedner Hauptstraße 135/B3', + 'name': 'datenpol gmbh', + 'street': 'Lederergasse 32', 'street2': False, - 'city': 'Wien', - 'zip': '1050', - 'phone': '+43 1 78910 96 70', + 'city': 'Linz', + 'zip': '4020', + 'phone': '+43 732 997 035-0', 'fax': False, - 'email': 'office@camadeus.at', - 'website': 'http://www.camadeus.at/', - 'company_registry': '280076b', + 'email': 'office@datenpol.at', + 'website': 'http://www.datenpol.at/', + 'company_registry': '359270p', 'country_id': 'at', # 'de' für Deutschland 'logo': False, - 'vat': 'ATU 62991855', + 'vat': 'ATU 66309611', 'rml_header1': False, 'vat_check_vies': True, 'tax_calculation_rounding_method': 'round_globally', - 'logo': '../ext/custom-addons/cam_custom/static/src/img/logo.png', + 'logo': '../ext/custom-addons/dp_custom/static/src/img/logo.png', } self.mail_server = { @@ -241,8 +241,8 @@ class Config(): ] self.default_values = [ # ir.values - #('product.template', 'type', 'service'), - #('product.template', 'type', 'XML:xmlid'), #mit prefix "XML:" kann eine XML ID übergeben werden + ('product.template', 'type', 'service'), + ('product.template', 'type', 'XML:xmlid'), #mit prefix "XML:" kann eine XML ID übergeben werden ] self.data_updates = { diff --git a/setup/lib/environments.py b/setup/lib/environments.py index 29ab25dc..57534db1 100644 --- a/setup/lib/environments.py +++ b/setup/lib/environments.py @@ -26,11 +26,8 @@ Port: %s ENVIRONMENTS = { # Local environments are listed with passwords 'br': Environment('http://localhost', '8080', 'INSTANCE_1', 'admin', 'x', 'admin'), - 'sk': Environment('http://localhost', '8080', 'INSTANCE_1', 'admin', 'x', 'admin'), - 'ha': Environment('http://localhost', '8080', 'INSTANCE_1', 'admin', 'x', 'admin'), - 'jb': Environment('http://localhost', '8080', 'INSTANCE_1', 'admin', 'x', 'admin'), - 'uk': Environment('http://localhost', '8080', 'INSTANCE_1', 'admin', 'x', 'admin'), + # Remote environments are always listed without passwords! # Do not store them here, you have to type them anyway! - 'test': Environment('https://INSTANCE.camadeus.at', '443', 'INSTANCE_1', 'admin'), + 'test': Environment('https://INSTANCE.datenpol.at', '443', 'INSTANCE_1', 'admin'), } diff --git a/setup/lib/functions.py b/setup/lib/functions.py index 1237b4b8..0b28b55e 100644 --- a/setup/lib/functions.py +++ b/setup/lib/functions.py @@ -8,7 +8,8 @@ import xmlrpclib import requests -class CamadeusFunctions(): + +class DatenpolFunctions(): def __init__(self, environment, config): self.env = environment self.config = config @@ -16,23 +17,22 @@ class CamadeusFunctions(): def create_db(self): """Neue Datenbank erstellen""" - payload = {'fields': [ {'name': 'super_admin_pwd', 'value': self.env.super_admin_pw}, - {'name': 'db_name', 'value': self.env.dbname}, - {'name': 'demo_data', 'value': False}, - {'name': 'db_lang', 'value': self.config.lang}, - {'name': 'create_admin_pwd', 'value': self.env.pwd}, - ] - } - payload = {'params': payload} - json_data = json.dumps(payload) - headers = {'content-type': 'application/json'} - r = requests.post('%s:%s/web/database/create' % (self.env.host, self.env.port), data=json_data, headers=headers, auth=self.env.basic_auth, verify=False) - if r and r.json().get('result', False): - return True - else: - msg = pprint.pformat(r.json().get('error', '????')) - print 'Error occured: %s' % msg + params = { + 'master_pwd': self.env.super_admin_pw, + 'name': self.env.dbname, + 'login': self.env.username, + 'password': self.env.pwd, + 'lang': self.config.lang, + 'country_code': self.config.company_data.get('country_id', 'at'), + } + if self.env.demo: + params.update(demo=1) + + base_url = '%s:%s/web/database/create' % (self.env.host, self.env.port) + res = requests.post(base_url, params=params, verify=False, stream=True) + if not res.ok: return False + return True def create_dump(self): """ Erstelle Odoo-Dump""" @@ -43,9 +43,9 @@ class CamadeusFunctions(): 'backup_pwd': self.env.super_admin_pw, 'token': 'x', } - + res = requests.post(base_url, params=params, verify=False, stream=True) - + if res.headers['Content-Type'].startswith('application/octet-stream'): with open(self.config.dump_file, 'wb') as fh: chunk_size = 100000 @@ -69,12 +69,11 @@ class CamadeusFunctions(): print "\nACHTUNG: Nicht vergessen './cam [env] anonym' auszuführen, sodass es zu keiner Kommunikation mit dem Produktivsystem kommt" return True - def login(self): """Login""" # Get the uid - sock_common = xmlrpclib.ServerProxy ('%s:%s/xmlrpc/common' % (self.env.host, self.env.port)) + sock_common = xmlrpclib.ServerProxy('%s:%s/xmlrpc/common' % (self.env.host, self.env.port)) self.uid = sock_common.login(self.env.dbname, self.env.username, self.env.pwd) if not self.uid: raise Exception('Authentication Error') @@ -84,12 +83,12 @@ class CamadeusFunctions(): def _execute(self, *args): return self.sock.execute(self.env.dbname, self.uid, self.env.pwd, *args) - def _readAndReturnFile(self, filename, encode =''): - fi = open (filename, 'r') + def _readAndReturnFile(self, filename, encode=''): + fi = open(filename, 'r') content = '' - if encode=='': + if encode == '': content = fi.read() - elif encode=='base64': + elif encode == 'base64': content = base64.b64encode(fi.read()) else: sys.exit(-1) @@ -100,7 +99,7 @@ class CamadeusFunctions(): """Setze Unternehmensdaten (Allgemein, RML, Logo)""" vals = self.config.company_data - dummy,country_id = self._execute('ir.model.data', 'get_object_reference', 'base', vals['country_id']) + dummy, country_id = self._execute('ir.model.data', 'get_object_reference', 'base', vals['country_id']) if vals.get('logo', False): vals['logo'] = self._readAndReturnFile(vals['logo'], encode='base64') @@ -195,8 +194,9 @@ class CamadeusFunctions(): if hasattr(self.config, 'incoterms'): terms = self.config.incoterms - for name,code in terms: - existing_ids = self._execute('stock.incoterms', 'search', ['|', ('active', '=', True), ('active', '=', False), ('code', '=', code)]) + for name, code in terms: + existing_ids = self._execute('stock.incoterms', 'search', + ['|', ('active', '=', True), ('active', '=', False), ('code', '=', code)]) if existing_ids: vals = { 'active': True, @@ -210,7 +210,7 @@ class CamadeusFunctions(): } self._execute('stock.incoterms', 'create', vals) - codes = [code for name,code in terms] + codes = [code for name, code in terms] inactive_ids = self._execute('stock.incoterms', 'search', [('code', 'not in', codes)]) self._execute('stock.incoterms', 'write', inactive_ids, {'active': False}) @@ -227,7 +227,8 @@ class CamadeusFunctions(): def install_module_sale(self): """Modul 'Sale' installieren""" - modules_to_install = self._execute('ir.module.module', 'search', [('name', '=', 'sale'), ('state', '!=', 'installed')]) + modules_to_install = self._execute('ir.module.module', 'search', + [('name', '=', 'sale'), ('state', '!=', 'installed')]) self._execute('ir.module.module', 'button_install', modules_to_install) self._execute('base.module.upgrade', 'upgrade_module', modules_to_install) return True @@ -235,7 +236,8 @@ class CamadeusFunctions(): def install_modules(self): """Module installieren""" - modules_to_install = self._execute('ir.module.module', 'search', [('name', 'in', self.config.modules), ('state', '!=', 'installed')]) + modules_to_install = self._execute('ir.module.module', 'search', + [('name', 'in', self.config.modules), ('state', '!=', 'installed')]) self._execute('ir.module.module', 'button_install', modules_to_install) self._execute('base.module.upgrade', 'upgrade_module', modules_to_install) return True @@ -261,15 +263,15 @@ class CamadeusFunctions(): seq_dict = self.config.sequences # Lieferschein - if seq_dict.get('picking.out',False): + if seq_dict.get('picking.out', False): self._set_picking_sequence_prefix('outgoing', 'picking.out') - if seq_dict.get('picking.in',False): + if seq_dict.get('picking.in', False): self._set_picking_sequence_prefix('incoming', 'picking.in') - if seq_dict.get('picking.int',False): + if seq_dict.get('picking.int', False): self._set_picking_sequence_prefix('internal', 'picking.int') # Angebot - if seq_dict.get('sale.order',False): + if seq_dict.get('sale.order', False): s_ids = self._execute('ir.sequence', 'search', [('code', '=', 'sale.order')]) if len(s_ids) != 1: return False @@ -277,7 +279,7 @@ class CamadeusFunctions(): return False # Arbeitsschein - if seq_dict.get('work.order',False): + if seq_dict.get('work.order', False): s_ids = self._execute('ir.sequence', 'search', [('code', '=', 'work.order')]) if len(s_ids) != 1: return False @@ -285,7 +287,7 @@ class CamadeusFunctions(): return False # EK-Angebot - if seq_dict.get('purchase.order',False): + if seq_dict.get('purchase.order', False): s_ids = self._execute('ir.sequence', 'search', [('code', '=', 'purchase.order')]) if len(s_ids) != 1: return False @@ -293,7 +295,7 @@ class CamadeusFunctions(): return False # Rechnungsnummer - if seq_dict.get('account.invoice',False): + if seq_dict.get('account.invoice', False): j_ids = self._execute('account.journal', 'search', [('code', '=', 'VK')]) if len(j_ids) != 1: return False @@ -323,15 +325,15 @@ class CamadeusFunctions(): def set_admin_rights(self): """Setze Administrator Rechte""" - dummy,user_id = self._execute('ir.model.data', 'get_object_reference', 'base', 'user_root') + dummy, user_id = self._execute('ir.model.data', 'get_object_reference', 'base', 'user_root') groups = [] # Technische Eigenschaften - dummy,group_id = self._execute('ir.model.data', 'get_object_reference', 'base', 'group_no_one') + dummy, group_id = self._execute('ir.model.data', 'get_object_reference', 'base', 'group_no_one') groups.append((4, group_id)) # Finanzmanager - dummy,group_id = self._execute('ir.model.data', 'get_object_reference', 'account', 'group_account_manager') + dummy, group_id = self._execute('ir.model.data', 'get_object_reference', 'account', 'group_account_manager') groups.append((4, group_id)) vals = { @@ -354,20 +356,22 @@ class CamadeusFunctions(): """Konfiguration Kontenplan""" c = self.config - sales_tax_ids = self._execute('account.tax.template', 'search', [('description', '=', c.sales_tax), ('parent_id', '=', False)]) + sales_tax_ids = self._execute('account.tax.template', 'search', + [('description', '=', c.sales_tax), ('parent_id', '=', False)]) if not sales_tax_ids: return False - purchase_tax_ids = self._execute('account.tax.template', 'search', [('description', '=', c.purchase_tax), ('parent_id', '=', False)]) + purchase_tax_ids = self._execute('account.tax.template', 'search', + [('description', '=', c.purchase_tax), ('parent_id', '=', False)]) if not purchase_tax_ids: return False # Set Your Accounting Options - dummy,currency_id = self._execute('ir.model.data', 'get_object_reference', 'base', 'EUR') + dummy, currency_id = self._execute('ir.model.data', 'get_object_reference', 'base', 'EUR') vals = {} vals['chart_template_id'] = c.chart_template_id vals['sale_tax'] = sales_tax_ids[0] vals['purchase_tax'] = purchase_tax_ids[0] - vals['company_id'] = 1 # Default + vals['company_id'] = 1 # Default vals['currency_id'] = currency_id wizard_id = self._execute('wizard.multi.charts.accounts', 'create', vals) self._execute('wizard.multi.charts.accounts', 'action_next', [wizard_id]) @@ -426,7 +430,7 @@ class CamadeusFunctions(): return False # Update names - for uom_xml_id,name in c.active_uoms.items(): + for uom_xml_id, name in c.active_uoms.items(): uom_id = self._execute('ir.model.data', 'xmlid_to_res_id', uom_xml_id) res = self._execute('product.uom', 'write', [uom_id], {'name': name}, context) if not res: @@ -443,10 +447,13 @@ class CamadeusFunctions(): self._execute('account.fiscal.position', 'write', invalid_ids, {'active': False}) # Mappings inaktiver Steuern löschen (also wenn rechte Seite eine inaktive Steuer ist, wie z. B "strf. i.g.L")) - valid_position_ids = self._execute('account.fiscal.position', 'search', [('name', 'in', c.valid_fiscal_positions)]) + valid_position_ids = self._execute('account.fiscal.position', 'search', + [('name', 'in', c.valid_fiscal_positions)]) valid_tax_ids = self._execute('account.tax', 'search', [('parent_id', '=', False)]) - position_tax_line_ids = self._execute('account.fiscal.position.tax', 'search', [('position_id', 'in', valid_position_ids), ('tax_dest_id', 'not in', valid_tax_ids)]) + position_tax_line_ids = self._execute('account.fiscal.position.tax', 'search', + [('position_id', 'in', valid_position_ids), + ('tax_dest_id', 'not in', valid_tax_ids)]) vals = {'tax_dest_id': False} return self._execute('account.fiscal.position.tax', 'write', position_tax_line_ids, vals) @@ -454,9 +461,9 @@ class CamadeusFunctions(): """Aktualisiere Modul""" module_name = self.config.module_name - mod_ids = self._execute('ir.module.module', 'search', [('name', '=', module_name),('state', '=', 'installed')]) + mod_ids = self._execute('ir.module.module', 'search', [('name', '=', module_name), ('state', '=', 'installed')]) if not len(mod_ids) == 1: - raise Exception('Module "%s" not found or not installed.' % module_name) + raise Exception('Module "%s" not found or not installed.' % module_name) self._execute('ir.module.module', 'button_upgrade', mod_ids) self._execute('base.module.upgrade', 'upgrade_module', []) @@ -466,9 +473,10 @@ class CamadeusFunctions(): """Installiere Modul""" module_name = self.config.module_name - mod_ids = self._execute('ir.module.module', 'search', [('name', '=', module_name), ('state', '=', 'uninstalled')]) + mod_ids = self._execute('ir.module.module', 'search', + [('name', '=', module_name), ('state', '=', 'uninstalled')]) if not len(mod_ids) == 1: - raise Exception('Module "%s" not found or is not in state "uninstalled".' % module_name) + raise Exception('Module "%s" not found or is not in state "uninstalled".' % module_name) self._execute('ir.module.module', 'button_install', mod_ids) self._execute('base.module.upgrade', 'upgrade_module', []) @@ -484,9 +492,9 @@ class CamadeusFunctions(): def uninstall_module(self): """Deinstalliere Modul""" module_name = self.config.module_name - mod_ids = self._execute('ir.module.module', 'search', [('name','=',module_name),('state','=','installed')]) + mod_ids = self._execute('ir.module.module', 'search', [('name', '=', module_name), ('state', '=', 'installed')]) if not len(mod_ids) == 1: - raise Exception("Module '%s' not found or is not installed." % module_name) + raise Exception("Module '%s' not found or is not installed." % module_name) self._execute('ir.module.module', 'button_uninstall', mod_ids) self._execute('base.module.upgrade', 'upgrade_module', []) @@ -495,9 +503,10 @@ class CamadeusFunctions(): def cancel_upgrade_module(self): """Modul Upgrade abbrechen""" module_name = self.config.module_name - mod_ids = self._execute('ir.module.module', 'search', [('name','=',module_name),('state','=','to upgrade')]) + mod_ids = self._execute('ir.module.module', 'search', + [('name', '=', module_name), ('state', '=', 'to upgrade')]) if not len(mod_ids) == 1: - raise Exception("Module '%s' not found or is not installed." % module_name) + raise Exception("Module '%s' not found or is not installed." % module_name) self._execute('ir.module.module', 'button_upgrade_cancel', mod_ids) return True @@ -520,7 +529,8 @@ class CamadeusFunctions(): """Aktualisiere Modul""" for module_name in self.config.modules: - mod_ids = self._execute('ir.module.module', 'search', [('name', '=', module_name), ('state', '=', 'installed')]) + mod_ids = self._execute('ir.module.module', 'search', + [('name', '=', module_name), ('state', '=', 'installed')]) if not len(mod_ids) == 1: raise Exception('Module "%s" not found or ist not installed.' % module_name) self._execute('ir.module.module', 'button_upgrade', mod_ids) @@ -531,7 +541,8 @@ class CamadeusFunctions(): def set_warehouse(self): """Name des Zentrallagers setzen""" - is_installed = self._execute('ir.module.module', 'search', [('name', '=', 'stock'), ('state', '=', 'installed')]) + is_installed = self._execute('ir.module.module', 'search', + [('name', '=', 'stock'), ('state', '=', 'installed')]) if is_installed: vals = { 'name': self.config.warehouse_name or self.config.company_data.get('name', 'Mein Unternehmen'), @@ -547,7 +558,7 @@ class CamadeusFunctions(): def set_dmi_noupdate(self): """DMI: Einträge auf 'no update' setzen""" - domain = [('module','=','cam_dmi'), ('noupdate', '=', False)] + domain = [('module', '=', 'dp_dmi'), ('noupdate', '=', False)] data_ids = self._execute('ir.model.data', 'search', domain) vals = {'noupdate': True} @@ -556,7 +567,7 @@ class CamadeusFunctions(): def dmi_confirm_inventory(self): """DMI: Lagerstand einbuchen""" - dummy,inventory_id = self._execute('ir.model.data', 'get_object_reference', 'cam_dmi','inv_init') + dummy, inventory_id = self._execute('ir.model.data', 'get_object_reference', 'dp_dmi', 'inv_init') inventory = self._execute('stock.inventory', 'read', inventory_id, ['state']) @@ -620,12 +631,13 @@ class CamadeusFunctions(): vals = {} vals['res_model'] = 'res.users' vals['file'] = self._readAndReturnFile(self.config.users_file) - fields = [u'id', u'name', u'login', u'email', u'groups_id/id', False, u'tz', u'mobile', u'phone', u'function'] - options = {u'headers': True, u'quoting': u'"', u'separator': u',', u'encoding': u'utf-8'} + fields = [u'id', u'name', u'login', u'email', u'groups_id/id', False, u'tz', u'mobile', u'phone', + u'function'] + options = {u'headers': True, u'quoting': u'"', u'separator': u',', u'encoding': u'utf-8'} wizard_id = self._execute('base_import.import', 'create', vals) if wizard_id: - messages = self._execute('base_import.import', 'do', wizard_id, fields,options) + messages = self._execute('base_import.import', 'do', wizard_id, fields, options) if messages: print messages return False @@ -677,11 +689,11 @@ class CamadeusFunctions(): def set_default_values(self): """Defaultwerte für Dokumente setzen""" - for model,field,value in self.config.default_values: + for model, field, value in self.config.default_values: # Falls XML ID (prefix "XML:") dann die DB ID holen if value[0:4] == 'XML:': xml_id = value[4:] - dummy,dummy2,res_id = self._execute('ir.model.data', 'xmlid_lookup', xml_id) + dummy, dummy2, res_id = self._execute('ir.model.data', 'xmlid_lookup', xml_id) if not res_id: raise Exception('Defaultwerte anlegen: XML ID %s nicht vorhanden!' % (xml_id)) value = res_id @@ -704,9 +716,9 @@ class CamadeusFunctions(): def update_special_values(self): """Spezialwerte setzen""" - #Z. B.: + # Z. B.: ## Lösche alle Anreden außer Herr und Frau - #data_deletes = [ + # data_deletes = [ # 'base.res_partner_title_doctor', # 'base.res_partner_title_miss', # 'base.res_partner_title_prof', @@ -715,8 +727,8 @@ class CamadeusFunctions(): # 'base.res_partner_title_ltd', # 'sale.email_template_edi_sale', # 'account.email_template_edi_invoice', - #] - #for xml_id in data_deletes: + # ] + # for xml_id in data_deletes: # try: # dummy,model,res_id = self._execute('ir.model.data', 'xmlid_lookup', xml_id) # self._execute(model, 'unlink', [res_id]) @@ -728,8 +740,8 @@ class CamadeusFunctions(): def update_values(self): """Existierende Daten aktualisieren""" - for xml_id,vals in self.config.data_updates.items(): - dummy,model,res_id = self._execute('ir.model.data', 'xmlid_lookup', xml_id) + for xml_id, vals in self.config.data_updates.items(): + dummy, model, res_id = self._execute('ir.model.data', 'xmlid_lookup', xml_id) self._execute(model, 'write', [res_id], vals) return True @@ -737,7 +749,7 @@ class CamadeusFunctions(): def set_sys_params(self): """Systemparameter setzen""" - for key,value in self.config.system_parameters.items(): + for key, value in self.config.system_parameters.items(): param_ids = self._execute('ir.config_parameter', 'search', [('key', '=', key)]) vals = { 'key': key, @@ -749,6 +761,17 @@ class CamadeusFunctions(): self._execute('ir.config_parameter', 'create', vals) return True + def remove_sys_params(self): + """Systemparameter entfernen""" + + for key, value in self.config.system_parameters_remove_on_rollout.items(): + print key + param_ids = self._execute('ir.config_parameter', 'search', [('key', '=', key)]) + print param_ids + if param_ids: + self._execute('ir.config_parameter', 'unlink', param_ids) + return True + def setup_reports(self): """Berichte konfigurieren""" @@ -763,13 +786,13 @@ class CamadeusFunctions(): def invalidate_email(self): """In E-Mail-Adressen @ durch # ersetzen, um unbeabsichtigen E-Mail-Versand zu vermeiden""" - #E-Mail adressen von res_partner: @ -> # - p_ids = self._execute('res.partner', 'search', [('email','ilike','%@%')]) + # E-Mail adressen von res_partner: @ -> # + p_ids = self._execute('res.partner', 'search', [('email', 'ilike', '%@%')]) partner = self._execute('res.partner', 'read', p_ids, ['email']) for p in partner: id = p['id'] email = p['email'] - new_email = email.replace('@','#') + new_email = email.replace('@', '#') self._execute('res.partner', 'write', [id], {'email': new_email}) def finance_config(self): @@ -786,10 +809,10 @@ class CamadeusFunctions(): """Anonymisieren der Daten""" res = True - #res &= self.make_anonymous_one('make_anonymous_partner') - #res &= self.make_anonymous_one('make_anonymous_project') - #res &= self.make_anonymous_one('make_anonymous_employee') - #res &= self.make_anonymous_one('make_anonymous_leads') + # res &= self.make_anonymous_one('make_anonymous_partner') + # res &= self.make_anonymous_one('make_anonymous_project') + # res &= self.make_anonymous_one('make_anonymous_employee') + # res &= self.make_anonymous_one('make_anonymous_leads') res &= self.make_anonymous_one('make_anonymous_mailserver') res &= self.make_anonymous_one('make_anonymous_cron') return res @@ -809,27 +832,27 @@ class CamadeusFunctions(): ids = self._execute('res.partner', 'search', []) for id in ids: vals = { - 'name': 'Partner %s' % id, - 'street': '----', - 'email': 'test@example.com', - } + 'name': 'Partner %s' % id, + 'street': '----', + 'email': 'test@example.com', + } self._execute('res.partner', 'write', [id], vals) def make_anonymous_project(self): - if(self._execute('ir.module.module', 'search', [('name', '=', 'project'), ('state', '=', 'installed')])): + if (self._execute('ir.module.module', 'search', [('name', '=', 'project'), ('state', '=', 'installed')])): ids = self._execute('project.project', 'search', []) for id in ids: vals = { - 'name': 'Projekt %s' % id, - } + 'name': 'Projekt %s' % id, + } self._execute('project.project', 'write', [id], vals) - #Tasks + # Tasks ids = self._execute('project.task', 'search', []) for id in ids: vals = { - 'name': 'Aufgabe %s' % id, - } + 'name': 'Aufgabe %s' % id, + } self._execute('project.task', 'write', [id], vals) def make_anonymous_employee(self): @@ -837,21 +860,21 @@ class CamadeusFunctions(): ids = self._execute('hr.employee', 'search', []) for id in ids: vals = { - 'name': 'Mitarbeiter %s' % id, - 'work_email': 'test@example.com', - } - self._execute('hr.employee','write', [id], vals) + 'name': 'Mitarbeiter %s' % id, + 'work_email': 'test@example.com', + } + self._execute('hr.employee', 'write', [id], vals) def make_anonymous_leads(self): if (self._execute('ir.module.module', 'search', [('name', '=', 'crm'), ('state', '=', 'installed')])): ids = self._execute('crm.lead', 'search', []) for id in ids: vals = { - 'name': 'Lead %s' % id, - 'email_from': 'test@example.com', - 'description': '', - } - ids = self._execute('crm.lead','write', [id], vals) + 'name': 'Lead %s' % id, + 'email_from': 'test@example.com', + 'description': '', + } + ids = self._execute('crm.lead', 'write', [id], vals) def make_anonymous_mailserver(self): server_ids = self._execute('ir.mail_server', 'search', []) @@ -864,3 +887,28 @@ class CamadeusFunctions(): cron_ids = self._execute('ir.cron', 'search', []) if cron_ids: self._execute('ir.cron', 'write', cron_ids, {'active': False}) + + def set_ext_ids(self): + """ExtIDs für Accounts und Types""" + + # # Konten Ext IDs + # lst_accs = ['200000', '330000', '250000', '350000'] # odoo 9 nummern + # for acc in lst_accs: + # res_id = self._execute('account.account', 'search', [('code', '=', acc)]) + # # print "---------------------------------------------" + # # print acc + # # print res_id + # vals = { + # 'name': 'cust_account_mapp_' + acc, + # 'module': 'account', + # 'model': 'account.account', + # 'res_id': res_id[0], + # } + # try: + # self._execute('ir.model.data', 'create', vals) + # except: + # print "Fehler Anlage ExtID " + 'cust_account_mapp_' + acc + + + + return True