commit 52d653f2418f0f2558759b32827b7a8a8e284b1a Author: Stefan Katzensteiner Date: Mon Nov 24 15:03:39 2014 +0100 Created dir structure, imported files from cam-int and whole cam-ext diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..2375512a --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.pyc +.project +.pydevproject +.settings diff --git a/dev/odoo-server.conf b/dev/odoo-server.conf new file mode 100644 index 00000000..fbb4c00b --- /dev/null +++ b/dev/odoo-server.conf @@ -0,0 +1,14 @@ +[options] + +xmlrpc_port = 8080 +; This is the password that allows database operations: +; admin_passwd = admin +db_host = False +db_port = 5436 +db_user = False +db_password = False + +addons_path = odoo/addons,ext/addons +timezone = Europe/Brussels + +dbfilter_test = ['.*',] \ No newline at end of file diff --git a/ext/config/logrotate b/ext/config/logrotate new file mode 100644 index 00000000..060ec54d --- /dev/null +++ b/ext/config/logrotate @@ -0,0 +1,5 @@ +/var/log/odoo/*.log { + copytruncate + missingok + notifempty +} diff --git a/ext/config/odoo-443.nginx b/ext/config/odoo-443.nginx new file mode 100644 index 00000000..40750f45 --- /dev/null +++ b/ext/config/odoo-443.nginx @@ -0,0 +1,66 @@ +server { + listen 80 default_server; + server_name "xxxxx"; + + # Strict Transport Security + # add_header Strict-Transport-Security max-age=2592000; + rewrite ^ https://$server_name$request_uri? permanent; +} + + +upstream odoo-server { + server 127.0.0.1:8069 fail_timeout=3000s; +} + +server { + listen 443 ssl default_server; + server_name _; + + + # Specifies the maximum accepted body size of a client request, + # as indicated by the request header Content-Length. + client_max_body_size 200m; + + # log files + access_log /var/log/nginx/odoo-access.log; + error_log /var/log/nginx/odoo-error.log; + + # increase proxy buffer to handle some OpenERP web requests + proxy_buffers 16 64k; + proxy_buffer_size 128k; + + # SSL config + ssl_certificate /etc/nginx/ssl/server.crt; + ssl_certificate_key /etc/nginx/ssl/server.key; + ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; + ssl_ciphers HIGH:!aNULL:!MD5; + + location / { + proxy_pass http://odoo-server; + # force timeouts if the backend dies + proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; + proxy_read_timeout 300s; + + # set headers + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; + + # Let the OpenERP web service know that we're using HTTPS, otherwise + # it will generate URL using http:// and not https:// + # proxy_set_header X-Forwarded-Proto https; + + # by default, do not forward anything + proxy_redirect off; + } + + # cache some static data in memory for 60mins. + # under heavy load this should relieve stress on the OpenERP web interface a bit. + location ~* /web/static/ { + proxy_cache_valid 200 60m; + proxy_buffering on; + expires 864000; + proxy_pass http://odoo-server; + } + +} diff --git a/ext/config/odoo-80.nginx b/ext/config/odoo-80.nginx new file mode 100644 index 00000000..6fb7c17c --- /dev/null +++ b/ext/config/odoo-80.nginx @@ -0,0 +1,50 @@ +upstream odoo-server { + server 127.0.0.1:8069 fail_timeout=3000s; +} + +server { + listen 80 default_server; + server_name _; + + + # Specifies the maximum accepted body size of a client request, + # as indicated by the request header Content-Length. + client_max_body_size 200m; + + # log files + access_log /var/log/nginx/odoo-access.log; + error_log /var/log/nginx/odoo-error.log; + + # increase proxy buffer to handle some OpenERP web requests + proxy_buffers 16 64k; + proxy_buffer_size 128k; + + location / { + proxy_pass http://odoo-server; + # force timeouts if the backend dies + proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; + proxy_read_timeout 300s; + + # set headers + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; + + # Let the OpenERP web service know that we're using HTTPS, otherwise + # it will generate URL using http:// and not https:// + # proxy_set_header X-Forwarded-Proto https; + + # by default, do not forward anything + proxy_redirect off; + } + + # cache some static data in memory for 60mins. + # under heavy load this should relieve stress on the OpenERP web interface a bit. + location ~* /web/static/ { + proxy_cache_valid 200 60m; + proxy_buffering on; + expires 864000; + proxy_pass http://odoo-server; + } + +} diff --git a/ext/config/odoo-server.conf b/ext/config/odoo-server.conf new file mode 100644 index 00000000..32c2d163 --- /dev/null +++ b/ext/config/odoo-server.conf @@ -0,0 +1,35 @@ +[options] +addons_path = /opt/odoo/odoo/addons,/opt/odoo/ext/addons +admin_passwd = c76EVdqj + +db_host = False +db_name = False +db_password = False +db_port = False +db_user = odoo + +debug_mode = False +list_db = True +log_level = error +logfile = /var/log/odoo/odoo-server.log + +max_cron_threads = 1 +workers = 1 + +xmlrpc_interface = 127.0.0.1 +xmlrpc_port = 8069 + +timezone = Europe/Brussels + +# 5 min +#limit_time_cpu = 300 +# 10 min +#limit_time_real = 600 + +# input DMI: +limit_time_cpu = 3000 +limit_time_real = 6000 + +# if DB > 150MB, otherwise "AccessDenied" error occurs +# 10 GB +limit_memory_hard = 10000000000 diff --git a/ext/config/odoo-server.init b/ext/config/odoo-server.init new file mode 100755 index 00000000..2f0aac66 --- /dev/null +++ b/ext/config/odoo-server.init @@ -0,0 +1,85 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: odoo-server +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Should-Start: $network +# Should-Stop: $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Enterprise Resource Management software +# Description: Open ERP is a complete ERP and CRM software. +### END INIT INFO + +PATH=/bin:/sbin:/usr/bin:/usr/local/bin +DAEMON=/opt/odoo/odoo/openerp-server +NAME=odoo-server +DESC=odoo-server + +#FILTER="^%d$" +# Specify the user name (Default: openerp). +USER=odoo + +# Specify an alternate config file (Default: /etc/openerp-server.conf). +CONFIGFILE="/opt/odoo/ext/config/odoo-server.conf" + +# pidfile +PIDFILE=/var/run/$NAME.pid + +# Additional options that are passed to the Daemon. +DAEMON_OPTS="-c $CONFIGFILE" + +[ -x $DAEMON ] || exit 0 +[ -f $CONFIGFILE ] || exit 0 + +checkpid() { + [ -f $PIDFILE ] || return 1 + pid=`cat $PIDFILE` + [ -d /proc/$pid ] && return 0 + return 1 +} + +case "${1}" in + start) + echo -n "Starting ${DESC}: " + + start-stop-daemon --start --quiet --pidfile ${PIDFILE} \ + --chuid ${USER} --background --make-pidfile \ + --exec ${DAEMON} -- ${DAEMON_OPTS} + + echo "${NAME}." + ;; + + stop) + echo -n "Stopping ${DESC}: " + + start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \ + --oknodo + + echo "${NAME}." + ;; + + restart|force-reload) + echo -n "Restarting ${DESC}: " + + start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \ + --oknodo + + sleep 1 + + start-stop-daemon --start --quiet --pidfile ${PIDFILE} \ + --chuid ${USER} --background --make-pidfile \ + --exec ${DAEMON} -- ${DAEMON_OPTS} + + echo "${NAME}." + ;; + + *) + N=/etc/init.d/${NAME} + echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/ext/custom-addons/cam_custom/__init__.py b/ext/custom-addons/cam_custom/__init__.py new file mode 100644 index 00000000..384274dc --- /dev/null +++ b/ext/custom-addons/cam_custom/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import cam_custom + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/ext/custom-addons/cam_custom/__openerp__.py b/ext/custom-addons/cam_custom/__openerp__.py new file mode 100644 index 00000000..d1ae3a28 --- /dev/null +++ b/ext/custom-addons/cam_custom/__openerp__.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +{ + 'name': 'Camadeus Anpassungen', + 'category': 'Custom', + 'version': '1.0', + 'description': """Individuelle Anpassungen""", + 'author': 'camadeus GmbH', + 'website': 'http://www.camadeus.at', + 'depends': ['crm','sale','mail','account'], + 'data': [ + 'cam_custom_view.xml', + 'cam_custom_data.xml', + 'views/custom_theme.xml', + ], + 'installable': True, + 'auto_install': False, +} + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/ext/custom-addons/cam_custom/cam_custom.py b/ext/custom-addons/cam_custom/cam_custom.py new file mode 100644 index 00000000..aeb2ff42 --- /dev/null +++ b/ext/custom-addons/cam_custom/cam_custom.py @@ -0,0 +1,81 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.osv import fields, osv +from openerp import api +from openerp.tools.translate import _ +from openerp import SUPERUSER_ID +from openerp import tools +from lxml import etree + +class res_partner(osv.osv): + _inherit = 'res.partner' + + @api.model + def fields_view_get_address(self, arch): + """ verhindert das Überschreiben von address_format """ + return arch + +class mail_notification(osv.Model): + _inherit = 'mail.notification' + + # override original function + def get_signature_footer(self, cr, uid, user_id, res_model=None, res_id=None, context=None, user_signature=True): + """ Format a standard footer for notification emails (such as pushed messages + notification or invite emails). + Format: +

--
+ Administrator +

+
+ Sent from Your Company using OpenERP. +
+ """ + footer = "" + if not user_id: + return footer + + # add user signature + user = self.pool.get("res.users").browse(cr, SUPERUSER_ID, [user_id], context=context)[0] + if user_signature: + if user.signature: + signature = user.signature + else: + signature = "--
%s" % user.name + footer = tools.append_content_to_html(footer, signature, plaintext=False) + + # add company signature +# if user.company_id.website: +# website_url = ('http://%s' % user.company_id.website) if not user.company_id.website.lower().startswith(('http:', 'https:')) \ +# else user.company_id.website +# company = "%s" % (website_url, user.company_id.name) +# else: +# company = user.company_id.name +# sent_by = _('Sent by %(company)s using %(odoo)s') +# +# signature_company = '
%s' % (sent_by % { +# 'company': company, +# 'odoo': "Odoo" +# }) +# footer = tools.append_content_to_html(footer, signature_company, plaintext=False, container_tag='div') + + return footer \ No newline at end of file diff --git a/ext/custom-addons/cam_custom/cam_custom_data.xml b/ext/custom-addons/cam_custom/cam_custom_data.xml new file mode 100644 index 00000000..3018e5f9 --- /dev/null +++ b/ext/custom-addons/cam_custom/cam_custom_data.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ext/custom-addons/cam_custom/cam_custom_view.xml b/ext/custom-addons/cam_custom/cam_custom_view.xml new file mode 100644 index 00000000..e2cf755e --- /dev/null +++ b/ext/custom-addons/cam_custom/cam_custom_view.xml @@ -0,0 +1,68 @@ + + + + + + tree,kanban,form + + + + + + + + partner_section_form + res.partner + + + +
+ + + +
+
+ + +
+ + + +
+
+
+
+ + + + product_template_variant_kanban + product.template + + + + + + + + + product_template_custom_tree + product.template + + + + + + + + + + + + + + tree,form,kanban + + + +
+
diff --git a/ext/custom-addons/cam_custom/static/description/icon.png b/ext/custom-addons/cam_custom/static/description/icon.png new file mode 100644 index 00000000..fd7ee3b9 Binary files /dev/null and b/ext/custom-addons/cam_custom/static/description/icon.png differ diff --git a/ext/custom-addons/cam_custom/static/src/img/favicon.ico b/ext/custom-addons/cam_custom/static/src/img/favicon.ico new file mode 100644 index 00000000..4abb4092 Binary files /dev/null and b/ext/custom-addons/cam_custom/static/src/img/favicon.ico differ diff --git a/ext/custom-addons/cam_custom/views/custom_theme.xml b/ext/custom-addons/cam_custom/views/custom_theme.xml new file mode 100644 index 00000000..3e1a53aa --- /dev/null +++ b/ext/custom-addons/cam_custom/views/custom_theme.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/ext/custom-addons/cam_max_width/__init__.py b/ext/custom-addons/cam_max_width/__init__.py new file mode 100755 index 00000000..49a09e55 --- /dev/null +++ b/ext/custom-addons/cam_max_width/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/ext/custom-addons/cam_max_width/__openerp__.py b/ext/custom-addons/cam_max_width/__openerp__.py new file mode 100755 index 00000000..881f882c --- /dev/null +++ b/ext/custom-addons/cam_max_width/__openerp__.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +{ + 'name': 'Max. Width for Form View', + 'category': 'Custom', + 'version': '1.0', + 'description': """ + """, + 'author': 'camadeus GmbH', + 'website': 'http://www.camadeus.at', + 'depends': [], + 'data': [ + 'views/max_width.xml', + ], + 'installable': True, + 'sequence': 150, + 'auto_install': False, +} + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/ext/custom-addons/cam_max_width/static/description/icon.png b/ext/custom-addons/cam_max_width/static/description/icon.png new file mode 100644 index 00000000..fd7ee3b9 Binary files /dev/null and b/ext/custom-addons/cam_max_width/static/description/icon.png differ diff --git a/ext/custom-addons/cam_max_width/static/src/css/max_width.css b/ext/custom-addons/cam_max_width/static/src/css/max_width.css new file mode 100644 index 00000000..a51466dc --- /dev/null +++ b/ext/custom-addons/cam_max_width/static/src/css/max_width.css @@ -0,0 +1,10 @@ +.openerp .oe_followers .oe_invite { + float: none !important; + display: block; + padding-left: 0px; +} + +.openerp .oe_form_sheet_width { + max-width: 95%; +} + diff --git a/ext/custom-addons/cam_max_width/views/max_width.xml b/ext/custom-addons/cam_max_width/views/max_width.xml new file mode 100644 index 00000000..84864796 --- /dev/null +++ b/ext/custom-addons/cam_max_width/views/max_width.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/ext/custom-addons/cam_reports/__init__.py b/ext/custom-addons/cam_reports/__init__.py new file mode 100644 index 00000000..a45901fe --- /dev/null +++ b/ext/custom-addons/cam_reports/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import cam_reports +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/ext/custom-addons/cam_reports/__openerp__.py b/ext/custom-addons/cam_reports/__openerp__.py new file mode 100644 index 00000000..eeac5896 --- /dev/null +++ b/ext/custom-addons/cam_reports/__openerp__.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +{ + 'name': 'Camadeus Reports', + 'category': 'Custom', + 'version': '1.0', + 'description': """Individuelle Dokumentenvorlagen""", + 'author': 'camadeus GmbH', + 'website': 'http://www.camadeus.at', + 'depends': ['purchase','sale','account','stock'], + 'data': ['reports_data.xml', + ], + 'installable': True, + 'auto_install': False, +} + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/ext/custom-addons/cam_reports/cam_reports.py b/ext/custom-addons/cam_reports/cam_reports.py new file mode 100644 index 00000000..46d5125b --- /dev/null +++ b/ext/custom-addons/cam_reports/cam_reports.py @@ -0,0 +1,55 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.osv import fields, osv +import openerp.modules as addons +import os +import base64 + +class res_company(osv.osv): + _inherit = 'res.company' + + def get_image(self, img): + + def _get_dir(): + styles_dir = 'pittoresk_reports/static/src/img' + adps = addons.module.ad_paths + for adp in adps: + dir = os.path.join(adp, styles_dir) + if os.path.isdir(dir): + return dir + return False + + def _get_file_data(filename): + try: + f = open(filename , 'rb') + data = base64.b64encode(f.read()) + f.close() + return data + except: + print "Error openening file '%s'." % (filename) + return False + + path = _get_dir() + fname = os.path.join(path, img) + img_data = _get_file_data(fname) + return img_data \ No newline at end of file diff --git a/ext/custom-addons/cam_reports/report/account.invoice.rml b/ext/custom-addons/cam_reports/report/account.invoice.rml new file mode 100644 index 00000000..fe1b2cd0 --- /dev/null +++ b/ext/custom-addons/cam_reports/report/account.invoice.rml @@ -0,0 +1,208 @@ + + + + + + + + + + + [[repeatIn(objects,'o')]] [[ setLang(o.partner_id.commercial_partner_id.lang)]] + + + [[ o.partner_id.commercial_partner_id.name ]] + [[ (o.partner_id.commercial_partner_id.id != o.partner_id.id and o.partner_id.name) or '' ]] + [[ (o.partner_id.street ) or '']] + [[ (o.partner_id.street2) or removeParentNode('para') ]] + [[ (o.partner_id.zip) or '' ]] [[ (o.partner_id and o.partner_id.city) or '' ]] + [[ (o.partner_id.state_id and o.partner_id.state_id.name) or removeParentNode('para')]] + [[ (o.partner_id.country_id and o.partner_id.country_id.name) or '' ]] + + + + + Kundennr.: + + + [[ o.partner_id.ref or removeParentNode('tr') ]] + + + + + Ihre Referenz: + + + [[ o.name ]] + + + + + Ansprechpartner: + + + [[ (o.user_id and o.user_id.name) or '' ]] + + + + + Ihre UID: + + + [[ o.partner_id.commercial_partner_id and o.partner_id.commercial_partner_id.vat or '' ]] + + + + + Datum: + + + [[ formatLang(o.date_invoice,date = True) ]] + + + + + + + Rechnung [[ ((o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')) or removeParentNode('para')) and '' ]] [[ o.number ]] + PRO-FORMA [[ ((o.type == 'out_invoice' and o.state == 'proforma2') or removeParentNode('para')) and '' ]] + Rechnungsentwurf [[ ((o.type == 'out_invoice' and o.state == 'draft') or removeParentNode('para')) and '' ]] + Stornierte Rechnung [[ ((o.type == 'out_invoice' and o.state == 'cancel') or removeParentNode('para')) and '' ]] [[ o.number ]] + Stornorechnung [[ (o.type=='out_refund' or removeParentNode('para')) and '' ]] [[ o.number ]] + Stornorechnung [[ (o.type=='in_refund' or removeParentNode('para')) and '' ]] [[ o.number ]] + Rechnung [[ (o.type=='in_invoice' or removeParentNode('para')) and '' ]] [[ o.number ]] + + + + + + + + Pos + + + Art-nr. + + + Bezeichnung + + + Menge + + + E-Preis + + + + + + Gesamtpreis + + + + [[repeatIn(o.invoice_line,'line')]] + + + + + + + [[ line.product_id and line.product_id.default_code or '']] + + + [[ (line.name or '').split('\n\n')[0] ]] +
[[ repeatIn((line.name or '').split('\n\n')[1:],'paragraphs') ]] + + [[ paragraphs ]] +
+ + + [[formatLang(line.quantity, digits=2)[-2:]=='00' and formatLang(line.quantity, digits=0) or formatLang(line.quantity, digits=2)]] + + + [[ formatLang(line.price_unit,digits=2) ]] + + + [[ line.discount <> 0 and (formatLang(line.discount) + '%') or '' ]] + + + [[ formatLang(line.price_subtotal,digits=2 ) ]] + + +
+ + + + + + + + Zwischensumme in € + + + [[ formatLang(o.amount_untaxed,digits=2 )]] + + + + + + + + MwSt. in € + + + [[ formatLang(o.amount_tax,digits=2 ) ]] + + + + + + + + Rechnungsbetrag in € + + + [[ formatLang(o.amount_total,digits=2 ) ]] + + + + + + + [[ (o.comment or '').split('\n\n')[0] ]] +
[[ repeatIn((o.comment or '').split('\n\n')[1:],'paragraphs') ]] + + [[ paragraphs ]] +
+ + + + + + + Zahlungsbedingungen: + + + [[ (o.payment_term and o.payment_term.note) or removeParentNode('blockTable') ]] + + + + + + Vielen Dank für Ihren Auftrag! + + + Bis zur Bezahlung aller Ansprüche aus den Geschäftsverbindungen behält sich der Verkäufer das Eigentum an seinen Warenlieferungen vor. Es gelten unsere Allgemeinen Geschäftsbedingungen. + + + +
+
diff --git a/ext/custom-addons/cam_reports/report/page.rml b/ext/custom-addons/cam_reports/report/page.rml new file mode 100644 index 00000000..eff25669 --- /dev/null +++ b/ext/custom-addons/cam_reports/report/page.rml @@ -0,0 +1,103 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [[ company.logo]] + + + + [[ company.partner_id.name ]], [[ company.partner_id.street ]], [[ company.partner_id.zip ]] [[ company.partner_id.city ]] + + + + + Seite + + + + + + + + -- + -- + -- + + + + + + + + [[ company.partner_id.street ]] + [[ company.partner_id.zip ]] [[ company.partner_id.city ]] + UID: [[company.vat ]] + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/ext/custom-addons/cam_reports/report/purchase.order.rml b/ext/custom-addons/cam_reports/report/purchase.order.rml new file mode 100644 index 00000000..23619f7a --- /dev/null +++ b/ext/custom-addons/cam_reports/report/purchase.order.rml @@ -0,0 +1,246 @@ + + + + + + + + + + [[repeatIn(objects,'o')]] [[ setLang(o.partner_id.commercial_partner_id.lang)]] + + [[ o.partner_id.commercial_partner_id.name ]] + [[ (o.partner_id.commercial_partner_id.id != o.partner_id.id and o.partner_id.name) or '' ]] + [[ (o.partner_id.street ) or '']] + [[ (o.partner_id.street2) or removeParentNode('para') ]] + [[ (o.partner_id.zip) or '' ]] [[ (o.partner_id.city) or '' ]] + [[ (o.partner_id.state_id and o.partner_id.state_id.name) or removeParentNode('para')]] + [[ (o.partner_id.country_id and o.partner_id.country_id.name) or '' ]] + + + + + + + + Ihr Ansprechpartner + + + + Name: + + + [[ (user.name) or '' ]] + + + + + Telefon: + + + [[ user.partner_id.phone or '' ]] + + + + + E-Mail: + + + [[ user.partner_id.email or '' ]] + + + + + + + + + + + + + Datum: + + + [[ formatLang(time.strftime('%Y-%m-%d'),date=True) ]] + + + + + Referenz: + + + [[ o.partner_ref or '' ]] + + + + + + + + + Bestellung [[ o.name ]] + + + + + + + Pos + + + Art.nr. + + + Bezeichnung + + + gepl. + Lieferung + + + Menge + + + E-Preis + + + G-Preis + + + [[repeatIn(o.order_line,'line')]] + + + + + + + [[ line.product_id and line.product_id.default_code ]] + + + [[ (line.name or '').split('\n\n')[0] ]] +
[[ repeatIn((line.name or '').split('\n\n')[1:],'paragraphs') ]] + + [[ paragraphs ]] +
+ + Ihre Artikelnr.: [[ line.supplier_code or removeParentNode('para')]] + + + [[ formatLang(line.date_planned,date=True) ]] + + + + [[ formatLang(line.product_qty, digits=2)[-2:]=='00' and formatLang(line.product_qty, digits=0) or formatLang(line.product_qty, digits=2) ]] + + + [[ formatLang(line.price_unit, digits=2) ]] + + + [[ formatLang(line.price_subtotal, digits=2) ]] + + +
+ + + + + [[ o.amount_tax > 0 or removeParentNode('tr') ]] + + + + + Nettobetrag in €: + + + [[o.pricelist_id.currency_id.name]] + + + [[ formatLang(o.amount_untaxed, digits=2)]] + + + [[ o.amount_tax > 0 or removeParentNode('tr') ]] + + + + + MwSt. in €: + + + [[ o.pricelist_id.currency_id.name ]] + + + [[ formatLang(o.amount_tax, digits=2) ]] + + + + + + + + Gesamt in €: + + + [[ o.pricelist_id.currency_id.name ]] + + + [[ formatLang(o.amount_total,digits=2) ]] + + + + + + + [[ (o.notes or '').split('\n\n')[0] ]] +
[[ repeatIn((o.notes or '').split('\n\n')[1:],'paragraphs') ]] + + [[ paragraphs ]] +
+ + + + [[o.incoterm_id or removeParentNode('blockTable') ]] + + + Lieferbedingung: + + + [[o.incoterm_id and o.incoterm_id.name or '' ]] + + + + [[o.payment_term_id or removeParentNode('blockTable') ]] + + + Zahlungsbedingungen: + + + [[o.payment_term_id and o.payment_term_id.note or '' ]] + + + + + + + + Mit freundlichen Grüßen, + + + + + [[ company.signature]] + + + + B. Neumeier + +
+
diff --git a/ext/custom-addons/cam_reports/report/purchase.quotation.rml b/ext/custom-addons/cam_reports/report/purchase.quotation.rml new file mode 100644 index 00000000..bfab0ae1 --- /dev/null +++ b/ext/custom-addons/cam_reports/report/purchase.quotation.rml @@ -0,0 +1,188 @@ + + + + + + + + + + [[repeatIn(objects,'o')]] [[ setLang(o.partner_id.commercial_partner_id.lang)]] + + [[ o.partner_id.commercial_partner_id.name ]] + [[ (o.partner_id.commercial_partner_id.id != o.partner_id.id and o.partner_id.name) or '' ]] + [[ (o.partner_id.street ) or '']] + [[ (o.partner_id.street2) or removeParentNode('para') ]] + [[ (o.partner_id.zip) or '' ]] [[ (o.partner_id.city) or '' ]] + [[ (o.partner_id.state_id and o.partner_id.state_id.name) or removeParentNode('para')]] + [[ (o.partner_id.country_id and o.partner_id.country_id.name) or '' ]] + + + + + + + + Ihr Ansprechpartner + + + + Name: + + + [[ (user.name) or '' ]] + + + + + Telefon: + + + [[ user.partner_id.phone or '' ]] + + + + + E-Mail: + + + [[ user.partner_id.email or '' ]] + + + + + + + + + + + + + + Datum: + + + [[ formatLang(time.strftime('%Y-%m-%d'),date=True) ]] + + + + + Referenz: + + + [[ o.partner_ref or '' ]] + + + + + + + + + Anfrage [[ o.name ]] + + + + + + + Pos + + + Art.nr. + + + Bezeichnung + + + gepl. + Lieferung + + + Menge + + + [[repeatIn(o.order_line,'line')]] + + + + + + + [[ line.product_id and line.product_id.default_code ]] + + + [[ (line.name or '').split('\n\n')[0] ]] +
[[ repeatIn((line.name or '').split('\n\n')[1:],'paragraphs') ]] + + [[ paragraphs ]] +
+ + Ihre Artikelnr.: [[ line.supplier_code or removeParentNode('para')]] + + + [[ formatLang(line.date_planned,date=True) ]] + + + + [[ formatLang(line.product_qty, digits=2)[-2:]=='00' and formatLang(line.product_qty, digits=0) or formatLang(line.product_qty, digits=2) ]] + + +
+ + + + [[ (o.notes or '').split('\n\n')[0] ]] +
[[ repeatIn((o.notes or '').split('\n\n')[1:],'paragraphs') ]] + + [[ paragraphs ]] +
+ + + + [[o.incoterm_id or removeParentNode('blockTable') ]] + + + Lieferbedingung: + + + [[o.incoterm_id and o.incoterm_id.name or '' ]] + + + + [[o.payment_term_id or removeParentNode('blockTable') ]] + + + Zahlungsbedingungen: + + + [[o.payment_term_id and o.payment_term_id.note or '' ]] + + + + + + + + Mit freundlichen Grüßen, + + + + + [[ company.signature]] + + + + B. Neumeier + +
+
diff --git a/ext/custom-addons/cam_reports/report/sale.order.rml b/ext/custom-addons/cam_reports/report/sale.order.rml new file mode 100644 index 00000000..43e7e83e --- /dev/null +++ b/ext/custom-addons/cam_reports/report/sale.order.rml @@ -0,0 +1,199 @@ + + + + + + + + + + + [[repeatIn(objects,'o')]] [[ setLang(o.partner_id.commercial_partner_id.lang)]] + + [[ o.partner_id.commercial_partner_id.name ]] + [[ (o.partner_id.commercial_partner_id.id != o.partner_id.id and o.partner_id.name) or '' ]] + [[ (o.partner_id.street ) or '']] + [[ (o.partner_id.street2) or removeParentNode('para') ]] + [[ (o.partner_id.zip) or '' ]] [[ (o.partner_id and o.partner_id.city) or '' ]] + [[ (o.partner_id.state_id and o.partner_id.state_id.name) or removeParentNode('para')]] + [[ (o.partner_id.country_id and o.partner_id.country_id.name) or '' ]] + + + + + + Ihre Referenz: + + + [[ o.client_order_ref ]] + + + + + Ansprechpartner: + + + [[ (o.user_id and o.user_id.name) or '' ]] + + + [[ o.user_id and o.user_id.phone or removeParentNode('tr') ]] + + Tel.: + + + [[ (o.user_id and o.user_id.phone) or '' ]] + + + + + Ihre UID: + + + [[ o.partner_id.commercial_partner_id and o.partner_id.commercial_partner_id.vat or '' ]] + + + + + Angebotsdatum:[[ o.state not in ['draft','sent'] and removeParentNode('para') ]] + Bestelldatum:[[ o.state in ['draft','sent'] and removeParentNode('para') ]] + + + [[ formatLang(o.date_order,date = True) ]] + + + + + +
+ [[ o.state not in ['draft','sent'] and removeParentNode('para') ]] Angebot [[ o.name ]] + [[ o.state in ['draft','sent'] and removeParentNode('para') ]] Bestellbestätigung [[ o.name ]] +
+ + + + + + + Pos + + + Art.nr. + + + Bezeichnung + + + Menge + + + E-Preis + + + + + + Gesamtpreis + + + + [[repeatIn(o.order_line,'line')]] + + + + + + + [[ line.product_id and line.product_id.default_code or '']] + + + [[ (line.name or '').split('\n\n')[0] ]] +
[[ repeatIn((line.name or '').split('\n\n')[1:],'paragraphs') ]] + + [[ paragraphs ]] +
+ + + + [[ formatLang(line.product_uos and line.product_uos_qty or line.product_uom_qty, digits=0) ]] + + + [[ formatLang(line.price_unit,digits=2) ]] + + + [[ line.discount <> 0 and (formatLang(line.discount) + '%') or '' ]] + + + [[ formatLang(line.price_subtotal,digits=2 ) ]] + + +
+ + + + + + + + Zwischensumme in € + + + [[ formatLang(o.amount_untaxed,digits=2 )]] + + + + + + + + MwSt. in € + + + [[ formatLang(o.amount_tax,digits=2 ) ]] + + + + + + + + Rechnungsbetrag in € + + + [[ formatLang(o.amount_total,digits=2 ) ]] + + + + + + + [[ (o.note or '').split('\n\n')[0] ]] +
[[ repeatIn((o.note or '').split('\n\n')[1:],'paragraphs') ]] + + [[ paragraphs ]] +
+ + + + + + + Zahlungsziele: + + + [[ (o.payment_term and o.payment_term.note) or removeParentNode('blockTable') ]] + + + + + + +
+
diff --git a/ext/custom-addons/cam_reports/report/stock.picking.list.rml b/ext/custom-addons/cam_reports/report/stock.picking.list.rml new file mode 100644 index 00000000..3b99dac0 --- /dev/null +++ b/ext/custom-addons/cam_reports/report/stock.picking.list.rml @@ -0,0 +1,117 @@ + + + + + + + + + + + + [[ repeatIn(objects,'picking') ]] [[ picking.partner_id and setLang(picking.partner_id.lang) ]] + + [[ picking.partner_id.commercial_partner_id.name ]] + [[ (picking.partner_id.commercial_partner_id.id != picking.partner_id.id and picking.partner_id.name) or '' ]] + [[ (picking.partner_id and picking.partner_id.street ) or '']] + [[ (picking.partner_id and picking.partner_id.street2) or removeParentNode('para') ]] + [[ (picking.partner_id and picking.partner_id.zip) or '' ]] [[ (picking.partner_id and picking.partner_id.city) or '' ]] + [[ (picking.partner_id and picking.partner_id.state_id and picking.partner_id.state_id.name) or removeParentNode('para')]] + [[ (picking.partner_id and picking.partner_id.country_id and picking.partner_id.country_id.name) or '' ]] + + + + + + Bestellung: + + + [[ picking.origin ]] + + + + + Datum: + + + [[ formatLang(picking.date_done, date=True) or formatLang(time.strftime('%Y-%m-%d'),date=True) ]] + + + + + Referenz: + + + [[ picking.sale_id and picking.sale_id.client_order_ref or '' ]] + + + + + Kundennr.: + + + [[ picking.partner_id and picking.partner_id.commercial_partner_id and picking.partner_id.commercial_partner_id.ref or '' ]] + + + + + + Lieferschein [[ picking.name ]] + + + + + + + Pos + + + Art.nr. + + + Bezeichnung + + + Menge + + + [[ repeatIn([line for line in picking.move_lines if line.state <> 'cancel'],'move_lines') ]] + + + + + + + [[ move_lines.product_id.default_code ]] + + + [[ (move_lines.name or '').split('\n\n')[0] ]] +
[[ repeatIn((move_lines.name or '').split('\n\n')[1:],'paragraphs') ]] + + [[ paragraphs ]] +
+ + + [[ formatLang(move_lines.product_qty, digits=0) ]] + + +
+ + + + [[ (picking.note or '').split('\n\n')[0] ]] +
[[ repeatIn((picking.note or '').split('\n\n')[1:],'paragraphs') ]] + + [[ paragraphs ]] +
+ +
+
diff --git a/ext/custom-addons/cam_reports/reports_data.xml b/ext/custom-addons/cam_reports/reports_data.xml new file mode 100644 index 00000000..eecd06db --- /dev/null +++ b/ext/custom-addons/cam_reports/reports_data.xml @@ -0,0 +1,29 @@ + + + + + cam_reports/report/sale.order.rml + pdf + + + + cam_reports/report/stock.picking.rml + pdf + + + + cam_reports/report/account.invoice.rml + pdf + + + + cam_reports/report/purchase.quotation.rml + pdf + + + + cam_reports/report/purchase.order.rml + pdf + + + \ No newline at end of file diff --git a/ext/custom-addons/cam_reports/static/description/icon.png b/ext/custom-addons/cam_reports/static/description/icon.png new file mode 100644 index 00000000..fd7ee3b9 Binary files /dev/null and b/ext/custom-addons/cam_reports/static/description/icon.png differ diff --git a/ext/custom-addons/cam_reports/static/src/img/warning.png b/ext/custom-addons/cam_reports/static/src/img/warning.png new file mode 100644 index 00000000..54ef62b3 Binary files /dev/null and b/ext/custom-addons/cam_reports/static/src/img/warning.png differ diff --git a/ext/custom-addons/cam_testenv/__init__.py b/ext/custom-addons/cam_testenv/__init__.py new file mode 100644 index 00000000..41102c7b --- /dev/null +++ b/ext/custom-addons/cam_testenv/__init__.py @@ -0,0 +1,25 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +import controllers +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/ext/custom-addons/cam_testenv/__openerp__.py b/ext/custom-addons/cam_testenv/__openerp__.py new file mode 100644 index 00000000..1ddf5d6a --- /dev/null +++ b/ext/custom-addons/cam_testenv/__openerp__.py @@ -0,0 +1,48 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + + +{ + 'name': 'Test Environment', + 'version': '1.0', + 'category': 'Custom', + 'description': """ +Test Environment +=========================== +* Shows the message "Test" in the background if the database matches the regular expression of the config paramter "dbfilter_test" +* Default filter: test* + + """, + 'author': 'camadeus Consulting GmbH', + 'website': 'http://www.camadeus.at', + 'depends': ['web','base'], + 'js': [ + 'static/src/js/testenv.js', + ], + 'css': [ + 'static/src/css/testenv.css', + ], + 'update_xml': [], + 'demo_xml': [], + 'installable': True, + 'active': False, +} \ No newline at end of file diff --git a/ext/custom-addons/cam_testenv/background.xcf b/ext/custom-addons/cam_testenv/background.xcf new file mode 100644 index 00000000..eb98e7b8 Binary files /dev/null and b/ext/custom-addons/cam_testenv/background.xcf differ diff --git a/ext/custom-addons/cam_testenv/controllers/__init__.py b/ext/custom-addons/cam_testenv/controllers/__init__.py new file mode 100644 index 00000000..84f59725 --- /dev/null +++ b/ext/custom-addons/cam_testenv/controllers/__init__.py @@ -0,0 +1,25 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +import testenv_controller +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/ext/custom-addons/cam_testenv/controllers/testenv_controller.py b/ext/custom-addons/cam_testenv/controllers/testenv_controller.py new file mode 100644 index 00000000..02e70dbd --- /dev/null +++ b/ext/custom-addons/cam_testenv/controllers/testenv_controller.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- + +import ast +import base64 +import csv +import glob +import itertools +import logging +import operator +import datetime +import hashlib +import os +import re +import simplejson +import time +import urllib +import urllib2 +import urlparse +import xmlrpclib +import zlib +from xml.etree import ElementTree +from cStringIO import StringIO + +import babel.messages.pofile +import werkzeug.utils +import werkzeug.wrappers +try: + import xlwt +except ImportError: + xlwt = None + +import openerp +import openerp.modules.registry +from openerp.tools.translate import _ +from openerp.tools import config + +from openerp.addons.web import http + + +class WebClient(http.Controller): + _cp_path = "/web/testenv" + + @http.jsonrequest + def testmode(self, req, db=False): + if not db and req and req.session: + db = req.session._db + + if db: + h = req.httprequest.environ['HTTP_HOST'].split(':')[0] + d = h.split('.')[0] + r = openerp.tools.config.get('dbfilter_test', 'test*').replace('%h', h).replace('%d', d) + try: + pattern_list = eval(r) + if not hasattr(pattern_list, '__iter__'): + pattern_list = [pattern_list] + except: + pattern_list = [r] + + for pattern in pattern_list: + if isinstance(pattern, str) and re.match(pattern, db): + return True + return False + + + +# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/ext/custom-addons/cam_testenv/static/description/icon.png b/ext/custom-addons/cam_testenv/static/description/icon.png new file mode 100644 index 00000000..fd7ee3b9 Binary files /dev/null and b/ext/custom-addons/cam_testenv/static/description/icon.png differ diff --git a/ext/custom-addons/cam_testenv/static/src/css/testenv.css b/ext/custom-addons/cam_testenv/static/src/css/testenv.css new file mode 100644 index 00000000..733c3f8c --- /dev/null +++ b/ext/custom-addons/cam_testenv/static/src/css/testenv.css @@ -0,0 +1,10 @@ + +.test-mode-activated { + background-size: cover; + background-attachment: fixed; +} + +.test-mode-activated > * { + opacity: 0.9; + background-color: rgba(0,0,0,0); +} \ No newline at end of file diff --git a/ext/custom-addons/cam_testenv/static/src/img/back-testenv.jpg b/ext/custom-addons/cam_testenv/static/src/img/back-testenv.jpg new file mode 100644 index 00000000..f52bed96 Binary files /dev/null and b/ext/custom-addons/cam_testenv/static/src/img/back-testenv.jpg differ diff --git a/ext/custom-addons/cam_testenv/static/src/js/testenv.js b/ext/custom-addons/cam_testenv/static/src/js/testenv.js new file mode 100644 index 00000000..e47184c5 --- /dev/null +++ b/ext/custom-addons/cam_testenv/static/src/js/testenv.js @@ -0,0 +1,32 @@ +openerp.cam_testenv = function (openerp) { + + openerp.web.WebClient = openerp.web.WebClient.extend({ + /** + * Test env + */ + start: function() { + var self = this; + + return $.when(this._super()).then(function() { + //this._super(); + + db = null + if (jQuery.param !== undefined && jQuery.deparam(jQuery.param.querystring()).db !== undefined) { + db = jQuery.deparam(jQuery.param.querystring()).db + } + + self.rpc("/web/testenv/testmode", {'db': db}).done(function(result) { + // If immediately follows a login (triggered by trying to restore + // an invalid session or no session at all), refresh session data + // (should not change, but just in case...) + if (result) { + $("body").addClass("test-mode-activated"); + $("body").css("background-image", "url(" + openerp.session.origin + "/cam_testenv/static/src/img/back-testenv.jpg" + ")"); + } + }); + }); + } + + }); + +} diff --git a/ext/custom-addons/cam_work_order/__init__.py b/ext/custom-addons/cam_work_order/__init__.py new file mode 100644 index 00000000..88b64a62 --- /dev/null +++ b/ext/custom-addons/cam_work_order/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import cam_work_order + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/ext/custom-addons/cam_work_order/__openerp__.py b/ext/custom-addons/cam_work_order/__openerp__.py new file mode 100644 index 00000000..6e1e2c8c --- /dev/null +++ b/ext/custom-addons/cam_work_order/__openerp__.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +{ + 'name': 'Camadeus Produktionsschein', + 'category': 'Custom', + 'version': '1.0', + 'description': """Produktionsschein für die Arbeitsausführung""", + 'author': 'camadeus GmbH', + 'website': 'http://www.camadeus.at', + 'depends': ['sale'], + 'data': [ + 'cam_work_order_view.xml', + 'cam_work_order_data.xml', + 'security/ir.model.access.csv', + ], + 'installable': True, + 'auto_install': False, +} + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/ext/custom-addons/cam_work_order/cam_work_order.py b/ext/custom-addons/cam_work_order/cam_work_order.py new file mode 100644 index 00000000..4c846835 --- /dev/null +++ b/ext/custom-addons/cam_work_order/cam_work_order.py @@ -0,0 +1,163 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.osv import fields, osv +from openerp import api +from openerp.tools.translate import _ +from openerp import SUPERUSER_ID +from openerp import tools +from lxml import etree + +class sale_order(osv.osv): + _inherit = 'sale.order' + + _columns = { + 'work_order_ids': fields.one2many('work.order','sale_id','Produktionsscheine'), + } + + def action_view_work_order(self, cr, uid, ids, context=None): + + mod_obj = self.pool.get('ir.model.data') + act_obj = self.pool.get('ir.actions.act_window') + + result = mod_obj.get_object_reference(cr, uid, 'cam_work_order', 'work_order_action') + id = result and result[1] or False + result = act_obj.read(cr, uid, [id], context=context)[0] + + #compute the number of work orders to display + work_ids = [] + for so in self.browse(cr, uid, ids, context=context): + work_ids += [order.id for order in so.work_order_ids] + + #choose the view_mode accordingly + if len(work_ids) > 1: + result['domain'] = "[('id','in',[" + ','.join(map(str, work_ids)) + "])]" + else: + res = mod_obj.get_object_reference(cr, uid, 'cam_custom', 'work_order_form') + result['views'] = [(res and res[1] or False, 'form')] + result['res_id'] = work_ids and work_ids[0] or False + return result + + def button_work_order(self, cr, uid, ids, context=None): + assert len(ids) == 1 #'This option should only be used for a single id at a time.' + order = self.browse(cr, uid, ids[0], context=context) + + existing_ids = self.pool.get('work.order').search(cr, uid, [('sale_id','=',order.id)]) + if existing_ids: + work_id = existing_ids[0] + else: + lines = [] + for l in order.order_line: + line = { + 'name': l.name, + 'qty': l.product_uom_qty, + } + lines.append((0,0,line)) + + vals = { + 'partner_id': order.partner_id.id, + 'sale_id': order.id, + 'line_ids': lines, + } + work_id = self.pool.get('work.order').create(cr, uid, vals, context=context) + return { + 'type': 'ir.actions.act_window', + 'name': _('Produktionsschein'), + 'res_model': 'work.order', + 'res_id': work_id, + 'view_type': 'form', + 'view_mode': 'form', + 'target': 'current', + 'nodestroy': True, + } + +class work_order_line(osv.Model): + _name = 'work.order.line' + _description = 'Arbeitsposition' + _order = 'seq, id' + _columns = { + 'seq': fields.integer('Sequenz'), + 'name': fields.text('Bezeichnung', size=30, required=True), + 'qty': fields.float('Stück'), + 'order_id': fields.many2one('work.order', required=True, ondelete='cascade'), + } + +class work_order_stage(osv.osv): + _name = "work.order.stage" + _description = "Stage of work order" + _order = "sequence, id" + + _columns = { + 'name': fields.char('Stage Name', required=True, translate=True), + 'sequence': fields.integer('Sequence', help="Used to order stages. Lower is better."), + 'fold': fields.boolean('Folded in Kanban View', help='This stage is folded in the kanban view when there are no records in that stage to display.'), + } + + _defaults = { + 'sequence': 1, + 'fold': False, + } + +class work_order(osv.Model): + _name = 'work.order' + _description = 'Produktionsschein' + _inherit = ['mail.thread'] + + _columns = { + 'name': fields.char('Bezeichnung', size=30, required=True), + 'sale_id': fields.many2one('sale.order', 'Verkaufsauftrag', required=True), + 'partner_id': fields.many2one('res.partner', 'Kunde', required=True), + 'parter_id_street': fields.related('partner_id', 'street', type="char", relation="res.partner", string="Strasse", store=False), + 'parter_id_zip': fields.related('partner_id', 'zip', type="char", relation="res.partner", string="Postleitzahl", store=False), + 'parter_id_city': fields.related('partner_id', 'city', type="char", relation="res.partner", string="Stadt", store=False), + 'user_id': fields.many2one('res.users', 'Bearbeiter'), + 'stage_id': fields.many2one('work.order.stage', 'Status', track_visibility='onchange', select=True), + 'date_of_creation': fields.date('Erstellungsdatum'), + 'line_ids': fields.one2many('work.order.line', 'order_id', 'Positionen', copy=True), + 'work_date': fields.char('Produktionsstermin',size=120), + 'work_address': fields.text('Produktionsadresse'), + 'graphic_text': fields.text('Anmerkungen'), + } + + def _get_default_stage_id(self, cr, uid, context=None): + """ Gives default stage_id """ + return self.pool.get('work.order.stage').search(cr, uid, [], context=context)[0] + + _defaults = { + 'name': '/', + 'date_of_creation': fields.date.context_today, + 'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c), + } + + def create(self, cr, uid, vals, context=None): + if context is None: + context = {} + if vals.get('name', '/') == '/': + vals['name'] = self.pool.get('ir.sequence').get(cr, uid, 'work.order') or '/' + new_id = super(work_order, self).create(cr, uid, vals, context=context) + return new_id + + def print_quotation(self, cr, uid, ids, context=None): + ''' + This function prints the work order + ''' + return self.pool['report'].get_action(cr, uid, ids, 'cam_reports.report_workorder', context=context) diff --git a/ext/custom-addons/cam_work_order/cam_work_order_data.xml b/ext/custom-addons/cam_work_order/cam_work_order_data.xml new file mode 100644 index 00000000..f65a7689 --- /dev/null +++ b/ext/custom-addons/cam_work_order/cam_work_order_data.xml @@ -0,0 +1,49 @@ + + + + + + Work Order + work.order + + + + Work Order + work.order + PS- + 5 + + + + + + Neu + 1 + False + + + + In Bearbeitung + 2 + False + + + + Bereit für Produktion + 3 + False + + + + Terminisiert + 4 + False + + + + Erledigt + 5 + False + + + diff --git a/ext/custom-addons/cam_work_order/cam_work_order_view.xml b/ext/custom-addons/cam_work_order/cam_work_order_view.xml new file mode 100644 index 00000000..aced5091 --- /dev/null +++ b/ext/custom-addons/cam_work_order/cam_work_order_view.xml @@ -0,0 +1,211 @@ + + + + + + + work_order_form + work.order + +
+ +
+
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+
+
+
+ + + + work_order_kanban + work.order + kanban + + + + +
+ +
+
+ +
+
+
+  
+   +
+
+ +
+
+
+
+ + + + + + + + + work_order_search + work.order + + + + + + + + + + + + + + + + + + work_order_tree + work.order + + + + + + + + + + + + + + Produktionsscheine + ir.actions.act_window + work.order + form + kanban,tree,form + +

+ Hier klicken um einen neuen Produktionsschein zu erstellen. +

+ Verwaltung von Produktionsscheinen. +

+
+
+ + + + work_order_stages_form + work.order.stage + +
+
+ +

+ +

+ + + + + + + + +
+ + + + + + + Status + ir.actions.act_window + work.order.stage + form + tree,form + +

+ Hier klicken um einen neuen Status für Produktionsschein zu erstellen. +

+ Verwaltung von Status von Produktionsscheinen. +

+
+
+ + + + + + + + + + + + view_order_work_form + sale.order + + + + + 17 + + + + diff --git a/ext/custom-addons/cam_work_order/security/ir.model.access.csv b/ext/custom-addons/cam_work_order/security/ir.model.access.csv new file mode 100644 index 00000000..e20db9d7 --- /dev/null +++ b/ext/custom-addons/cam_work_order/security/ir.model.access.csv @@ -0,0 +1,5 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +modify_work_order,modify_order_sale_user,model_work_order,base.group_sale_salesman,1,1,1,1 +modify_work_order_line,modify_order_line_sale_user,model_work_order_line,base.group_sale_salesman,1,1,1,1 +access_work_category,work_category_user,model_work_category,base.group_sale_salesman,1,0,0,0 +modify_work_category,work_category_manager,model_work_category,base.group_sale_manager,1,1,1,1 diff --git a/ext/custom-addons/cam_work_order/static/description/icon.png b/ext/custom-addons/cam_work_order/static/description/icon.png new file mode 100644 index 00000000..fd7ee3b9 Binary files /dev/null and b/ext/custom-addons/cam_work_order/static/description/icon.png differ diff --git a/ext/custom-addons/oerp_no_phoning_home/README.md b/ext/custom-addons/oerp_no_phoning_home/README.md new file mode 100644 index 00000000..54a855dd --- /dev/null +++ b/ext/custom-addons/oerp_no_phoning_home/README.md @@ -0,0 +1,15 @@ +Stop Phoning Home Feature from OpenERP +====================================== + +Note: +----- + +* For V8 checkout master branch +* for V7 checkout 7.0 branch + +Remove Few Phoning home feature effect from Core OpenERP. +--------------------------------------------------------- + +* Stop Scheduler for Sending Company/Database information to Odoo/OpenERP company. +* Remove ``Your OpenERP is not supported.``. +* Change sequence of the ``Apps`` and ``Update`` menu and arrange ``Installed Modules`` at first position. \ No newline at end of file diff --git a/ext/custom-addons/oerp_no_phoning_home/__init__.py b/ext/custom-addons/oerp_no_phoning_home/__init__.py new file mode 100644 index 00000000..fc631b41 --- /dev/null +++ b/ext/custom-addons/oerp_no_phoning_home/__init__.py @@ -0,0 +1 @@ +import mail diff --git a/ext/custom-addons/oerp_no_phoning_home/__openerp__.py b/ext/custom-addons/oerp_no_phoning_home/__openerp__.py new file mode 100644 index 00000000..eb8dab59 --- /dev/null +++ b/ext/custom-addons/oerp_no_phoning_home/__openerp__.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +{ + 'name': 'Stop Phoning Home', + 'version': '1.0', + 'category': '', + "sequence": 14, + 'complexity': "easy", + 'category': 'Hidden', + 'description': """ + Remove Few Phoning home feature effect from Core OpenERP. + """, + 'author': 'Ruchir Shukla', + 'website': 'www.bizzappdev.com', + 'depends': ["mail",'web'], + 'init_xml': [], + 'data': [ + "base_view.xml", + "mail_data.xml", + ], + 'demo_xml': [], + 'test': [ + ], + 'qweb' : [ + "static/src/xml/base.xml", + ], + 'installable': True, + 'auto_install': True, +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/ext/custom-addons/oerp_no_phoning_home/base_view.xml b/ext/custom-addons/oerp_no_phoning_home/base_view.xml new file mode 100644 index 00000000..a9449c48 --- /dev/null +++ b/ext/custom-addons/oerp_no_phoning_home/base_view.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ext/custom-addons/oerp_no_phoning_home/mail.py b/ext/custom-addons/oerp_no_phoning_home/mail.py new file mode 100644 index 00000000..bb0980a1 --- /dev/null +++ b/ext/custom-addons/oerp_no_phoning_home/mail.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +from openerp.osv import osv +import logging + +_logger = logging.getLogger(__name__) + +from openerp.tools import config + +config['publisher_warranty_url'] = '' + + +class publisher_warranty_contract(osv.osv): + _inherit = 'publisher_warranty.contract' + + def update_notification(self, cr, uid, ids, cron_mode=True, + context=None): + + _logger.info("NO More Spying Stuff") + + return True + + +publisher_warranty_contract() + diff --git a/ext/custom-addons/oerp_no_phoning_home/mail_data.xml b/ext/custom-addons/oerp_no_phoning_home/mail_data.xml new file mode 100644 index 00000000..5315dc4b --- /dev/null +++ b/ext/custom-addons/oerp_no_phoning_home/mail_data.xml @@ -0,0 +1,26 @@ + + + + + + + Update Notification + + + 1 + weeks + -1 + + + + + 1000 + + + + + diff --git a/ext/custom-addons/oerp_no_phoning_home/static/src/img/icon.png b/ext/custom-addons/oerp_no_phoning_home/static/src/img/icon.png new file mode 100644 index 00000000..9ad73d74 Binary files /dev/null and b/ext/custom-addons/oerp_no_phoning_home/static/src/img/icon.png differ diff --git a/ext/custom-addons/oerp_no_phoning_home/static/src/js/announcement.js b/ext/custom-addons/oerp_no_phoning_home/static/src/js/announcement.js new file mode 100644 index 00000000..0d7e1fde --- /dev/null +++ b/ext/custom-addons/oerp_no_phoning_home/static/src/js/announcement.js @@ -0,0 +1,13 @@ +openerp.oerp_no_phoning_home = function(instance) { + instance.web.WebClient.include({ + show_application: function() { + return $.when(this._super.apply(this, arguments)); + }, + _ab_location: function(dbuuid) { + // return _.str.sprintf('https://services.openerp.com/openerp-enterprise/ab/css/%s.css', dbuuid); + }, + show_annoucement_bar: function() { + return; + } + }); +}; diff --git a/ext/custom-addons/oerp_no_phoning_home/static/src/xml/base.xml b/ext/custom-addons/oerp_no_phoning_home/static/src/xml/base.xml new file mode 100644 index 00000000..97da789c --- /dev/null +++ b/ext/custom-addons/oerp_no_phoning_home/static/src/xml/base.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/ext/scripts/odoo-backup.sh b/ext/scripts/odoo-backup.sh new file mode 100755 index 00000000..67c3efc6 --- /dev/null +++ b/ext/scripts/odoo-backup.sh @@ -0,0 +1,33 @@ +#!/bin/sh +#dump the OpenERP DB (postgreSQL) +#author: Camadeus GmbH + +hostname=`/bin/hostname` + + +dbnames=`psql -d postgres -c "SELECT datname FROM pg_database WHERE NOT datistemplate AND datname <> 'postgres'" --tuples-only` + +# Dump DBs +for db in $dbnames +do + echo "creating backup for db: " $db + date=`date +"%Y%m%d_%H%M%N"` + filename="/var/pgdump/${hostname}_${db}_${date}.sql" + pg_dump -E UTF-8 -F p -b -f $filename $db + chmod 600 $filename + gzip $filename +done + + +########################################## +## Housekeeping +########################################## +for file in `find /var/pgdump/ -mtime +30 -type f -name '*.sql.gz'` +do + echo "deleting: " $file + rm $file +done + + +exit 0 + diff --git a/setup/cam b/setup/cam new file mode 100755 index 00000000..697c9f10 --- /dev/null +++ b/setup/cam @@ -0,0 +1,5 @@ +#!/usr/bin/env python +from lib import cli + +if __name__ == "__main__": + cli.main() diff --git a/setup/install-odoo-7.sh b/setup/install-odoo-7.sh new file mode 100755 index 00000000..4934fce2 --- /dev/null +++ b/setup/install-odoo-7.sh @@ -0,0 +1,150 @@ +#!/bin/bash +################################################################################ +# Script for Installation: ODOO Saas4/Trunk server on Ubuntu 14.04 LTS +# Author: André Schenkels, ICTSTUDIO 2014 +#------------------------------------------------------------------------------- +# +# This script will install ODOO Server on +# clean Ubuntu 14.04 Server +#------------------------------------------------------------------------------- +# USAGE: +# +# odoo-install +# +# EXAMPLE: +# ./odoo-install +# +################################################################################ + +##fixed parameters +OE_USER="odoo" +OE_HOME="/opt/$OE_USER" +OE_HOME_EXT="/opt/$OE_USER/$OE_USER-server" + +#Enter version for checkout "7.0" for version 7.0, "saas-4, saas-5 (opendays version) and "master" for trunk +OE_VERSION="7.0" + +#set the superadmin password +OE_SUPERADMIN="c76EVdqj" +OE_CONFIG="$OE_USER-server" + +#-------------------------------------------------- +# Set Locale en_US.UTF-8 +#-------------------------------------------------- +#echo -e "\n---- Set en_US.UTF-8 Locale ----" +#sudo cp /etc/default/locale /etc/default/locale.BACKUP +#sudo rm -rf /etc/default/locale +#echo -e "* Change server config file" +#sudo su root -c "echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale" +#sudo su root -c "echo 'LANG="en_US.UTF-8"' >> /etc/default/locale" +#sudo su root -c "echo 'LANGUAGE="en_US:en"' >> /etc/default/locale" + +#-------------------------------------------------- +# Update Server +#-------------------------------------------------- +echo -e "\n---- Update Server ----" +sudo apt-get upgrade -y +sudo apt-get update + +#-------------------------------------------------- +# Install PostgreSQL Server +#-------------------------------------------------- +echo -e "\n---- Install PostgreSQL Server ----" +sudo apt-get install postgresql -y + +#echo -e "\n---- PostgreSQL $PG_VERSION Settings ----" +#sudo sed -i s/"#listen_addresses = 'localhost'"/"listen_addresses = '*'"/g /etc/postgresql/9.3/main/postgresql.conf + +echo -e "\n---- Creating the ODOO PostgreSQL User ----" +sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true + +#-------------------------------------------------- +# Install Dependencies +#-------------------------------------------------- +echo -e "\n---- Install tool packages ----" +sudo apt-get install wget git bzr python-pip -y + +echo -e "\n---- Install python packages ----" +sudo apt-get install python-gevent python-dateutil python-feedparser python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi python-docutils python-psutil python-mock python-unittest2 python-jinja2 python-pypdf python-pdftools python-setuptools python-pybabel python-imaging python-matplotlib python-reportlab-accel python-openssl python-egenix-mxdatetime python-paramiko antiword python-decorator poppler-utils python-requests python-passlib -y + +sudo pip install gevent gevent_psycopg2 psycogreen passlib + +echo -e "\n---- Install latest gdata-python-client ----" +cd /tmp +wget http://gdata-python-client.googlecode.com/files/gdata-2.0.18.tar.gz +tar zxvf gdata-2.0.18.tar.gz +cd gdata-2.0.18/ +sudo python setup.py install + + +echo -e "\n---- Install Wkhtmltopdf 0.12.1 ----" +sudo wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb +sudo dpkg -i wkhtmltox-*.deb +sudo cp /usr/local/bin/wkhtmltopdf /usr/bin +sudo cp /usr/local/bin/wkhtmltoimage /usr/bin + +echo -e "\n---- Create ODOO system user ----" +sudo adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos 'ODOO' --group $OE_USER +sudo adduser $OE_USER sudo +sudo cp /root/.profile $OE_HOME +sudo chown $OE_USER:$OE_USER $OE_HOME/.profile +sudo cp /root/.bashrc $OE_HOME +sudo chown $OE_USER:$OE_USER $OE_HOME/.bashrc + +echo -e "\n---- Create Log directory ----" +sudo mkdir /var/log/$OE_USER +sudo chown $OE_USER:$OE_USER /var/log/$OE_USER +sudo chmod 700 /var/log/$OE_USER + +echo -e "\n---- Set Logrotate config ----" +sudo ln -s /opt/odoo/ext/config/logrotate /etc/logrotate.d/odoo + +#-------------------------------------------------- +# Install ODOO +#-------------------------------------------------- + +echo -e "\n---- Setting permissions on home folder ----" +sudo chown -R $OE_USER:$OE_USER $OE_HOME/* + +echo -e "Odoo Init File" +sudo ln -s /opt/odoo/exit/config/odoo-server.init /etc/init.d/odoo-server + +echo -e "\n---- Setup Git ----" +sudo -u odoo mkdir /opt/odoo/odoo.git +sudo -u odoo mkdir /opt/odoo/odoo +sudo -u odoo mkdir /opt/odoo/ext.git +sudo -u odoo mkdir /opt/odoo/ext +cd /opt/odoo/odoo.git +sudo -u odoo git init --bare +cd /opt/odoo/ext.git +sudo -u odoo git init --bare + +sudo -u odoo touch /opt/odoo/odoo.git/hooks/post-receive +sudo -u odoo echo -e '#!/bin/bash' >> /opt/odoo/odoo.git/hooks/post-receive +sudo -u odoo echo -e 'git --work-tree=/opt/odoo/odoo --git-dir=/opt/odoo/odoo.git checkout -f' >> /opt/odoo/odoo.git/hooks/post-receive +sudo -u odoo chmod +x /opt/odoo/odoo.git/hooks/post-receive + +sudo -u odoo touch /opt/odoo/ext.git/hooks/post-receive +sudo -u odoo echo -e '#!/bin/bash' >> /opt/odoo/ext.git/hooks/post-receive +sudo -u odoo echo -e 'git --work-tree=/opt/odoo/ext --git-dir=/opt/odoo/ext.git checkout -f' >> /opt/odoo/ext.git/hooks/post-receive +sudo -u odoo chmod +x /opt/odoo/ext.git/hooks/post-receive + +echo "Done! The ODOO server can be started with /etc/init.d/$OE_CONFIG" +echo "Please reboot the server now so that Wkhtmltopdf is working with your install." + +echo "Done! Please specify a password for user '$OE_USER'" +sudo passwd $OE_USER + +## +## HERE git push of local is required +## +## Local commands: +#git init +#git remote add odoo https://github.com/odoo/odoo.git +#git pull odoo 8.0 +#git remote add production odoo@134.119.17.66:/opt/odoo/odoo.git +#git config --global push.default simple # only push if on remote exists branch with same name +#git push --set-upstream production master + +echo -e "* Start ODOO on Startup" +sudo update-rc.d $OE_CONFIG defaults diff --git a/setup/install_nginx.sh b/setup/install_nginx.sh new file mode 100755 index 00000000..599ece6f --- /dev/null +++ b/setup/install_nginx.sh @@ -0,0 +1,34 @@ +#!/bin/bash +################################################################################ +# Script for Installation: Nginx for Odoo v8.0 on Ubuntu 14.04 LTS +# Author: Andreas Brückl | Camdeus Consulting +#------------------------------------------------------------------------------- +# +# This script will install nginx on +# clean Ubuntu 14.04 Server +#------------------------------------------------------------------------------- +################################################################################ + +#--------------------------------------------- +# Install +#-------------------------------------------------- +echo -e "\n---- Install nginx ----" +sudo apt-get install nginx -y + +#-------------------------------------------------- +# Configure Nginx +#-------------------------------------------------- +sudo ln -s /opt/odoo/ext/config/odoo-80.nginx /etc/nginx/sites-enabled/odoo-80 +sudo rm /etc/nginx/sites-enabled/default +sudo service nginx restart + +#-------------------------------------------------- +# Configure Nginx for SSL/HTTPS Port 443 +#-------------------------------------------------- + +#sudo touch /etc/nginx/sites-available/odoo-443 +#sudo ln -s /etc/nginx/sites-available/odoo-443 /etc/nginx/sites-enabled +#sudo mkdir /etc/nginx/ssl +#sudo chmod 600 ssl + +#sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/nginx/ssl/server.key -out /etc/nginx/ssl/server.crt diff --git a/setup/install_odoo.sh b/setup/install_odoo.sh new file mode 100755 index 00000000..6399d7a7 --- /dev/null +++ b/setup/install_odoo.sh @@ -0,0 +1,149 @@ +#!/bin/bash +################################################################################ +# Script for Installation: ODOO Saas4/Trunk server on Ubuntu 14.04 LTS +# Author: André Schenkels, ICTSTUDIO 2014 +#------------------------------------------------------------------------------- +# +# This script will install ODOO Server on +# clean Ubuntu 14.04 Server +#------------------------------------------------------------------------------- +# USAGE: +# +# odoo-install +# +# EXAMPLE: +# ./odoo-install +# +################################################################################ + +##fixed parameters +OE_USER="odoo" +OE_HOME="/opt/$OE_USER" +OE_HOME_EXT="/opt/$OE_USER/$OE_USER-server" + +#Enter version for checkout "7.0" for version 7.0, "saas-4, saas-5 (opendays version) and "master" for trunk +OE_VERSION="8.0" + +#set the superadmin password +OE_SUPERADMIN="PzdX2fYj" +OE_CONFIG="$OE_USER-server" + +#-------------------------------------------------- +# Set Locale en_US.UTF-8 +#-------------------------------------------------- +#echo -e "\n---- Set en_US.UTF-8 Locale ----" +#sudo cp /etc/default/locale /etc/default/locale.BACKUP +#sudo rm -rf /etc/default/locale +#echo -e "* Change server config file" +#sudo su root -c "echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale" +#sudo su root -c "echo 'LANG="en_US.UTF-8"' >> /etc/default/locale" +#sudo su root -c "echo 'LANGUAGE="en_US:en"' >> /etc/default/locale" + +#-------------------------------------------------- +# Update Server +#-------------------------------------------------- +echo -e "\n---- Update Server ----" +sudo apt-get upgrade -y +sudo apt-get update + +#-------------------------------------------------- +# Install PostgreSQL Server +#-------------------------------------------------- +echo -e "\n---- Install PostgreSQL Server ----" +sudo apt-get install postgresql -y + +#echo -e "\n---- PostgreSQL $PG_VERSION Settings ----" +#sudo sed -i s/"#listen_addresses = 'localhost'"/"listen_addresses = '*'"/g /etc/postgresql/9.3/main/postgresql.conf + +echo -e "\n---- Creating the ODOO PostgreSQL User ----" +sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true + +#-------------------------------------------------- +# Install Dependencies +#-------------------------------------------------- +echo -e "\n---- Install tool packages ----" +sudo apt-get install wget git bzr python-pip -y + +echo -e "\n---- Install python packages ----" +sudo apt-get install python-gevent python-dateutil python-feedparser python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi python-docutils python-psutil python-mock python-unittest2 python-jinja2 python-pypdf python-pdftools python-setuptools python-pybabel python-imaging python-matplotlib python-reportlab-accel python-openssl python-egenix-mxdatetime python-paramiko antiword python-decorator poppler-utils python-requests python-passlib -y + +sudo pip install gevent gevent_psycopg2 psycogreen passlib psycogreen + +echo -e "\n---- Install latest gdata-python-client ----" +cd /tmp +wget http://gdata-python-client.googlecode.com/files/gdata-2.0.18.tar.gz +tar zxvf gdata-2.0.18.tar.gz +cd gdata-2.0.18/ +sudo python setup.py install + + +echo -e "\n---- Install Wkhtmltopdf 0.12.1 ----" +sudo wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.1/wkhtmltox-0.12.1_linux-wheezy-amd64.deb +sudo dpkg -i wkhtmltox-0.12.1_linux-wheezy-amd64.deb +sudo cp /usr/local/bin/wkhtmltopdf /usr/bin +sudo cp /usr/local/bin/wkhtmltoimage /usr/bin + +echo -e "\n---- Create ODOO system user ----" +sudo adduser --system --quiet --shell /bin/bash --home $OE_HOME --gecos 'ODOO' --group $OE_USER +sudo adduser $OE_USER sudo +sudo cp /root/.profile $OE_HOME +sudo chown $OE_USER:$OE_USER $OE_HOME/.profile +sudo cp /root/.bashrc $OE_HOME +sudo chown $OE_USER:$OE_USER $OE_HOME/.bashrc + +echo -e "\n---- Create Log directory ----" +sudo mkdir /var/log/$OE_USER +sudo chown $OE_USER:$OE_USER /var/log/$OE_USER +sudo chmod 700 /var/log/$OE_USER + +echo -e "\n---- Set Logrotate config ----" +sudo ln -s /opt/odoo/odoo/config/logrotate /etc/logrotate.d/odoo + +#-------------------------------------------------- +# Install ODOO +#-------------------------------------------------- + +echo -e "\n---- Setting permissions on home folder ----" +sudo chown -R $OE_USER:$OE_USER $OE_HOME/* + +echo -e "Odoo Init File" +sudo ln -s /opt/odoo/ext/config/odoo-server.init /etc/init.d/odoo-server + +echo -e "\n---- Setup Git ----" +sudo -u odoo mkdir /opt/odoo/odoo.git +sudo -u odoo mkdir /opt/odoo/odoo +cd /opt/odoo/odoo.git +sudo -u odoo git init --bare +sudo -u odoo touch /opt/odoo/odoo.git/hooks/post-receive +sudo -u odoo echo -e '#!/bin/bash' >> /opt/odoo/odoo.git/hooks/post-receive +sudo -u odoo echo -e 'git --work-tree=/opt/odoo/odoo --git-dir=/opt/odoo/odoo.git checkout -f' >> /opt/odoo/odoo.git/hooks/post-receive +sudo -u odoo chmod +x /opt/odoo/odoo.git/hooks/post-receive + +sudo -u odoo mkdir /opt/odoo/ext.git +sudo -u odoo mkdir /opt/odoo/ext +cd /opt/odoo/ext.git +sudo -u odoo git init --bare +sudo -u odoo touch /opt/odoo/ext.git/hooks/post-receive +sudo -u odoo echo -e '#!/bin/bash' >> /opt/odoo/ext.git/hooks/post-receive +sudo -u odoo echo -e 'git --work-tree=/opt/odoo/ext --git-dir=/opt/odoo/ext.git checkout -f' >> /opt/odoo/ext.git/hooks/post-receive +sudo -u odoo chmod +x /opt/odoo/ext.git/hooks/post-receive + +echo "Done! The ODOO server can be started with /etc/init.d/$OE_CONFIG" +echo "Please reboot the server now so that Wkhtmltopdf is working with your install." + +echo "Done! Please specify a password for user '$OE_USER'" +sudo passwd $OE_USER + +## +## HERE git push of local is required +## +## Local commands: +#git init +#git remote add odoo https://github.com/odoo/odoo.git +#git pull odoo 8.0 +#git remote add production odoo@134.119.17.66:/opt/odoo/odoo.git +#git config --global push.default simple # only push if on remote exists branch with same name +#git push --set-upstream production master + +echo -e "* Start ODOO on Startup" +sudo update-rc.d $OE_CONFIG defaults diff --git a/setup/install_tools.sh b/setup/install_tools.sh new file mode 100755 index 00000000..6b1cc349 --- /dev/null +++ b/setup/install_tools.sh @@ -0,0 +1,28 @@ + +#!/bin/bash +################################################################################ +# Script for Installation: tools for Odoo v8.0 installation +# Author: Andreas Brückl | Camdeus Consulting +#------------------------------------------------------------------------------- +################################################################################ + +##fixed parameters +#openerp +OE_USER="odoo" + +# Execute with user "odoo" + +#--------------------------------------------- +# Setup daily backup +#-------------------------------------------------- +echo -e "\n---- Setup daily backup ----" +sudo mkdir /var/pgdump +sudo chown $OE_USER: /var/pgdump +sudo chmod 700 /var/pgdump + +# Install Cron job +sudo -u $OE_USER crontab -l > /tmp/tmpcron +echo "# Odoo backup daily at 1:30 a.m." >> /tmp/tmpcron +echo "30 01 * * * /opt/odoo/ext/scripts/odoo-backup.sh" >> /tmp/tmpcron +sudo -u $OE_USER crontab /tmp/tmpcron +sudo rm /tmp/tmpcron diff --git a/setup/lib/__init__.py b/setup/lib/__init__.py new file mode 100644 index 00000000..5bea60ea --- /dev/null +++ b/setup/lib/__init__.py @@ -0,0 +1,4 @@ +import cli +import config_at +import environments +import functions \ No newline at end of file diff --git a/setup/lib/cli.py b/setup/lib/cli.py new file mode 100755 index 00000000..12ab6d6a --- /dev/null +++ b/setup/lib/cli.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- + +from functions import CamadeusFunctions +from config_at import Config +from environments import ENVIRONMENTS +import sys, getopt + +def main(): + + def _usage(): + print 'cam.py [create|setup|rollout|update] []' + sys.exit(3) + + argv = sys.argv[1:] + if not len(argv) == 2: + if len(argv) == 3 and argv[1] == 'update': # 'update' requires additional param 'module_name' + pass + else: + _usage() + + cmd = argv[1] + config = Config() + + env = ENVIRONMENTS.get(argv[0],False) + if not env: + _usage() + + instance = CamadeusFunctions(env, config) + + methods = False + + if cmd == 'test': + methods = [ + 'login', + ] + + if cmd == 'create': + methods = [ + 'create_db', + 'login', + 'install_module_sale', + 'setup_accounting', + 'setup_accounting2', + 'set_admin_rights', + ] + + if cmd == 'setup': + methods = [ + 'login', + 'uninstall_chat', + 'install_modules', + 'base_config', + 'sale_config', + 'set_date_format', + 'set_company', + 'set_taxes', + 'set_uom', + 'set_steuerzuordnung', + ] + + if cmd == 'rollout': + methods = [ + 'login', + 'set_dokumentennummern', + ] + + if cmd == 'update': + instance.config.module_name = argv[2] + methods = [ + 'login', + 'update_module', + ] + + + if not methods: + _usage() + + print env + + for method in methods: + res = getattr(instance, method)() + print "%s: %s" % (res and "OK " or "ERROR ", getattr(instance, method).__doc__) + if not res: + return False + + print "\nAbgeschlossen." + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/setup/lib/config_at.py b/setup/lib/config_at.py new file mode 100644 index 00000000..f72892ca --- /dev/null +++ b/setup/lib/config_at.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- + +class Config(): + + def __init__(self): + + self.chart_of_accounts = 'l10n_at' + self.sales_tax = '20% MwSt' + self.purchase_tax = '20% VSt' + self.chart_template_id = 2 # Austrian Chart of Account + + self.company_data = { + 'name': 'Camadeus GmbH', + 'street': 'Kriehubergasse 16', + 'street2': False, + 'city': 'Wien', + 'zip': '1050', + 'phone': '+43 1 78910 96 70', + 'fax': False, + 'email': 'office@camadeus.at', + 'website': 'http://www.camadeus.at', + 'company_registry': '280076b ', + 'country_id': 'at', # "de" für deutschland + 'logo': False, + 'vat': 'ATU 62991855 ', + 'rml_header1': False, + 'vat_check_vies': True, + 'tax_calculation_rounding_method': 'round_globally', + #'rml_header' : './ext/addons/custom_reports/report/page.rml', # Report File + #'logo': './ext/addons/custom_reports/logo.png', + } + + self.valid_taxes = [ + '20% MwSt', + '10% MwSt', + '20% VSt', + '10% VSt', + ] + + # Aktive Steuerzuordnungen + self.valid_fiscal_positions = [ + #'Lieferant EU (ohne Ust-ID)', + #'Lieferant EU Unternehmen (mit USt-ID)', + #'Lieferant Ausland', + #'Kunde EU (ohne USt-ID)', + 'Kunde Ausland', + 'Kunde EU (ohne USt-ID)', + 'Kunde EU Unternehmen (mit USt-ID)', + ] + + # Allgemeine Einstellungen + self.base_config = { + 'module_portal': False, # Kundenportal + } + + # Einstellungen Verkauf + self.sale_config = { + 'group_sale_delivery_address': True, # Verschiedene Adressen für Rechnung und Lieferung + 'group_sale_pricelist': True, # Preislisten verwenden + 'group_discount_per_so_line': True, # Rabatte verwenden + 'group_uom': True, # Verwende Mengeneinheiten + } + + # Einstellungen Einkauf + self.purchase_config = { + 'group_purchase_pricelist': True, # Preislisten verwenden + } + + self.sequences = { + 'sale.order': { + 'number_next_actual': 2000, + 'prefix': 'A-', + 'padding': 5, + }, +# 'picking.out': { +# 'number_next_actual': 2000, +# 'prefix': 'L-', +# 'padding': 5, +# }, +# 'purchase.order': { +# 'number_next_actual': 2000, +# 'prefix': 'PO-', +# 'padding': 5, +# }, +# 'account.invoice': { +# 'number_next_actual': 2000, +# 'prefix': '14-', +# 'padding': 4, +# }, + } + + self.active_uoms = { + 'product.product_uom_unit': 'Stk.', + #'product.product_uom_meter': 'lfm', + #'product.product_uom_litre': 'l', + #'product.product_uom_hour': 'h', + } + + self.modules = [ + 'document', + 'auth_crypt', + 'cam_testenv', + #'cam_max_width', + #'oerp_no_phoning_home', + #'cam_custom', + #'custom_reports', + #'crm', + #'sale', + #'cam_hr_overtime', + #'cam_hr', + ] \ No newline at end of file diff --git a/setup/lib/environments.py b/setup/lib/environments.py new file mode 100644 index 00000000..5e629b70 --- /dev/null +++ b/setup/lib/environments.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +class Environment(): + + def __init__(self, host, port, dbname, username, pwd, admin_pw=False, basic_auth=False): + self.admin_pw = admin_pw + self.dbname = dbname + self.username = username + self.pwd = pwd + self.port = port + self.host = host + self.lang = 'de_DE' + self.basic_auth = basic_auth or ('user', 'pass') # HTTP authentification + + def __str__(self): + return """============================== +Host: %s +User: %s +DB: %s +Port: %s +==============================""" % (self.host, self.username, self.dbname, self.port) + + +ENVIRONMENTS = { + 'br': Environment('http://localhost', '8070', 'test13', 'admin', 'x', 'admin'), + 'br2': Environment('http://localhost', '8000', 'screenplane_1', 'admin', 'x', 'admin'), +} + \ No newline at end of file diff --git a/setup/lib/functions.py b/setup/lib/functions.py new file mode 100755 index 00000000..d029760d --- /dev/null +++ b/setup/lib/functions.py @@ -0,0 +1,321 @@ +# -*- coding: utf-8 -*- + +import xmlrpclib +import base64 +import os +import sys +import datetime +import json +import requests +from config_at import Config +from environments import ENVIRONMENTS + +class CamadeusFunctions(): + + def __init__(self, environment, config): + self.env = environment + self.config = config + + def create_db(self): + """Neue Datenbank erstellen""" + + payload = {'fields': [ {'name': 'super_admin_pwd', 'value': self.env.admin_pw}, + {'name': 'db_name', 'value': self.env.dbname}, + {'name': 'demo_data', 'value': False}, + {'name': 'db_lang', 'value': self.env.lang}, + {'name': 'create_admin_pwd', 'value': self.env.pwd}, + ] + } + payload = {'params': payload} + json_data = json.dumps(payload) + headers = {'content-type': 'application/json'} + r = requests.post('%s:%s/web/database/create' % (self.env.host,self.env.port), data=json_data, headers=headers, auth=self.env.basic_auth) + if r and r.json().get('result',False): + return True + else: + print "Error occured: %s" % r.json().get('error', '????') + return False + + def login(self): + """Login""" + + # Get the uid + sock_common = xmlrpclib.ServerProxy ('%s:%s/xmlrpc/common' % (self.env.host,self.env.port)) + self.uid = sock_common.login(self.env.dbname, self.env.username, self.env.pwd) + if not self.uid: + raise "Authentication Error" + self.sock = xmlrpclib.ServerProxy('%s:%s/xmlrpc/object' % (self.env.host,self.env.port)) + return True + + def _execute(self, *args): + return self.sock.execute(self.env.dbname, self.uid, self.env.pwd, *args) + + def _readAndReturnFile(self, filename, encode = ''): + fi = open (filename, 'r') + content = '' + if encode=='': + content = fi.read() + elif encode=='base64': + content = base64.b64encode(fi.read()) + else: + sys.exit(-1) + fi.close() + return content + + def set_company(self): + """Setze Unternehmensdaten (Allgemein, RML, Logo)""" + + vals = self.config.company_data + dummy,country_id = self._execute('ir.model.data', 'get_object_reference', 'base',vals['country_id']) + + # 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): + vals['logo'] = self._readAndReturnFile(vals['logo'], encode = 'base64') + vals['country_id'] = country_id + c_ids = self._execute('res.company', 'search', [], ) + return self._execute('res.company', 'write', c_ids, vals) + + def set_taxes(self): + """Setze nicht benötigte Steuern auf inaktiv""" + + tax_ids = self._execute('account.tax', 'search', [('description','not in', self.config.valid_taxes)]) + return self._execute('account.tax', 'write', tax_ids, {'active': False}) + + def set_date_format(self): + """Setzen des Datumsformats """ + + lang_ids = self._execute('res.lang', 'search', [('code','=','de_DE')]) + if lang_ids: + vals = { + 'date_format': '%d.%m.%Y', + 'time_format': '%H:%M:%S', + 'grouping': '[3,3]', + 'thousands_sep': '.', + 'decimal_point': ',', + } + self._execute('res.lang', 'write', lang_ids, vals) + else: + return False + + lang_ids = self._execute('res.lang', 'search', [('code','=','en_US')]) + if lang_ids: + vals = { + 'grouping': '[3,3]', + } + self._execute('res.lang', 'write', lang_ids, vals) + else: + return False + + 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): + """Basiskonfiguration für Einkauf laden""" + + if hasattr(self.config, 'purchase_config'): + vals = self._execute('purchase.config.settings', 'default_get', []) + vals.update(self.config.purchase_config) + wizard_id = self._execute('purchase.config.settings', 'create', vals) + return self._execute('purchase.config.settings', 'execute', [wizard_id]) + + def sale_config(self): + """Basiskonfiguration für Verkauf laden""" + + vals = self._execute('sale.config.settings', 'default_get', []) + vals.update(self.config.sale_config) + wizard_id = self._execute('sale.config.settings', 'create', vals) + return self._execute('sale.config.settings', 'execute', [wizard_id]) + + def base_config(self): + """Allgemeine Konfiguration laden""" + + vals = self._execute('base.config.settings', 'default_get', []) + vals.update(self.config.base_config) + wizard_id = self._execute('base.config.settings', 'create', vals) + return self._execute('base.config.settings', 'execute', [wizard_id]) + + def install_module_sale(self): + """Modul 'Sale' installieren""" + + 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('base.module.upgrade', 'upgrade_module', modules_to_install) + return True + + def install_modules(self): + """Module installieren""" + + 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('base.module.upgrade', 'upgrade_module', modules_to_install) + return True + + def set_dokumentennummern(self): + """Dokumentennummern setzen""" + + seq_dict = self.config.sequences + + # Lieferschein + if seq_dict.get('picking.out',False): + picking_type_ids = self._execute('stock.picking.type', 'search', []) + picking_types = self._execute('stock.picking.type', 'read', picking_type_ids, ['sequence_id']) + s_ids = [t['sequence_id'][0] for t in picking_types] + if not self._execute('ir.sequence', 'write', s_ids, seq_dict.get('picking.out')): + return False + + # Angebot + if seq_dict.get('sale.order',False): + s_ids = self._execute('ir.sequence', 'search', [('code','=','sale.order')]) + if len(s_ids) != 1: + return False + if not self._execute('ir.sequence', 'write', s_ids, seq_dict.get('sale.order')): + return False + + # EK-Angebot + if seq_dict.get('purchase.order',False): + s_ids = self._execute('ir.sequence', 'search', [('code','=','purchase.order')]) + if len(s_ids) != 1: + return False + if not self._execute('ir.sequence', 'write', s_ids, seq_dict.get('purchase.order')): + return False + + # Rechnungsnummer + if seq_dict.get('account.invoice',False): + j_ids = self._execute('account.journal', 'search', [('code','=','VK')]) + if len(j_ids) != 1: + return False + journals = self._execute('account.journal', 'read', j_ids, ['sequence_id']) + s_ids = [t['sequence_id'][0] for t in journals] + if not self._execute('ir.sequence', 'write', s_ids, seq_dict.get('account.invoicer')): + return False + + return True + + def set_admin_rights(self): + """Setze Administrator Rechte""" + + dummy,user_id = self._execute('ir.model.data', 'get_object_reference', 'base', 'user_root') + groups = [] + + # Technische Eigenschaften + dummy,group_id = self._execute('ir.model.data', 'get_object_reference', 'base', 'group_no_one') + groups.append((4,group_id)) + + # Finanzmanager + dummy,group_id = self._execute('ir.model.data', 'get_object_reference', 'account', 'group_account_manager') + groups.append((4,group_id)) + + vals = { + 'groups_id': groups, + } + + return self._execute('res.users', 'write', [user_id], vals) + + def setup_accounting(self): + """Konfiguration Buchhaltung""" + + vals = self._execute('account.installer', 'default_get', []) + vals['charts'] = self.config.chart_of_accounts + wizard_id = self._execute('account.installer', 'create', vals) + res = self._execute('account.installer', 'action_next', [wizard_id]) + return True + + def setup_accounting2(self): + """Konfiguration Kontenplan""" + + c = self.config + sales_tax_ids = self._execute('account.tax.template', 'search', [('description','=', c.sales_tax),('parent_id','=',False)]) + if not sales_tax_ids: + return False + purchase_tax_ids = self._execute('account.tax.template', 'search', [('description','=', c.purchase_tax),('parent_id','=',False)]) + if not purchase_tax_ids: + return False + + #Set Your Accounting Options + dummy,currency_id = self._execute('ir.model.data', 'get_object_reference', 'base', 'EUR') + vals = {} + vals['chart_template_id'] = c.chart_template_id + vals['sale_tax'] = sales_tax_ids[0] + vals['purchase_tax'] = purchase_tax_ids[0] + vals['company_id'] = 1 # Default + vals['currency_id'] = currency_id + wizard_id = self._execute('wizard.multi.charts.accounts', 'create', vals) + res = self._execute('wizard.multi.charts.accounts', 'action_next', [wizard_id]) + return True + + def uninstall_chat(self): + """ Chat-Modul deinstallieren """ + + modules = ['im_chat','im_odoo_support','bus'] + 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('base.module.upgrade', 'upgrade_module', modules_to_install) + return True + + def set_uom(self): + """ Mengeneinheiten setzen""" + + context = {'lang': 'de_DE'} + c = self.config + active_uoms = c.active_uoms.keys() + + active_ids = [] + for uom_xml_id in active_uoms: + uom_id = self._execute('ir.model.data', 'xmlid_to_res_id', uom_xml_id) + active_ids.append(uom_id) + + # Set all other UOMs to inactive + inactive_ids = self._execute('product.uom', 'search', [('id','not in',active_ids)]) + res = self._execute('product.uom', 'write', inactive_ids, {'active': False}) + if not res: + return False + + # Update names + for uom_xml_id,name in c.active_uoms.items(): + uom_id = self._execute('ir.model.data', 'xmlid_to_res_id', uom_xml_id) + res = self._execute('product.uom', 'write', [uom_id], {'name': name}, context) + if not res: + return False + return True + + def set_steuerzuordnung(self): + """Steuerzuordnungen setzen""" + + c = self.config + + # Ungültige Steuerzuordnungen auf inaktiv setzen + 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}) + + # 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_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)]) + vals = {'tax_dest_id': False} + return self._execute('account.fiscal.position.tax', 'write', position_tax_line_ids, vals) + + def update_module(self): + """Aktualisiere Modul""" + module_name = self.config.module_name + mod_ids = self._execute('ir.module.module', 'search', [('name','=',module_name),('state','=','installed')]) + if not len(mod_ids) == 1: + raise "Module '%s' not found or ist not installed." % module_name + + res = self._execute('ir.module.module', 'button_upgrade', mod_ids) + res = self._execute('base.module.upgrade', 'upgrade_module', mod_ids) + return True + \ No newline at end of file