[IMP] *: replace some odoo classes by native ones
This commit replaces some odoo classes by native ones. They are simple classes with no big extensions or not at all. task 3439226 closes odoo/odoo#137116 Related: odoo/enterprise#48154 Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import Class from "@web/legacy/js/core/class";
|
||||
class EventAdditionalTourSteps {
|
||||
|
||||
var EventAdditionalTourSteps = Class.extend({
|
||||
|
||||
_get_website_event_steps: function () {
|
||||
_get_website_event_steps() {
|
||||
return [false];
|
||||
},
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
export default EventAdditionalTourSteps;
|
||||
|
||||
@@ -1,30 +1,29 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import Class from "@web/legacy/js/core/class";
|
||||
import { session } from "@web/session";
|
||||
import { loadJS } from "@web/core/assets";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
|
||||
export const ReCaptcha = Class.extend({
|
||||
export class ReCaptcha {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
init: function () {
|
||||
constructor() {
|
||||
this._publicKey = session.recaptcha_public_key;
|
||||
},
|
||||
}
|
||||
/**
|
||||
* Loads the recaptcha libraries.
|
||||
*
|
||||
* @returns {Promise|boolean} promise if libs are loading else false if the reCaptcha key is empty.
|
||||
*/
|
||||
loadLibs: function () {
|
||||
loadLibs() {
|
||||
if (this._publicKey) {
|
||||
this._recaptchaReady = 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'));
|
||||
}
|
||||
return false;
|
||||
},
|
||||
}
|
||||
/**
|
||||
* Returns an object with the token if reCaptcha call succeeds
|
||||
* If no key is set an object with a message is returned
|
||||
@@ -33,7 +32,7 @@ export const ReCaptcha = Class.extend({
|
||||
* @param {string} action
|
||||
* @returns {Promise|Object}
|
||||
*/
|
||||
getToken: async function (action) {
|
||||
async getToken(action) {
|
||||
if (!this._publicKey) {
|
||||
return {
|
||||
message: _t("No recaptcha site key set."),
|
||||
@@ -49,8 +48,8 @@ export const ReCaptcha = Class.extend({
|
||||
error: _t("The recaptcha site key is invalid."),
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
ReCaptcha: ReCaptcha,
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import Class from "@web/legacy/js/core/class";
|
||||
|
||||
var PurchaseAdditionalTourSteps = Class.extend({
|
||||
_get_purchase_stock_steps: function () {
|
||||
class PurchaseAdditionalTourSteps {
|
||||
_get_purchase_stock_steps() {
|
||||
return [
|
||||
{
|
||||
auto: true, // Useless final step to trigger congratulation message
|
||||
trigger: ".o_purchase_order",
|
||||
},
|
||||
];
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default PurchaseAdditionalTourSteps;
|
||||
|
||||
@@ -3,12 +3,9 @@
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
|
||||
import PurchaseAdditionalTourSteps from "@purchase/js/tours/purchase_steps";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
PurchaseAdditionalTourSteps.include({
|
||||
|
||||
init: function() {
|
||||
this._super.apply(this, arguments);
|
||||
},
|
||||
patch(PurchaseAdditionalTourSteps.prototype, {
|
||||
|
||||
_get_purchase_stock_steps: function () {
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import Class from "@web/legacy/js/core/class";
|
||||
import { floatIsZero } from "@web/core/utils/numbers";
|
||||
|
||||
/**
|
||||
@@ -148,8 +147,8 @@ OdooEvent.prototype.is_stopped = function () {
|
||||
* http://backbonejs.org
|
||||
*
|
||||
*/
|
||||
var Events = Class.extend({
|
||||
on : function (events, callback, context) {
|
||||
class Events {
|
||||
on(events, callback, context) {
|
||||
var ev;
|
||||
events = events.split(/\s+/);
|
||||
var calls = this._callbacks || (this._callbacks = {});
|
||||
@@ -161,9 +160,9 @@ var Events = Class.extend({
|
||||
list.tail = tail.next = {};
|
||||
}
|
||||
return this;
|
||||
},
|
||||
}
|
||||
|
||||
off : function (events, callback, context) {
|
||||
off(events, callback, context) {
|
||||
var ev, calls, node;
|
||||
if (!events) {
|
||||
delete this._callbacks;
|
||||
@@ -183,9 +182,9 @@ var Events = Class.extend({
|
||||
}
|
||||
}
|
||||
return this;
|
||||
},
|
||||
}
|
||||
|
||||
callbackList: function () {
|
||||
callbackList() {
|
||||
var lst = [];
|
||||
for (const [eventName, el] of Object.entries(this._callbacks || {})) {
|
||||
var node = el;
|
||||
@@ -194,9 +193,9 @@ var Events = Class.extend({
|
||||
}
|
||||
}
|
||||
return lst;
|
||||
},
|
||||
}
|
||||
|
||||
trigger : function (events) {
|
||||
trigger(events) {
|
||||
var event, node, calls, tail, args, all, rest;
|
||||
if (!(calls = this._callbacks))
|
||||
return this;
|
||||
@@ -227,7 +226,7 @@ var Events = Class.extend({
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Mixin containing an event system. Events are also registered by specifying the target object
|
||||
|
||||
@@ -4,12 +4,9 @@ import { _t } from "@web/core/l10n/translation";
|
||||
import EventAdditionalTourSteps from "@event/js/tours/event_steps";
|
||||
|
||||
import { markup } from "@odoo/owl";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
EventAdditionalTourSteps.include({
|
||||
|
||||
init: function() {
|
||||
this._super.apply(this, arguments);
|
||||
},
|
||||
patch(EventAdditionalTourSteps.prototype, {
|
||||
|
||||
_get_website_event_steps: function () {
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
+9
-11
@@ -1,16 +1,14 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import Class from "@web/legacy/js/core/class";
|
||||
class FinalSteps {
|
||||
|
||||
var FinalSteps = Class.extend({
|
||||
_getSteps() {
|
||||
return [{
|
||||
trigger: 'h3:contains("Booth Registration completed!")',
|
||||
run: function() {},
|
||||
}];
|
||||
}
|
||||
|
||||
_getSteps: function () {
|
||||
return [{
|
||||
trigger: 'h3:contains("Booth Registration completed!")',
|
||||
run: function() {},
|
||||
}];
|
||||
},
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
export default FinalSteps;
|
||||
export default FinalSteps;
|
||||
|
||||
+2
-1
@@ -1,9 +1,10 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import FinalSteps from "@website_event_booth_exhibitor/../tests/tours/website_event_booth_exhibitor_steps";
|
||||
import wsTourUtils from '@website_sale/js/tours/tour_utils';
|
||||
|
||||
FinalSteps.include({
|
||||
patch(FinalSteps.prototype, {
|
||||
|
||||
_getSteps: function () {
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user