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,19 +1,23 @@
|
||||||
# -*- 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]
|
||||||
|
|
||||||
|
|
@ -26,22 +30,30 @@ def main():
|
||||||
|
|
||||||
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 = [
|
||||||
|
|
@ -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,9 +1,7 @@
|
||||||
# -*- 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'
|
||||||
|
|
@ -14,16 +12,16 @@ class Config():
|
||||||
|
|
||||||
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,
|
||||||
|
|
@ -78,7 +76,7 @@ class Config():
|
||||||
# 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
|
||||||
|
|
@ -105,7 +103,6 @@ class 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
|
||||||
|
|
@ -209,7 +206,7 @@ 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,
|
||||||
|
|
@ -225,10 +222,10 @@ class Config():
|
||||||
'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
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,17 @@
|
||||||
# -*- 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 """==============================
|
||||||
|
|
@ -21,9 +23,13 @@ Port: %s
|
||||||
|
|
||||||
|
|
||||||
ENVIRONMENTS = {
|
ENVIRONMENTS = {
|
||||||
|
# Local environments are listed with passwords
|
||||||
'br': Environment('http://localhost', '8080', 'INSTANCE_1', 'admin', 'x', 'admin'),
|
'br': Environment('http://localhost', '8080', 'INSTANCE_1', 'admin', 'x', 'admin'),
|
||||||
'sk': Environment('http://localhost', '8080', 'INSTANCE_1', 'admin', 'x', 'admin'),
|
'sk': Environment('http://localhost', '8080', 'INSTANCE_1', 'admin', 'x', 'admin'),
|
||||||
'ka': Environment('http://localhost', '8080', 'INSTANCE_1', 'admin', 'x', 'admin'),
|
'ha': Environment('http://localhost', '8080', 'INSTANCE_1', 'admin', 'x', 'admin'),
|
||||||
'test': Environment('https://INSTANCE.camadeus.at', '443', 'INSTANCE_1', 'admin', '141kcal', 'asdfasdf'),
|
'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,17 +1,13 @@
|
||||||
# -*- 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
|
||||||
|
|
@ -19,7 +15,7 @@ class CamadeusFunctions():
|
||||||
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},
|
||||||
|
|
@ -33,7 +29,8 @@ class CamadeusFunctions():
|
||||||
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', '????'))
|
||||||
|
print 'Error occured: %s' % msg
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def login(self):
|
def login(self):
|
||||||
|
|
@ -43,7 +40,7 @@ class CamadeusFunctions():
|
||||||
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
|
||||||
|
|
||||||
|
|
@ -68,14 +65,10 @@ class CamadeusFunctions():
|
||||||
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('rml_header',False):
|
|
||||||
# vals['rml_header'] = self._readAndReturnFile(vals['rml_header'])
|
|
||||||
|
|
||||||
if vals.get('logo', False):
|
if vals.get('logo', False):
|
||||||
vals['logo'] = self._readAndReturnFile(vals['logo'], encode='base64')
|
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):
|
||||||
|
|
@ -111,17 +104,6 @@ class CamadeusFunctions():
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# def set_report_types(self):
|
|
||||||
# """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"""
|
||||||
|
|
||||||
|
|
@ -154,7 +136,7 @@ class CamadeusFunctions():
|
||||||
"""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])
|
||||||
|
|
@ -176,7 +158,6 @@ class CamadeusFunctions():
|
||||||
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:
|
||||||
|
|
@ -196,7 +177,6 @@ class CamadeusFunctions():
|
||||||
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):
|
||||||
|
|
@ -435,10 +415,11 @@ class CamadeusFunctions():
|
||||||
|
|
||||||
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', [])
|
||||||
|
|
@ -446,10 +427,11 @@ class CamadeusFunctions():
|
||||||
|
|
||||||
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', [])
|
||||||
|
|
@ -464,6 +446,7 @@ class CamadeusFunctions():
|
||||||
|
|
||||||
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:
|
||||||
|
|
@ -477,10 +460,11 @@ class CamadeusFunctions():
|
||||||
|
|
||||||
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', [])
|
||||||
|
|
@ -618,6 +602,7 @@ 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)])
|
||||||
|
|
@ -633,6 +618,7 @@ class CamadeusFunctions():
|
||||||
|
|
||||||
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,
|
||||||
|
|
@ -663,8 +649,10 @@ class CamadeusFunctions():
|
||||||
|
|
||||||
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:
|
||||||
|
|
|
||||||
|
|
@ -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")
|
||||||
|
|
@ -157,7 +156,6 @@ 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
|
||||||
|
|
@ -206,7 +204,6 @@ class odoo {
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
|
|
@ -270,7 +267,6 @@ define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_lo
|
||||||
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":
|
||||||
owner => $instance,
|
owner => $instance,
|
||||||
|
|
@ -347,7 +343,6 @@ git --work-tree=/home/$instance/ext --git-dir=/home/$instance/ext.git checkout -
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# backup
|
# backup
|
||||||
file { "/home/$instance/odoo-backup.sh":
|
file { "/home/$instance/odoo-backup.sh":
|
||||||
owner => $instance,
|
owner => $instance,
|
||||||
|
|
@ -357,7 +352,6 @@ git --work-tree=/home/$instance/ext --git-dir=/home/$instance/ext.git checkout -
|
||||||
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"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue