From c7b1faa458277c516464304cc8ab9024f424bf42 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Mon, 11 Jun 2018 15:24:57 +0200 Subject: [PATCH 1/7] [FIX] web_calendar: color of sidebar filter Before this rev., if you went to Sales > Sales order, switched to calendar view, edited the arch such that 'color="state"' is replaced by 'color="invoice_status"' on the root node, it crashed. The reason of the crash is that a possible value of the 'invoice_status' selection field is 'to invoice' (it contains a whitespace), and the JQuery selector didn't wrap the value by quotes. OPW~1856305 --- addons/web_calendar/static/src/js/widgets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_calendar/static/src/js/widgets.js b/addons/web_calendar/static/src/js/widgets.js index 39324d3caf0..23a63415d54 100644 --- a/addons/web_calendar/static/src/js/widgets.js +++ b/addons/web_calendar/static/src/js/widgets.js @@ -214,7 +214,7 @@ var SidebarFilter = Widget.extend({ var self = this; _.forEach(self.view.all_filters, function(o) { if (_.contains(self.view.now_filter_ids, o.value)) { - self.$('div.o_calendar_responsible input[value=' + o.value + ']').prop('checked',o.is_checked); + self.$('div.o_calendar_responsible input[value="' + o.value + '"]').prop('checked',o.is_checked); } }); }, From a8dd1de5c466b64351d54536ac0529d2a744cf4d Mon Sep 17 00:00:00 2001 From: Antonio Espinosa Date: Fri, 28 Oct 2016 09:20:08 +0200 Subject: [PATCH 2/7] [IMP] doc: add i18n section to command line reference Closes #14042 --- doc/reference/cmdline.rst | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/doc/reference/cmdline.rst b/doc/reference/cmdline.rst index 0e9094a898f..20f3d582944 100644 --- a/doc/reference/cmdline.rst +++ b/doc/reference/cmdline.rst @@ -156,6 +156,45 @@ database when creating new databases from the database-management screens, use the specified `template database`_. Defaults to ``template1``. +.. _reference/cmdline/server/internationalisation: + +Internationalisation +-------------------- + +Use these options to translate Odoo to another language. See i18n section of +the user manual. Option '-d' is mandatory. Option '-l' is mandatory in case +of importation + +.. option:: --load-language + + specifies the languages (separated by commas) for the translations you + want to be loaded + +.. option:: -l, --language + + specify the language of the translation file. Use it with --i18n-export + or --i18n-import + +.. option:: --i18n-export + + export all sentences to be translated to a CSV file, a PO file or a TGZ + archive and exit. + +.. option:: --i18n-import + + import a CSV or a PO file with translations and exit. The '-l' option is + required. + +.. option:: --i18n-overwrite + + overwrites existing translation terms on updating a module or importing + a CSV or a PO file. + +.. option:: --modules + + specify modules to export. Use in combination with --i18n-export + + built-in HTTP ------------- From c4ddf55880b7aa83580aa8ab312ba71f093a7587 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 11 Jun 2018 15:26:16 +0200 Subject: [PATCH 3/7] [FIX] web_editor: link don't duplicate child text If we applied a link eg. on: ``` hello world ``` The system actually gets the "label": hello worldworld because there is 3 nodes: text node: hello element node: `world` text node: world Also since "hello worldworld" is different than "hello world", instead of just keeping existing nodes and adding the link, the system would replace the selected range by: `hello worldworld' instead of: `hello world` This commit ignores element nodes when creating a new link, since when getting the label of the link from the selection, only the text nodes insides the element nodes have any interest. There was a second issue because if we had: ``` world! ``` and tried to put a link over "world!", the code would decide: "world" is inside a link so we will just update that link. Thus we would get: ``` world!! ``` instead of: ``` world! ``` opw-1848351 closes #25187 --- .../web_editor/static/lib/summernote/src/js/module/Editor.js | 4 ++-- addons/web_editor/static/src/js/widgets.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/web_editor/static/lib/summernote/src/js/module/Editor.js b/addons/web_editor/static/lib/summernote/src/js/module/Editor.js index a30ee9c18c8..3ae8f60db7d 100644 --- a/addons/web_editor/static/lib/summernote/src/js/module/Editor.js +++ b/addons/web_editor/static/lib/summernote/src/js/module/Editor.js @@ -629,9 +629,9 @@ define([ } var anchors = []; - // ODOO: adding this branch to modify existing anchor + // ODOO: adding this branch to modify existing anchor if it fully contains the range var ancestor_anchor = dom.ancestor(rng.sc, dom.isAnchor); - if(ancestor_anchor) { + if(ancestor_anchor && ancestor_anchor === dom.ancestor(rng.ec, dom.isAnchor)) { anchors.push($(ancestor_anchor).html(linkText).get(0)); } else if (isTextChanged) { // Create a new link when text changed. diff --git a/addons/web_editor/static/src/js/widgets.js b/addons/web_editor/static/src/js/widgets.js index f23e196997a..b7e21996e45 100644 --- a/addons/web_editor/static/src/js/widgets.js +++ b/addons/web_editor/static/src/js/widgets.js @@ -1025,6 +1025,8 @@ var LinkDialog = Dialog.extend({ if (dom.ancestor(nodes[i], dom.isImg)) { this.data.images.push(dom.ancestor(nodes[i], dom.isImg)); text += '[IMG]'; + } else if (!is_link && nodes[i].nodeType === 1) { + // just use text nodes from listBetween } else if (!is_link && i===0) { text += nodes[i].textContent.slice(so, Infinity); } else if (!is_link && i===nodes.length-1) { From 50418c481182cb414792da32f2a0529503e59f9c Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 13 Jun 2018 17:04:34 +0200 Subject: [PATCH 4/7] [FIX] web_editor: properly save media dialog without any image When saving the media dialog without any selected image, a crash occurred. Now, it properly closes the dialog. opw-1858614 --- addons/web_editor/static/src/js/widgets.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/web_editor/static/src/js/widgets.js b/addons/web_editor/static/src/js/widgets.js index b7e21996e45..675c5c60598 100644 --- a/addons/web_editor/static/src/js/widgets.js +++ b/addons/web_editor/static/src/js/widgets.js @@ -326,8 +326,7 @@ var ImageDialog = Widget.extend({ var img = this.images[0]; if (!img) { - var id = this.$(".existing-attachments [data-src]:first").data('id'); - img = _.find(this.images, function (img) { return img.id === id;}); + return this.media; } if (!img.is_document) { From c13d67dd25b63693c7a90012ce9eba59f12dc813 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 14 Jun 2018 15:42:59 +0200 Subject: [PATCH 5/7] [FIX] website: valid time zone guessed from GeoIP The timezone returned by GeoIP may be unknown by `pytz` due to incompatibilities between GeoIP and pytz databases (which may be outdated). --- addons/website/models/ir_http.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py index 70cb480c86d..a25c8c9c263 100644 --- a/addons/website/models/ir_http.py +++ b/addons/website/models/ir_http.py @@ -5,6 +5,7 @@ import re import time import traceback +import pytz import werkzeug import werkzeug.routing import werkzeug.utils @@ -159,6 +160,11 @@ class ir_http(orm.AbstractModel): request.context['edit_translations'] = False if not request.context.get('tz'): request.context['tz'] = request.session.get('geoip', {}).get('time_zone') + try: + pytz.timezone(request.context['tz'] or '') + except pytz.UnknownTimeZoneError: + request.context.pop('tz') + # bind modified context request.website = request.website.with_context(request.context) From 5233dbdb54ac03e52b991be0d0495b8a0a95b8c8 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 13 Jun 2018 15:22:12 +0200 Subject: [PATCH 6/7] [FIX] core: do not clear cache when removing registry from pool No need to force other workers to reset their cache. --- openerp/modules/registry.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openerp/modules/registry.py b/openerp/modules/registry.py index 35966773ae5..e715f1e234e 100644 --- a/openerp/modules/registry.py +++ b/openerp/modules/registry.py @@ -415,7 +415,6 @@ class RegistryManager(object): """Delete the registry linked to a given database. """ with cls.lock(): if db_name in cls.registries: - cls.registries[db_name].clear_caches() del cls.registries[db_name] @classmethod From 90165e2d96ac27dd1dbb2e367d47b8a38b7aea40 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 13 Jun 2018 15:30:24 +0200 Subject: [PATCH 7/7] [FIX] WorkerCron: keep registry alive after job processing --- openerp/service/server.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openerp/service/server.py b/openerp/service/server.py index af01ea9d54f..faade2985b7 100644 --- a/openerp/service/server.py +++ b/openerp/service/server.py @@ -795,7 +795,6 @@ class WorkerCron(Worker): import openerp.addons.base as base base.ir.ir_cron.ir_cron._acquire_job(db_name) - openerp.modules.registry.RegistryManager.delete(db_name) # dont keep cursors in multi database mode if len(db_names) > 1: