From 682ae668bd87ab041bfd5674954fb256cc599334 Mon Sep 17 00:00:00 2001 From: Ahmed Aly Date: Mon, 20 Nov 2017 16:34:39 +0100 Subject: [PATCH 1/3] dp_changelogs wuth reboot --- .../dp_changelogs/data/cron_job.xml | 1 - .../dp_changelogs/models/dp_changelog.py | 53 +++++++++++++++---- .../views/dp_changelog_views.xml | 2 + 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/ext/custom-addons/dp_changelogs/data/cron_job.xml b/ext/custom-addons/dp_changelogs/data/cron_job.xml index d3d28879..28944756 100644 --- a/ext/custom-addons/dp_changelogs/data/cron_job.xml +++ b/ext/custom-addons/dp_changelogs/data/cron_job.xml @@ -12,5 +12,4 @@ model.cron_get_changelog() - diff --git a/ext/custom-addons/dp_changelogs/models/dp_changelog.py b/ext/custom-addons/dp_changelogs/models/dp_changelog.py index ae3044aa..8e57d52c 100644 --- a/ext/custom-addons/dp_changelogs/models/dp_changelog.py +++ b/ext/custom-addons/dp_changelogs/models/dp_changelog.py @@ -2,6 +2,7 @@ from subprocess import check_output import pytz +import os from odoo import models, fields, api, tools @@ -20,35 +21,65 @@ class ChangeLog(models.Model): tz_name = self.env.context.get('tz') or tools.config.get('timezone') date_string = fields.datetime.now().strftime("%Y-%m-%d %H:%M:%S") date_string = fields.Datetime.to_string( - pytz.timezone('UTC').localize(fields.Datetime.from_string(date_string), is_dst=None).astimezone( + pytz.timezone('UTC').localize(fields.Datetime.from_string(date_string), + is_dst=None).astimezone( pytz.timezone(tz_name))) return 'Changelog ' + date_string[:-3] name = fields.Char('Name', required=True, default=_get_changelog_name) - date = fields.Date('Datum', required=True, default=lambda *a: fields.datetime.now()) + date = fields.Datetime('Timestamp', required=True, default=lambda *a: fields.datetime.now()) commit = fields.Char('Commit') changelogs = fields.Text('Changelogs') + ppid = fields.Char('letzte ppid') @api.model def cron_get_changelog(self): vals = self._get_changelogs_vals() - changelog = self.create(vals) + changelog = False + if vals: + changelog = self.create(vals) return changelog @api.model def _get_changelogs_vals(self): commit = check_output(["git", "log", "--pretty=oneline", "-1"]) - commit1 = self.search([], limit=1) + last_commit = self.search([], limit=1) com2 = commit.decode("utf-8") com2 = com2.split(' ')[0] new_logs = b'' - if commit1: - com1 = commit1.commit + if last_commit: + com1 = last_commit.commit changelogs = check_output(["git", "log", "--pretty=oneline", com1 + "..." + com2]) - new_logs = b'' for changelog in changelogs.splitlines(): new_logs += b' '.join(changelog.split(b' ')[1:]) + b'\n' - return { - 'commit': com2, - 'changelogs': new_logs - } + if new_logs == b'': + vals = {} + else: + vals = { + 'commit': com2, + 'changelogs': new_logs, + 'ppid': last_commit.ppid + } + return vals + + @api.model + def _get_reboot_vals(self): + last_commit = self.search([], limit=1) + if last_commit and last_commit.ppid != str(os.getppid()): + vals = { + 'commit': last_commit.commit, + 'changelogs': 'Reboot', + 'ppid': str(os.getppid()) + } + return vals + + @api.model_cr + def _register_hook(self): + try: + self.cron_get_changelog() + vals = self._get_reboot_vals() + if vals: + self.create(vals) + except: + # falls git nicht vorhanden ist wird sicher eine Fehler ausgegeben. + pass diff --git a/ext/custom-addons/dp_changelogs/views/dp_changelog_views.xml b/ext/custom-addons/dp_changelogs/views/dp_changelog_views.xml index ab1ef553..d056f46b 100644 --- a/ext/custom-addons/dp_changelogs/views/dp_changelog_views.xml +++ b/ext/custom-addons/dp_changelogs/views/dp_changelog_views.xml @@ -10,6 +10,7 @@ + @@ -27,6 +28,7 @@ + From 2aed9fca45f2e6b1d70538835a44669ea7c5d549 Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Tue, 21 Nov 2017 13:44:07 +0100 Subject: [PATCH 2/3] Setup Windows 7 TZAUSTRIA --- .gitignore | 1 + setup/lib/environments.py | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 10aa3296..86340969 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .settings .idea *.swp +tza36 \ No newline at end of file diff --git a/setup/lib/environments.py b/setup/lib/environments.py index c3596b02..d1b688fe 100644 --- a/setup/lib/environments.py +++ b/setup/lib/environments.py @@ -26,6 +26,7 @@ ENVIRONMENTS = { # Local environments are listed with passwords 'br': Environment('http://localhost', '8080', 'tz-austria_1', 'admin', 'x', 'admin'), 'aa': Environment('http://localhost', '8080', 'tz-austria_1', 'admin', 'x', 'admin'), + 'oa': Environment('http://localhost', '8080', 'tz-austria_1', 'admin', 'x', 'admin'), # Remote environments are always listed without passwords! # Do not store them here, you have to type them anyway! From 1a3d7dd8b8cc0f1cd59cf7ff1b1dabee652c6a87 Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Tue, 21 Nov 2017 13:44:32 +0100 Subject: [PATCH 3/3] Setup Windows 7 TZAUSTRIA --- dev/odoo-server-dev-oa.conf | 17 +++++++++++++++ ext/odoo/requirements_W7.txt | 40 ++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 dev/odoo-server-dev-oa.conf create mode 100644 ext/odoo/requirements_W7.txt diff --git a/dev/odoo-server-dev-oa.conf b/dev/odoo-server-dev-oa.conf new file mode 100644 index 00000000..e632cd15 --- /dev/null +++ b/dev/odoo-server-dev-oa.conf @@ -0,0 +1,17 @@ +[options] + +xmlrpc_port = 8080 +; This is the password that allows database operations: +; admin_passwd = admin +db_host = localhost +db_port = 5432 +db_user = tzaustria +db_password = x + +addons_path = ext/odoo/addons,ext/custom-addons,ext/3rd-party-addons +; For enterprise use the addons path bellow +; addons_path = ext/enterprise-addons,ext/odoo/addons,ext/3rd-party-addons,ext/custom-addons,dmi/run1 +timezone = Europe/Vienna + +#dbfilter_test = ['.*',] +show_debug = 1 diff --git a/ext/odoo/requirements_W7.txt b/ext/odoo/requirements_W7.txt new file mode 100644 index 00000000..afd149f8 --- /dev/null +++ b/ext/odoo/requirements_W7.txt @@ -0,0 +1,40 @@ +Babel==2.3.4 +decorator==4.0.10 +docutils==0.12 +ebaysdk==2.1.5 +feedparser==5.2.1 +gevent>=1.1.2 +greenlet>=0.4.10 +html2text==2016.9.19 +Jinja2==2.8 +lxml>=3.5.0 +Mako==1.0.4 +MarkupSafe==0.23 +mock==2.0.0 +num2words==0.5.4 +ofxparse==0.16 +passlib==1.6.5 +Pillow>=3.4.1 +psutil>=4.3.1 +psycopg2==2.7.1 +pydot==1.2.3 +#pyldap==2.4.28 +pyparsing==2.1.10 +PyPDF2==1.26.0 +pyserial==3.1.1 +python-dateutil==2.5.3 +pytz==2016.7 +pyusb==1.0.0 +PyYAML==3.12 +qrcode==5.3 +reportlab>=3.3.0 +requests==2.11.1 +six==1.10.0 +suds-jurko==0.6 +vatnumber==1.2 +vobject==0.9.3 +Werkzeug==0.11.11 +XlsxWriter==0.9.3 +xlwt==1.3.* +xlrd==1.0.0 +odoorpc==0.6.0 \ No newline at end of file