Aufgaben aus der Dev-Session 10. 2. 2016:
* cam warnt bei nicht lokalen Umgebungen und fragt nach dem Passwort * Passwörter für nicht lokale Umgebungen nicht im environments speichern * cam list-envs zum Auflisten aller Umgebungen Allgemein: * Mich hinzufügen, Kumar entfernen * Überflüssigen Leerraum entfernendevelop
							parent
							
								
									a1d621ee8a
								
							
						
					
					
						commit
						a9d0bb2b59
					
				|  | @ -1,53 +1,65 @@ | ||||||
| # -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||||
|  | import urlparse | ||||||
|  | import sys | ||||||
| 
 | 
 | ||||||
| from functions import CamadeusFunctions |  | ||||||
| from config_at import Config | from config_at import Config | ||||||
| from environments import ENVIRONMENTS, Environment | from environments import ENVIRONMENTS, Environment | ||||||
| import sys, getopt | from functions import CamadeusFunctions | ||||||
| 
 | 
 | ||||||
| def main(): | def main(): | ||||||
|      |  | ||||||
|     def _usage(): |     def _usage(): | ||||||
|         print 'cam.py <environment> [create|setup|rollout|update] [<module_name>]' |         print 'cam.py <environment> [create|setup|rollout|update] [<module_name>]' | ||||||
|  |         print 'cam.py list-envs' | ||||||
|         sys.exit(3) |         sys.exit(3) | ||||||
|      | 
 | ||||||
|     argv = sys.argv[1:] |     argv = sys.argv[1:] | ||||||
|     config = Config() |     config = Config() | ||||||
|              | 
 | ||||||
|  |     if not argv: | ||||||
|  |         _usage() | ||||||
|  | 
 | ||||||
|     # RUNBOT |     # RUNBOT | ||||||
|     # ./cam runbot create [db] [port] [working-dir] |     # ./cam runbot create [db] [port] [working-dir] | ||||||
|      | 
 | ||||||
|     if argv[0] == 'runbot': |     if argv[0] == 'runbot': | ||||||
|         import os |         import os | ||||||
|         cmd = argv[1] |         cmd = argv[1] | ||||||
|         db = argv[2] |         db = argv[2] | ||||||
|         port = argv[3] |         port = argv[3] | ||||||
|         setup_path = argv[4] |         setup_path = argv[4] | ||||||
|          | 
 | ||||||
|         env = Environment('http://localhost', port, db, 'admin', 'admin', 'admin') |         env = Environment('http://localhost', port, db, 'admin', 'admin', 'admin') | ||||||
|         os.chdir(setup_path) |         os.chdir(setup_path) | ||||||
|  |     elif argv[0] == 'list-envs': | ||||||
|  |         print 'name: host:port dbname username' | ||||||
|  |         for env_name in sorted(ENVIRONMENTS): | ||||||
|  |             env = ENVIRONMENTS[env_name] | ||||||
|  |             print '%s: %s:%s %s %s' % (env_name, env.host, env.port, env.dbname, env.username) | ||||||
|  |         return | ||||||
|     else: |     else: | ||||||
|         if not len(argv) == 2: |         if len(argv) != 2: | ||||||
|             if len(argv) == 3 and argv[1] in ['update','install']: # 'update' requires additional param 'module_name' |             if len(argv) == 3 and argv[1] in ['update', 'install']: | ||||||
|  |                 # 'update' requires additional param 'module_name' | ||||||
|                 pass |                 pass | ||||||
|             else: |             else: | ||||||
|                 _usage() |                 _usage() | ||||||
|              | 
 | ||||||
|         cmd = argv[1] |         cmd = argv[1] | ||||||
|          | 
 | ||||||
|         env = ENVIRONMENTS.get(argv[0],False) |         env = ENVIRONMENTS.get(argv[0]) | ||||||
|         if not env: |         if not env: | ||||||
|  |             print 'Unbekannte Umgebung' | ||||||
|             _usage() |             _usage() | ||||||
|      | 
 | ||||||
|     instance = CamadeusFunctions(env, config) |     instance = CamadeusFunctions(env, config) | ||||||
| 
 | 
 | ||||||
|     methods = False |     methods = None | ||||||
|      | 
 | ||||||
|     if cmd == 'test': |     if cmd == 'test': | ||||||
|         methods = [ |         methods = [ | ||||||
|             'login', |             'login', | ||||||
|         ] |         ] | ||||||
|      | 
 | ||||||
|     if cmd == 'create': |     if cmd == 'create': | ||||||
|         methods = [ |         methods = [ | ||||||
|             'create_db', |             'create_db', | ||||||
|  | @ -57,7 +69,7 @@ def main(): | ||||||
|             'setup_accounting2', |             'setup_accounting2', | ||||||
|             'set_admin_rights', |             'set_admin_rights', | ||||||
|         ] |         ] | ||||||
|      | 
 | ||||||
|     if cmd == 'setup': |     if cmd == 'setup': | ||||||
|         methods = [ |         methods = [ | ||||||
|             'login', |             'login', | ||||||
|  | @ -69,7 +81,7 @@ def main(): | ||||||
|             'hr_config', |             'hr_config', | ||||||
|             'stock_config', |             'stock_config', | ||||||
|             'mrp_config', |             'mrp_config', | ||||||
|             'stock_set_cost_method',             |             'stock_set_cost_method', | ||||||
|             'set_incoterms', |             'set_incoterms', | ||||||
|             'purchase_config', |             'purchase_config', | ||||||
|             'set_date_format', |             'set_date_format', | ||||||
|  | @ -84,10 +96,10 @@ def main(): | ||||||
|             'set_translations', |             'set_translations', | ||||||
|             'set_default_removal_strategy', |             'set_default_removal_strategy', | ||||||
|             'default_set_order_policy', |             'default_set_order_policy', | ||||||
|             'delete_mail_server',  |             'delete_mail_server', | ||||||
|             'update_values',  |             'update_values', | ||||||
|             'set_sys_params', |             'set_sys_params', | ||||||
|             'setup_reports',             |             'setup_reports', | ||||||
|         ] |         ] | ||||||
| 
 | 
 | ||||||
|     if cmd == 'rollout': |     if cmd == 'rollout': | ||||||
|  | @ -96,7 +108,7 @@ def main(): | ||||||
|             'set_dokumentennummern', |             'set_dokumentennummern', | ||||||
|             'set_dmi_noupdate', |             'set_dmi_noupdate', | ||||||
|             'dmi_confirm_inventory', |             'dmi_confirm_inventory', | ||||||
|             'import_users',             |             'import_users', | ||||||
|         ] |         ] | ||||||
| 
 | 
 | ||||||
|     if cmd == 'update': |     if cmd == 'update': | ||||||
|  | @ -126,17 +138,42 @@ def main(): | ||||||
|         ] |         ] | ||||||
| 
 | 
 | ||||||
|     if not methods: |     if not methods: | ||||||
|  |         print 'Unbekanntes Kommando' | ||||||
|         _usage() |         _usage() | ||||||
| 
 | 
 | ||||||
|     print env |     print env | ||||||
| 
 | 
 | ||||||
|  |     local_netlocs = [ | ||||||
|  |         'localhost', | ||||||
|  |         '127.0.0.1', | ||||||
|  |         '::1', | ||||||
|  |     ] | ||||||
|  |     netloc = urlparse.urlparse(env.host).netloc | ||||||
|  |     if netloc not in local_netlocs: | ||||||
|  |         print '\nAchtung, diese Umgebung ist nicht lokal!\n' | ||||||
|  | 
 | ||||||
|  |         print cmd, | ||||||
|  |         print instance.config.module_name if instance.config.module_name else '' | ||||||
|  |         print | ||||||
|  | 
 | ||||||
|  |         env.pwd = raw_input('Passwort: ') | ||||||
|  | 
 | ||||||
|  |         if cmd == 'create': | ||||||
|  |             env.super_admin_pw = raw_input('Super-Admin-Passwort: ') | ||||||
|  | 
 | ||||||
|  |         print | ||||||
|  | 
 | ||||||
|     for method in methods: |     for method in methods: | ||||||
|  |         doc = getattr(instance, method).__doc__ | ||||||
|  |         print doc, | ||||||
|  |         sys.stdout.flush() | ||||||
|         res = getattr(instance, method)() |         res = getattr(instance, method)() | ||||||
|         print "%s: %s" % (res and "OK     " or "ERROR  ", getattr(instance, method).__doc__) |         print '\r%s: %s' % (res and 'OK     ' or 'ERROR  ', doc) | ||||||
|         if not res: |         if not res: | ||||||
|             return False |             print 'Abbruch wegen Fehler' | ||||||
|  |             return | ||||||
| 
 | 
 | ||||||
|     print "\nAbgeschlossen." |     print '\nAbgeschlossen.' | ||||||
| 
 | 
 | ||||||
| if __name__ == "__main__": | if __name__ == '__main__': | ||||||
|     main() |     main() | ||||||
|  |  | ||||||
|  | @ -1,31 +1,29 @@ | ||||||
| # -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||||
| 
 | class Config(): | ||||||
| class Config():  |  | ||||||
| 
 |  | ||||||
|     def __init__(self): |     def __init__(self): | ||||||
|          |         self.module_name = None | ||||||
|         self.lang = 'de_DE' #                 de_DE, en_US |         self.lang = 'de_DE' # de_DE, en_US | ||||||
|         self.chart_of_accounts = 'l10n_at' |         self.chart_of_accounts = 'l10n_at' | ||||||
|         self.sales_tax = '20% MwSt' |         self.sales_tax = '20% MwSt' | ||||||
|         self.purchase_tax = '20% VSt' |         self.purchase_tax = '20% VSt' | ||||||
|         self.chart_template_id = 2 # Austrian Chart of Account         |         self.chart_template_id = 2 # Austrian Chart of Account | ||||||
|         self.price_decimals = 2 # Nachkommastellen Preis |         self.price_decimals = 2 # Nachkommastellen Preis | ||||||
|         self.uom_decimals = 3 # Nachkommastellen Mengeneinheiten |         self.uom_decimals = 3 # Nachkommastellen Mengeneinheiten | ||||||
|                  | 
 | ||||||
|         self.company_data = { |         self.company_data = { | ||||||
|             'name': 'Camadeus GmbH', |             'name': 'Camadeus GmbH', | ||||||
|             'street': 'Kriehubergasse 16', |             'street': 'Wiedner Hauptstraße 135/B3', | ||||||
|             'street2': False, |             'street2': False, | ||||||
|             'city': 'Wien', |             'city': 'Wien', | ||||||
|             'zip': '1050', |             'zip': '1050', | ||||||
|             'phone': '+43 1 78910 96 70', |             'phone': '+43 1 78910 96 70', | ||||||
|             'fax': False, |             'fax': False, | ||||||
|             'email': 'office@camadeus.at', |             'email': 'office@camadeus.at', | ||||||
|             'website': 'http://www.camadeus.at', |             'website': 'http://www.camadeus.at/', | ||||||
|             'company_registry': '280076b', |             'company_registry': '280076b', | ||||||
|             'country_id': 'at', # "de" für deutschland |             'country_id': 'at', # 'de' für Deutschland | ||||||
|             'logo': False,        |             'logo': False, | ||||||
|             'vat': 'ATU 62991855',      |             'vat': 'ATU 62991855', | ||||||
|             'rml_header1': False, |             'rml_header1': False, | ||||||
|             'vat_check_vies': True, |             'vat_check_vies': True, | ||||||
|             'tax_calculation_rounding_method': 'round_globally', |             'tax_calculation_rounding_method': 'round_globally', | ||||||
|  | @ -41,25 +39,25 @@ class Config(): | ||||||
|             'smtp_user': 'test', |             'smtp_user': 'test', | ||||||
|             'smtp_pass': 'test', |             'smtp_pass': 'test', | ||||||
|         } |         } | ||||||
|          | 
 | ||||||
|         # Nur für Lager |         # Nur für Lager | ||||||
|         # Wenn nicht gesetzt, dann wird der Firmenname genommen |         # Wenn nicht gesetzt, dann wird der Firmenname genommen | ||||||
|         self.warehouse_name = False   |         self.warehouse_name = False | ||||||
|         self.warehouse_code = False         |         self.warehouse_code = False | ||||||
|          | 
 | ||||||
|         # Anzahl der Schritte beim Ausliefern |         # Anzahl der Schritte beim Ausliefern | ||||||
|         # [ship_only] Direkt vom Lager liefern |         # [ship_only] Direkt vom Lager liefern | ||||||
|         # [pick_ship] Liefere vor Auslieferung zuerst in Versandlager (Pick + Ship)         |         # [pick_ship] Liefere vor Auslieferung zuerst in Versandlager (Pick + Ship) | ||||||
|         # [pick_pack_ship] Verpacken Sie die Produkte an einer Pack-Station bevor Sie den Versand vornehmen |         # [pick_pack_ship] Verpacken Sie die Produkte an einer Pack-Station bevor Sie den Versand vornehmen | ||||||
|         self.delivery_steps = 'ship_only'       |         self.delivery_steps = 'ship_only' | ||||||
|          | 
 | ||||||
|         self.valid_taxes = [ |         self.valid_taxes = [ | ||||||
|             '20% MwSt', |             '20% MwSt', | ||||||
|             '10% MwSt', |             '10% MwSt', | ||||||
|             '20% VSt', |             '20% VSt', | ||||||
|             '10% VSt', |             '10% VSt', | ||||||
|         ] |         ] | ||||||
|          | 
 | ||||||
|         # Aktive Steuerzuordnungen |         # Aktive Steuerzuordnungen | ||||||
|         self.valid_fiscal_positions = [ |         self.valid_fiscal_positions = [ | ||||||
|             #'Lieferant EU (ohne Ust-ID)', |             #'Lieferant EU (ohne Ust-ID)', | ||||||
|  | @ -68,29 +66,29 @@ class Config(): | ||||||
|             'Kunde Ausland', |             'Kunde Ausland', | ||||||
|             'Kunde EU (ohne USt-ID)', |             'Kunde EU (ohne USt-ID)', | ||||||
|             'Kunde EU Unternehmen (mit USt-ID)', |             'Kunde EU Unternehmen (mit USt-ID)', | ||||||
|         ]       |         ] | ||||||
|          | 
 | ||||||
