From ae175d1574ee61f1b3cd99afad29d67a0795d323 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 1 Dec 2015 17:38:33 +0100 Subject: [PATCH] [FIX] website_blog: change_background doesn't work occasionally Some time new background image, which I set via "Change cover" button don't saved. Because super is called before the jsonRpc and don't wait that the background is saved. --- .../website_blog/static/src/js/website_blog.editor.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/website_blog/static/src/js/website_blog.editor.js b/addons/website_blog/static/src/js/website_blog.editor.js index 3101488ab77..6d23189e1e0 100644 --- a/addons/website_blog/static/src/js/website_blog.editor.js +++ b/addons/website_blog/static/src/js/website_blog.editor.js @@ -30,14 +30,18 @@ $(document).ready(function() { $('body').on('click', '#clear_cover',_.bind(this.clean_bg, self.rte.editor, vHeight)); }, save : function() { - var res = this._super(); + var self = this; + var _super = this._super; if ($('.cover').length) { - openerp.jsonRpc("/blogpost/change_background", 'call', { + return openerp.jsonRpc("/blogpost/change_background", 'call', { 'post_id' : $('#blog_post_name').attr('data-oe-id'), 'image' : $('.cover').css('background-image').replace(/url\(|\)|"|'/g,''), + }).then(function () { + return _super.call(self); }); + } else { + return this._super(); } - return res; }, clean_bg : function(vHeight) { $('.js_fullheight').css({"background-image":'none', 'min-height': vHeight});