From c16884364b61cd5bf88790a0818aad52ac1715d1 Mon Sep 17 00:00:00 2001 From: Samus CTO Date: Fri, 8 Aug 2014 11:46:41 +0200 Subject: [PATCH 1/7] [FIX] Calculate date interval using super user time zone When you set the date of a cron the July 1st at midnight, if the user time zone has a positive offset, then the converted UTC date is the June 30th and adding 1 month will end up on July 30th translating to July 31th instead of September 1st. To solve this issue we use the super user time zone for the date calculation. --- openerp/addons/base/ir/ir_cron.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openerp/addons/base/ir/ir_cron.py b/openerp/addons/base/ir/ir_cron.py index 77c9835d9be..cfabd97fb16 100644 --- a/openerp/addons/base/ir/ir_cron.py +++ b/openerp/addons/base/ir/ir_cron.py @@ -24,9 +24,10 @@ import time import psycopg2 from datetime import datetime from dateutil.relativedelta import relativedelta +import pytz import openerp -from openerp import netsvc +from openerp import netsvc, SUPERUSER_ID from openerp.osv import fields, osv from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT from openerp.tools.safe_eval import safe_eval as eval @@ -149,8 +150,8 @@ class ir_cron(osv.osv): must not be committed/rolled back! """ try: - now = datetime.now() - nextcall = datetime.strptime(job['nextcall'], DEFAULT_SERVER_DATETIME_FORMAT) + now = fields.datetime.context_timestamp(job_cr, SUPERUSER_ID, datetime.now()) + nextcall = fields.datetime.context_timestamp(job_cr, SUPERUSER_ID, datetime.strptime(job['nextcall'], DEFAULT_SERVER_DATETIME_FORMAT)) numbercall = job['numbercall'] ok = False @@ -166,7 +167,7 @@ class ir_cron(osv.osv): if not numbercall: addsql = ', active=False' cron_cr.execute("UPDATE ir_cron SET nextcall=%s, numbercall=%s"+addsql+" WHERE id=%s", - (nextcall.strftime(DEFAULT_SERVER_DATETIME_FORMAT), numbercall, job['id'])) + (nextcall.astimezone(pytz.UTC).strftime(DEFAULT_SERVER_DATETIME_FORMAT), numbercall, job['id'])) finally: job_cr.commit() From e4c2da59f8f6f848ad1713c5b039bc251ab63fc9 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Mon, 4 Aug 2014 12:25:59 +0200 Subject: [PATCH 2/7] [FIX] website: use internal route for SEO suggest keyword, old server is down --- addons/website/controllers/main.py | 11 +++++++++++ addons/website/static/src/js/website.seo.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index 4f2a2a3da4a..2ab001317ba 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -3,6 +3,8 @@ import cStringIO import contextlib import hashlib import json +import xml.etree.ElementTree as ET + import logging import os import datetime @@ -13,6 +15,7 @@ import psycopg2 import werkzeug import werkzeug.exceptions import werkzeug.utils +import urllib2 import werkzeug.wrappers from PIL import Image @@ -301,6 +304,14 @@ class Website(openerp.addons.web.controllers.main.Home): obj = _object.browse(request.cr, request.uid, _id) return bool(obj.website_published) + @http.route(['/website/seo_suggest/'], type='http', auth="public", website=True) + def seo_suggest(self, keywords): + url = "http://google.com/complete/search?ie=utf8&oe=utf8&output=toolbar&q=" + req = urllib2.Request("%s?%s" % (url, keywords)) + request = urllib2.urlopen(req) + xmlroot = ET.fromstring(request.read()) + return json.dumps([sugg[0].attrib['data'] for sugg in xmlroot if len(sugg) and sugg[0].attrib['data']]) + #------------------------------------------------------ # Helpers #------------------------------------------------------ diff --git a/addons/website/static/src/js/website.seo.js b/addons/website/static/src/js/website.seo.js index 8588b7a3765..4a285409bdf 100644 --- a/addons/website/static/src/js/website.seo.js +++ b/addons/website/static/src/js/website.seo.js @@ -95,7 +95,7 @@ } }); } - $.getJSON("http://suggest.hp.af.cm/suggest/"+encodeURIComponent(this.root + " "), addSuggestions); + $.getJSON("/website/seo_suggest/" + encodeURIComponent(this.root + " "), addSuggestions); }, }); From c7fb787c70973c009d2902ea0468b32487a00a3c Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 11 Aug 2014 10:32:08 +0200 Subject: [PATCH 3/7] [FIX] website: seo, url encode params, + handle connection breaks --- addons/website/controllers/main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index 2ab001317ba..97962d41bf9 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -306,9 +306,13 @@ class Website(openerp.addons.web.controllers.main.Home): @http.route(['/website/seo_suggest/'], type='http', auth="public", website=True) def seo_suggest(self, keywords): - url = "http://google.com/complete/search?ie=utf8&oe=utf8&output=toolbar&q=" - req = urllib2.Request("%s?%s" % (url, keywords)) - request = urllib2.urlopen(req) + url = "http://google.com/complete/search" + try: + req = urllib2.Request("%s?%s" % (url, werkzeug.url_encode({ + 'ie': 'utf8', 'oe': 'utf8', 'output': 'toolbar', 'q': keywords}))) + request = urllib2.urlopen(req) + except (urllib2.HTTPError, urllib2.URLError): + return [] xmlroot = ET.fromstring(request.read()) return json.dumps([sugg[0].attrib['data'] for sugg in xmlroot if len(sugg) and sugg[0].attrib['data']]) From 2da233d89d69b7afaff0da7baaa197f4b30ba84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Maes?= Date: Mon, 11 Aug 2014 11:00:31 +0200 Subject: [PATCH 4/7] [FIX] web_kanban : resequence column and content by drag and dropping --- addons/web_kanban/static/src/js/kanban.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index b7cc68fbb82..91bbf9ceeed 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -387,8 +387,8 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ stop: function(event, ui) { var stop_index = ui.item.index(); if (start_index !== stop_index) { - var $start_column = $('.oe_kanban_groups_records .oe_kanban_column').eq(start_index); - var $stop_column = $('.oe_kanban_groups_records .oe_kanban_column').eq(stop_index); + var $start_column = self.$('.oe_kanban_groups_records .oe_kanban_column').eq(start_index); + var $stop_column = self.$('.oe_kanban_groups_records .oe_kanban_column').eq(stop_index); var method = (start_index > stop_index) ? 'insertBefore' : 'insertAfter'; $start_column[method]($stop_column); var tmp_group = self.groups.splice(start_index, 1)[0]; @@ -1029,7 +1029,7 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({ */ instance.web_kanban.QuickCreate = instance.web.Widget.extend({ template: 'KanbanView.quick_create', - + /** * close_btn: If true, the widget will display a "Close" button able to trigger * a "close" event. From 2b0487113aa4218655b039289b0657c4723ded3f Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 11 Aug 2014 11:11:36 +0200 Subject: [PATCH 5/7] [FIX] yaml tests: Set on_change keys not in view logger as debug instead of warning This is related to commit d31faceb67fd87acaca00365dcfc28925b08a37f (This is to avoid the runbot being yellow if on_change methods have extra keys in the returned value, this is not wrong, the web client will simply ignore them). --- openerp/tools/yaml_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/tools/yaml_import.py b/openerp/tools/yaml_import.py index 8f98573c413..b065294f7d7 100644 --- a/openerp/tools/yaml_import.py +++ b/openerp/tools/yaml_import.py @@ -452,7 +452,7 @@ class YamlInterpreter(object): if key in fg: record_dict[key] = process_val(key, val) else: - _logger.warning("The returning field '%s' from your on_change call '%s'" + _logger.debug("The returning field '%s' from your on_change call '%s'" " does not exist either on the object '%s', either in" " the view '%s'", key, match.group(1), model._name, view_info['name']) From 576e3c776a74d6b807d60a612c643cbddcee97b3 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Fri, 8 Aug 2014 14:09:44 +0200 Subject: [PATCH 6/7] [FIX] css: add display table rule to oe_popup_form class To correct the display of the "add contact" wizard in modal (buttons not well placed) --- addons/web/static/src/css/base.css | 8 ++++---- addons/web/static/src/css/base.sass | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 9fb53aab8e9..6831c419010 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -8,7 +8,6 @@ font-weight: normal; font-style: normal; } - @font-face { font-family: "EntypoRegular"; src: url("/web/static/src/font/entypo-webfont.eot") format("eot"); @@ -19,7 +18,6 @@ font-weight: normal; font-style: normal; } - .openerp { padding: 0; margin: 0; @@ -809,7 +807,7 @@ background-image: -moz-linear-gradient(top, #fc8787, maroon); background-image: -ms-linear-gradient(top, #fc8787, maroon); background-image: -o-linear-gradient(top, #fc8787, maroon); - background-image: linear-gradient(to bottom, #fc8787, #800000); + background-image: linear-gradient(to bottom, #fc8787, maroon); } .openerp .navbar .oe_topbar_anonymous_login a { display: block; @@ -1353,6 +1351,9 @@ .openerp .oe_view_manager_inline > .oe_view_manager_header, .openerp .oe_view_manager_inlineview > .oe_view_manager_header { display: none; } +.openerp .oe_popup_form { + display: table; +} .openerp .oe_popup_form .oe_formview .oe_form_pager { display: none !important; } @@ -3074,7 +3075,6 @@ top: 0px; } } - .kitten-mode-activated { background-size: cover; background-attachment: fixed; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 6c1ba2d80ef..fedefd2b58a 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1134,6 +1134,7 @@ $sheet-padding: 16px // }}} // FormPopup {{{ .oe_popup_form + display: table .oe_formview .oe_form_pager display: none !important // Customize label weight for popup wizard appear from another wizard according bootstrap3 From 3632949cffb24180832e18a3f19a6d02bd8e8729 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 11 Aug 2014 14:39:50 +0200 Subject: [PATCH 7/7] [FIX] web: image fields re-render on next/previous By default, on binary images read, the server returns the binary size This is possible that two images have the exact same size Therefore we trigger the change in case the image value hasn't changed So the image is re-rendered correctly --- addons/web/static/src/js/view_form.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index e91955e0a4e..08050c7d686 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -5194,6 +5194,20 @@ instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({ this._super.apply(this, arguments); this.render_value(); this.set_filename(''); + }, + set_value: function(value_){ + var changed = value_ !== this.get_value(); + this._super.apply(this, arguments); + // By default, on binary images read, the server returns the binary size + // This is possible that two images have the exact same size + // Therefore we trigger the change in case the image value hasn't changed + // So the image is re-rendered correctly + if (!changed){ + this.trigger("change:value", this, { + oldValue: value_, + newValue: value_ + }); + } } });