|         # Aktive Währungen |         # Aktive Währungen | ||||||
|         self.valid_currencies = [ |         self.valid_currencies = [ | ||||||
|             'EUR', |             'EUR', | ||||||
|         ]            |         ] | ||||||
|          | 
 | ||||||
|         # Allgemeine Einstellungen |         # Allgemeine Einstellungen | ||||||
|         self.base_config = { |         self.base_config = { | ||||||
|             'module_portal': False,      # Kundenportal |             'module_portal': False,      # Kundenportal | ||||||
|             'alias_domain': False,       # False: keine Domainbezogenen E-Mails (wie zB. Reply-To zur alias-Adresse) |             'alias_domain': False,       # False: keine Domainbezogenen E-Mails (wie z. B. Reply-To zur Alias-Adresse) | ||||||
|         } |         } | ||||||
|          | 
 | ||||||
|         # Einstellungen Verkauf |         # Einstellungen Verkauf | ||||||
|         self.sale_config = { |         self.sale_config = { | ||||||
|             'group_sale_delivery_address': True,         # Verschiedene Adressen für Rechnung und Lieferung |             'group_sale_delivery_address': True,         # Verschiedene Adressen für Rechnung und Lieferung | ||||||
|             'group_sale_pricelist': True,                # Preislisten verwenden |             'group_sale_pricelist': True,                # Preislisten verwenden | ||||||
|             'group_discount_per_so_line': True,          # Rabatte verwenden |             'group_discount_per_so_line': True,          # Rabatte verwenden | ||||||
|             'group_uom': True,                           # Verwende Mengeneinheiten |             'group_uom': True,                           # Verwende Mengeneinheiten | ||||||
|             'group_invoice_deli_orders': True,           # Erstelle Rechnungen durch Auslieferungen             |             'group_invoice_deli_orders': True,           # Erstelle Rechnungen durch Auslieferungen | ||||||
|         } |         } | ||||||
|         self.order_policy = 'picking'                   # Erzeuge Rechnung: [manual], [picking],[prepaid] |         self.order_policy = 'picking'                   # Erzeuge Rechnung: [manual], [picking],[prepaid] | ||||||
|          | 
 | ||||||
|         # Einstellungen Einkauf |         # Einstellungen Einkauf | ||||||
|         self.purchase_config = { |         self.purchase_config = { | ||||||
|             'group_purchase_pricelist': True,            # Preislisten verwenden |             'group_purchase_pricelist': True,            # Preislisten verwenden | ||||||
|  | @ -99,23 +97,22 @@ class Config(): | ||||||
|                                                          # [order] - Vorabrechnungsentwurf durch Bestellung |                                                          # [order] - Vorabrechnungsentwurf durch Bestellung | ||||||
|             'group_costing_method': True,                # Benutzen Sie 'Einkaufs-' oder 'Durchschnittspreis' zur Bestandsbewertung |             'group_costing_method': True,                # Benutzen Sie 'Einkaufs-' oder 'Durchschnittspreis' zur Bestandsbewertung | ||||||
|         } |         } | ||||||
|          | 
 | ||||||
|         #Einstellungen Personal |         #Einstellungen Personal | ||||||
|         self.hr_config = { |         self.hr_config = { | ||||||
|             'module_hr_expense': True,                 # Spesen der Mitarbeiter verwalten |             'module_hr_expense': True,                 # Spesen der Mitarbeiter verwalten | ||||||
|             'module_hr_timesheet': False,              # Verwalten Sie Ihre Studenzettel   |             'module_hr_timesheet': False,              # Verwalten Sie Ihre Studenzettel | ||||||
|             'group_hr_attendance': True,               # Zuweisung der Berechtigung  zur Arbeitszeiteingabe für alle Benutzer |             'group_hr_attendance': True,               # Zuweisung der Berechtigung  zur Arbeitszeiteingabe für alle Benutzer | ||||||
|   |         } | ||||||
|         }   | 
 | ||||||
|          |  | ||||||
|         #Einstellungen Lager |         #Einstellungen Lager | ||||||
|         self.stock_config = { |         self.stock_config = { | ||||||
|             'group_stock_multiple_locations': True,      # Verwalten Sie mehrere Lager und Lagerorte |             'group_stock_multiple_locations': True,      # Verwalten Sie mehrere Lager und Lagerorte | ||||||
|             'group_stock_tracking_lot': False,           # Benutze Verpackungen: Paletten, Boxen, ... |             'group_stock_tracking_lot': False,           # Benutze Verpackungen: Paletten, Boxen, ... | ||||||
|             'group_stock_production_lot': True,          # Verfolgen Sie Los- und Seriennummern. |             'group_stock_production_lot': True,          # Verfolgen Sie Los- und Seriennummern. | ||||||
|             'group_stock_packaging': False,              # Ermöglicht die Auswahl einer Verpackung             |             'group_stock_packaging': False,              # Ermöglicht die Auswahl einer Verpackung | ||||||
|             'group_stock_adv_location': True,            # Verwalten Sie erweiterte Routen im Lager     |             'group_stock_adv_location': True,            # Verwalten Sie erweiterte Routen im Lager | ||||||
|         }   |         } | ||||||
| 
 | 
 | ||||||
|         # Einstellungen Fertigung |         # Einstellungen Fertigung | ||||||
|         self.mrp_config = { |         self.mrp_config = { | ||||||
|  | @ -124,82 +121,82 @@ class Config(): | ||||||
|             'group_mrp_properties': False,               # Ermögliche Merkmale für verschiedene Stücklisten eines Produkts |             'group_mrp_properties': False,               # Ermögliche Merkmale für verschiedene Stücklisten eines Produkts | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         #self.removal_strategy = 'fefo'                      #[fifo], [lifo], [fefo] |         #self.removal_strategy = 'fefo'                  #[fifo], [lifo], [fefo] | ||||||
|          | 
 | ||||||
|         self.stock_cost_method = 'average'               # [standard], [average], [real]  |         self.stock_cost_method = 'average'               # [standard], [average], [real] | ||||||
| 
 | 
 | ||||||
|         # Wenn gesetzt, teilen sich Gutschriften und Rechnungen den selben Nummernkreis |         # Wenn gesetzt, teilen sich Gutschriften und Rechnungen den selben Nummernkreis | ||||||
|         self.refund_invoice_sequence = True |         self.refund_invoice_sequence = True | ||||||
|          | 
 | ||||||
|         self.sequences = { |         self.sequences = { | ||||||
|             'sale.order':  {  |             'sale.order':  { | ||||||
|                 'number_next_actual': 1,  |                 'number_next_actual': 1, | ||||||
|                 'prefix': 'A-', |                 'prefix': 'A-', | ||||||
|                 'padding': 5, |                 'padding': 5, | ||||||
|             }, |             }, | ||||||
| #             'work.order':  {  | #             'work.order':  { | ||||||
| #                 'number_next_actual': 1,  | #                 'number_next_actual': 1, | ||||||
| #                 'prefix': 'AS-', | #                 'prefix': 'AS-', | ||||||
| #                 'padding': 5, | #                 'padding': 5, | ||||||
| #             },                            | #             }, | ||||||
| #            'picking.out':  {  | #            'picking.out':  { | ||||||
| #                #'number_next_actual': 1,  | #                #'number_next_actual': 1, | ||||||
| #                'prefix': 'LS/', | #                'prefix': 'LS/', | ||||||
| #                'padding': 4, | #                'padding': 4, | ||||||
| #            }, | #            }, | ||||||
| #            'picking.in':  {  | #            'picking.in':  { | ||||||
| #                #'number_next_actual': 1,  | #                #'number_next_actual': 1, | ||||||
| #                'prefix': 'LS/IN/', | #                'prefix': 'LS/IN/', | ||||||
| #                'padding': 4, | #                'padding': 4, | ||||||
| #            },                    | #            }, | ||||||
| #            'picking.int':  {  | #            'picking.int':  { | ||||||
| #                #'number_next_actual': 1,  | #                #'number_next_actual': 1, | ||||||
| #                'prefix': 'LS/INT/', | #                'prefix': 'LS/INT/', | ||||||
| #                'padding': 4, | #                'padding': 4, | ||||||
| #            }, | #            }, | ||||||
| #             'purchase.order':  {  | #             'purchase.order':  { | ||||||
| #                 'number_next_actual': 1,  | #                 'number_next_actual': 1, | ||||||
| #                 'prefix': 'B-', | #                 'prefix': 'B-', | ||||||
| #                 'padding': 5, | #                 'padding': 5, | ||||||
| #             }, | #             }, | ||||||
| #             'account.invoice':  {  | #             'account.invoice':  { | ||||||
| #                 'number_next_actual': 2000,  | #                 'number_next_actual': 2000, | ||||||
| #                 'prefix': '15-', | #                 'prefix': '15-', | ||||||
| #                 'padding': 4, | #                 'padding': 4, | ||||||
| #             }, | #             }, | ||||||
|         } |         } | ||||||
|          | 
 | ||||||
|         self.active_uoms = { |         self.active_uoms = { | ||||||
|             'product.product_uom_unit': 'Stk.', |             'product.product_uom_unit': 'Stk.', | ||||||
|             #'product.product_uom_meter': 'lfm', |             #'product.product_uom_meter': 'lfm', | ||||||
|             #'product.product_uom_litre': 'l', |             #'product.product_uom_litre': 'l', | ||||||
|             #'product.product_uom_hour': 'h', |             #'product.product_uom_hour': 'h', | ||||||
|             #'product.product_uom_kgm': 'kg', |             #'product.product_uom_kgm': 'kg', | ||||||
|         }         |         } | ||||||
| 
 | 
 | ||||||
|         #Lieferbedingungen |         #Lieferbedingungen | ||||||
|         self.incoterms = { |         self.incoterms = { | ||||||
|             ('Ab Werk', 'ABW'), |             ('Ab Werk', 'ABW'), | ||||||
|             ('Botendienst', 'BOT'), |             ('Botendienst', 'BOT'), | ||||||
|             ('Zustellung', 'ZUS'), |             ('Zustellung', 'ZUS'), | ||||||
|         }   |         } | ||||||
|          | 
 | ||||||
|         # Soll das Ändern einer Rechnung im Nachhinein erlaubt sein? |         # Soll das Ändern einer Rechnung im Nachhinein erlaubt sein? | ||||||
|         self.allow_cancel_invoice = True |         self.allow_cancel_invoice = True | ||||||
|          | 
 | ||||||
|         self.modules = [ |         self.modules = [ | ||||||
|             'base_iban', |             'base_iban', | ||||||
|             'document', |             'document', | ||||||
|             'knowledge', |             'knowledge', | ||||||
|             'auth_crypt', |             'auth_crypt', | ||||||
|             'cam_testenv',             |             'cam_testenv', | ||||||
|             'cam_max_width', |             'cam_max_width', | ||||||
|             'oerp_no_phoning_home', |             'oerp_no_phoning_home', | ||||||
|             'cam_custom', |             'cam_custom', | ||||||
|             'cam_reports', |             'cam_reports', | ||||||
|             'account_cancel', |             'account_cancel', | ||||||
|             'cam_invoice_skonto', |             'cam_invoice_skonto', | ||||||
|             'web_printscreen_zb',                                                 |             'web_printscreen_zb', | ||||||
|             'crm', |             'crm', | ||||||
|             'sale', |             'sale', | ||||||
|             'mail_follower_control', |             'mail_follower_control', | ||||||
|  | @ -209,13 +206,13 @@ class Config(): | ||||||
|             #'sale_order_reminder', |             #'sale_order_reminder', | ||||||
|         ] |         ] | ||||||
| 
 | 
 | ||||||
|         # Setzen das Feld "Attachment" im Report (wenn gesetzt, wird das PDF in den Anhängen gespeichert) |         # Setze das Feld "Attachment" im Report (wenn gesetzt wird das PDF in den Anhängen gespeichert) | ||||||
|         timestamp = " + '_' +  time.strftime('%Y-%m-%d-%H%M') + '.pdf')" |         timestamp = " + '_' +  time.strftime('%Y-%m-%d-%H%M') + '.pdf')" | ||||||
|         self.reports = {                         |         self.reports = { | ||||||
|             'sale.report_saleorder': "((object.state in ('draft','sent') and 'KV_' or 'AB_') + object.name" + timestamp, |             'sale.report_saleorder': "((object.state in ('draft','sent') and 'KV_' or 'AB_') + object.name" + timestamp, | ||||||
|             'cam_reports.report_saleorder_ohne': "((object.state in ('draft','sent') and 'KV_' or 'AB_') + object.name" + timestamp, |             'cam_reports.report_saleorder_ohne': "((object.state in ('draft','sent') and 'KV_' or 'AB_') + object.name" + timestamp, | ||||||
|             'cam_reports.report_porto_anforderung': "('PV_' + object.name " + timestamp, |             'cam_reports.report_porto_anforderung': "('PV_' + object.name " + timestamp, | ||||||
|             'cam_reports.report_porto_anforderung_ohne': "('PV_' + object.name " + timestamp,             |             'cam_reports.report_porto_anforderung_ohne': "('PV_' + object.name " + timestamp, | ||||||
|             'account.report_invoice': "(object.state in ('open','paid')) and ('RE_'+(object.number or '').replace('/','')" + timestamp, |             'account.report_invoice': "(object.state in ('open','paid')) and ('RE_'+(object.number or '').replace('/','')" + timestamp, | ||||||
|             'cam_reports.report_invoices_ohne': "(object.state in ('open','paid')) and ('RE_'+(object.number or '').replace('/','')" + timestamp, |             'cam_reports.report_invoices_ohne': "(object.state in ('open','paid')) and ('RE_'+(object.number or '').replace('/','')" + timestamp, | ||||||
|             'cam_reports.report_porto_rechnung': "(object.state in ('open','paid')) and ('RE_'+(object.number or '').replace('/','')" + timestamp, |             'cam_reports.report_porto_rechnung': "(object.state in ('open','paid')) and ('RE_'+(object.number or '').replace('/','')" + timestamp, | ||||||
|  | @ -224,11 +221,11 @@ class Config(): | ||||||
|             'purchase.report_purchaseorder': "('B_' + object.name" + timestamp, |             'purchase.report_purchaseorder': "('B_' + object.name" + timestamp, | ||||||
|             'cam_reports.report_purchaseorder_ohne': "('B_' + object.name" + timestamp, |             'cam_reports.report_purchaseorder_ohne': "('B_' + object.name" + timestamp, | ||||||
|         } |         } | ||||||
|          | 
 | ||||||
|         self.users_file = "res.users.csv" |         self.users_file = 'res.users.csv' | ||||||
|          | 
 | ||||||
|         self.translation_files = [ |         self.translation_files = [ | ||||||
|                                   "ir.translation.csv" |                                   'ir.translation.csv' | ||||||
|                                   ] |                                   ] | ||||||
| 
 | 
 | ||||||
|         self.default_values = [   # ir.values |         self.default_values = [   # ir.values | ||||||
|  | @ -240,7 +237,7 @@ class Config(): | ||||||
|             'purchase.route_warehouse0_buy': {'name': 'Einkaufen'}, |             'purchase.route_warehouse0_buy': {'name': 'Einkaufen'}, | ||||||
|             'stock.route_warehouse0_mto': {'name': 'Beschaffe von Auftrag'}, |             'stock.route_warehouse0_mto': {'name': 'Beschaffe von Auftrag'}, | ||||||
|         } |         } | ||||||
|          | 
 | ||||||
|         self.system_parameters = { |         self.system_parameters = { | ||||||
|             'ir_attachment.location': 'db', # [db] oder [file] |             'ir_attachment.location': 'db', # [db] oder [file] | ||||||
|         }          |         } | ||||||
|  |  | ||||||
|  | @ -1,16 +1,18 @@ | ||||||
| # -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||||
| 
 |  | ||||||
| class Environment(): | class Environment(): | ||||||
|      |     def __init__(self, host, port, dbname, username, pwd=None, super_admin_pw=None, basic_auth=None): | ||||||
|     def __init__(self, host, port, dbname, username, pwd, admin_pw=False, basic_auth=False): |         self.host = host | ||||||
|         self.admin_pw = admin_pw |         self.port = port | ||||||
|         self.dbname = dbname |         self.dbname = dbname | ||||||
|         self.username = username |         self.username = username | ||||||
|  |         # The password for the user named username | ||||||
|  |         # During create the user is created with this password, | ||||||
|  |         # otherwise it's used to authenticate during login. | ||||||
|         self.pwd = pwd |         self.pwd = pwd | ||||||
|         self.port = port |         self.super_admin_pw = super_admin_pw | ||||||
|         self.host = host |         # HTTP authentication | ||||||
|         self.basic_auth = basic_auth or ('user', 'pass') # HTTP authentification |         self.basic_auth = basic_auth or ('user', 'pass') | ||||||
|      | 
 | ||||||
|     def __str__(self): |     def __str__(self): | ||||||
|         return """============================== |         return """============================== | ||||||
| Host:     %s | Host:     %s | ||||||
|  | @ -18,12 +20,16 @@ User:     %s | ||||||
| DB:       %s | DB:       %s | ||||||
| Port:     %s | Port:     %s | ||||||
| ==============================""" % (self.host, self.username, self.dbname, self.port) | ==============================""" % (self.host, self.username, self.dbname, self.port) | ||||||
|          | 
 | ||||||
|      | 
 | ||||||
| ENVIRONMENTS = { | ENVIRONMENTS = { | ||||||
|     'br': Environment('http://localhost', '8080', 'INSTANCE_1', 'admin', 'x', 'admin'),         |     # Local environments are listed with passwords | ||||||
|     'sk': Environment('http://localhost', '8080', 'INSTANCE_1', 'admin', 'x', 'admin'),        |     'br': Environment('http://localhost', '8080', 'INSTANCE_1', 'admin', 'x', 'admin'), | ||||||
|     'ka': Environment('http://localhost', '8080', 'INSTANCE_1', 'admin', 'x', 'admin'),      |     'sk': Environment('http://localhost', '8080', 'INSTANCE_1', 'admin', 'x', 'admin'), | ||||||
|     'test': Environment('https://INSTANCE.camadeus.at', '443', 'INSTANCE_1', 'admin', '141kcal', 'asdfasdf'), |     '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'), | ||||||
| } | } | ||||||
|     |  | ||||||
|  | @ -1,25 +1,21 @@ | ||||||
| # -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||||
| 
 |  | ||||||
