From 229c119999467ed770b0813b577d93d649079998 Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Mon, 3 Sep 2018 15:21:26 +0200 Subject: [PATCH 1/4] [FIX] hr_recruitment: limit new hired filter to group In Employees views, selecting New Hired filters leads to an access error with a simple user. With this commit, this filter is limited to the corresponding users group. Backport of 804b9b7c5e56bad5b3461f0d0655f5cabf069583 --- addons/hr_recruitment/views/hr_recruitment_views.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_recruitment/views/hr_recruitment_views.xml b/addons/hr_recruitment/views/hr_recruitment_views.xml index f79de645eb1..553b0434b2f 100644 --- a/addons/hr_recruitment/views/hr_recruitment_views.xml +++ b/addons/hr_recruitment/views/hr_recruitment_views.xml @@ -769,7 +769,7 @@ - + From e673484b35bc2f36aae3c4957925aa0eef4ac0df Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 4 Sep 2018 15:35:04 +0200 Subject: [PATCH 2/4] [FIX] web_editor: image name Add the image name in the website for SEO purpose. This is a backport of: 88a5d9a0000a5ea43afdc00ed 886c07dabb636767b80abb849 152e3f8686ec4f48ba22e5c13 opw-1880472 --- addons/web_editor/static/src/js/widgets.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web_editor/static/src/js/widgets.js b/addons/web_editor/static/src/js/widgets.js index dc347c61690..a3a990a7baf 100644 --- a/addons/web_editor/static/src/js/widgets.js +++ b/addons/web_editor/static/src/js/widgets.js @@ -390,7 +390,7 @@ var ImageDialog = Widget.extend({ $form.find('.well > span').remove(); $form.find('.well > div').show(); _.each(attachments, function (record) { - record.src = record.url || '/web/image/' + record.id; + record.src = record.url || _.str.sprintf('/web/image/%s/%s', record.id, encodeURI(record.name)); // Name is added for SEO purposes record.is_document = !(/gif|jpe|jpg|png/.test(record.mimetype)); }); if (error || !attachments.length) { @@ -447,7 +447,7 @@ var ImageDialog = Widget.extend({ return (r.url || r.id); }); _.each(this.records, function (record) { - record.src = record.url || '/web/image/' + record.id; + record.src = record.url || _.str.sprintf('/web/image/%s/%s', record.id, encodeURI(record.name)); // Name is added for SEO purposes record.is_document = !(/gif|jpe|jpg|png/.test(record.mimetype)); }); this.display_attachments(); From 1d0940d96f3f5de45b38a9ddad9af65087dd04f3 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Tue, 4 Sep 2018 18:15:12 +0200 Subject: [PATCH 3/4] [FIX] base: allow get_template serialization retry When two transactions conflicts (eg. deleting same data, see [1]) Odoo will retry the whole transaction several times hoping for the best. But when rendering template, the error handling would prevent this feature. For example a recurring issue was: - loading quickly two times the /web route - for each recompute the assets => this could lead to 2 concurrents transactions that would delete previous same attachment (ie. DELETE FROM ir_attachment where id=3). With this changeset, when getting a template fails because of a transaction rollback, we let the issue bubble up so our retry system is used. So instead of a "500 Internal Server Error" page and in log: bad query: b'DELETE FROM ir_attachment WHERE id IN (3)' ERROR: could not serialize access due to concurrent update "GET /web HTTP/1.1" 200 - "GET /web HTTP/1.1" 500 - ... big traceback ... load could not load template we would get the requested page without error and: bad query: b'DELETE FROM ir_attachment WHERE id IN (3)' ERROR: could not serialize access due to concurrent update "GET /web HTTP/1.1" 200 - SERIALIZATION_FAILURE, retry 1/5 in 0.8920 sec.. "GET /web HTTP/1.1" 200 - As a side node, the issue was exacerbated in some instances: - when running a database on another server: assets are recomputed - when a module was installed/uninstalled: assets may are recomputed - when updating the source code: assets may be recomputed - when starting server: requests could be stacked waiting for readiness - when using google chrome: the "Use a prediction service to load pages more quickly" option may load a page two times. for example: -> an URL is entered in address bar -> a prediction request to it is started URL -> go to this page (Enter) when that request is not already resolved -> the prediction request is cancelled and a new request is started [1] https://www.postgresql.org/docs/9.6/static/transaction-iso.html#XACT-REPEATABLE-READ note: 10.0 backport of 11.0 #26778 opw-1849167 closes #26785 --- odoo/addons/base/ir/ir_qweb/qweb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/odoo/addons/base/ir/ir_qweb/qweb.py b/odoo/addons/base/ir/ir_qweb/qweb.py index 82a3cb0fadd..759fdea4054 100644 --- a/odoo/addons/base/ir/ir_qweb/qweb.py +++ b/odoo/addons/base/ir/ir_qweb/qweb.py @@ -5,6 +5,7 @@ from lxml import etree, html import re import traceback from itertools import count +from psycopg2.extensions import TransactionRollbackError from textwrap import dedent import werkzeug from werkzeug.utils import escape as _escape @@ -313,7 +314,7 @@ class QWeb(object): values = dict(self.default_values(), **values) try: return compiled(self, append, values, options, log) - except QWebException, e: + except (QWebException, TransactionRollbackError) as e: raise e except Exception, e: path = log['last_path_node'] From 568445a327030d080da4c08c4156a8117628bdd9 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 5 Sep 2018 10:52:16 +0200 Subject: [PATCH 4/4] [FIX] pos_sale: group_by for POS in dashboard Steps to reproduce the bug: -Go to Sales > Dashboard > Point of Sale > Settings -Set nothing as group_by value -Go back to Dashboard Bug: A traceback was raised. opw:1881444 --- addons/pos_sale/models/crm_team.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/pos_sale/models/crm_team.py b/addons/pos_sale/models/crm_team.py index 341e275a791..86b5c5146a8 100644 --- a/addons/pos_sale/models/crm_team.py +++ b/addons/pos_sale/models/crm_team.py @@ -77,7 +77,7 @@ class CrmTeam(models.Model): for data_point in order_data: result.append({'x_value': data_point.get('user_id')[0], 'y_value': data_point.get('price_total')}) - else: + elif self.dashboard_graph_group_pos in ['day', 'week', 'month']: # locale en_GB is used to be able to obtain the datetime from the string returned by read_group # /!\ do not use en_US as it's not ISO-standard and does not match datetime's library order_data = self.env['report.pos.order'].with_context(lang='en_GB').read_group(