[PATCH] Upstream patch - 28032023

This commit is contained in:
Parthiv Patel
2023-03-28 08:34:32 +00:00
parent e838c8b099
commit 48940b91d2
15 changed files with 25 additions and 25 deletions

View File

@@ -21,7 +21,7 @@ const ReCaptcha = Class.extend({
*/
loadLibs: function () {
if (this._publicKey) {
this._recaptchaReady = ajax.loadJS(`https://www.recaptcha.net/recaptcha/api.js?render=${this._publicKey}`)
this._recaptchaReady = ajax.loadJS(`https://www.recaptcha.net/recaptcha/api.js?render=${encodeURIComponent(this._publicKey)}`)
.then(() => new Promise(resolve => window.grecaptcha.ready(() => resolve())));
return this._recaptchaReady.then(() => !!document.querySelector('.grecaptcha-badge'));
}

View File

@@ -37,8 +37,7 @@ image_re = re.compile(r"data:(image/[A-Za-z]+);base64,(.*)")
class MassMailing(models.Model):
""" MassMailing models a wave of emails for a mass mailign campaign.
A mass mailing is an occurence of sending emails. """
""" Mass Mailing models the sending of emails to a list of recipients for a mass mailing campaign."""
_name = 'mailing.mailing'
_description = 'Mass Mailing'
_inherit = ['mail.thread', 'mail.activity.mixin', 'mail.render.mixin']

View File

@@ -71,7 +71,7 @@
<field name="view_mode">graph,pivot</field>
<field name="view_id"></field> <!-- force empty -->
<field name="search_view_id" ref="view_order_product_search"/>
<field name="context">{'search_default_Sales':1, 'group_by_no_leaf':1,'group_by':[]}</field>
<field name="context">{'search_default_Sales':1, 'group_by_no_leaf':1,'group_by':[], 'search_default_filter_order_date': 1}</field>
<field name="help">This report performs analysis on your quotations and sales orders. Analysis check your sales revenues and sort it by different group criteria (salesman, partner, product, etc.) Use this report to perform analysis on sales not having invoiced yet. If you want to analyse your turnover, you should use the Invoice Analysis report in the Accounting application.</field>
</record>
</flectra>

View File

@@ -16,7 +16,7 @@ class ProductReplenish(models.TransientModel):
product_tmpl_id = fields.Many2one('product.template', string='Product Template', required=True)
product_has_variants = fields.Boolean('Has variants', default=False, required=True)
product_uom_category_id = fields.Many2one('uom.category', related='product_id.uom_id.category_id', readonly=True, required=True)
product_uom_id = fields.Many2one('uom.uom', string='Unity of measure', required=True)
product_uom_id = fields.Many2one('uom.uom', string='Unit of measure', required=True)
quantity = fields.Float('Quantity', default=1, required=True)
date_planned = fields.Datetime('Scheduled Date', required=True, help="Date at which the replenishment should take place.")
warehouse_id = fields.Many2one(

View File

@@ -2628,7 +2628,7 @@ var SnippetsMenu = Widget.extend({
$content: $('<div/>', {text: _.str.sprintf(_t("Do you want to install the %s App?"), name)}).append(
$('<a/>', {
target: '_blank',
href: '/web#id=' + moduleID + '&view_type=form&model=ir.module.module&action=base.open_module_tree',
href: '/web#id=' + encodeURIComponent(moduleID) + '&view_type=form&model=ir.module.module&action=base.open_module_tree',
text: _t("More info about this app."),
class: 'ml4',
})

View File

@@ -421,7 +421,7 @@ var FileWidget = SearchableMediaWidget.extend({
if (img.image_src) {
var src = img.image_src;
if (!img.public && img.access_token) {
src += _.str.sprintf('?access_token=%s', img.access_token);
src += _.str.sprintf('?access_token=%s', encodeURIComponent(img.access_token));
}
if (!this.$media.is('img')) {
@@ -1426,7 +1426,7 @@ var VideoWidget = MediaWidget.extend({
let type;
if (matches.youtube && matches.youtube[2].length === 11) {
const fullscreen = options.hide_fullscreen ? '&fs=0' : '';
const ytLoop = loop ? loop + `&playlist=${matches.youtube[2]}` : '';
const ytLoop = loop ? loop + `&playlist=${encodeURIComponent(matches.youtube[2])}` : '';
const logo = options.hide_yt_logo ? '&modestbranding=1' : '';
// The youtube js api is needed for autoplay on mobile. Note: this
// was added as a fix, old customers may have autoplay videos

View File

@@ -171,7 +171,7 @@ var WebsiteRoot = publicRootData.PublicRoot.extend(KeyboardNavigationMixin, {
this._gmapAPILoading = false;
return;
}
await ajax.loadJS(`https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places&callback=flectra_gmap_api_post_load&key=${key}`);
await ajax.loadJS(`https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places&callback=flectra_gmap_api_post_load&key=${encodeURIComponent(key)}`);
});
}
return this._gmapAPILoading;
@@ -233,7 +233,7 @@ var WebsiteRoot = publicRootData.PublicRoot.extend(KeyboardNavigationMixin, {
var $target = $(ev.currentTarget);
// retrieve the hash before the redirect
var redirect = {
lang: $target.data('url_code'),
lang: encodeURIComponent($target.data('url_code')),
url: encodeURIComponent($target.attr('href').replace(/[&?]edit_translations[^&?]+/, '')),
hash: encodeURIComponent(window.location.hash)
};

View File

@@ -132,7 +132,7 @@ weSnippetEditor.Class.include({
*/
async _validateGMapAPIKey(key) {
try {
const response = await fetch(`https://maps.googleapis.com/maps/api/staticmap?center=belgium&size=10x10&key=${key}`);
const response = await fetch(`https://maps.googleapis.com/maps/api/staticmap?center=belgium&size=10x10&key=${encodeURIComponent(key)}`);
const isValid = (response.status === 200);
return {
isValid: isValid,

View File

@@ -191,7 +191,7 @@ const FontFamilyPickerUserValueWidget = SelectUserValueWidget.extend({
let isValidFamily = false;
try {
const result = await fetch("https://fonts.googleapis.com/css?family=" + m[1]+':300,300i,400,400i,700,700i', {method: 'HEAD'});
const result = await fetch("https://fonts.googleapis.com/css?family=" + encodeURIComponent(m[1]) + ':300,300i,400,400i,700,700i', {method: 'HEAD'});
// Google fonts server returns a 400 status code if family is not valid.
if (result.ok) {
isValidFamily = true;
@@ -1284,7 +1284,7 @@ options.registry.company_data = options.Class.extend({
args: [session.uid, ['company_id']],
});
}).then(function (res) {
proto.__link = '/web#action=base.action_res_company_form&view_type=form&id=' + (res && res[0] && res[0].company_id[0] || 1);
proto.__link = '/web#action=base.action_res_company_form&view_type=form&id=' + encodeURIComponent(res && res[0] && res[0].company_id[0] || 1);
});
}
return Promise.all([this._super.apply(this, arguments), prom]);

View File

@@ -71,16 +71,16 @@ publicWidget.registry.websiteBlog = publicWidget.Widget.extend({
ev.preventDefault();
var url = '';
var $element = $(ev.currentTarget);
var blogPostTitle = encodeURIComponent($('#o_wblog_post_name').html() || '');
var articleURL = encodeURIComponent(window.location.href);
var blogPostTitle = $('#o_wblog_post_name').html() || '';
var articleURL = window.location.href;
if ($element.hasClass('o_twitter')) {
var twitterText = core._t("Amazing blog article: %s! Check it live: %s");
var tweetText = _.string.sprintf(twitterText, blogPostTitle, articleURL);
url = 'https://twitter.com/intent/tweet?tw_p=tweetbutton&text=' + tweetText;
url = 'https://twitter.com/intent/tweet?tw_p=tweetbutton&text=' + encodeURIComponent(tweetText);
} else if ($element.hasClass('o_facebook')) {
url = 'https://www.facebook.com/sharer/sharer.php?u=' + articleURL;
url = 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(articleURL);
} else if ($element.hasClass('o_linkedin')) {
url = 'https://www.linkedin.com/sharing/share-offsite/?url=' + articleURL;
url = 'https://www.linkedin.com/sharing/share-offsite/?url=' + encodeURIComponent(articleURL);
}
window.open(url, '', 'menubar=no, width=500, height=400');
},

View File

@@ -45,7 +45,7 @@ publicWidget.registry.websiteForum = publicWidget.Widget.extend({
// welcome message action button
var forumLogin = _.string.sprintf('%s/web?redirect=%s',
window.location.origin,
escape(window.location.href)
encodeURIComponent(window.location.href)
);
$('.forum_register_url').attr('href', forumLogin);

View File

@@ -69,8 +69,8 @@ var ProductComparison = publicWidget.Widget.extend(VariantMixin, {
$(document.body).on('click.product_comparaison_widget', '.o_comparelist_remove', function (ev) {
self._removeFromComparelist(ev);
self.guard.exec(function() {
var new_link = '/shop/compare/?products=' + self.comparelist_product_ids.toString();
window.location.href = _.isEmpty(self.comparelist_product_ids) ? '/shop' : new_link;
const newLink = '/shop/compare/?products=' + encodeURIComponent(self.comparelist_product_ids);
window.location.href = _.isEmpty(self.comparelist_product_ids) ? '/shop' : newLink;
});
});
@@ -240,7 +240,8 @@ var ProductComparison = publicWidget.Widget.extend(VariantMixin, {
this.$('.o_comparelist_products').addClass('d-md-block');
if (this.comparelist_product_ids.length >=2) {
this.$('.o_comparelist_button').addClass('d-md-block');
this.$('.o_comparelist_button a').attr('href', '/shop/compare/?products='+this.comparelist_product_ids.toString());
this.$('.o_comparelist_button a').attr('href',
'/shop/compare/?products=' + encodeURIComponent(this.comparelist_product_ids));
}
}
},

View File

@@ -123,7 +123,7 @@ var CourseJoinWidget = publicWidget.Widget.extend({
if (signupAllowed) {
message = _t('Please <a href="/web/signup?redirect=%s">create an account</a> to join this course');
}
self._popoverAlert(self.$el, _.str.sprintf(message, (document.URL)));
self._popoverAlert(self.$el, _.str.sprintf(message, encodeURIComponent(document.URL)));
} else if (data.error === 'join_done') {
self._popoverAlert(self.$el, _t('You have already joined this channel'));
} else {

View File

@@ -60,7 +60,7 @@ var SlideLikeWidget = publicWidget.Widget.extend({
if (signupAllowed) {
message = _t('Please <a href="/web/signup?redirect=%s">create an account</a> to vote this lesson');
}
self._popoverAlert(self.$el, _.str.sprintf(message, (document.URL)));
self._popoverAlert(self.$el, _.str.sprintf(message, encodeURIComponent(document.URL)));
} else if (data.error === 'vote_done') {
self._popoverAlert(self.$el, _t('You have already voted for this lesson'));
} else if (data.error === 'slide_access') {

View File

@@ -63,7 +63,7 @@ publicWidget.registry.twitter = publicWidget.Widget.extend({
.replace(
/[#]+[A-Za-z0-9_]+/g,
function (hashtag) {
return _makeLink('http://twitter.com/search?q='+hashtag.replace('#',''), hashtag);
return _makeLink('http://twitter.com/search?q=' + encodeURIComponent(hashtag.replace('#', '')), hashtag);
}
);