| import xmlrpclib |  | ||||||
| import base64 | import base64 | ||||||
| import os |  | ||||||
| import sys |  | ||||||
| import datetime |  | ||||||
| import json | import json | ||||||
|  | import pprint | ||||||
|  | import sys | ||||||
|  | import xmlrpclib | ||||||
|  | 
 | ||||||
| import requests | import requests | ||||||
| from config_at import Config |  | ||||||
| from environments import ENVIRONMENTS |  | ||||||
| 
 | 
 | ||||||
| class CamadeusFunctions(): | class CamadeusFunctions(): | ||||||
|      |  | ||||||
|     def __init__(self, environment, config): |     def __init__(self, environment, config): | ||||||
|         self.env = environment |         self.env = environment | ||||||
|         self.config = config |         self.config = config | ||||||
| 
 | 
 | ||||||
|     def create_db(self): |     def create_db(self): | ||||||
|         """Neue Datenbank erstellen""" |         """Neue Datenbank erstellen""" | ||||||
|          | 
 | ||||||
|         payload = {'fields': [  {'name': 'super_admin_pwd', 'value': self.env.admin_pw}, |         payload = {'fields': [  {'name': 'super_admin_pwd', 'value': self.env.super_admin_pw}, | ||||||
|                                 {'name': 'db_name', 'value': self.env.dbname}, |                                 {'name': 'db_name', 'value': self.env.dbname}, | ||||||
|                                 {'name': 'demo_data', 'value': False}, |                                 {'name': 'demo_data', 'value': False}, | ||||||
|                                 {'name': 'db_lang', 'value': self.config.lang}, |                                 {'name': 'db_lang', 'value': self.config.lang}, | ||||||
|  | @ -29,28 +25,29 @@ class CamadeusFunctions(): | ||||||
|         payload = {'params': payload} |         payload = {'params': payload} | ||||||
|         json_data = json.dumps(payload) |         json_data = json.dumps(payload) | ||||||
|         headers = {'content-type': 'application/json'} |         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) |         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): |         if r and r.json().get('result', False): | ||||||
|             return True |             return True | ||||||
|         else: |         else: | ||||||
|             print "Error occured: %s" % r.json().get('error', '????') |             msg = pprint.pformat(r.json().get('error', '????')) | ||||||
|             return False         |             print 'Error occured: %s' % msg | ||||||
|  |             return False | ||||||
| 
 | 
 | ||||||
|     def login(self): |     def login(self): | ||||||
|         """Login""" |         """Login""" | ||||||
|          | 
 | ||||||
|         # Get the uid |         # 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) |         self.uid = sock_common.login(self.env.dbname, self.env.username, self.env.pwd) | ||||||
|         if not self.uid: |         if not self.uid: | ||||||
|             raise "Authentication Error" |             raise Exception('Authentication Error') | ||||||
|         self.sock = xmlrpclib.ServerProxy('%s:%s/xmlrpc/object' % (self.env.host,self.env.port)) |         self.sock = xmlrpclib.ServerProxy('%s:%s/xmlrpc/object' % (self.env.host, self.env.port)) | ||||||
|         return True |         return True | ||||||
| 
 | 
 | ||||||
|     def _execute(self, *args): |     def _execute(self, *args): | ||||||
|         return self.sock.execute(self.env.dbname, self.uid, self.env.pwd, *args) |         return self.sock.execute(self.env.dbname, self.uid, self.env.pwd, *args) | ||||||
| 
 | 
 | ||||||
|     def _readAndReturnFile(self, filename, encode = ''): |     def _readAndReturnFile(self, filename, encode =''): | ||||||
|         fi = open (filename, 'r') |         fi = open (filename, 'r') | ||||||
|         content = '' |         content = '' | ||||||
|         if encode=='': |         if encode=='': | ||||||
|  | @ -61,73 +58,58 @@ class CamadeusFunctions(): | ||||||
|             sys.exit(-1) |             sys.exit(-1) | ||||||
|         fi.close() |         fi.close() | ||||||
|         return content |         return content | ||||||
|      | 
 | ||||||
|     def set_company(self): |     def set_company(self): | ||||||
|         """Setze Unternehmensdaten (Allgemein, RML, Logo)""" |         """Setze Unternehmensdaten (Allgemein, RML, Logo)""" | ||||||
|          | 
 | ||||||
|         vals = self.config.company_data |         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']) | ||||||
|          | 
 | ||||||
|         # RML-Header ist nun ein function-Feld |         if vals.get('logo', False): | ||||||
|         #if vals.get('rml_header',False): |             vals['logo'] = self._readAndReturnFile(vals['logo'], encode='base64') | ||||||
|         #    vals['rml_header'] =  self._readAndReturnFile(vals['rml_header'])    |  | ||||||
|          |  | ||||||
|         if vals.get('logo',False): |  | ||||||
|             vals['logo'] =  self._readAndReturnFile(vals['logo'], encode = 'base64') |  | ||||||
|         vals['country_id'] = country_id |         vals['country_id'] = country_id | ||||||
|         c_ids = self._execute('res.company', 'search', [],  ) |         c_ids = self._execute('res.company', 'search', []) | ||||||
|         return self._execute('res.company', 'write', c_ids,  vals) |         return self._execute('res.company', 'write', c_ids, vals) | ||||||
| 
 | 
 | ||||||
|     def set_taxes(self): |     def set_taxes(self): | ||||||
|         """Setze nicht benötigte Steuern auf inaktiv""" |         """Setze nicht benötigte Steuern auf inaktiv""" | ||||||
|          | 
 | ||||||
|         tax_ids = self._execute('account.tax', 'search',  [('description','not in', self.config.valid_taxes)]) |         tax_ids = self._execute('account.tax', 'search', [('description', 'not in', self.config.valid_taxes)]) | ||||||
|         return self._execute('account.tax', 'write', tax_ids, {'active': False}) |         return self._execute('account.tax', 'write', tax_ids, {'active': False}) | ||||||
| 
 | 
 | ||||||
|     def set_date_format(self): |     def set_date_format(self): | ||||||
|         """Setzen des Datumsformats """ |         """Setzen des Datumsformats """ | ||||||
|          | 
 | ||||||
|         lang_ids = self._execute('res.lang', 'search',  [('code','=',self.config.lang)]) |         lang_ids = self._execute('res.lang', 'search', [('code', '=', self.config.lang)]) | ||||||
|         if lang_ids: |         if lang_ids: | ||||||
|             vals = { |             vals = { | ||||||
|                 'date_format': '%d.%m.%Y', |                 'date_format': '%d.%m.%Y', | ||||||
|                 'time_format': '%H:%M:%S', |                 'time_format': '%H:%M:%S', | ||||||
|                 'grouping': '[3,3]',     |                 'grouping': '[3,3]', | ||||||
|                 'thousands_sep': '.', |                 'thousands_sep': '.', | ||||||
|                 'decimal_point': ',',            |                 'decimal_point': ',', | ||||||
|             } |             } | ||||||
|             self._execute('res.lang', 'write', lang_ids, vals) |             self._execute('res.lang', 'write', lang_ids, vals) | ||||||
|         else: |         else: | ||||||
|             return False |             return False | ||||||
|          | 
 | ||||||
|         lang_ids = self._execute('res.lang', 'search',  [('code','=','en_US')]) |         lang_ids = self._execute('res.lang', 'search', [('code', '=', 'en_US')]) | ||||||
|         if lang_ids: |         if lang_ids: | ||||||
|             vals = { |             vals = { | ||||||
|                 'grouping': '[3,3]',         |                 'grouping': '[3,3]', | ||||||
|             } |             } | ||||||
|             self._execute('res.lang', 'write', lang_ids, vals) |             self._execute('res.lang', 'write', lang_ids, vals) | ||||||
|         else: |         else: | ||||||
|             return False       |             return False | ||||||
|          |  | ||||||
|         return True   |  | ||||||
| 
 | 
 | ||||||
| #     def set_report_types(self): |         return True | ||||||
| #         """Setzen der Report Types auf RML (PDF)""" |  | ||||||
| #          |  | ||||||
| #         report_names = ['purchase.report_purchaseorder', |  | ||||||
| #                       'purchase.report_purchasequotation', |  | ||||||
| #                       'account.report_invoice', |  | ||||||
| #                       'sale.report_saleorder', |  | ||||||
| #                       'stock.report_picking'] |  | ||||||
| #         report_ids = self._execute('ir.actions.report.xml', 'search', [('report_name','in',report_names)]) |  | ||||||
| #         return self._execute('ir.actions.report.xml', 'write', report_ids, {'report_type': 'pdf'}) |  | ||||||
| 
 | 
 | ||||||
|     def purchase_config(self): |     def purchase_config(self): | ||||||
|         """Basiskonfiguration für Einkauf laden""" |         """Basiskonfiguration für Einkauf laden""" | ||||||
|          | 
 | ||||||
|         if hasattr(self.config, 'purchase_config'): |         if hasattr(self.config, 'purchase_config'): | ||||||
|             vals = self._execute('purchase.config.settings', 'default_get', [])   |             vals = self._execute('purchase.config.settings', 'default_get', []) | ||||||
|             vals.update(self.config.purchase_config)            |             vals.update(self.config.purchase_config) | ||||||
|             wizard_id = self._execute('purchase.config.settings', 'create', vals) |             wizard_id = self._execute('purchase.config.settings', 'create', vals) | ||||||
|             return self._execute('purchase.config.settings', 'execute', [wizard_id]) |             return self._execute('purchase.config.settings', 'execute', [wizard_id]) | ||||||
|         return True |         return True | ||||||
|  | @ -139,46 +121,45 @@ class CamadeusFunctions(): | ||||||
|         vals.update(self.config.sale_config) |         vals.update(self.config.sale_config) | ||||||
|         wizard_id = self._execute('sale.config.settings', 'create', vals) |         wizard_id = self._execute('sale.config.settings', 'create', vals) | ||||||
|         return self._execute('sale.config.settings', 'execute', [wizard_id]) |         return self._execute('sale.config.settings', 'execute', [wizard_id]) | ||||||
|      | 
 | ||||||
|     def stock_config(self): |     def stock_config(self): | ||||||
|         """Basiskonfiguration für Lager laden""" |         """Basiskonfiguration für Lager laden""" | ||||||
| 
 | 
 | ||||||
|         if hasattr(self.config, 'stock_config'): |         if hasattr(self.config, 'stock_config'): | ||||||
|             vals = self._execute('stock.config.settings', 'default_get', [])   |             vals = self._execute('stock.config.settings', 'default_get', []) | ||||||
|             vals.update(self.config.stock_config)            |             vals.update(self.config.stock_config) | ||||||
|             wizard_id = self._execute('stock.config.settings', 'create', vals) |             wizard_id = self._execute('stock.config.settings', 'create', vals) | ||||||
|             return self._execute('stock.config.settings', 'execute', [wizard_id])   |             return self._execute('stock.config.settings', 'execute', [wizard_id]) | ||||||
|         return True  |         return True | ||||||
| 
 | 
 | ||||||
|     def mrp_config(self): |     def mrp_config(self): | ||||||
|         """Basiskonfiguration für Fertigung laden""" |         """Basiskonfiguration für Fertigung laden""" | ||||||
| 
 | 
 | ||||||
|         if hasattr(self.config, 'mrp_config'): |         if hasattr(self.config, 'mrp_config'): | ||||||
|             vals = {}#self._execute('mrp.config.settings', 'default_get', self.config.mrp_config.keys()) |             vals = {} | ||||||
|             vals.update(self.config.mrp_config)            |             vals.update(self.config.mrp_config) | ||||||
|             wizard_id = self._execute('mrp.config.settings', 'create', vals) |             wizard_id = self._execute('mrp.config.settings', 'create', vals) | ||||||
|             return self._execute('mrp.config.settings', 'execute', [wizard_id])   |             return self._execute('mrp.config.settings', 'execute', [wizard_id]) | ||||||
|         return True   |         return True | ||||||
|      | 
 | ||||||
|     def hr_config(self): |     def hr_config(self): | ||||||
|         """Basiskonfiguration für Personal Laden""" |         """Basiskonfiguration für Personal Laden""" | ||||||
| 
 | 
 | ||||||
|         if hasattr(self.config, 'hr_config'): |         if hasattr(self.config, 'hr_config'): | ||||||
|             vals = self._execute('hr.config.settings', 'default_get', [])   |             vals = self._execute('hr.config.settings', 'default_get', []) | ||||||
|             vals.update(self.config.hr_config)            |             vals.update(self.config.hr_config) | ||||||
|             wizard_id = self._execute('hr.config.settings', 'create', vals) |             wizard_id = self._execute('hr.config.settings', 'create', vals) | ||||||
|             return self._execute('hr.config.settings', 'execute', [wizard_id])   |             return self._execute('hr.config.settings', 'execute', [wizard_id]) | ||||||
|         return True  |         return True | ||||||
| 
 | 
 | ||||||
|     def set_incoterms(self): |     def set_incoterms(self): | ||||||
|         """Lieferbedingungen setzen""" |         """Lieferbedingungen setzen""" | ||||||
|          | 
 | ||||||
|         if hasattr(self.config, 'incoterms'): |         if hasattr(self.config, 'incoterms'): | ||||||
|             terms = self.config.incoterms |             terms = self.config.incoterms | ||||||
|              | 
 | ||||||
|              |             for name,code in terms: | ||||||
|             for name,code in terms:                 |                 existing_ids = self._execute('stock.incoterms', 'search', ['|', ('active', '=', True), ('active', '=', False), ('code', '=', code)]) | ||||||
|                 existing_ids = self._execute('stock.incoterms', 'search', ['|',('active','=',True),('active','=',False),('code','=',code)]) |  | ||||||
|                 if existing_ids: |                 if existing_ids: | ||||||
|                     vals = { |                     vals = { | ||||||
|                         'active': True, |                         'active': True, | ||||||
|  | @ -191,69 +172,68 @@ class CamadeusFunctions(): | ||||||
|                         'code': code, |                         'code': code, | ||||||
|                     } |                     } | ||||||
|                     self._execute('stock.incoterms', 'create', vals) |                     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)]) |             inactive_ids = self._execute('stock.incoterms', 'search', [('code', 'not in', codes)]) | ||||||
|             self._execute('stock.incoterms', 'write', inactive_ids, {'active': False}) |             self._execute('stock.incoterms', 'write', inactive_ids, {'active': False}) | ||||||
|              | 
 | ||||||
