From 4f3ec7e0e0ff3424c189596794de67574d148f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Br=C3=BCckl?= Date: Thu, 23 Apr 2015 16:48:13 +0200 Subject: [PATCH] verbesserungen --- setup/lib/cli.py | 1 + setup/lib/config_at.py | 4 ++++ setup/lib/functions.py | 24 +++++++++++++++++++ setup/puppet/modules/odoo/manifests/init.pp | 17 +++++++++++-- .../modules/odoo/templates/default.nginx.erb | 19 +++++++++++++++ .../odoo/templates/odoo-server.init.erb | 2 +- setup/puppet/setup_server.sh | 2 +- setup/puppet/site.pp | 4 ++-- 8 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 setup/puppet/modules/odoo/templates/default.nginx.erb diff --git a/setup/lib/cli.py b/setup/lib/cli.py index 0841e78e..30d15425 100755 --- a/setup/lib/cli.py +++ b/setup/lib/cli.py @@ -64,6 +64,7 @@ def main(): 'setup_journals', 'set_currencies', 'set_decimal_price', + 'set_default_values', 'set_translations', 'set_default_removal_strategy', diff --git a/setup/lib/config_at.py b/setup/lib/config_at.py index 746b7544..e3ed9e1e 100644 --- a/setup/lib/config_at.py +++ b/setup/lib/config_at.py @@ -184,3 +184,7 @@ class Config(): self.translation_files = [ "ir.translation.csv" ] + + self.default_values = [ # ir.values + #('product.template', 'type', 'service'), + ] \ No newline at end of file diff --git a/setup/lib/functions.py b/setup/lib/functions.py index bbc030f1..a16cdbe8 100755 --- a/setup/lib/functions.py +++ b/setup/lib/functions.py @@ -508,6 +508,12 @@ class CamadeusFunctions(): res = self._execute('decimal.precision', 'write', [decimal_id], {'digits': self.config.uom_decimals}) if not res: return False + + # 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}) + if not res: + return False # Product Price decimal_id = self._execute('ir.model.data', 'xmlid_to_res_id', 'product.decimal_price') @@ -605,3 +611,21 @@ class CamadeusFunctions(): return self._execute('stock.location', 'write', stock_id,{'removal_strategy_id':strategy_ids[0]}) return False + + def set_default_values(self): + """Defaultwerte für Dokumente setzen""" + for model,field,value in self.config.default_values: + vals = { + 'name': field, + 'model': model, + 'value_unpickle': value, + 'key': 'default', + 'key2': False, + } + domain = [('name','=',field),('model','=',model)] + val_ids = self._execute('ir.values', 'search', domain) + if val_ids: + self._execute('ir.values', 'write', val_ids, vals) + else: + self._execute('ir.values', 'create', vals) + return True \ No newline at end of file diff --git a/setup/puppet/modules/odoo/manifests/init.pp b/setup/puppet/modules/odoo/manifests/init.pp index 37ec7cc8..c4a0f5e5 100644 --- a/setup/puppet/modules/odoo/manifests/init.pp +++ b/setup/puppet/modules/odoo/manifests/init.pp @@ -166,10 +166,21 @@ class odoo { mydomain => 'camadeus.at', mydestination => "\$myhostname, localhost.\$mydomain, localhost, $fqdn", inet_interfaces => 'localhost', - } + } + + # Default nginx file (prevent default server) REQUIRES SSL-key!!! + # Conf file + file { "/etc/nginx/conf.d/default.conf": + owner => 'www-data', + group => 'www-data', + mode => '0600', + ensure => present, + content => template('odoo/default.nginx.erb'), + notify => Package['nginx'], + } } -define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_logpolling) { +define odoo::instance ($db_pw,$ssl = false, $servername, $odooport, $odooport_longpolling) { $instance = $title @@ -370,6 +381,7 @@ git --work-tree=/home/$instance/ext --git-dir=/home/$instance/ext.git checkout - unless => $key_file_test, path => ['/bin', '/sbin', '/usr/bin', '/usr/sbin'], notify => Service['nginx'], + require => Package[nginx], } } @@ -380,6 +392,7 @@ git --work-tree=/home/$instance/ext --git-dir=/home/$instance/ext.git checkout - mode => '0600', ensure => present, content => template('odoo/odoo.nginx.erb'), + require => Package[nginx], notify => Service['nginx'], } } diff --git a/setup/puppet/modules/odoo/templates/default.nginx.erb b/setup/puppet/modules/odoo/templates/default.nginx.erb new file mode 100644 index 00000000..1e3cb38e --- /dev/null +++ b/setup/puppet/modules/odoo/templates/default.nginx.erb @@ -0,0 +1,19 @@ +server { + listen 80 default_server; + return 444; + server_name _; +} + + +#server { +# listen 443 ssl default_server; +# return 444; +# server_name _; + + # THIS IS REQUIRED FOR SSL!!!! + #ssl_certificate /etc/nginx/ssl/camadeus.at.crt; + #ssl_certificate_key /etc/nginx/ssl/camadeus.at.key; + #ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; + #ssl_ciphers HIGH:!aNULL:!MD5; + +#} diff --git a/setup/puppet/modules/odoo/templates/odoo-server.init.erb b/setup/puppet/modules/odoo/templates/odoo-server.init.erb index af543537..bfcb6d03 100644 --- a/setup/puppet/modules/odoo/templates/odoo-server.init.erb +++ b/setup/puppet/modules/odoo/templates/odoo-server.init.erb @@ -29,7 +29,7 @@ PIDFILE=/var/run/$NAME.pid LOGFILE=/var/log/odoo/<%= @instance %>/odoo-server.log # Additional options that are passed to the Daemon. -DAEMON_OPTS="-c $CONFIGFILE --db-filter $FILTER --xmlrpc-port <%= @odooport %> --longpolling-port <%= @odooport_logpolling %> --logfile $LOGFILE" +DAEMON_OPTS="-c $CONFIGFILE --db-filter $FILTER --xmlrpc-port <%= @odooport %> --longpolling-port <%= @odooport_longpolling %> --logfile $LOGFILE" [ -x $DAEMON ] || exit 0 [ -f $CONFIGFILE ] || exit 0 diff --git a/setup/puppet/setup_server.sh b/setup/puppet/setup_server.sh index 054fada8..84fb2645 100755 --- a/setup/puppet/setup_server.sh +++ b/setup/puppet/setup_server.sh @@ -21,7 +21,7 @@ TYPE=$1 USER=root if [ "$TYPE" = "init" ]; then - ssh ${USER}@$HOST "sudo echo '$HOST' > /etc/hostname; sudo /etc/init.d/hostname.sh start; sudo apt-get update; sudo apt-get install puppet;" + ssh ${USER}@$HOST "apt-get update; apt-get install puppet; sudo echo '$HOST' > /etc/hostname; sudo /etc/init.d/hostname.sh start;" ssh ${USER}@${HOST} "sudo apt-get install rsync" ssh ${USER}@${HOST} "sudo puppet module install puppetlabs-postgresql" ssh ${USER}@${HOST} "sudo puppet module install saz-sudo" diff --git a/setup/puppet/site.pp b/setup/puppet/site.pp index 4f090557..ee28159d 100644 --- a/setup/puppet/site.pp +++ b/setup/puppet/site.pp @@ -5,9 +5,9 @@ node default { odoo::instance {'TODO': db_pw => 'x54ef6t77t6ZZul3', ssl => true, - servername => 'TODO', + servername => 'TODO.camadeus.at', odooport => 8069, - odooport_logpolling => 8070, + odooport_longpolling => 8070, } } \ No newline at end of file