From c55c15aef39e9780cf48d2bc967b4e8357f31402 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Fri, 10 Jun 2016 15:26:58 +0200 Subject: [PATCH 01/32] [FIX] packaging: Backport of efe37469 to 8.0 [FIX] packaging: debian: update-python-module is no more The command is not installed by default. It was available in the python-support library which we didn't depend on and now this library is no more in debian jessie/ubuntu xenial. Backported for #13302 --- debian/postinst | 2 -- 1 file changed, 2 deletions(-) diff --git a/debian/postinst b/debian/postinst index 5126df0cf79..5a33cc158df 100644 --- a/debian/postinst +++ b/debian/postinst @@ -24,8 +24,6 @@ case "${1}" in chmod 0750 $ODOO_LOG_DIR # Data dir chown $ODOO_USER:$ODOO_GROUP $ODOO_DATA_DIR - # update-python-modules NOW otherwise invoke-rc.d openerp start will fail - update-python-modules ;; *) ;; From 4733c8727e0a59e1917027feff71382fa573d368 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Thu, 25 Aug 2016 17:11:40 +0200 Subject: [PATCH 02/32] [FIX] base: ir.ui.view: traceback during create from the backend If you create an ir.ui.view from the backend, it'll everytime show a traceback (Keyerror arch). The field we write to in the form view is `arch_base`. Writing in `arch_base` will indirectly write on `arch`. The issue is that the `create` function or ir.ui.view is overriden in order to compute the `type` column. For this to be done, we parse the `arch` content and the type is the string of the root tag. The issue is that we parsed the `arch` field instead of `arch_base`. However, during the creation of the db, convert.py will write to the `arch` field when inserting the views in database. Another thing is that we'll get a traceback if the parse fail for any reasons (an invalid xml string for example). To workaround that, we chose to catch the issue and do nothing with it as the constraint on `ir.ui.view` will detects this issue among others and will raise a proper ValidationError. Lastly, the actual code only clears the `arch_fs` field if we write on `arch`. This patch also clears it when writing on `arch_base`. --- openerp/addons/base/ir/ir_ui_view.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/ir/ir_ui_view.py b/openerp/addons/base/ir/ir_ui_view.py index a25ea329b47..707b81e213e 100644 --- a/openerp/addons/base/ir/ir_ui_view.py +++ b/openerp/addons/base/ir/ir_ui_view.py @@ -15,6 +15,7 @@ import json import werkzeug import HTMLParser from lxml import etree +from lxml.etree import LxmlError import openerp from openerp import tools, api @@ -341,7 +342,13 @@ class view(osv.osv): if values.get('inherit_id'): values['type'] = self.browse(cr, uid, values['inherit_id'], context).type else: - values['type'] = etree.fromstring(values['arch']).tag + + try: + values['type'] = etree.fromstring(values.get('arch') or values.get('arch_base')).tag + except LxmlError: + # don't raise here, the constraint that runs `self._check_xml` will + # do the job properly. + pass if not values.get('name'): values['name'] = "%s %s" % (values.get('model'), values['type']) @@ -360,7 +367,7 @@ class view(osv.osv): # If view is modified we remove the arch_fs information thus activating the arch_db # version. An `init` of the view will restore the arch_fs for the --dev mode - if 'arch' in vals and 'install_mode_data' not in context: + if ('arch' in vals or 'arch_base' in vals) and 'install_mode_data' not in context: vals['arch_fs'] = False # drop the corresponding view customizations (used for dashboards for example), otherwise From 755e1f453350ccf4b5a424a54342f5b675b15c57 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 25 Aug 2016 14:37:40 +0200 Subject: [PATCH 03/32] [FIX] web_tips: fix a memory leak Before this commit, the web_client slows down because callbacks are added many times without ever being removed. --- addons/web_tip/static/src/js/tip.js | 73 +++++++++++++++++------------ 1 file changed, 42 insertions(+), 31 deletions(-) diff --git a/addons/web_tip/static/src/js/tip.js b/addons/web_tip/static/src/js/tip.js index 303bd1c1c68..6a305885660 100644 --- a/addons/web_tip/static/src/js/tip.js +++ b/addons/web_tip/static/src/js/tip.js @@ -40,7 +40,10 @@ var Tips = Class.extend({ on_view: function() { var self = this; - bus.on('DOM_updated', this, function() { + if (this._DOM_updated) { + bus.off('DOM_updated', this, this._DOM_updated); + } + this._DOM_updated = function() { var action_id = self.view.ViewManager.action ? self.view.ViewManager.action.id : null; var model = self.view.fields_view.model; var mode = self.view.fields_view.type; @@ -49,14 +52,17 @@ var Tips = Class.extend({ self.on_form_view(action_id, model); } else if (self.view.hasOwnProperty('editor')) { - self.view.on('view_list_rendered', self, function() { - self.eval_tips(action_id, model, mode); - }); + if (self._view_list_rendered) { + self.view.off('view_list_rendered', self, self._view_list_rendered); + } + self._view_list_rendered = function() { self.eval_tips(action_id, model, mode); }; + self.view.on('view_list_rendered', self, self._view_list_rendered); } else { self.eval_tips(action_id, model, mode); } - }); + }; + bus.on('DOM_updated', this, this._DOM_updated); }, on_form_view: function(action_id, model) { @@ -64,19 +70,26 @@ var Tips = Class.extend({ var type = this.view.datarecord ? this.view.datarecord.type : null if ($('.oe_chatter').length > 0) { - this.view.on('chatter_messages_displayed', this, function() { - self.eval_tips(action_id, model, 'form', type); - }); + if (this._chatter_messages_displayed) { + this.view.off('chatter_messages_displayed', this, this._chatter_messages_displayed); + } + this._chatter_messages_displayed = function() { self.eval_tips(action_id, model, 'form', type); }; + this.view.on('chatter_messages_displayed', this, this._chatter_messages_displayed); } else { this.eval_tips(action_id, model, 'form', type); } - this.view.on('to_edit_mode', this, function() { - self.remove_tips(); - }); - this.view.on('to_view_mode', this, function() { - self.eval_tips(action_id, model, 'form', type); - }); + if (this._to_edit_mode) { + this.view.off('to_edit_mode', this, this._to_edit_mode); + } + this._to_edit_mode = function() { self.remove_tips(); }; + this.view.on('to_edit_mode', this, this._to_edit_mode); + + if (this._to_view_mode) { + this.view.off('to_view_mode', this, this._to_view_mode); + } + this._to_view_mode = function() { self.eval_tips(action_id, model, 'form', type); }; + this.view.on('to_view_mode', this, this._to_view_mode); }, eval_tips: function(action_id, model, mode, type) { @@ -123,11 +136,12 @@ var Tips = Class.extend({ var Tip = Class.extend({ init: function(tip) { + var self = this; this.tip = tip; - this.highlight_selector = tip.highlight_selector; this.end_selector = tip.end_selector ? tip.end_selector : tip.highlight_selector; this.triggers = tip.trigger_selector ? tip.trigger_selector.split(',') : []; + this._resize = function() { self._set_breathing_position(); }; }, do_tip: function() { @@ -171,17 +185,9 @@ var Tip = Class.extend({ }); // resize - bus.on('resize', this, function() { - self._set_breathing_position(); - }); - - bus.on('image_loaded', this, function() { - self._set_breathing_position(); - }); - - bus.on('please_reposition_tip', this, function() { - self._set_breathing_position(); - }); + bus.on('resize', this, this._resize); + bus.on('image_loaded', this, this._resize); + bus.on('please_reposition_tip', this, this._resize); return true; }, @@ -246,6 +252,7 @@ var Tip = Class.extend({ this.$overlay.on('click', function($ev) { self.end_tip(); }); + $(document).on('keyup.web_tip', function($ev) { if ($ev.which === 27) { // esc self.end_tip(); @@ -253,9 +260,8 @@ var Tip = Class.extend({ }); // resize - bus.on('resize', this, function() { - self._set_popover_position(); - }); + this._resize_position = function() { self._set_popover_position(); }; + bus.on('resize', this, this._resize_position); }, scroll_to_tip: function(){ @@ -278,11 +284,16 @@ var Tip = Class.extend({ this.$overlay.remove(); this.$cross.remove(); - _.each($('.oe_tip_fix_parent'), function(el) { - $(el).removeClass('oe_tip_fix_parent'); + $('.oe_tip_fix_parent').each(function() { + $(this).removeClass('oe_tip_fix_parent'); }); $(document).off('keyup.web_tip'); + bus.off('resize', this, this._resize_position); + bus.off('resize', this, this._resize); + bus.off('image_loaded', this, this._resize); + bus.off('please_reposition_tip', this, this._resize); + Tips.call('consume', [this.tip.id], {}); this.tip.is_consumed = true; }, From 2fda62ebd8707f872781da85a223ca7817b43575 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 26 Aug 2016 15:04:17 +0200 Subject: [PATCH 04/32] [FIX] website, website_{*}: Google Maps API Key Partial backport of c82b65c8552a2ddccb9ac9990366c03199ff9d29 opw-686510 --- addons/website/models/website.py | 3 ++ addons/website/views/website_templates.xml | 9 ++++- .../controllers/main.py | 2 ++ .../views/website_crm_partner_assign.xml | 36 ++++++++++--------- addons/website_customer/controllers/main.py | 2 ++ .../views/website_customer.xml | 36 ++++++++++--------- addons/website_event/views/website_event.xml | 9 ++++- addons/website_google_map/controllers/main.py | 4 ++- .../website_google_map/views/google_map.xml | 7 +++- addons/website_membership/controllers/main.py | 2 ++ .../views/website_membership.xml | 36 ++++++++++--------- 11 files changed, 91 insertions(+), 55 deletions(-) diff --git a/addons/website/models/website.py b/addons/website/models/website.py index a1aa25f5d2a..5425550a9ff 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -656,6 +656,9 @@ class res_partner(osv.osv): 'zoom': zoom, 'sensor': 'false', } + google_maps_api_key = self.pool['ir.config_parameter'].get_param(cr, openerp.SUPERUSER_ID, 'google_maps_api_key', context=context) + if google_maps_api_key: + params['key'] = google_maps_api_key return urlplus('//maps.googleapis.com/maps/api/staticmap' , params) def google_map_link(self, cr, uid, ids, zoom=10, context=None): diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index 9e4e8d95999..84b83af4f5e 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -927,7 +927,14 @@ Sitemap: sitemap.xml "fields": ["name", "address", "phone", "mobile", "fax", "email"]}'/> - Visualize on Google Maps + + + + + + + Visualize on Google Maps +