|          |  | ||||||
|         return True |         return True | ||||||
|      | 
 | ||||||
|     def base_config(self): |     def base_config(self): | ||||||
|         """Allgemeine Konfiguration laden""" |         """Allgemeine Konfiguration laden""" | ||||||
| 
 | 
 | ||||||
|         vals = self._execute('base.config.settings', 'default_get', []) |         vals = self._execute('base.config.settings', 'default_get', []) | ||||||
|         vals.update(self.config.base_config)     |         vals.update(self.config.base_config) | ||||||
|         wizard_id = self._execute('base.config.settings', 'create', vals) |         wizard_id = self._execute('base.config.settings', 'create', vals) | ||||||
|         return self._execute('base.config.settings', 'execute', [wizard_id]) |         return self._execute('base.config.settings', 'execute', [wizard_id]) | ||||||
| 
 | 
 | ||||||
|     def install_module_sale(self): |     def install_module_sale(self): | ||||||
|         """Modul 'Sale' installieren""" |         """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')]) | ||||||
|         res = self._execute('ir.module.module', 'button_install', modules_to_install)    |         res = self._execute('ir.module.module', 'button_install', modules_to_install) | ||||||
|         res = self._execute('base.module.upgrade', 'upgrade_module', modules_to_install) |         res = self._execute('base.module.upgrade', 'upgrade_module', modules_to_install) | ||||||
|         return True |         return True | ||||||
|      | 
 | ||||||
|     def install_modules(self): |     def install_modules(self): | ||||||
|         """Module installieren""" |         """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')]) | ||||||
|         res = self._execute('ir.module.module', 'button_install', modules_to_install)    |         res = self._execute('ir.module.module', 'button_install', modules_to_install) | ||||||
|         res = self._execute('base.module.upgrade', 'upgrade_module', modules_to_install) |         res = self._execute('base.module.upgrade', 'upgrade_module', modules_to_install) | ||||||
|         return True |         return True | ||||||
| 
 | 
 | ||||||
|     def _set_picking_sequence_prefix(self, code, value): |     def _set_picking_sequence_prefix(self, code, value): | ||||||
|         seq_dict = self.config.sequences |         seq_dict = self.config.sequences | ||||||
|          | 
 | ||||||
|         #Hauptsequenz des Picking Types mit diesem code anpassen |         # Hauptsequenz des Picking Types mit diesem code anpassen | ||||||
|         picking_type_id = self._execute('stock.picking.type', 'search', [('code','=',code)], 0, 1, 'id')[0] |         picking_type_id = self._execute('stock.picking.type', 'search', [('code', '=', code)], 0, 1, 'id')[0] | ||||||
|         picking_type = self._execute('stock.picking.type', 'read', picking_type_id, ['sequence_id']) |         picking_type = self._execute('stock.picking.type', 'read', picking_type_id, ['sequence_id']) | ||||||
|         s_id = picking_type['sequence_id'][0] |         s_id = picking_type['sequence_id'][0] | ||||||
|         if not self._execute('ir.sequence', 'write', s_id, seq_dict.get(value)): |         if not self._execute('ir.sequence', 'write', s_id, seq_dict.get(value)): | ||||||
|             return False |             return False | ||||||
|          | 
 | ||||||
|         #Allen Picking Types mit diesem code die Haupsequenz geben |         # Allen Picking Types mit diesem code die Haupsequenz geben | ||||||
|         picking_type_ids = self._execute('stock.picking.type', 'search', [('code','=',code)]) |         picking_type_ids = self._execute('stock.picking.type', 'search', [('code', '=', code)]) | ||||||
|         if not self._execute('stock.picking.type', 'write', picking_type_ids, {'sequence_id': s_id}): |         if not self._execute('stock.picking.type', 'write', picking_type_ids, {'sequence_id': s_id}): | ||||||
|             return False |             return False | ||||||
| 
 | 
 | ||||||
|     def set_dokumentennummern(self): |     def set_dokumentennummern(self): | ||||||
|         """Dokumentennummern setzen""" |         """Dokumentennummern setzen""" | ||||||
|          | 
 | ||||||
|         seq_dict = self.config.sequences |         seq_dict = self.config.sequences | ||||||
|          | 
 | ||||||
|         # Lieferschein |         # Lieferschein | ||||||
|         if seq_dict.get('picking.out',False):    |         if seq_dict.get('picking.out',False): | ||||||
|             self._set_picking_sequence_prefix('outgoing', 'picking.out') |             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')       |             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') |             self._set_picking_sequence_prefix('internal', 'picking.int') | ||||||
|          | 
 | ||||||
|         # Angebot |         # 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')]) |             s_ids = self._execute('ir.sequence', 'search', [('code', '=', 'sale.order')]) | ||||||
|             if len(s_ids) != 1: |             if len(s_ids) != 1: | ||||||
|                 return False |                 return False | ||||||
|             if not self._execute('ir.sequence', 'write', s_ids, seq_dict.get('sale.order')): |             if not self._execute('ir.sequence', 'write', s_ids, seq_dict.get('sale.order')): | ||||||
|  | @ -261,132 +241,132 @@ class CamadeusFunctions(): | ||||||
| 
 | 
 | ||||||
|         # Arbeitsschein |         # 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')]) |             s_ids = self._execute('ir.sequence', 'search', [('code', '=', 'work.order')]) | ||||||
|             if len(s_ids) != 1: |             if len(s_ids) != 1: | ||||||
|                 return False |                 return False | ||||||
|             if not self._execute('ir.sequence', 'write', s_ids, seq_dict.get('work.order')): |             if not self._execute('ir.sequence', 'write', s_ids, seq_dict.get('work.order')): | ||||||
|                 return False  |                 return False | ||||||
|          | 
 | ||||||
|         # EK-Angebot |         # 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')]) |             s_ids = self._execute('ir.sequence', 'search', [('code', '=', 'purchase.order')]) | ||||||
|             if len(s_ids) != 1: |             if len(s_ids) != 1: | ||||||
|                 return False |                 return False | ||||||
|             if not self._execute('ir.sequence', 'write', s_ids, seq_dict.get('purchase.order')): |             if not self._execute('ir.sequence', 'write', s_ids, seq_dict.get('purchase.order')): | ||||||
|                 return False         |                 return False | ||||||
|          | 
 | ||||||
|         # Rechnungsnummer |         # Rechnungsnummer | ||||||
|         if seq_dict.get('account.invoice',False): |         if seq_dict.get('account.invoice',False): | ||||||
|             j_ids = self._execute('account.journal', 'search', [('code','=','VK')]) |             j_ids = self._execute('account.journal', 'search', [('code', '=', 'VK')]) | ||||||
|             if len(j_ids) != 1: |             if len(j_ids) != 1: | ||||||
|                 return False |                 return False | ||||||
|             journals = self._execute('account.journal', 'read', j_ids, ['sequence_id']) |             journals = self._execute('account.journal', 'read', j_ids, ['sequence_id']) | ||||||
|             s_id = journals[0]['sequence_id'][0] |             s_id = journals[0]['sequence_id'][0] | ||||||
|             if not self._execute('ir.sequence', 'write', [s_id], seq_dict.get('account.invoice')): |             if not self._execute('ir.sequence', 'write', [s_id], seq_dict.get('account.invoice')): | ||||||
|                 return False  |                 return False | ||||||
| 
 | 
 | ||||||
|         # Setzen Gutschriftenkreis |         # Setzen Gutschriftenkreis | ||||||
|         if self.config.refund_invoice_sequence: |         if self.config.refund_invoice_sequence: | ||||||
|             j_ids = self._execute('account.journal', 'search', [('code','=','VK')]) |             j_ids = self._execute('account.journal', 'search', [('code', '=', 'VK')]) | ||||||
|             if len(j_ids) != 1: |             if len(j_ids) != 1: | ||||||
|                 return False |                 return False | ||||||
|             journals = self._execute('account.journal', 'read', j_ids, ['sequence_id']) |             journals = self._execute('account.journal', 'read', j_ids, ['sequence_id']) | ||||||
|             s_id = journals[0]['sequence_id'][0] |             s_id = journals[0]['sequence_id'][0] | ||||||
|              | 
 | ||||||
|             gj_ids = self._execute('account.journal', 'search', [('code','=','GSV')]) |             gj_ids = self._execute('account.journal', 'search', [('code', '=', 'GSV')]) | ||||||
|             if len(gj_ids) != 1: |             if len(gj_ids) != 1: | ||||||
|                 return False |                 return False | ||||||
|             vals = { |             vals = { | ||||||
|                 'sequence_id': s_id, |                 'sequence_id': s_id, | ||||||
|             } |             } | ||||||
|             self._execute('account.journal', 'write', gj_ids,vals) |             self._execute('account.journal', 'write', gj_ids, vals) | ||||||
| 
 | 
 | ||||||
|         return True |         return True | ||||||
| 
 | 
 | ||||||
