From 0159d71ec16de2ce40ac84bb16e35a19c857dcea Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 27 Aug 2019 11:20:07 +0000 Subject: [PATCH 1/3] [FIX] website_blog: encode URL for social sharing Like in other places where we have social sharing buttons, when we pass a URL or title as a parameter it needs to be properly encoded. closes odoo/odoo#36197 Signed-off-by: Quentin Smetz (qsm) --- .../static/src/js/website_blog.js | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/addons/website_blog/static/src/js/website_blog.js b/addons/website_blog/static/src/js/website_blog.js index 7985e0ebecc..d0f93a7a473 100644 --- a/addons/website_blog/static/src/js/website_blog.js +++ b/addons/website_blog/static/src/js/website_blog.js @@ -27,30 +27,33 @@ function animate(event) { function shareArticle(event){ var url = ''; + var articleURL; if ($(this).is('*[class*="_complete"]')) { - var blog_title_complete = $('#blog_post_name').html() || ''; + var blog_title_complete = encodeURIComponent($('#blog_post_name').html() || ''); + articleURL = encodeURIComponent(window.location.href); if ($(this).hasClass('o_twitter_complete')){ - url = 'https://twitter.com/intent/tweet?tw_p=tweetbutton&text=Amazing blog article : '+blog_title_complete+"! Check it live: "+window.location.href; + url = 'https://twitter.com/intent/tweet?tw_p=tweetbutton&text=Amazing blog article : ' + blog_title_complete + "! Check it live: " + articleURL; } else if ($(this).hasClass('o_facebook_complete')){ - url = 'https://www.facebook.com/sharer/sharer.php?u='+window.location.href; + url = 'https://www.facebook.com/sharer/sharer.php?u=' + articleURL; } else if ($(this).hasClass('o_linkedin_complete')){ - url = 'https://www.linkedin.com/shareArticle?mini=true&url='+window.location.href+'&title='+blog_title_complete; + url = 'https://www.linkedin.com/shareArticle?mini=true&url=' + articleURL + '&title=' + blog_title_complete; } else { - url = 'https://plus.google.com/share?url='+window.location.href; + url = 'https://plus.google.com/share?url=' + articleURL; } } else { var blog_post = $(this).parents("[name='blog_post']"); - var blog_post_title = blog_post.find('.o_blog_post_title').html() || ''; + var blog_post_title = encodeURIComponent(blog_post.find('.o_blog_post_title').html() || ''); var blog_article_link = blog_post.find('.o_blog_post_title').parent('a').attr('href'); + articleURL = encodeURIComponent(window.location.host + blog_article_link); if ($(this).hasClass('o_twitter')) { - url = 'https://twitter.com/intent/tweet?tw_p=tweetbutton&text=Amazing blog article : '+blog_post_title+"! "+window.location.host+blog_article_link; + url = 'https://twitter.com/intent/tweet?tw_p=tweetbutton&text=Amazing blog article : ' + blog_post_title + "! " + articleURL; } else if ($(this).hasClass('o_facebook')){ - url = 'https://www.facebook.com/sharer/sharer.php?u='+window.location.host+blog_article_link; + url = 'https://www.facebook.com/sharer/sharer.php?u=' + articleURL; } else if ($(this).hasClass('o_linkedin')){ - url = 'https://www.linkedin.com/shareArticle?mini=true&url='+window.location.host+blog_article_link+'&title='+blog_post_title; + url = 'https://www.linkedin.com/shareArticle?mini=true&url=' + articleURL + '&title=' + blog_post_title; } else if ($(this).hasClass('o_google')){ - url = 'https://plus.google.com/share?url='+window.location.host+blog_article_link; + url = 'https://plus.google.com/share?url=' + articleURL; } } window.open(url, "", "menubar=no, width=500, height=400"); From 923fb7aa05f0e9e0e67440073993ec36bb0f5f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Tue, 3 Sep 2019 10:55:30 +0000 Subject: [PATCH 2/3] [FIX] im_livechat: no duplicated messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, when using website livechat with multiple tabs, it may duplicate messages in the chat window. This happens due to registering messages twice: - once, from `/mail/chat_history` - second, from receiving notification from master tab, via local storage. This commit fixes the issue by not registering messages that have already been registered (i.e. unique ID). opw-2052960 closes odoo/odoo#36370 Signed-off-by: Alexandre Kühn (aku) --- addons/im_livechat/static/src/js/im_livechat.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/im_livechat/static/src/js/im_livechat.js b/addons/im_livechat/static/src/js/im_livechat.js index 7de6629f24e..f357e987e57 100644 --- a/addons/im_livechat/static/src/js/im_livechat.js +++ b/addons/im_livechat/static/src/js/im_livechat.js @@ -232,7 +232,12 @@ var LivechatButton = Widget.extend({ is_note: data.is_note, customer_email_data: [] }; - + var hasAlreadyMessage = _.some(this.messages, function (message) { + return message.id === msg.id; + }); + if (hasAlreadyMessage) { + return; + } // Compute displayed author name or email msg.displayed_author = msg.author_id && msg.author_id[1] || this.options.default_username; From cd1b56b41fb6e5b28d22e33867bea31343475fe8 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 4 Sep 2019 09:58:06 +0000 Subject: [PATCH 3/3] [FIX] account: Wrong amount due when reconciling with refund MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce the bug: - Let's consider the following currency rates: 1.00 for USD and 0.50 for EUR - Create invoice I with the same currency of your company (USD) and amount due = 100$ - Validate I - Create refund R with a diffenrent currency of your company (EUR) and amount due = 1€ - Validate R - Reconcile R with I Bug: The amount due of I was 196$ instead of 98$ PS: The root of this issue was coming from function assign_outstanding_credit that was called when reconciling R with I. This function changes the currency_id and the amount_currency of the account move line. So the function _amount_residual defined on model account.move.line was triggered as the currency_id was changed. In _amount_residual, the residual_amount_currency was computed. Forward-port up to saas-11.3 Closes #36252 opw:2062103 closes odoo/odoo#36412 Signed-off-by: Simon Goffin (sig) --- addons/account/models/account_invoice.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index c22a2beb56b..e545d5d0507 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -114,8 +114,10 @@ class AccountInvoice(models.Model): if line.currency_id == self.currency_id: residual += line.amount_residual_currency if line.currency_id else line.amount_residual else: - from_currency = (line.currency_id and line.currency_id.with_context(date=line.date)) or line.company_id.currency_id.with_context(date=line.date) - residual += from_currency.compute(line.amount_residual, self.currency_id) + if line.currency_id: + residual += line.currency_id.with_context(date=line.date).compute(line.amount_residual_currency, self.currency_id) + else: + residual += line.company_id.currency_id.with_context(date=line.date).compute(line.amount_residual, self.currency_id) self.residual_company_signed = abs(residual_company_signed) * sign self.residual_signed = abs(residual) * sign self.residual = abs(residual)