|     def set_admin_rights(self): |     def set_admin_rights(self): | ||||||
|         """Setze Administrator Rechte""" |         """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 = [] |         groups = [] | ||||||
|          | 
 | ||||||
|         # Technische Eigenschaften |         # 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)) |         groups.append((4, group_id)) | ||||||
|          | 
 | ||||||
|         # Finanzmanager |         # 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)) |         groups.append((4, group_id)) | ||||||
|          | 
 | ||||||
|         vals = { |         vals = { | ||||||
|             'groups_id': groups, |             'groups_id': groups, | ||||||
|             'tz': 'Europe/Vienna', |             'tz': 'Europe/Vienna', | ||||||
|         } |         } | ||||||
|          | 
 | ||||||
|         return self._execute('res.users', 'write', [user_id], vals) |         return self._execute('res.users', 'write', [user_id], vals) | ||||||
| 
 | 
 | ||||||
|     def setup_accounting(self): |     def setup_accounting(self): | ||||||
|         """Konfiguration Buchhaltung""" |         """Konfiguration Buchhaltung""" | ||||||
|          | 
 | ||||||
|         vals = self._execute('account.installer', 'default_get', [])    |         vals = self._execute('account.installer', 'default_get', []) | ||||||
|         vals['charts'] = self.config.chart_of_accounts     |         vals['charts'] = self.config.chart_of_accounts | ||||||
|         wizard_id = self._execute('account.installer', 'create', vals) |         wizard_id = self._execute('account.installer', 'create', vals) | ||||||
|         res = self._execute('account.installer', 'action_next', [wizard_id]) |         res = self._execute('account.installer', 'action_next', [wizard_id]) | ||||||
|         return True   |         return True | ||||||
| 
 | 
 | ||||||
|     def setup_accounting2(self): |     def setup_accounting2(self): | ||||||
|         """Konfiguration Kontenplan""" |         """Konfiguration Kontenplan""" | ||||||
|          | 
 | ||||||
|         c = self.config |         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: |         if not sales_tax_ids: | ||||||
|             return False |             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: |         if not purchase_tax_ids: | ||||||
|             return False |             return False | ||||||
|          | 
 | ||||||
|         #Set Your Accounting Options  |         # 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 = {} | ||||||
|         vals['chart_template_id'] = c.chart_template_id |         vals['chart_template_id'] = c.chart_template_id | ||||||
|         vals['sale_tax'] = sales_tax_ids[0] |         vals['sale_tax'] = sales_tax_ids[0] | ||||||
|         vals['purchase_tax'] = purchase_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   |         vals['currency_id'] = currency_id | ||||||
|         wizard_id = self._execute('wizard.multi.charts.accounts', 'create', vals) |         wizard_id = self._execute('wizard.multi.charts.accounts', 'create', vals) | ||||||
|         res = self._execute('wizard.multi.charts.accounts', 'action_next', [wizard_id]) |         res = self._execute('wizard.multi.charts.accounts', 'action_next', [wizard_id]) | ||||||
|         return True |         return True | ||||||
| 
 | 
 | ||||||
|     def set_currencies(self): |     def set_currencies(self): | ||||||
|         """Währungen setzen""" |         """Währungen setzen""" | ||||||
|          | 
 | ||||||
|         c = self.config |         c = self.config | ||||||
|          | 
 | ||||||
|         # Set all currencies to active |         # Set all currencies to active | ||||||
|         ids = self._execute('res.currency', 'search', ['|',('active','=',True),('active','=',False)]) |         ids = self._execute('res.currency', 'search', ['|', ('active', '=', True), ('active', '=', False)]) | ||||||
|         res = self._execute('res.currency', 'write', ids, {'active': True}) |         res = self._execute('res.currency', 'write', ids, {'active': True}) | ||||||
|         if not res: |         if not res: | ||||||
|             return False |             return False | ||||||
|          | 
 | ||||||
|         # Set all other UOMs to inactive |         # Set all other UOMs to inactive | ||||||
|         inactive_ids = self._execute('res.currency', 'search', [('name','not in',c.valid_currencies)]) |         inactive_ids = self._execute('res.currency', 'search', [('name', 'not in', c.valid_currencies)]) | ||||||
|         res = self._execute('res.currency', 'write', inactive_ids, {'active': False}) |         res = self._execute('res.currency', 'write', inactive_ids, {'active': False}) | ||||||
|         if not res: |         if not res: | ||||||
|             return False |             return False | ||||||
|                  | 
 | ||||||
|         return True |         return True | ||||||
|      | 
 | ||||||
|     def uninstall_chat(self): |     def uninstall_chat(self): | ||||||
|         """Chat-Modul deinstallieren """ |         """Chat-Modul deinstallieren """ | ||||||
|          | 
 | ||||||
|         modules = ['im_chat','im_odoo_support','bus'] |         modules = ['im_chat', 'im_odoo_support', 'bus'] | ||||||
|         modules_to_install = self._execute('ir.module.module', 'search', [('name','in',modules)]) |         modules_to_install = self._execute('ir.module.module', 'search', [('name', 'in', modules)]) | ||||||
|         res = self._execute('ir.module.module', 'button_uninstall', modules_to_install)    |         res = self._execute('ir.module.module', 'button_uninstall', modules_to_install) | ||||||
|         res = self._execute('base.module.upgrade', 'upgrade_module', modules_to_install) |         res = self._execute('base.module.upgrade', 'upgrade_module', modules_to_install) | ||||||
|         return True         |         return True | ||||||
| 
 | 
 | ||||||
|     def set_uom(self): |     def set_uom(self): | ||||||
|         """Mengeneinheiten setzen""" |         """Mengeneinheiten setzen""" | ||||||
|          | 
 | ||||||
|         context = {'lang': self.config.lang} |         context = {'lang': self.config.lang} | ||||||
|         c = self.config |         c = self.config | ||||||
|         active_uoms = c.active_uoms.keys() |         active_uoms = c.active_uoms.keys() | ||||||
|  | @ -395,19 +375,19 @@ class CamadeusFunctions(): | ||||||
|         for uom_xml_id in active_uoms: |         for uom_xml_id in active_uoms: | ||||||
|             uom_id = self._execute('ir.model.data', 'xmlid_to_res_id', uom_xml_id) |             uom_id = self._execute('ir.model.data', 'xmlid_to_res_id', uom_xml_id) | ||||||
|             active_ids.append(uom_id) |             active_ids.append(uom_id) | ||||||
|          | 
 | ||||||
|         # Set all UOMs to active |         # Set all UOMs to active | ||||||
|         ids = self._execute('product.uom', 'search', ['|',('active','=',True),('active','=',False)]) |         ids = self._execute('product.uom', 'search', ['|', ('active', '=', True), ('active', '=', False)]) | ||||||
|         res = self._execute('product.uom', 'write', ids, {'active': True}) |         res = self._execute('product.uom', 'write', ids, {'active': True}) | ||||||
|         if not res: |         if not res: | ||||||
|             return False |             return False | ||||||
|          | 
 | ||||||
|         # Set all other UOMs to inactive |         # Set all other UOMs to inactive | ||||||
|         inactive_ids = self._execute('product.uom', 'search', [('id','not in',active_ids)]) |         inactive_ids = self._execute('product.uom', 'search', [('id', 'not in', active_ids)]) | ||||||
|         res = self._execute('product.uom', 'write', inactive_ids, {'active': False}) |         res = self._execute('product.uom', 'write', inactive_ids, {'active': False}) | ||||||
|         if not res: |         if not res: | ||||||
|             return False |             return False | ||||||
|          | 
 | ||||||
|         # Update names |         # 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) |             uom_id = self._execute('ir.model.data', 'xmlid_to_res_id', uom_xml_id) | ||||||
|  | @ -418,114 +398,118 @@ class CamadeusFunctions(): | ||||||
| 
 | 
 | ||||||
|     def set_steuerzuordnung(self): |     def set_steuerzuordnung(self): | ||||||
|         """Steuerzuordnungen setzen""" |         """Steuerzuordnungen setzen""" | ||||||
|          | 
 | ||||||
|         c = self.config |         c = self.config | ||||||
|                  | 
 | ||||||
|         # Ungültige Steuerzuordnungen auf inaktiv setzen |         # Ungültige Steuerzuordnungen auf inaktiv setzen | ||||||
|         invalid_ids = self._execute('account.fiscal.position', 'search', [('name','not in',c.valid_fiscal_positions)]) |         invalid_ids = self._execute('account.fiscal.position', 'search', [('name', 'not in', c.valid_fiscal_positions)]) | ||||||
|         self._execute('account.fiscal.position', 'write', invalid_ids, {'active': False}) |         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")) |         # 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)]) |         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} |         vals = {'tax_dest_id': False} | ||||||
|         return self._execute('account.fiscal.position.tax', 'write', position_tax_line_ids, vals) |         return self._execute('account.fiscal.position.tax', 'write', position_tax_line_ids, vals) | ||||||
|      | 
 | ||||||
|     def update_module(self): |     def update_module(self): | ||||||
|         """Aktualisiere Modul""" |         """Aktualisiere Modul""" | ||||||
|  | 
 | ||||||
|         module_name = self.config.module_name |         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: |         if not len(mod_ids) == 1: | ||||||
|            raise "Module '%s' not found or ist not installed." % module_name |            raise Exception('Module "%s" not found or not installed.' % module_name) | ||||||
|         | 
 | ||||||
|         res = self._execute('ir.module.module', 'button_upgrade', mod_ids)    |         res = self._execute('ir.module.module', 'button_upgrade', mod_ids) | ||||||
|         res = self._execute('base.module.upgrade', 'upgrade_module', []) |         res = self._execute('base.module.upgrade', 'upgrade_module', []) | ||||||
|         return True |         return True | ||||||
| 
 | 
 | ||||||
|     def install_module(self): |     def install_module(self): | ||||||
|         """Installiere Modul""" |         """Installiere Modul""" | ||||||
|  | 
 | ||||||
|         module_name = self.config.module_name |         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: |         if not len(mod_ids) == 1: | ||||||
|            raise "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) | ||||||
|         | 
 | ||||||
|         res = self._execute('ir.module.module', 'button_install', mod_ids)    |         res = self._execute('ir.module.module', 'button_install', mod_ids) | ||||||
|         res = self._execute('base.module.upgrade', 'upgrade_module', []) |         res = self._execute('base.module.upgrade', 'upgrade_module', []) | ||||||
|         return True   |         return True | ||||||
| 
 | 
 | ||||||
|     def update_modules(self): |     def update_modules(self): | ||||||
|         """Verfügbare Module updaten""" |         """Verfügbare Module updaten""" | ||||||
|          | 
 | ||||||
|         wizard_id = self._execute('base.module.update', 'create', {}) |         wizard_id = self._execute('base.module.update', 'create', {}) | ||||||
|         vals = self._execute('base.module.update', 'update_module', [wizard_id]) |         vals = self._execute('base.module.update', 'update_module', [wizard_id]) | ||||||
|         return True      |         return True | ||||||
|      | 
 | ||||||
|     def setup_journals(self): |     def setup_journals(self): | ||||||
|         """Update journals""" |         """Update journals""" | ||||||
|  | 
 | ||||||
|         # Verkauf- und Gutschriftenjournal |         # Verkauf- und Gutschriftenjournal | ||||||
|         j_ids = self._execute('account.journal', 'search', [('code','in',['VK','GSV','SAJ','SCNJ'])]) |         j_ids = self._execute('account.journal', 'search', [('code', 'in', ['VK', 'GSV', 'SAJ', 'SCNJ'])]) | ||||||
|         if len(j_ids) != 2: |         if len(j_ids) != 2: | ||||||
|             return False |             return False | ||||||
|         vals = { |         vals = { | ||||||
|             'update_posted': self.config.allow_cancel_invoice |             'update_posted': self.config.allow_cancel_invoice | ||||||
|         } |         } | ||||||
|         if not self._execute('account.journal', 'write', j_ids, vals): |         if not self._execute('account.journal', 'write', j_ids, vals): | ||||||
|             return False    |             return False | ||||||
|         return True  |         return True | ||||||
|      | 
 | ||||||
|     def update_all(self): |     def update_all(self): | ||||||
|         """Aktualisiere Modul""" |         """Aktualisiere Modul""" | ||||||
|  | 
 | ||||||
|         for module_name in self.config.modules: |         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: |             if not len(mod_ids) == 1: | ||||||
|                 raise Exception("Module '%s' not found or ist not installed." % module_name) |                 raise Exception('Module "%s" not found or ist not installed.' % module_name) | ||||||
|             res = self._execute('ir.module.module', 'button_upgrade', mod_ids)    |             res = self._execute('ir.module.module', 'button_upgrade', mod_ids) | ||||||
|              | 
 | ||||||
|         res = self._execute('base.module.upgrade', 'upgrade_module', []) |         res = self._execute('base.module.upgrade', 'upgrade_module', []) | ||||||
|         return True     |         return True | ||||||
| 
 | 
 | ||||||
|     def set_warehouse(self): |     def set_warehouse(self): | ||||||
|         """Name des Zentrallagers setzen""" |         """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: |         if is_installed: | ||||||
|             vals = { |             vals = { | ||||||
|                 'name': self.config.warehouse_name or self.config.company_data.get('name','Mein Unternehmen'), |                 'name': self.config.warehouse_name or self.config.company_data.get('name', 'Mein Unternehmen'), | ||||||
|                 'delivery_steps': self.config.delivery_steps, |                 'delivery_steps': self.config.delivery_steps, | ||||||
|             } |             } | ||||||
|             if self.config.warehouse_code: |             if self.config.warehouse_code: | ||||||
|                 vals.update({'code': self.config.warehouse_code}) |                 vals.update({'code': self.config.warehouse_code}) | ||||||
|             warehouse_ids = self._execute('stock.warehouse', 'search', [('id','=',1)]) |             warehouse_ids = self._execute('stock.warehouse', 'search', [('id', '=', 1)]) | ||||||
|             return self._execute('stock.warehouse', 'write', warehouse_ids, vals) |             return self._execute('stock.warehouse', 'write', warehouse_ids, vals) | ||||||
|         else: |         else: | ||||||
|             return True       |             return True | ||||||
| 
 | 
 | ||||||
|     def set_dmi_noupdate(self): |     def set_dmi_noupdate(self): | ||||||
|         """DMI: Einträge auf 'no update' setzen""" |         """DMI: Einträge auf 'no update' setzen""" | ||||||
|          | 
 | ||||||
|         domain = [('module','=','cam_dmi'),('noupdate','=',False)] |         domain = [('module','=','cam_dmi'), ('noupdate', '=', False)] | ||||||
|         data_ids = self._execute('ir.model.data', 'search', domain) |         data_ids = self._execute('ir.model.data', 'search', domain) | ||||||
|          | 
 | ||||||
|         vals = {'noupdate': True} |         vals = {'noupdate': True} | ||||||
|         return self._execute('ir.model.data', 'write', data_ids, vals) |         return self._execute('ir.model.data', 'write', data_ids, vals) | ||||||
|      | 
 | ||||||
|     def dmi_confirm_inventory(self): |     def dmi_confirm_inventory(self): | ||||||
|         """DMI: Lagerstand einbuchen""" |         """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', 'cam_dmi','inv_init') | ||||||
|          | 
 | ||||||
|         inventory = self._execute('stock.inventory', 'read', inventory_id, ['state']) |         inventory = self._execute('stock.inventory', 'read', inventory_id, ['state']) | ||||||
|          | 
 | ||||||
|         if inventory.get('state','') == 'confirm': |         if inventory.get('state', '') == 'confirm': | ||||||
|             return self._execute('stock.inventory', 'action_done', [inventory_id]) |             return self._execute('stock.inventory', 'action_done', [inventory_id]) | ||||||
|          | 
 | ||||||
|         return True |         return True | ||||||
|      | 
 | ||||||
|     def set_decimal_price(self): |     def set_decimal_price(self): | ||||||
|         """Dezimalstellen setzen""" |         """Dezimalstellen setzen""" | ||||||
|          | 
 | ||||||
|         # UOM |         # UOM | ||||||
|         decimal_id = self._execute('ir.model.data', 'xmlid_to_res_id', 'product.decimal_product_uom') |         decimal_id = self._execute('ir.model.data', 'xmlid_to_res_id', 'product.decimal_product_uom') | ||||||
|         res = self._execute('decimal.precision', 'write', [decimal_id], {'digits': self.config.uom_decimals}) |         res = self._execute('decimal.precision', 'write', [decimal_id], {'digits': self.config.uom_decimals}) | ||||||
|  | @ -536,81 +520,81 @@ class CamadeusFunctions(): | ||||||
|         decimal_id = self._execute('ir.model.data', 'xmlid_to_res_id', 'product.decimal_product_uos') |         decimal_id = self._execute('ir.model.data', 'xmlid_to_res_id', 'product.decimal_product_uos') | ||||||
|         res = self._execute('decimal.precision', 'write', [decimal_id], {'digits': self.config.uom_decimals}) |         res = self._execute('decimal.precision', 'write', [decimal_id], {'digits': self.config.uom_decimals}) | ||||||
|         if not res: |         if not res: | ||||||
|             return False       |             return False | ||||||
|          | 
 | ||||||
|         # Product Price |         # Product Price | ||||||
|         decimal_id = self._execute('ir.model.data', 'xmlid_to_res_id', 'product.decimal_price') |         decimal_id = self._execute('ir.model.data', 'xmlid_to_res_id', 'product.decimal_price') | ||||||
|         res = self._execute('decimal.precision', 'write', [decimal_id], {'digits': self.config.price_decimals}) |         res = self._execute('decimal.precision', 'write', [decimal_id], {'digits': self.config.price_decimals}) | ||||||
|         if not res: |         if not res: | ||||||
|             return False         |             return False | ||||||
|          | 
 | ||||||
|         # Product Price |         # Product Price | ||||||
|         ids = self._execute('decimal.precision', 'search', [('name','=','Product Price')]) |         ids = self._execute('decimal.precision', 'search', [('name', '=', 'Product Price')]) | ||||||
|         res = self._execute('decimal.precision', 'write', ids, {'digits': self.config.price_decimals}) |         res = self._execute('decimal.precision', 'write', ids, {'digits': self.config.price_decimals}) | ||||||
|         if not res: |         if not res: | ||||||
|             return False |             return False | ||||||
|          | 
 | ||||||
|         return True     |         return True | ||||||
| 
 | 
 | ||||||
|     def delete_mail_server(self): |     def delete_mail_server(self): | ||||||
|         """Mailserver einrichten""" |         """Mailserver einrichten""" | ||||||
|          | 
 | ||||||
|         server_ids = self._execute('ir.mail_server', 'search', []) |         server_ids = self._execute('ir.mail_server', 'search', []) | ||||||
|         if server_ids: |         if server_ids: | ||||||
|             return self._execute('ir.mail_server', 'unlink', server_ids) |             return self._execute('ir.mail_server', 'unlink', server_ids) | ||||||
| 
 | 
 | ||||||
|         return True |         return True | ||||||
|      | 
 | ||||||
|     def stock_set_cost_method(self): |     def stock_set_cost_method(self): | ||||||
|         """Kalkulationsverfahren für Lager setzen""" |         """Kalkulationsverfahren für Lager setzen""" | ||||||
|          | 
 | ||||||
|         if hasattr(self.config, 'stock_cost_method'): |         if hasattr(self.config, 'stock_cost_method'): | ||||||
|             method = self.config.stock_cost_method |             method = self.config.stock_cost_method | ||||||
|             self._execute('ir.values', 'set_default', 'product.template', 'cost_method', method) |             self._execute('ir.values', 'set_default', 'product.template', 'cost_method', method) | ||||||
|             return True |             return True | ||||||
|              | 
 | ||||||
|         return True     |         return True | ||||||
| 
 | 
 | ||||||
|     def import_users(self): |     def import_users(self): | ||||||
|         """User importieren""" |         """User importieren""" | ||||||
|          | 
 | ||||||
|         if hasattr(self.config, 'users_file'): |         if hasattr(self.config, 'users_file'): | ||||||
|             vals = {} |             vals = {} | ||||||
|             vals['res_model'] = 'res.users' |             vals['res_model'] = 'res.users' | ||||||
|             vals['file'] = self._readAndReturnFile(self.config.users_file) |             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'] |             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'} |             options =  {u'headers': True, u'quoting': u'"', u'separator': u',', u'encoding': u'utf-8'} | ||||||
|              | 
 | ||||||
|             wizard_id = self._execute('base_import.import', 'create', vals) |             wizard_id = self._execute('base_import.import', 'create', vals) | ||||||
|             if wizard_id: |             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: |                 if messages: | ||||||
|                     print messages |                     print messages | ||||||
|                     return False |                     return False | ||||||
|                 return True |                 return True | ||||||
| 
 | 
 | ||||||
|         return False |         return False | ||||||
|      | 
 | ||||||
|     def set_translations(self): |     def set_translations(self): | ||||||
|         """Übersetzungen aktualisieren """ |         """Übersetzungen aktualisieren """ | ||||||
|              | 
 | ||||||
|         if hasattr(self.config, 'translation_files') and self.config.lang != 'en_US': |         if hasattr(self.config, 'translation_files') and self.config.lang != 'en_US': | ||||||
|             for file in self.config.translation_files: |             for file in self.config.translation_files: | ||||||
|                 data = self._readAndReturnFile(file,encode='base64') |                 data = self._readAndReturnFile(file, encode='base64') | ||||||
|                 vals = { |                 vals = { | ||||||
|                     'name': 'test', |                     'name': 'test', | ||||||
|                     'code': self.config.lang, |                     'code': self.config.lang, | ||||||
|                     'data': data, |                     'data': data, | ||||||
|                     'overwrite': True, |                     'overwrite': True, | ||||||
|                 } |                 } | ||||||
|                 wizard_id = self._execute('base.language.import', 'create', vals)             |                 wizard_id = self._execute('base.language.import', 'create', vals) | ||||||
|                 self._execute('base.language.import', 'import_lang', [wizard_id]) |                 self._execute('base.language.import', 'import_lang', [wizard_id]) | ||||||
|                 return True |                 return True | ||||||
|         return True |         return True | ||||||
|      | 
 | ||||||
|     def default_set_order_policy(self): |     def default_set_order_policy(self): | ||||||
|         """Setze Rechnung von Lieferschein""" |         """Setze Rechnung von Lieferschein""" | ||||||
|          | 
 | ||||||
|         if hasattr(self.config, 'order_policy'): |         if hasattr(self.config, 'order_policy'): | ||||||
|             method = self.config.order_policy |             method = self.config.order_policy | ||||||
|             self._execute('ir.values', 'set_default', 'sale.order', 'order_policy', method) |             self._execute('ir.values', 'set_default', 'sale.order', 'order_policy', method) | ||||||
|  | @ -618,21 +602,23 @@ class CamadeusFunctions(): | ||||||
| 
 | 
 | ||||||
|     def set_default_removal_strategy(self): |     def set_default_removal_strategy(self): | ||||||
|         """Default Entnahmestrategie für Lager setzen""" |         """Default Entnahmestrategie für Lager setzen""" | ||||||
|  | 
 | ||||||
|         if hasattr(self.config, 'removal_strategy'): |         if hasattr(self.config, 'removal_strategy'): | ||||||
|             method = self.config.removal_strategy |             method = self.config.removal_strategy | ||||||
|             strategy_ids = self._execute('product.removal', 'search', [('method','=',method)]) |             strategy_ids = self._execute('product.removal', 'search', [('method', '=', method)]) | ||||||
|             if not strategy_ids: |             if not strategy_ids: | ||||||
|                 return False |                 return False | ||||||
|              | 
 | ||||||
|             stock_id = self._execute('ir.model.data', 'xmlid_to_res_id', 'stock.stock_location_stock') |             stock_id = self._execute('ir.model.data', 'xmlid_to_res_id', 'stock.stock_location_stock') | ||||||
|             if not stock_id: |             if not stock_id: | ||||||
|                 return False |                 return False | ||||||
|              | 
 | ||||||
|             return self._execute('stock.location', 'write', stock_id,{'removal_strategy_id':strategy_ids[0]}) |             return self._execute('stock.location', 'write', stock_id, {'removal_strategy_id': strategy_ids[0]}) | ||||||
|         return True |         return True | ||||||
| 
 | 
 | ||||||
|     def set_default_values(self): |     def set_default_values(self): | ||||||
|         """Defaultwerte für Dokumente setzen""" |         """Defaultwerte für Dokumente setzen""" | ||||||
|  | 
 | ||||||
|         for model,field,value in self.config.default_values: |         for model,field,value in self.config.default_values: | ||||||
|             vals = { |             vals = { | ||||||
|                 'name': field, |                 'name': field, | ||||||
|  | @ -641,7 +627,7 @@ class CamadeusFunctions(): | ||||||
|                 'key': 'default', |                 'key': 'default', | ||||||
|                 'key2': False, |                 'key2': False, | ||||||
|             } |             } | ||||||
|             domain = [('name','=',field),('model','=',model)] |             domain = [('name', '=', field), ('model', '=', model)] | ||||||
|             val_ids = self._execute('ir.values', 'search', domain) |             val_ids = self._execute('ir.values', 'search', domain) | ||||||
|             if val_ids: |             if val_ids: | ||||||
|                 self._execute('ir.values', 'write', val_ids, vals) |                 self._execute('ir.values', 'write', val_ids, vals) | ||||||
|  | @ -653,31 +639,33 @@ class CamadeusFunctions(): | ||||||
|         """Existierende Daten aktualisieren""" |         """Existierende Daten aktualisieren""" | ||||||
| 
 | 
 | ||||||
|         for xml_id,vals in self.config.data_updates.items(): |         for xml_id,vals in self.config.data_updates.items(): | ||||||
|             dummy,model,res_id = self._execute('ir.model.data', 'xmlid_lookup', xml_id)             |             dummy,model,res_id = self._execute('ir.model.data', 'xmlid_lookup', xml_id) | ||||||
|             self._execute(model, 'write',  [res_id], vals) |             self._execute(model, 'write', [res_id], vals) | ||||||
|          | 
 | ||||||
|         return True |         return True | ||||||
|      | 
 | ||||||
|     def set_sys_params(self): |     def set_sys_params(self): | ||||||
|         """Systemparameter setzen""" |         """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)])         |             param_ids = self._execute('ir.config_parameter', 'search', [('key', '=', key)]) | ||||||
|             vals = {'key': key, |             vals = { | ||||||
|                     'value': value} |                 'key': key, | ||||||
|  |                 'value': value, | ||||||
|  |             } | ||||||
|             if param_ids: |             if param_ids: | ||||||
|                 self._execute('ir.config_parameter', 'write', param_ids, vals) |                 self._execute('ir.config_parameter', 'write', param_ids, vals) | ||||||
|             else: |             else: | ||||||
|                 self._execute('ir.config_parameter', 'create', vals)     |                 self._execute('ir.config_parameter', 'create', vals) | ||||||
|         return True     |         return True | ||||||
|      | 
 | ||||||
|     def setup_reports(self): |     def setup_reports(self): | ||||||
|         """Berichte konfigurieren""" |         """Berichte konfigurieren""" | ||||||
|          | 
 | ||||||
|         for report, attachment in self.config.reports.items(): |         for report, attachment in self.config.reports.items(): | ||||||
|             r_ids = self._execute('ir.actions.report.xml', 'search', [('report_name','=',report)]) |             r_ids = self._execute('ir.actions.report.xml', 'search', [('report_name', '=', report)]) | ||||||
|             if r_ids: |             if r_ids: | ||||||
|                 self._execute('ir.actions.report.xml', 'write', r_ids, {'attachment': attachment}) |                 self._execute('ir.actions.report.xml', 'write', r_ids, {'attachment': attachment}) | ||||||
|             else: |             else: | ||||||
|                 return False |                 return False | ||||||
|         return True     |         return True | ||||||
|  |  | ||||||
|  | @ -13,7 +13,7 @@ class odoo { | ||||||
|         priority => 10, |         priority => 10, | ||||||
|         content  => $sudo_entry, |         content  => $sudo_entry, | ||||||
|     } |     } | ||||||
| 	 | 
 | ||||||
|     ssh_authorized_key { "andreas@camadeus": |     ssh_authorized_key { "andreas@camadeus": | ||||||
|         user => odoo, |         user => odoo, | ||||||
|         type => 'ssh-rsa', |         type => 'ssh-rsa', | ||||||
|  | @ -24,21 +24,21 @@ class odoo { | ||||||
|         user => odoo, |         user => odoo, | ||||||
|         type => 'ssh-rsa', |         type => 'ssh-rsa', | ||||||
|         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC0Lv4GOvotyJRzPphIjf+UEzRzWZpGaEt5HiWBx9ih6aBnSLXx0O+PA8+ejN4dfMK3rAu3vdcXcI/egj9eJbIYWeHnE2k/gckCgk3Ttg2aq24cGDcgTDB0MdfLYSeFNxRsrLH4fFpPtvulNyu7ZPuXJj/BaIUHGGas+lUP3r+Bmhj2+guWlTMVMLFMENn3FUlrtMCiL7wIiXGQ+xXHhRAqG55t+CLxX0jaf57uCGkYKlkTfQAmnGMiUnUcxjileUDq8HRlANSqv2XRH/tjonP/bPqs0PySCU9rWEomSpertvdrO/8ZPCo3fjAKCyAAC6GS8uPJlQIoEMo2EVG8DrbX', |         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC0Lv4GOvotyJRzPphIjf+UEzRzWZpGaEt5HiWBx9ih6aBnSLXx0O+PA8+ejN4dfMK3rAu3vdcXcI/egj9eJbIYWeHnE2k/gckCgk3Ttg2aq24cGDcgTDB0MdfLYSeFNxRsrLH4fFpPtvulNyu7ZPuXJj/BaIUHGGas+lUP3r+Bmhj2+guWlTMVMLFMENn3FUlrtMCiL7wIiXGQ+xXHhRAqG55t+CLxX0jaf57uCGkYKlkTfQAmnGMiUnUcxjileUDq8HRlANSqv2XRH/tjonP/bPqs0PySCU9rWEomSpertvdrO/8ZPCo3fjAKCyAAC6GS8uPJlQIoEMo2EVG8DrbX', | ||||||
|     }  |     } | ||||||
| 
 | 
 | ||||||
|     ssh_authorized_key { "joerg@camadeus": |     ssh_authorized_key { "joerg@camadeus": | ||||||
|         user => odoo, |         user => odoo, | ||||||
|         type => 'ssh-rsa', |         type => 'ssh-rsa', | ||||||
|         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC5wf8HJPMWf9+NGbrHxehVB/mWavztXx6v6hgsjvY+mg8V2eAHwKVvm8k9idvg/AqkMR6DbxC5GbMYcYP9drxcE5WhBFV5okR8o5h0/ZvpCmF8FQOZuR0NbRWA9ybVPfkn9thdMv3PI7iAMt+3Nh0g1QBEx/w7RRZ+/3LxSeGOGIFBtWja5hA94SLIunjKTyo2wPxyr3GZoGkG9KTN9f1iI4Imrg5kUXAXtT7rpJ1NdZdphYiuBZiZ9rAHymr9yJkXsSLxNWboqBsFoWSkFVc1CxGeqHNcEKO16wtOeGoJgsURM0wscWi+YjQXCYxLVY8a8JzeRLlMVhojk0zSfwdD', |         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC5wf8HJPMWf9+NGbrHxehVB/mWavztXx6v6hgsjvY+mg8V2eAHwKVvm8k9idvg/AqkMR6DbxC5GbMYcYP9drxcE5WhBFV5okR8o5h0/ZvpCmF8FQOZuR0NbRWA9ybVPfkn9thdMv3PI7iAMt+3Nh0g1QBEx/w7RRZ+/3LxSeGOGIFBtWja5hA94SLIunjKTyo2wPxyr3GZoGkG9KTN9f1iI4Imrg5kUXAXtT7rpJ1NdZdphYiuBZiZ9rAHymr9yJkXsSLxNWboqBsFoWSkFVc1CxGeqHNcEKO16wtOeGoJgsURM0wscWi+YjQXCYxLVY8a8JzeRLlMVhojk0zSfwdD', | ||||||
|     }  |     } | ||||||
|      | 
 | ||||||
|     ssh_authorized_key { "christian@camadeus": |     ssh_authorized_key { "christian@camadeus": | ||||||
|         user => odoo, |         user => odoo, | ||||||
|         type => 'ssh-rsa', |         type => 'ssh-rsa', | ||||||
|         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDt1sWm9vgxSzLLIU8KUJunWmJDpX3KNRgcDI8NeTEVTlfSBWniLzbur1qaQrl1WuC9rMTIZ3JarhknVue/7RPq2fjZU2n9wBCkwgtanvpmv7eLBckyGAmW5ctHWnvLcbEexl3YsgKfQJ10a1xCDY2+Vm+cLDCO6ZH7L0KlnboRryMiASxYA+C73/ySXWTKj0tO6kSuDvt48DgRbbeqTMpRrhHlab5svz37AkZtb3cPz3UnMh+a7OlqA6Q4EL4fLVAmAC5bBVi2bsYzSVxwqbnAn/OwtmfIUP3v0UsyW/D6F8De9UhSPm2lgc+ZtTpXqUzrnHDxjituD6vFZPSLzayz', |         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDt1sWm9vgxSzLLIU8KUJunWmJDpX3KNRgcDI8NeTEVTlfSBWniLzbur1qaQrl1WuC9rMTIZ3JarhknVue/7RPq2fjZU2n9wBCkwgtanvpmv7eLBckyGAmW5ctHWnvLcbEexl3YsgKfQJ10a1xCDY2+Vm+cLDCO6ZH7L0KlnboRryMiASxYA+C73/ySXWTKj0tO6kSuDvt48DgRbbeqTMpRrhHlab5svz37AkZtb3cPz3UnMh+a7OlqA6Q4EL4fLVAmAC5bBVi2bsYzSVxwqbnAn/OwtmfIUP3v0UsyW/D6F8De9UhSPm2lgc+ZtTpXqUzrnHDxjituD6vFZPSLzayz', | ||||||
|     }     |     } | ||||||
| 
 | 
 | ||||||
|     class { 'postgresql::server':  |     class { 'postgresql::server': | ||||||
|         listen_addresses           => '*', |         listen_addresses           => '*', | ||||||
|         locale => 'de_AT.UTF-8', |         locale => 'de_AT.UTF-8', | ||||||
|         encoding => 'UTF8', |         encoding => 'UTF8', | ||||||
|  | @ -124,7 +124,7 @@ class odoo { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|     package { 'wkhtmltox': |     package { 'wkhtmltox': | ||||||
|     	provider => dpkg, |         provider => dpkg, | ||||||
|         ensure => installed, |         ensure => installed, | ||||||
|         source => "/tmp/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb", |         source => "/tmp/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb", | ||||||
|         require => [File['wkhtmltopdf'],Package['xfonts-base']], |         require => [File['wkhtmltopdf'],Package['xfonts-base']], | ||||||
|  | @ -139,7 +139,6 @@ class odoo { | ||||||
|         ensure   => installed, |         ensure   => installed, | ||||||
|         provider => 'pip', |         provider => 'pip', | ||||||
|         require => Package['python-pip'], |         require => Package['python-pip'], | ||||||
|      |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     # Update python lib distribute if required ("sudo easy_install -U distribute") |     # Update python lib distribute if required ("sudo easy_install -U distribute") | ||||||
|  | @ -149,7 +148,7 @@ class odoo { | ||||||
|         command => $upg_cmd, |         command => $upg_cmd, | ||||||
|         unless  => $unless_upg_cmd, |         unless  => $unless_upg_cmd, | ||||||
|         path    => ['/bin', '/sbin', '/usr/bin', '/usr/sbin'], |         path    => ['/bin', '/sbin', '/usr/bin', '/usr/sbin'], | ||||||
|     }     |     } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     # TODO, benötigt: "sudo easy_install -U distribute" |     # TODO, benötigt: "sudo easy_install -U distribute" | ||||||
|  | @ -157,17 +156,16 @@ class odoo { | ||||||
|         ensure   => present, |         ensure   => present, | ||||||
|         provider => 'pip', |         provider => 'pip', | ||||||
|         require => [Package['python-pip'],Package['python-psycopg2'],Exec['upgrade_distribute'], Class['postgresql::server']], |         require => [Package['python-pip'],Package['python-psycopg2'],Exec['upgrade_distribute'], Class['postgresql::server']], | ||||||
|      |  | ||||||
|     } |     } | ||||||
|      | 
 | ||||||
|     # main directory for odoo backups |     # main directory for odoo backups | ||||||
| 	file { "/var/pgdump": | 	file { "/var/pgdump": | ||||||
| 	    owner => 'root', | 	    owner => 'root', | ||||||
| 	    group => 'root', | 	    group => 'root', | ||||||
| 	    mode  => '0777', | 	    mode  => '0777', | ||||||
| 	    ensure => "directory", | 	    ensure => "directory", | ||||||
| 	}     | 	} | ||||||
|    | 
 | ||||||
|   	# Postfix setup |   	# Postfix setup | ||||||
| #	class { '::postfix::server': | #	class { '::postfix::server': | ||||||
| #	  	myhostname              => 'test.camadeus.at', | #	  	myhostname              => 'test.camadeus.at', | ||||||
|  | @ -175,7 +173,7 @@ class odoo { | ||||||
| #	  	mydestination           => "\$myhostname, localhost.\$mydomain, localhost, $fqdn", | #	  	mydestination           => "\$myhostname, localhost.\$mydomain, localhost, $fqdn", | ||||||
| #	  	inet_interfaces         => 'localhost', | #	  	inet_interfaces         => 'localhost', | ||||||
| #	} | #	} | ||||||
| 	 | 
 | ||||||
| 	# Default nginx file (prevent default server) REQUIRES SSL-key!!! | 	# Default nginx file (prevent default server) REQUIRES SSL-key!!! | ||||||
|     # Conf file |     # Conf file | ||||||
|     file { "/etc/nginx/conf.d/default.conf": |     file { "/etc/nginx/conf.d/default.conf": | ||||||
|  | @ -185,8 +183,8 @@ class odoo { | ||||||
|         ensure  => present, |         ensure  => present, | ||||||
|         content => template('odoo/default.nginx.erb'), |         content => template('odoo/default.nginx.erb'), | ||||||
|         notify => Service['nginx'], |         notify => Service['nginx'], | ||||||
|     } 	  |     } | ||||||
|      | 
 | ||||||
| 	# NGINX SSL | 	# NGINX SSL | ||||||
|   	file { "/etc/nginx/ssl": |   	file { "/etc/nginx/ssl": | ||||||
|       	owner => 'www-data', |       	owner => 'www-data', | ||||||
|  | @ -195,18 +193,17 @@ class odoo { | ||||||
| 		ensure => "directory", | 		ensure => "directory", | ||||||
| 		require => Package['nginx'], | 		require => Package['nginx'], | ||||||
| 		notify => Service['nginx'], | 		notify => Service['nginx'], | ||||||
|   	}	    |   	} | ||||||
|   	 | 
 | ||||||
|   	# Delete Default Server |   	# Delete Default Server | ||||||
|   	file { "/etc/nginx/sites-enabled/default": |   	file { "/etc/nginx/sites-enabled/default": | ||||||
| 		ensure => "absent", | 		ensure => "absent", | ||||||
| 		require => Package['nginx'], | 		require => Package['nginx'], | ||||||
| 		notify => Service['nginx'], | 		notify => Service['nginx'], | ||||||
|   	}  	  	   |   	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_longpolling) { | define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_longpolling) { | ||||||
|      |  | ||||||
|     $instance = $title |     $instance = $title | ||||||
| 
 | 
 | ||||||
|     include odoo |     include odoo | ||||||
|  | @ -217,36 +214,36 @@ define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_lo | ||||||
| 		shell => '/bin/bash', | 		shell => '/bin/bash', | ||||||
| 		managehome => 'true', | 		managehome => 'true', | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	$key_andreas="andreas@$instance"  | 	$key_andreas="andreas@$instance" | ||||||
|     ssh_authorized_key { $key_andreas: |     ssh_authorized_key { $key_andreas: | ||||||
|         user => $instance, |         user => $instance, | ||||||
|         type => 'ssh-rsa', |         type => 'ssh-rsa', | ||||||
|         key => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDBIg6NZV4tTs+J5qUP4/zQAn+Xi3muKqbaSDV8yYm50mH77PcLwbkZVlxdF0/OFCl5f5FCNp4Ag4Px97M35Nv+BweOTCZNMKOHmvtXY1fCRUQnk6ca3NlipImppL0U47SUzt9KkNIsz0FWxLu74LANgxKwrf8Hgim8Nkq8WrlvuoJCqf+542N15cGrf/9eD6yRm7AmdFi7VIYrP4m7TPbXJBGX+cXOo0bKTyaq8mtinbUN5UCi/eJ08wYkm/CGVxL+9cm6HOABw332A8OadAliCZBWqhFT0rBKdoWLxBbTsILALskrddpKLwBLOUIU79YeT0OfNpLCnVi8u67X9inl', |         key => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDBIg6NZV4tTs+J5qUP4/zQAn+Xi3muKqbaSDV8yYm50mH77PcLwbkZVlxdF0/OFCl5f5FCNp4Ag4Px97M35Nv+BweOTCZNMKOHmvtXY1fCRUQnk6ca3NlipImppL0U47SUzt9KkNIsz0FWxLu74LANgxKwrf8Hgim8Nkq8WrlvuoJCqf+542N15cGrf/9eD6yRm7AmdFi7VIYrP4m7TPbXJBGX+cXOo0bKTyaq8mtinbUN5UCi/eJ08wYkm/CGVxL+9cm6HOABw332A8OadAliCZBWqhFT0rBKdoWLxBbTsILALskrddpKLwBLOUIU79YeT0OfNpLCnVi8u67X9inl', | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     $key_stefan="stefan@$instance"  |     $key_stefan="stefan@$instance" | ||||||
|     ssh_authorized_key { $key_stefan: |     ssh_authorized_key { $key_stefan: | ||||||
|         user => $instance, |         user => $instance, | ||||||
|         type => 'ssh-rsa', |         type => 'ssh-rsa', | ||||||
|         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC0Lv4GOvotyJRzPphIjf+UEzRzWZpGaEt5HiWBx9ih6aBnSLXx0O+PA8+ejN4dfMK3rAu3vdcXcI/egj9eJbIYWeHnE2k/gckCgk3Ttg2aq24cGDcgTDB0MdfLYSeFNxRsrLH4fFpPtvulNyu7ZPuXJj/BaIUHGGas+lUP3r+Bmhj2+guWlTMVMLFMENn3FUlrtMCiL7wIiXGQ+xXHhRAqG55t+CLxX0jaf57uCGkYKlkTfQAmnGMiUnUcxjileUDq8HRlANSqv2XRH/tjonP/bPqs0PySCU9rWEomSpertvdrO/8ZPCo3fjAKCyAAC6GS8uPJlQIoEMo2EVG8DrbX', |         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC0Lv4GOvotyJRzPphIjf+UEzRzWZpGaEt5HiWBx9ih6aBnSLXx0O+PA8+ejN4dfMK3rAu3vdcXcI/egj9eJbIYWeHnE2k/gckCgk3Ttg2aq24cGDcgTDB0MdfLYSeFNxRsrLH4fFpPtvulNyu7ZPuXJj/BaIUHGGas+lUP3r+Bmhj2+guWlTMVMLFMENn3FUlrtMCiL7wIiXGQ+xXHhRAqG55t+CLxX0jaf57uCGkYKlkTfQAmnGMiUnUcxjileUDq8HRlANSqv2XRH/tjonP/bPqs0PySCU9rWEomSpertvdrO/8ZPCo3fjAKCyAAC6GS8uPJlQIoEMo2EVG8DrbX', | ||||||
|     }  |     } | ||||||
| 
 | 
 | ||||||
|     $key_joerg="joerg@$instance"  |     $key_joerg="joerg@$instance" | ||||||
|     ssh_authorized_key { $key_joerg: |     ssh_authorized_key { $key_joerg: | ||||||
|         user => odoo, |         user => odoo, | ||||||
|         type => 'ssh-rsa', |         type => 'ssh-rsa', | ||||||
|         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC5wf8HJPMWf9+NGbrHxehVB/mWavztXx6v6hgsjvY+mg8V2eAHwKVvm8k9idvg/AqkMR6DbxC5GbMYcYP9drxcE5WhBFV5okR8o5h0/ZvpCmF8FQOZuR0NbRWA9ybVPfkn9thdMv3PI7iAMt+3Nh0g1QBEx/w7RRZ+/3LxSeGOGIFBtWja5hA94SLIunjKTyo2wPxyr3GZoGkG9KTN9f1iI4Imrg5kUXAXtT7rpJ1NdZdphYiuBZiZ9rAHymr9yJkXsSLxNWboqBsFoWSkFVc1CxGeqHNcEKO16wtOeGoJgsURM0wscWi+YjQXCYxLVY8a8JzeRLlMVhojk0zSfwdD', |         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQC5wf8HJPMWf9+NGbrHxehVB/mWavztXx6v6hgsjvY+mg8V2eAHwKVvm8k9idvg/AqkMR6DbxC5GbMYcYP9drxcE5WhBFV5okR8o5h0/ZvpCmF8FQOZuR0NbRWA9ybVPfkn9thdMv3PI7iAMt+3Nh0g1QBEx/w7RRZ+/3LxSeGOGIFBtWja5hA94SLIunjKTyo2wPxyr3GZoGkG9KTN9f1iI4Imrg5kUXAXtT7rpJ1NdZdphYiuBZiZ9rAHymr9yJkXsSLxNWboqBsFoWSkFVc1CxGeqHNcEKO16wtOeGoJgsURM0wscWi+YjQXCYxLVY8a8JzeRLlMVhojk0zSfwdD', | ||||||
|     }  |     } | ||||||
|      | 
 | ||||||
|     $key_christian="christian@$instance" |     $key_christian="christian@$instance" | ||||||
|     ssh_authorized_key { $key_christian: |     ssh_authorized_key { $key_christian: | ||||||
|         user => odoo, |         user => odoo, | ||||||
|         type => 'ssh-rsa', |         type => 'ssh-rsa', | ||||||
|         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDt1sWm9vgxSzLLIU8KUJunWmJDpX3KNRgcDI8NeTEVTlfSBWniLzbur1qaQrl1WuC9rMTIZ3JarhknVue/7RPq2fjZU2n9wBCkwgtanvpmv7eLBckyGAmW5ctHWnvLcbEexl3YsgKfQJ10a1xCDY2+Vm+cLDCO6ZH7L0KlnboRryMiASxYA+C73/ySXWTKj0tO6kSuDvt48DgRbbeqTMpRrhHlab5svz37AkZtb3cPz3UnMh+a7OlqA6Q4EL4fLVAmAC5bBVi2bsYzSVxwqbnAn/OwtmfIUP3v0UsyW/D6F8De9UhSPm2lgc+ZtTpXqUzrnHDxjituD6vFZPSLzayz', |         key  => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDt1sWm9vgxSzLLIU8KUJunWmJDpX3KNRgcDI8NeTEVTlfSBWniLzbur1qaQrl1WuC9rMTIZ3JarhknVue/7RPq2fjZU2n9wBCkwgtanvpmv7eLBckyGAmW5ctHWnvLcbEexl3YsgKfQJ10a1xCDY2+Vm+cLDCO6ZH7L0KlnboRryMiASxYA+C73/ySXWTKj0tO6kSuDvt48DgRbbeqTMpRrhHlab5svz37AkZtb3cPz3UnMh+a7OlqA6Q4EL4fLVAmAC5bBVi2bsYzSVxwqbnAn/OwtmfIUP3v0UsyW/D6F8De9UhSPm2lgc+ZtTpXqUzrnHDxjituD6vFZPSLzayz', | ||||||
|     }     |     } | ||||||
|      | 
 | ||||||
|      | 
 | ||||||
|     $sudo_entry="$instance ALL = (root) NOPASSWD: /etc/init.d/odoo-server-$instance, /usr/sbin/service odoo-server-$instance *" |     $sudo_entry="$instance ALL = (root) NOPASSWD: /etc/init.d/odoo-server-$instance, /usr/sbin/service odoo-server-$instance *" | ||||||
|     sudo::conf { $instance: |     sudo::conf { $instance: | ||||||
|         priority => 10, |         priority => 10, | ||||||
|  | @ -261,15 +258,14 @@ define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_lo | ||||||
|         ensure => "directory", |         ensure => "directory", | ||||||
|         #require  => file['/var/log/odoo'], |         #require  => file['/var/log/odoo'], | ||||||
|     } |     } | ||||||
|    | 
 | ||||||
|     file { "/home/$instance/logs": |     file { "/home/$instance/logs": | ||||||
|         ensure => "link", |         ensure => "link", | ||||||
|         owner => $instance, |         owner => $instance, | ||||||
|         group => $instance, |         group => $instance, | ||||||
|         mode  => '0600',         |         mode  => '0600', | ||||||
|         target => "/var/log/odoo/$instance/odoo-server.log", |         target => "/var/log/odoo/$instance/odoo-server.log", | ||||||
|     } |     } | ||||||
|    |  | ||||||
| 
 | 
 | ||||||
|     $require_log = "file[/var/log/odoo/$instance]" |     $require_log = "file[/var/log/odoo/$instance]" | ||||||
|     file { "/var/log/odoo/$instance/odoo-server.log": |     file { "/var/log/odoo/$instance/odoo-server.log": | ||||||
|  | @ -285,30 +281,30 @@ define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_lo | ||||||
|         owner => 'root', |         owner => 'root', | ||||||
|         group => 'root', |         group => 'root', | ||||||
|         mode  => '0644', |         mode  => '0644', | ||||||
|         ensure  => present,	 |         ensure  => present, | ||||||
| 		content => template('odoo/logrotate.erb'), | 		content => template('odoo/logrotate.erb'), | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	# init file | 	# init file | ||||||
| 	# sudo ln -s /opt/odoo/odoo/config/odoo-server.init /etc/init.d/odoo-server | 	# sudo ln -s /opt/odoo/odoo/config/odoo-server.init /etc/init.d/odoo-server | ||||||
|     $init_odoo_notify = "Service[odoo-server-$instance]"	 |     $init_odoo_notify = "Service[odoo-server-$instance]" | ||||||
|   	file { "/etc/init.d/odoo-server-$instance": |   	file { "/etc/init.d/odoo-server-$instance": | ||||||
|       	owner => $instance, |       	owner => $instance, | ||||||
|       	group => $instance, |       	group => $instance, | ||||||
|       	mode  => '0755', |       	mode  => '0755', | ||||||
| 		ensure  => present, | 		ensure  => present, | ||||||
| 		content => template('odoo/odoo-server.init.erb'), | 		content => template('odoo/odoo-server.init.erb'), | ||||||
|         notify => $init_odoo_notify,		 |         notify => $init_odoo_notify, | ||||||
|   	} |   	} | ||||||
|    | 
 | ||||||
|   file { "/home/$instance/restart.sh": |   file { "/home/$instance/restart.sh": | ||||||
|       owner => $instance, |       owner => $instance, | ||||||
|       group => $instance, |       group => $instance, | ||||||
|       mode  => '0755', |       mode  => '0755', | ||||||
| 	  ensure  => present, |       ensure  => present, | ||||||
|       content => template('odoo/restart.sh.erb'), |       content => template('odoo/restart.sh.erb'), | ||||||
|   }   |   } | ||||||
|    | 
 | ||||||
|     file { "/home/$instance/ext.git": |     file { "/home/$instance/ext.git": | ||||||
|         owner => $instance, |         owner => $instance, | ||||||
|         group => $instance, |         group => $instance, | ||||||
|  | @ -317,7 +313,7 @@ define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_lo | ||||||
| 		recurse => true, | 		recurse => true, | ||||||
| 		require => Package[git], | 		require => Package[git], | ||||||
|     } |     } | ||||||
|      | 
 | ||||||
| 	file { "/home/$instance/ext": | 	file { "/home/$instance/ext": | ||||||
| 	    owner => $instance, | 	    owner => $instance, | ||||||
| 	    group => $instance, | 	    group => $instance, | ||||||
|  | @ -326,7 +322,7 @@ define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_lo | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|     $git_requires = "File[/home/$instance/ext.git]" |     $git_requires = "File[/home/$instance/ext.git]" | ||||||
| 	$git_create_cmd = "sudo -u $instance git init --bare /home/$instance/ext.git" |     $git_create_cmd = "sudo -u $instance git init --bare /home/$instance/ext.git" | ||||||
|     $git_unless_cmd = "sudo -u $instance test -e /home/$instance/ext.git/HEAD" |     $git_unless_cmd = "sudo -u $instance test -e /home/$instance/ext.git/HEAD" | ||||||
|     $git_repo = "git_repo_$instance" |     $git_repo = "git_repo_$instance" | ||||||
|     exec { $git_repo: |     exec { $git_repo: | ||||||
|  | @ -340,24 +336,22 @@ define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_lo | ||||||
|       owner => $instance, |       owner => $instance, | ||||||
|       group => $instance, |       group => $instance, | ||||||
|       mode  => '0700', |       mode  => '0700', | ||||||
| 			ensure => present, |       ensure  => present, | ||||||
| 			content => "#!/bin/bash |       content => "#!/bin/bash | ||||||
| git --work-tree=/home/$instance/ext --git-dir=/home/$instance/ext.git checkout -f", | git --work-tree=/home/$instance/ext --git-dir=/home/$instance/ext.git checkout -f", | ||||||
|       require => Exec[$git_repo], |       require => Exec[$git_repo], | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 |       # backup | ||||||
| 	# backup |  | ||||||
|       file { "/home/$instance/odoo-backup.sh": |       file { "/home/$instance/odoo-backup.sh": | ||||||
|           owner => $instance, |           owner => $instance, | ||||||
|           group => $instance, |           group => $instance, | ||||||
|           mode  => '0700', |           mode  => '0700', | ||||||
|           ensure  => present, |           ensure  => present, | ||||||
|           content => template('odoo/odoo-backup.sh.erb'), |           content => template('odoo/odoo-backup.sh.erb'), | ||||||
|       }	 |       } | ||||||
| 	 | 
 | ||||||
| 	 |  | ||||||
| 	$cron_cmd = "/home/$instance/odoo-backup.sh" | 	$cron_cmd = "/home/$instance/odoo-backup.sh" | ||||||
| 	$cron_require = "file[/home/$instance/odoo-backup.sh]" | 	$cron_require = "file[/home/$instance/odoo-backup.sh]" | ||||||
| 	$odoo_backup = "odoo-backup-$instance" | 	$odoo_backup = "odoo-backup-$instance" | ||||||
|  | @ -374,7 +368,7 @@ git --work-tree=/home/$instance/ext --git-dir=/home/$instance/ext.git checkout - | ||||||
|       	owner => $instance, |       	owner => $instance, | ||||||
|       	group => $instance, |       	group => $instance, | ||||||
|       	mode  => '0700', |       	mode  => '0700', | ||||||
| 		ensure => "directory", | 	ensure => "directory", | ||||||
|   	} |   	} | ||||||
| 
 | 
 | ||||||
| 	$odoo_service = "odoo-server-$instance" | 	$odoo_service = "odoo-server-$instance" | ||||||
|  | @ -391,17 +385,17 @@ git --work-tree=/home/$instance/ext --git-dir=/home/$instance/ext.git checkout - | ||||||
|     postgresql::server::role { "$instance": |     postgresql::server::role { "$instance": | ||||||
|         password_hash => postgresql_password($instance, $db_pw), |         password_hash => postgresql_password($instance, $db_pw), | ||||||
|         createdb  => true, |         createdb  => true, | ||||||
| #        require => Exec['utf8 postgres'], |         #require => Exec['utf8 postgres'], | ||||||
|     }     |     } | ||||||
|      | 
 | ||||||
|     # NGINX |     # NGINX | ||||||
| 	# Run server | 	# Run server | ||||||
| 	service {'nginx': | 	service {'nginx': | ||||||
| 		ensure => running, | 		ensure => running, | ||||||
| 		require => Package['nginx'], | 		require => Package['nginx'], | ||||||
| 		enable => true, | 		enable => true, | ||||||
| 	}     | 	} | ||||||
|          | 
 | ||||||
|     if str2bool("$ssl") { |     if str2bool("$ssl") { | ||||||
|         $key_file_test = "test -e /etc/nginx/ssl/$instance.key" |         $key_file_test = "test -e /etc/nginx/ssl/$instance.key" | ||||||
|         $key_file_cmd = "sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/nginx/ssl/$instance.key -out /etc/nginx/ssl/$instance.crt -subj \"/C=AT/ST=Vienna/L=Vienna/O=Security/OU=IT-Department/CN=dummy\"" |         $key_file_cmd = "sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/nginx/ssl/$instance.key -out /etc/nginx/ssl/$instance.crt -subj \"/C=AT/ST=Vienna/L=Vienna/O=Security/OU=IT-Department/CN=dummy\"" | ||||||
|  | @ -412,7 +406,7 @@ git --work-tree=/home/$instance/ext --git-dir=/home/$instance/ext.git checkout - | ||||||
|             path    => ['/bin', '/sbin', '/usr/bin', '/usr/sbin'], |             path    => ['/bin', '/sbin', '/usr/bin', '/usr/sbin'], | ||||||
|             notify => Service['nginx'], |             notify => Service['nginx'], | ||||||
|             require => [Package[nginx], File['/etc/nginx/ssl']], |             require => [Package[nginx], File['/etc/nginx/ssl']], | ||||||
|         }         |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     # Conf file |     # Conf file | ||||||
|  | @ -422,8 +416,8 @@ git --work-tree=/home/$instance/ext --git-dir=/home/$instance/ext.git checkout - | ||||||
|         mode  => '0600', |         mode  => '0600', | ||||||
|         ensure  => present, |         ensure  => present, | ||||||
|         content => template('odoo/odoo.nginx.erb'), |         content => template('odoo/odoo.nginx.erb'), | ||||||
|         require => Package[nginx],         |         require => Package[nginx], | ||||||
|         notify => Service['nginx'], |         notify => Service['nginx'], | ||||||
|     }     |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue