[REF] *: adapt patches after new patch function
In the commit [1], the patch has been refactored to support the native keyword `super`. The current commit just adapts the codebase to that change. task 3410198 [1]: 19ea1ac08043e22a811630968e44715cc3bfc495 Part-of: odoo/odoo#125716
This commit is contained in:
@@ -32,7 +32,7 @@ QUnit.module("Views", {}, function (hooks) {
|
|||||||
});
|
});
|
||||||
patchWithCleanup(AccountMoveFormRenderer.prototype, {
|
patchWithCleanup(AccountMoveFormRenderer.prototype, {
|
||||||
saveBeforeTabChange() {
|
saveBeforeTabChange() {
|
||||||
this._super();
|
super.saveBeforeTabChange();
|
||||||
assert.step("tab saved");
|
assert.step("tab saved");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ QUnit.module("Fields", (hooks) => {
|
|||||||
patchWithCleanup(FormController.prototype, {
|
patchWithCleanup(FormController.prototype, {
|
||||||
onPagerUpdate() {
|
onPagerUpdate() {
|
||||||
assert.step("update");
|
assert.step("update");
|
||||||
return this._super.apply(this, arguments);
|
return super.onPagerUpdate(...arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export class GS1BarcodeError extends Error {};
|
|||||||
|
|
||||||
export const FNC1_CHAR = String.fromCharCode(29);
|
export const FNC1_CHAR = String.fromCharCode(29);
|
||||||
|
|
||||||
patch(BarcodeParser, "barcodes_gs1_nomenclature.BarcodeParser static", {
|
patch(BarcodeParser, {
|
||||||
barcodeNomenclatureFields: [
|
barcodeNomenclatureFields: [
|
||||||
...BarcodeParser.barcodeNomenclatureFields,
|
...BarcodeParser.barcodeNomenclatureFields,
|
||||||
"is_gs1_nomenclature",
|
"is_gs1_nomenclature",
|
||||||
@@ -21,14 +21,14 @@ patch(BarcodeParser, "barcodes_gs1_nomenclature.BarcodeParser static", {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
patch(BarcodeParser.prototype, "barcodes_gs1_nomenclature.BarcodeParser", {
|
patch(BarcodeParser.prototype, {
|
||||||
/**
|
/**
|
||||||
* Convert YYMMDD GS1 date into a Date object
|
* Convert YYMMDD GS1 date into a Date object
|
||||||
*
|
*
|
||||||
* @param {string} gs1Date YYMMDD string date, length must be 6
|
* @param {string} gs1Date YYMMDD string date, length must be 6
|
||||||
* @returns {Date}
|
* @returns {Date}
|
||||||
*/
|
*/
|
||||||
gs1_date_to_date: function(gs1Date) {
|
gs1_date_to_date(gs1Date) {
|
||||||
// See 7.12 Determination of century in dates:
|
// See 7.12 Determination of century in dates:
|
||||||
// https://www.gs1.org/sites/default/files/docs/barcodes/GS1_General_Specifications.pdfDetermination of century
|
// https://www.gs1.org/sites/default/files/docs/barcodes/GS1_General_Specifications.pdfDetermination of century
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
@@ -58,7 +58,7 @@ patch(BarcodeParser.prototype, "barcodes_gs1_nomenclature.BarcodeParser", {
|
|||||||
* @param {Object} rule Matched Barcode Rule
|
* @param {Object} rule Matched Barcode Rule
|
||||||
* @returns {Object|null}
|
* @returns {Object|null}
|
||||||
*/
|
*/
|
||||||
parse_gs1_rule_pattern: function(match, rule) {
|
parse_gs1_rule_pattern(match, rule) {
|
||||||
const result = {
|
const result = {
|
||||||
rule: Object.assign({}, rule),
|
rule: Object.assign({}, rule),
|
||||||
ai: match[1],
|
ai: match[1],
|
||||||
@@ -103,7 +103,7 @@ patch(BarcodeParser.prototype, "barcodes_gs1_nomenclature.BarcodeParser", {
|
|||||||
* @param {string} barcode
|
* @param {string} barcode
|
||||||
* @returns {Array} Array of object
|
* @returns {Array} Array of object
|
||||||
*/
|
*/
|
||||||
gs1_decompose_extanded: function(barcode) {
|
gs1_decompose_extanded(barcode) {
|
||||||
const results = [];
|
const results = [];
|
||||||
const rules = this.nomenclature.rules.filter(rule => rule.encoding === 'gs1-128');
|
const rules = this.nomenclature.rules.filter(rule => rule.encoding === 'gs1-128');
|
||||||
const separatorReg = FNC1_CHAR + "?";
|
const separatorReg = FNC1_CHAR + "?";
|
||||||
@@ -137,10 +137,10 @@ patch(BarcodeParser.prototype, "barcodes_gs1_nomenclature.BarcodeParser", {
|
|||||||
* @override
|
* @override
|
||||||
* @returns {Object|Array|null} If nomenclature is GS1, returns an array or null
|
* @returns {Object|Array|null} If nomenclature is GS1, returns an array or null
|
||||||
*/
|
*/
|
||||||
parse_barcode: function(barcode){
|
parse_barcode(barcode) {
|
||||||
if (this.nomenclature && this.nomenclature.is_gs1_nomenclature) {
|
if (this.nomenclature && this.nomenclature.is_gs1_nomenclature) {
|
||||||
return this.gs1_decompose_extanded(barcode);
|
return this.gs1_decompose_extanded(barcode);
|
||||||
}
|
}
|
||||||
return this._super(...arguments);
|
return super.parse_barcode(...arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ import { barcodeService } from '@barcodes/barcode_service';
|
|||||||
import { FNC1_CHAR } from "@barcodes_gs1_nomenclature/js/barcode_parser";
|
import { FNC1_CHAR } from "@barcodes_gs1_nomenclature/js/barcode_parser";
|
||||||
|
|
||||||
|
|
||||||
patch(barcodeService, 'barcodes_gs1_nomenclature', {
|
patch(barcodeService, {
|
||||||
// Use the regex given by the session, else use an impossible one
|
// Use the regex given by the session, else use an impossible one
|
||||||
gs1SeparatorRegex: new RegExp(session.gs1_group_separator_encodings || '.^', 'g'),
|
gs1SeparatorRegex: new RegExp(session.gs1_group_separator_encodings || '.^', 'g'),
|
||||||
|
|
||||||
cleanBarcode: function(barcode) {
|
cleanBarcode(barcode) {
|
||||||
barcode = barcode.replace(barcodeService.gs1SeparatorRegex, FNC1_CHAR);
|
barcode = barcode.replace(barcodeService.gs1SeparatorRegex, FNC1_CHAR);
|
||||||
return this._super(barcode);
|
return super.cleanBarcode(barcode);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ QUnit.module("base_automation", {}, function () {
|
|||||||
errorContext,
|
errorContext,
|
||||||
"Received the correct error context"
|
"Received the correct error context"
|
||||||
);
|
);
|
||||||
this._super();
|
super.setup();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1054,7 +1054,7 @@ QUnit.module("Base Import Tests", (hooks) => {
|
|||||||
|
|
||||||
patchWithCleanup(ImportBlockUI.prototype, {
|
patchWithCleanup(ImportBlockUI.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super();
|
super.setup();
|
||||||
if (this.props.message === "Importing") {
|
if (this.props.message === "Importing") {
|
||||||
assert.step("Block UI received the right text");
|
assert.step("Block UI received the right text");
|
||||||
}
|
}
|
||||||
@@ -1063,7 +1063,7 @@ QUnit.module("Base Import Tests", (hooks) => {
|
|||||||
|
|
||||||
patchWithCleanup(ImportDataProgress.prototype, {
|
patchWithCleanup(ImportDataProgress.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super();
|
super.setup();
|
||||||
useEffect(
|
useEffect(
|
||||||
() => {
|
() => {
|
||||||
if (this.props.importProgress.step === 1) {
|
if (this.props.importProgress.step === 1) {
|
||||||
@@ -1146,7 +1146,7 @@ QUnit.module("Base Import Tests", (hooks) => {
|
|||||||
|
|
||||||
patchWithCleanup(ImportBlockUI.prototype, {
|
patchWithCleanup(ImportBlockUI.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super();
|
super.setup();
|
||||||
if (this.props.message === "Testing") {
|
if (this.props.message === "Testing") {
|
||||||
assert.step("Block UI received the right text");
|
assert.step("Block UI received the right text");
|
||||||
}
|
}
|
||||||
@@ -1155,7 +1155,7 @@ QUnit.module("Base Import Tests", (hooks) => {
|
|||||||
|
|
||||||
patchWithCleanup(ImportDataProgress.prototype, {
|
patchWithCleanup(ImportDataProgress.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super();
|
super.setup();
|
||||||
useEffect(
|
useEffect(
|
||||||
() => {
|
() => {
|
||||||
if (this.props.importProgress.step === 1) {
|
if (this.props.importProgress.step === 1) {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ QUnit.module("Bus Assets WatchDog", (hooks) => {
|
|||||||
serviceRegistry.add("multi_tab", multiTabService);
|
serviceRegistry.add("multi_tab", multiTabService);
|
||||||
patchWithCleanup(browser, {
|
patchWithCleanup(browser, {
|
||||||
setTimeout(fn) {
|
setTimeout(fn) {
|
||||||
return this._super(fn, 0);
|
return super.setTimeout(fn, 0);
|
||||||
},
|
},
|
||||||
location: {
|
location: {
|
||||||
reload: () => assert.step("reloadPage"),
|
reload: () => assert.step("reloadPage"),
|
||||||
|
|||||||
@@ -113,8 +113,7 @@ QUnit.module(
|
|||||||
window,
|
window,
|
||||||
{
|
{
|
||||||
setTimeout: (callback) => oldSetTimeout(callback, 0),
|
setTimeout: (callback) => oldSetTimeout(callback, 0),
|
||||||
},
|
}
|
||||||
{ pure: true }
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const pyEnv = await startServer();
|
const pyEnv = await startServer();
|
||||||
@@ -217,7 +216,7 @@ QUnit.module(
|
|||||||
if (eventName === "pagehide") {
|
if (eventName === "pagehide") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._super(eventName, callback);
|
super.addEventListener(eventName, callback);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const secondEnv = await makeTestEnv({ activateMockServer: true });
|
const secondEnv = await makeTestEnv({ activateMockServer: true });
|
||||||
@@ -255,22 +254,22 @@ QUnit.module(
|
|||||||
QUnit.test("two tabs calling addChannel simultaneously", async function (assert) {
|
QUnit.test("two tabs calling addChannel simultaneously", async function (assert) {
|
||||||
assert.expect(5);
|
assert.expect(5);
|
||||||
|
|
||||||
const channelPatch = {
|
const channelPatch = () => ({
|
||||||
addChannel(channel) {
|
addChannel(channel) {
|
||||||
assert.step("Tab " + this.__tabId__ + ": addChannel " + channel);
|
assert.step("Tab " + this.__tabId__ + ": addChannel " + channel);
|
||||||
this._super.apply(this, arguments);
|
super.addChannel(...arguments);
|
||||||
},
|
},
|
||||||
deleteChannel(channel) {
|
deleteChannel(channel) {
|
||||||
assert.step("Tab " + this.__tabId__ + ": deleteChannel " + channel);
|
assert.step("Tab " + this.__tabId__ + ": deleteChannel " + channel);
|
||||||
this._super.apply(this, arguments);
|
super.deleteChannel(...arguments);
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
const firstTabEnv = await makeTestEnv({ activateMockServer: true });
|
const firstTabEnv = await makeTestEnv({ activateMockServer: true });
|
||||||
const secondTabEnv = await makeTestEnv({ activateMockServer: true });
|
const secondTabEnv = await makeTestEnv({ activateMockServer: true });
|
||||||
firstTabEnv.services["bus_service"].__tabId__ = 1;
|
firstTabEnv.services["bus_service"].__tabId__ = 1;
|
||||||
secondTabEnv.services["bus_service"].__tabId__ = 2;
|
secondTabEnv.services["bus_service"].__tabId__ = 2;
|
||||||
patchWithCleanup(firstTabEnv.services["bus_service"], channelPatch);
|
patchWithCleanup(firstTabEnv.services["bus_service"], channelPatch());
|
||||||
patchWithCleanup(secondTabEnv.services["bus_service"], channelPatch);
|
patchWithCleanup(secondTabEnv.services["bus_service"], channelPatch());
|
||||||
firstTabEnv.services["bus_service"].addChannel("alpha");
|
firstTabEnv.services["bus_service"].addChannel("alpha");
|
||||||
secondTabEnv.services["bus_service"].addChannel("alpha");
|
secondTabEnv.services["bus_service"].addChannel("alpha");
|
||||||
firstTabEnv.services["bus_service"].addChannel("beta");
|
firstTabEnv.services["bus_service"].addChannel("beta");
|
||||||
@@ -391,7 +390,7 @@ QUnit.module(
|
|||||||
assert.step(`${action} - ${data["lastNotificationId"]}`);
|
assert.step(`${action} - ${data["lastNotificationId"]}`);
|
||||||
updateLastNotificationDeferred.resolve();
|
updateLastNotificationDeferred.resolve();
|
||||||
}
|
}
|
||||||
return this._super(...arguments);
|
return super._onClientMessage(...arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const env1 = await makeTestEnv();
|
const env1 = await makeTestEnv();
|
||||||
@@ -426,7 +425,7 @@ QUnit.module(
|
|||||||
let connectionOpenedDeferred = makeDeferred();
|
let connectionOpenedDeferred = makeDeferred();
|
||||||
patchWebsocketWorkerWithCleanup({
|
patchWebsocketWorkerWithCleanup({
|
||||||
_initializeConnection(client, data) {
|
_initializeConnection(client, data) {
|
||||||
this._super(client, data);
|
super._initializeConnection(client, data);
|
||||||
connectionInitializedDeferred.resolve();
|
connectionInitializedDeferred.resolve();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -466,7 +465,7 @@ QUnit.module(
|
|||||||
let websocketConnectedDeferred = makeDeferred();
|
let websocketConnectedDeferred = makeDeferred();
|
||||||
patchWebsocketWorkerWithCleanup({
|
patchWebsocketWorkerWithCleanup({
|
||||||
_initializeConnection(client, data) {
|
_initializeConnection(client, data) {
|
||||||
this._super(client, data);
|
super._initializeConnection(client, data);
|
||||||
connectionInitializedDeferred.resolve();
|
connectionInitializedDeferred.resolve();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -503,7 +502,7 @@ QUnit.module(
|
|||||||
patchWithCleanup(busParametersService, {
|
patchWithCleanup(busParametersService, {
|
||||||
start() {
|
start() {
|
||||||
return {
|
return {
|
||||||
...this._super(...arguments),
|
...super.start(...arguments),
|
||||||
serverURL,
|
serverURL,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -517,8 +516,7 @@ QUnit.module(
|
|||||||
websocketCreatedDeferred.resolve();
|
websocketCreatedDeferred.resolve();
|
||||||
return new EventTarget();
|
return new EventTarget();
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
{ pure: true }
|
|
||||||
);
|
);
|
||||||
const env = await makeTestEnv();
|
const env = await makeTestEnv();
|
||||||
env.services["bus_service"].start();
|
env.services["bus_service"].start();
|
||||||
@@ -573,7 +571,7 @@ QUnit.module(
|
|||||||
let openDeferred = makeDeferred();
|
let openDeferred = makeDeferred();
|
||||||
const worker = patchWebsocketWorkerWithCleanup({
|
const worker = patchWebsocketWorkerWithCleanup({
|
||||||
_onWebsocketOpen() {
|
_onWebsocketOpen() {
|
||||||
this._super();
|
super._onWebsocketOpen();
|
||||||
openDeferred.resolve();
|
openDeferred.resolve();
|
||||||
},
|
},
|
||||||
_sendToServer({ event_name }) {
|
_sendToServer({ event_name }) {
|
||||||
@@ -589,14 +587,13 @@ QUnit.module(
|
|||||||
patchWithCleanup(worker.websocket, {
|
patchWithCleanup(worker.websocket, {
|
||||||
close(code = WEBSOCKET_CLOSE_CODES.CLEAN, reason) {
|
close(code = WEBSOCKET_CLOSE_CODES.CLEAN, reason) {
|
||||||
this.readyState = 2;
|
this.readyState = 2;
|
||||||
const _super = this._super;
|
|
||||||
if (code === WEBSOCKET_CLOSE_CODES.CLEAN) {
|
if (code === WEBSOCKET_CLOSE_CODES.CLEAN) {
|
||||||
closeDeferred.then(() => {
|
closeDeferred.then(() => {
|
||||||
// Simulate that the connection could not be closed cleanly.
|
// Simulate that the connection could not be closed cleanly.
|
||||||
_super(WEBSOCKET_CLOSE_CODES.ABNORMAL_CLOSURE, reason);
|
super.close(WEBSOCKET_CLOSE_CODES.ABNORMAL_CLOSURE, reason);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
_super(code, reason);
|
super.close(code, reason);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -659,8 +656,7 @@ QUnit.module(
|
|||||||
assert.step("worker creation");
|
assert.step("worker creation");
|
||||||
return new originalWorker(url, options);
|
return new originalWorker(url, options);
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
{ pure: true }
|
|
||||||
);
|
);
|
||||||
patchWithCleanup(window.console, {
|
patchWithCleanup(window.console, {
|
||||||
warn(message) {
|
warn(message) {
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ import { patchWebsocketWorkerWithCleanup } from "@bus/../tests/helpers/mock_webs
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||||
|
|
||||||
patch(MockServer.prototype, "bus", {
|
patch(MockServer.prototype, {
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
super.init(...arguments);
|
||||||
Object.assign(this, TEST_USER_IDS);
|
Object.assign(this, TEST_USER_IDS);
|
||||||
const self = this;
|
const self = this;
|
||||||
this.websocketWorker = patchWebsocketWorkerWithCleanup({
|
this.websocketWorker = patchWebsocketWorkerWithCleanup({
|
||||||
_sendToServer(message) {
|
_sendToServer(message) {
|
||||||
self._performWebsocketRequest(message);
|
self._performWebsocketRequest(message);
|
||||||
this._super(message);
|
super._sendToServer(message);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
this.notificationsToBeResolved = [];
|
this.notificationsToBeResolved = [];
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||||
|
|
||||||
patch(MockServer.prototype, "bus/models/ir_websocket", {
|
patch(MockServer.prototype, {
|
||||||
/**
|
/**
|
||||||
* Simulates `_update_presence` on `ir.websocket`.
|
* Simulates `_update_presence` on `ir.websocket`.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -69,8 +69,7 @@ export function patchWebsocketWorkerWithCleanup(params = {}) {
|
|||||||
WebSocket: function () {
|
WebSocket: function () {
|
||||||
return new WebSocketMock();
|
return new WebSocketMock();
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
{ pure: true }
|
|
||||||
);
|
);
|
||||||
patchWithCleanup(websocketWorker || WebsocketWorker.prototype, params);
|
patchWithCleanup(websocketWorker || WebsocketWorker.prototype, params);
|
||||||
websocketWorker = websocketWorker || new WebsocketWorker();
|
websocketWorker = websocketWorker || new WebsocketWorker();
|
||||||
@@ -85,8 +84,7 @@ export function patchWebsocketWorkerWithCleanup(params = {}) {
|
|||||||
});
|
});
|
||||||
return sharedWorker;
|
return sharedWorker;
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
{ pure: true }
|
|
||||||
);
|
);
|
||||||
registerCleanup(() => {
|
registerCleanup(() => {
|
||||||
if (websocketWorker) {
|
if (websocketWorker) {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ QUnit.module("bus", function () {
|
|||||||
if (eventName === "pagehide") {
|
if (eventName === "pagehide") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._super(eventName, callback);
|
super.addEventListener(eventName, callback);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const secondTabEnv = await makeTestEnv();
|
const secondTabEnv = await makeTestEnv();
|
||||||
@@ -95,7 +95,7 @@ QUnit.module("bus", function () {
|
|||||||
if (eventName === "pagehide") {
|
if (eventName === "pagehide") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._super(eventName, callback);
|
super.addEventListener(eventName, callback);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const secondTabEnv = await makeTestEnv();
|
const secondTabEnv = await makeTestEnv();
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ QUnit.test("receive and display simple notification as sticky", async (assert) =
|
|||||||
* Sticky notifications are removed after a delay. If the notification is still
|
* Sticky notifications are removed after a delay. If the notification is still
|
||||||
* present when this delay is set to 0 it means it is a sticky one.
|
* present when this delay is set to 0 it means it is a sticky one.
|
||||||
*/
|
*/
|
||||||
return this._super(fn, 0);
|
return super.setTimeout(fn, 0);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await afterNextRender(() => {
|
await afterNextRender(() => {
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import { ActivityListPopoverItem } from "@mail/core/web/activity_list_popover_item";
|
import { ActivityListPopoverItem } from "@mail/core/web/activity_list_popover_item";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(ActivityListPopoverItem.prototype, "calendar", {
|
patch(ActivityListPopoverItem.prototype, {
|
||||||
get hasEditButton() {
|
get hasEditButton() {
|
||||||
return this._super() && !this.props.activity.calendar_event_id;
|
return super.hasEditButton && !this.props.activity.calendar_event_id;
|
||||||
},
|
},
|
||||||
|
|
||||||
async onClickReschedule() {
|
async onClickReschedule() {
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import { patch } from "@web/core/utils/patch";
|
|||||||
import { deserializeDateTime, formatDateTime } from "@web/core/l10n/dates";
|
import { deserializeDateTime, formatDateTime } from "@web/core/l10n/dates";
|
||||||
import { localization } from "@web/core/l10n/localization";
|
import { localization } from "@web/core/l10n/localization";
|
||||||
|
|
||||||
patch(ActivityMenu.prototype, "calendar", {
|
patch(ActivityMenu.prototype, {
|
||||||
async fetchSystrayActivities() {
|
async fetchSystrayActivities() {
|
||||||
await this._super();
|
await super.fetchSystrayActivities();
|
||||||
for (const group of Object.values(this.store.activityGroups)) {
|
for (const group of Object.values(this.store.activityGroups)) {
|
||||||
if (group.type === "meeting") {
|
if (group.type === "meeting") {
|
||||||
for (const meeting of group.meetings) {
|
for (const meeting of group.meetings) {
|
||||||
@@ -31,7 +31,7 @@ patch(ActivityMenu.prototype, "calendar", {
|
|||||||
clearBreadcrumbs: true,
|
clearBreadcrumbs: true,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this._super(...arguments);
|
super.openActivityGroup(...arguments);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import { Activity } from "@mail/core/web/activity";
|
|||||||
import { useService } from "@web/core/utils/hooks";
|
import { useService } from "@web/core/utils/hooks";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(Activity.prototype, "calendar", {
|
patch(Activity.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super();
|
super.setup();
|
||||||
this.orm = useService("orm");
|
this.orm = useService("orm");
|
||||||
},
|
},
|
||||||
async onClickReschedule() {
|
async onClickReschedule() {
|
||||||
@@ -20,7 +20,7 @@ patch(Activity.prototype, "calendar", {
|
|||||||
await this.orm.call("mail.activity", "unlink_w_meeting", [[this.props.data.id]]);
|
await this.orm.call("mail.activity", "unlink_w_meeting", [[this.props.data.id]]);
|
||||||
this.props.onUpdate();
|
this.props.onUpdate();
|
||||||
} else {
|
} else {
|
||||||
this._super();
|
super.unlink();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import { ActivityService } from "@mail/core/web/activity_service";
|
import { ActivityService } from "@mail/core/web/activity_service";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(ActivityService.prototype, "calendar/activity_service", {
|
patch(ActivityService.prototype, {
|
||||||
insert(data) {
|
insert(data) {
|
||||||
const activity = this._super(...arguments);
|
const activity = super.insert(...arguments);
|
||||||
const { calendar_event_id: calendarEventId } = data;
|
const { calendar_event_id: calendarEventId } = data;
|
||||||
if (calendarEventId) {
|
if (calendarEventId) {
|
||||||
activity["calendar_event_id"] = calendarEventId;
|
activity["calendar_event_id"] = calendarEventId;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ QUnit.test("list activity widget: reschedule button in dropdown", async (assert)
|
|||||||
const { openView } = await start({ serverData: { views } });
|
const { openView } = await start({ serverData: { views } });
|
||||||
patchWithCleanup(ListController.prototype, {
|
patchWithCleanup(ListController.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super();
|
super.setup();
|
||||||
const selectRecord = this.props.selectRecord;
|
const selectRecord = this.props.selectRecord;
|
||||||
this.props.selectRecord = (...args) => {
|
this.props.selectRecord = (...args) => {
|
||||||
assert.step(`select_record ${JSON.stringify(args)}`);
|
assert.step(`select_record ${JSON.stringify(args)}`);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ QUnit.module("Calendar Notification", (hooks) => {
|
|||||||
serviceRegistry.add("multi_tab", multiTabService);
|
serviceRegistry.add("multi_tab", multiTabService);
|
||||||
patchWithCleanup(browser, {
|
patchWithCleanup(browser, {
|
||||||
setTimeout(fn) {
|
setTimeout(fn) {
|
||||||
this._super(fn, 0);
|
super.setTimeout(fn, 0);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/** @odoo-module **/
|
/** @odoo-module **/
|
||||||
|
|
||||||
import { patch } from '@web/core/utils/patch';
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { MockServer } from '@web/../tests/helpers/mock_server';
|
import { MockServer } from '@web/../tests/helpers/mock_server';
|
||||||
|
|
||||||
patch(MockServer.prototype, 'calendar/models/calendar_event', {
|
patch(MockServer.prototype, {
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
@@ -12,6 +12,6 @@ patch(MockServer.prototype, 'calendar/models/calendar_event', {
|
|||||||
if (args.model === 'calendar.event' && args.method === 'check_access_rights') {
|
if (args.model === 'calendar.event' && args.method === 'check_access_rights') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return this._super(...arguments);
|
return super._performRPC(...arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
// ensure mail override is applied first.
|
// ensure mail override is applied first.
|
||||||
import '@mail/../tests/helpers/mock_server/models/mail_activity';
|
import '@mail/../tests/helpers/mock_server/models/mail_activity';
|
||||||
|
|
||||||
import { patch } from '@web/core/utils/patch';
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { MockServer } from '@web/../tests/helpers/mock_server';
|
import { MockServer } from '@web/../tests/helpers/mock_server';
|
||||||
|
|
||||||
patch(MockServer.prototype, 'calendar/models/mail_activity', {
|
patch(MockServer.prototype, {
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// Private
|
// Private
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@@ -25,6 +25,6 @@ patch(MockServer.prototype, 'calendar/models/mail_activity', {
|
|||||||
target: 'current',
|
target: 'current',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return this._super(...arguments);
|
return super._performRPC(...arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
// ensure mail override is applied first.
|
// ensure mail override is applied first.
|
||||||
import '@mail/../tests/helpers/mock_server/models/res_users';
|
import '@mail/../tests/helpers/mock_server/models/res_users';
|
||||||
|
|
||||||
import { patch } from '@web/core/utils/patch';
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { MockServer } from '@web/../tests/helpers/mock_server';
|
import { MockServer } from '@web/../tests/helpers/mock_server';
|
||||||
|
|
||||||
import { datetime_to_str } from '@web/legacy/js/core/time';
|
import { datetime_to_str } from '@web/legacy/js/core/time';
|
||||||
|
|
||||||
patch(MockServer.prototype, 'calendar/models/res_users', {
|
patch(MockServer.prototype, {
|
||||||
/**
|
/**
|
||||||
* Simulates `_systray_get_calendar_event_domain` on `res.users`.
|
* Simulates `_systray_get_calendar_event_domain` on `res.users`.
|
||||||
*
|
*
|
||||||
@@ -41,7 +41,7 @@ patch(MockServer.prototype, 'calendar/models/res_users', {
|
|||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
_mockResUsersSystrayGetActivities() {
|
_mockResUsersSystrayGetActivities() {
|
||||||
const activities = this._super(...arguments);
|
const activities = super._mockResUsersSystrayGetActivities(...arguments);
|
||||||
const meetingsLines = this.pyEnv['calendar.event'].searchRead(
|
const meetingsLines = this.pyEnv['calendar.event'].searchRead(
|
||||||
this._mockResUsers_SystrayGetCalendarEventDomain(),
|
this._mockResUsers_SystrayGetCalendarEventDomain(),
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { ActivityMenu } from "@mail/core/web/activity_menu";
|
import { ActivityMenu } from "@mail/core/web/activity_menu";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(ActivityMenu.prototype, "crm", {
|
patch(ActivityMenu.prototype, {
|
||||||
availableViews(group) {
|
availableViews(group) {
|
||||||
if (group.model === "crm.lead") {
|
if (group.model === "crm.lead") {
|
||||||
return [
|
return [
|
||||||
@@ -16,7 +16,7 @@ patch(ActivityMenu.prototype, "crm", {
|
|||||||
[false, "activity"],
|
[false, "activity"],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return this._super(...arguments);
|
return super.availableViews(...arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
openActivityGroup(group, filter = "all") {
|
openActivityGroup(group, filter = "all") {
|
||||||
@@ -38,7 +38,7 @@ patch(ActivityMenu.prototype, "crm", {
|
|||||||
clearBreadcrumbs: true,
|
clearBreadcrumbs: true,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return this._super(group, filter);
|
return super.openActivityGroup(group, filter);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { patch } from "@web/core/utils/patch";
|
|||||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||||
import { deserializeDateTime } from "@web/core/l10n/dates";
|
import { deserializeDateTime } from "@web/core/l10n/dates";
|
||||||
|
|
||||||
patch(MockServer.prototype, "CRM", {
|
patch(MockServer.prototype, {
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// Private
|
// Private
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@@ -51,6 +51,6 @@ patch(MockServer.prototype, "CRM", {
|
|||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
return this._super(...arguments);
|
return super._performRPC(...arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import "@crm/js/tours/crm";
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
var _t = core._t;
|
var _t = core._t;
|
||||||
|
|
||||||
patch(registry.category("web_tour.tours").get("crm_tour"), "patch_crm_tour", {
|
patch(registry.category("web_tour.tours").get("crm_tour"), {
|
||||||
steps() {
|
steps() {
|
||||||
const originalSteps = this._super();
|
const originalSteps = super.steps();
|
||||||
const DragOppToWonStepIndex = originalSteps.findIndex(
|
const DragOppToWonStepIndex = originalSteps.findIndex(
|
||||||
(step) => step.id === "drag_opportunity_to_won_step"
|
(step) => step.id === "drag_opportunity_to_won_step"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,24 +5,24 @@ import { x2ManyCommands } from "@web/core/orm_service";
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
|
|
||||||
patch(SaleOrderLineProductField.prototype, 'event_booth_sale', {
|
patch(SaleOrderLineProductField.prototype, {
|
||||||
|
|
||||||
async _onProductUpdate() {
|
async _onProductUpdate() {
|
||||||
this._super(...arguments);
|
super._onProductUpdate(...arguments);
|
||||||
if (this.props.record.data.product_type === 'event_booth') {
|
if (this.props.record.data.product_type === 'event_booth') {
|
||||||
this._openEventBoothConfigurator(false);
|
this._openEventBoothConfigurator(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_editLineConfiguration() {
|
_editLineConfiguration() {
|
||||||
this._super(...arguments);
|
super._editLineConfiguration(...arguments);
|
||||||
if (this.props.record.data.product_type === 'event_booth') {
|
if (this.props.record.data.product_type === 'event_booth') {
|
||||||
this._openEventBoothConfigurator(true);
|
this._openEventBoothConfigurator(true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
get isConfigurableLine() {
|
get isConfigurableLine() {
|
||||||
return this._super(...arguments) || this.props.record.data.product_type === 'event_booth';
|
return super.isConfigurableLine || this.props.record.data.product_type === 'event_booth';
|
||||||
},
|
},
|
||||||
|
|
||||||
async _openEventBoothConfigurator(edit) {
|
async _openEventBoothConfigurator(edit) {
|
||||||
|
|||||||
@@ -4,24 +4,24 @@ import { patch } from "@web/core/utils/patch";
|
|||||||
import { SaleOrderLineProductField } from '@sale/js/sale_product_field';
|
import { SaleOrderLineProductField } from '@sale/js/sale_product_field';
|
||||||
|
|
||||||
|
|
||||||
patch(SaleOrderLineProductField.prototype, 'event_sale', {
|
patch(SaleOrderLineProductField.prototype, {
|
||||||
|
|
||||||
async _onProductUpdate() {
|
async _onProductUpdate() {
|
||||||
this._super(...arguments);
|
super._onProductUpdate(...arguments);
|
||||||
if (this.props.record.data.product_type === 'event') {
|
if (this.props.record.data.product_type === 'event') {
|
||||||
this._openEventConfigurator();
|
this._openEventConfigurator();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_editLineConfiguration() {
|
_editLineConfiguration() {
|
||||||
this._super(...arguments);
|
super._editLineConfiguration(...arguments);
|
||||||
if (this.props.record.data.product_type === 'event') {
|
if (this.props.record.data.product_type === 'event') {
|
||||||
this._openEventConfigurator();
|
this._openEventConfigurator();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
get isConfigurableLine() {
|
get isConfigurableLine() {
|
||||||
return this._super(...arguments) || this.props.record.data.product_type === 'event';
|
return super.isConfigurableLine || this.props.record.data.product_type === 'event';
|
||||||
},
|
},
|
||||||
|
|
||||||
async _openEventConfigurator() {
|
async _openEventConfigurator() {
|
||||||
|
|||||||
+2
-2
@@ -3,8 +3,8 @@
|
|||||||
import { AttendeeCalendarCommonPopover } from "@calendar/views/attendee_calendar/common/attendee_calendar_common_popover";
|
import { AttendeeCalendarCommonPopover } from "@calendar/views/attendee_calendar/common/attendee_calendar_common_popover";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(AttendeeCalendarCommonPopover.prototype, "google_calendar_google_calendar_common_popover", {
|
patch(AttendeeCalendarCommonPopover.prototype, {
|
||||||
get isEventArchivable() {
|
get isEventArchivable() {
|
||||||
return this._super() || (this.isCurrentUserOrganizer && this.props.record.rawRecord.google_id);
|
return super.isEventArchivable || (this.isCurrentUserOrganizer && this.props.record.rawRecord.google_id);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-2
@@ -5,9 +5,9 @@ import { patch } from "@web/core/utils/patch";
|
|||||||
import { useService } from "@web/core/utils/hooks";
|
import { useService } from "@web/core/utils/hooks";
|
||||||
import { ConfirmationDialog, AlertDialog } from "@web/core/confirmation_dialog/confirmation_dialog";
|
import { ConfirmationDialog, AlertDialog } from "@web/core/confirmation_dialog/confirmation_dialog";
|
||||||
|
|
||||||
patch(AttendeeCalendarController.prototype, "google_calendar_google_calendar_controller", {
|
patch(AttendeeCalendarController.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super(...arguments);
|
super.setup(...arguments);
|
||||||
this.dialog = useService("dialog");
|
this.dialog = useService("dialog");
|
||||||
this.notification = useService("notification");
|
this.notification = useService("notification");
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
import { AttendeeCalendarModel } from "@calendar/views/attendee_calendar/attendee_calendar_model";
|
import { AttendeeCalendarModel } from "@calendar/views/attendee_calendar/attendee_calendar_model";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(AttendeeCalendarModel, "google_calendar_google_calendar_model", {
|
patch(AttendeeCalendarModel, {
|
||||||
services: [...AttendeeCalendarModel.services, "rpc"],
|
services: [...AttendeeCalendarModel.services, "rpc"],
|
||||||
});
|
});
|
||||||
|
|
||||||
patch(AttendeeCalendarModel.prototype, "google_calendar_google_calendar_model_functions", {
|
patch(AttendeeCalendarModel.prototype, {
|
||||||
setup(params, { rpc }) {
|
setup(params, { rpc }) {
|
||||||
this._super(...arguments);
|
super.setup(...arguments);
|
||||||
this.rpc = rpc;
|
this.rpc = rpc;
|
||||||
this.googleIsSync = true;
|
this.googleIsSync = true;
|
||||||
this.googlePendingSync = false;
|
this.googlePendingSync = false;
|
||||||
@@ -19,9 +19,8 @@ patch(AttendeeCalendarModel.prototype, "google_calendar_google_calendar_model_fu
|
|||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
async updateData() {
|
async updateData() {
|
||||||
const _super = this._super.bind(this);
|
|
||||||
if (this.googlePendingSync) {
|
if (this.googlePendingSync) {
|
||||||
return _super(...arguments);
|
return super.updateData(...arguments);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await Promise.race([
|
await Promise.race([
|
||||||
@@ -35,7 +34,7 @@ patch(AttendeeCalendarModel.prototype, "google_calendar_google_calendar_model_fu
|
|||||||
console.error("Could not synchronize Google events now.", error);
|
console.error("Could not synchronize Google events now.", error);
|
||||||
this.googlePendingSync = false;
|
this.googlePendingSync = false;
|
||||||
}
|
}
|
||||||
return _super(...arguments);
|
return super.updateData(...arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
async syncGoogleCalendar(silent = false) {
|
async syncGoogleCalendar(silent = false) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||||
|
|
||||||
patch(MockServer.prototype, "google_calendar_mock_server", {
|
patch(MockServer.prototype, {
|
||||||
/**
|
/**
|
||||||
* Simulate the creation of a custom appointment type
|
* Simulate the creation of a custom appointment type
|
||||||
* by receiving a list of slots.
|
* by receiving a list of slots.
|
||||||
@@ -13,6 +13,6 @@ patch(MockServer.prototype, "google_calendar_mock_server", {
|
|||||||
if (route === '/google_calendar/sync_data') {
|
if (route === '/google_calendar/sync_data') {
|
||||||
return Promise.resolve({status: 'no_new_event_from_google'});
|
return Promise.resolve({status: 'no_new_event_from_google'});
|
||||||
}
|
}
|
||||||
return this._super(...arguments);
|
return super._performRPC(...arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ import { useService } from "@web/core/utils/hooks";
|
|||||||
|
|
||||||
export const patchAvatarCardPopover = {
|
export const patchAvatarCardPopover = {
|
||||||
setup() {
|
setup() {
|
||||||
this._super();
|
super.setup();
|
||||||
this.userInfoTemplate = "hr.avatarCardUserInfos",
|
this.userInfoTemplate = "hr.avatarCardUserInfos",
|
||||||
this.actionService = useService("action");
|
this.actionService = useService("action");
|
||||||
},
|
},
|
||||||
get fieldNames(){
|
get fieldNames(){
|
||||||
let fields = this._super();
|
let fields = super.fieldNames;
|
||||||
return fields.concat([
|
return fields.concat([
|
||||||
"work_phone",
|
"work_phone",
|
||||||
"work_email",
|
"work_email",
|
||||||
@@ -34,4 +34,4 @@ export const patchAvatarCardPopover = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
patch(AvatarCardPopover.prototype, "hr", patchAvatarCardPopover);
|
export const unpatchAvatarCardPopover = patch(AvatarCardPopover.prototype, patchAvatarCardPopover);
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ import { Persona } from "@mail/core/common/persona_model";
|
|||||||
|
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(Persona.prototype, "hr", {
|
patch(Persona.prototype, {
|
||||||
employeeId: undefined,
|
employeeId: undefined,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,16 +3,16 @@
|
|||||||
import { helpers } from "@mail/core/web/open_chat_hook";
|
import { helpers } from "@mail/core/web/open_chat_hook";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(helpers, "hr_m2x_avatar_employee", {
|
patch(helpers, {
|
||||||
SUPPORTED_M2X_AVATAR_MODELS: [
|
SUPPORTED_M2X_AVATAR_MODELS: [
|
||||||
...helpers.SUPPORTED_M2X_AVATAR_MODELS,
|
...helpers.SUPPORTED_M2X_AVATAR_MODELS,
|
||||||
"hr.employee",
|
"hr.employee",
|
||||||
"hr.employee.public",
|
"hr.employee.public",
|
||||||
],
|
],
|
||||||
buildOpenChatParams: function (resModel, id) {
|
buildOpenChatParams(resModel, id) {
|
||||||
if (["hr.employee", "hr.employee.public"].includes(resModel)) {
|
if (["hr.employee", "hr.employee.public"].includes(resModel)) {
|
||||||
return { employeeId: id };
|
return { employeeId: id };
|
||||||
}
|
}
|
||||||
return this._super(...arguments);
|
return super.buildOpenChatParams(...arguments);
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
/** @odoo-module */
|
/** @odoo-module */
|
||||||
|
|
||||||
import { unpatch } from "@web/core/utils/patch";
|
import { unpatchAvatarCardPopover } from "@hr/components/avatar_card/avatar_card_popover_patch";
|
||||||
import { AvatarCardPopover } from "@mail/discuss/web/avatar_card/avatar_card_popover";
|
|
||||||
|
|
||||||
unpatch(AvatarCardPopover.prototype, "hr");
|
unpatchAvatarCardPopover();
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { patch } from "@web/core/utils/patch";
|
|||||||
* As 'hr' changes the flow a bit and displays the user preferences form in a full view instead of
|
* As 'hr' changes the flow a bit and displays the user preferences form in a full view instead of
|
||||||
* a modal, we adapt the steps of the original tour accordingly.
|
* a modal, we adapt the steps of the original tour accordingly.
|
||||||
*/
|
*/
|
||||||
patch(registry.category("web_tour.tours").get("mail/static/tests/tours/user_modify_own_profile_tour.js"), "patch_user_modify_own_profile_tour", {
|
patch(registry.category("web_tour.tours").get("mail/static/tests/tours/user_modify_own_profile_tour.js"), {
|
||||||
steps() {
|
steps() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ import { sprintf } from "@web/core/utils/strings";
|
|||||||
|
|
||||||
const { DateTime } = luxon;
|
const { DateTime } = luxon;
|
||||||
|
|
||||||
patch(personaService, "hr_holidays", {
|
patch(personaService, {
|
||||||
dependencies: [...new Set([...personaService.dependencies, "user"])],
|
dependencies: [...new Set([...personaService.dependencies, "user"])],
|
||||||
});
|
});
|
||||||
|
|
||||||
patch(PersonaService.prototype, "hr_holidays", {
|
patch(PersonaService.prototype, {
|
||||||
setup(env, services) {
|
setup(env, services) {
|
||||||
this._super(env, services);
|
super.setup(env, services);
|
||||||
this.userService = services.user;
|
this.userService = services.user;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import { Thread } from "@mail/core/common/thread";
|
|||||||
import { useService } from "@web/core/utils/hooks";
|
import { useService } from "@web/core/utils/hooks";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(Thread.prototype, "hr_holidays", {
|
patch(Thread.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super();
|
super.setup();
|
||||||
this.personaService = useService("mail.persona");
|
this.personaService = useService("mail.persona");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ import '@mail/../tests/helpers/mock_server/models/res_partner'; // ensure mail o
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||||
|
|
||||||
patch(MockServer.prototype, 'hr_holidays/models/res_partner', {
|
patch(MockServer.prototype, {
|
||||||
/**
|
/**
|
||||||
* Overrides to add out of office to employees.
|
* Overrides to add out of office to employees.
|
||||||
*
|
*
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
_mockResPartnerMailPartnerFormat(ids) {
|
_mockResPartnerMailPartnerFormat(ids) {
|
||||||
const partnerFormats = this._super(...arguments);
|
const partnerFormats = super._mockResPartnerMailPartnerFormat(...arguments);
|
||||||
const partners = this.getRecords(
|
const partners = this.getRecords(
|
||||||
'res.partner',
|
'res.partner',
|
||||||
[['id', 'in', ids]],
|
[['id', 'in', ids]],
|
||||||
|
|||||||
@@ -3,9 +3,10 @@
|
|||||||
import { AttendeeCalendarCommonRenderer } from "@calendar/views/attendee_calendar/common/attendee_calendar_common_renderer"
|
import { AttendeeCalendarCommonRenderer } from "@calendar/views/attendee_calendar/common/attendee_calendar_common_renderer"
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { renderToString } from "@web/core/utils/render";
|
import { renderToString } from "@web/core/utils/render";
|
||||||
patch(AttendeeCalendarCommonRenderer.prototype, "hr_homeworking_calendar_common_renderer", {
|
|
||||||
|
patch(AttendeeCalendarCommonRenderer.prototype, {
|
||||||
get options(){
|
get options(){
|
||||||
let a = Object.assign(this._super(), {
|
let a = Object.assign(super.options, {
|
||||||
columnHeaderHtml: function(date) {
|
columnHeaderHtml: function(date) {
|
||||||
if (this.props.model.scale === 'week'){
|
if (this.props.model.scale === 'week'){
|
||||||
return "<div>" + moment(date).format("ddd DD") +"</div>" + renderToString(this.constructor.HeaderCalendarTemplate, {date: date, today : new Date()});
|
return "<div>" + moment(date).format("ddd DD") +"</div>" + renderToString(this.constructor.HeaderCalendarTemplate, {date: date, today : new Date()});
|
||||||
@@ -31,7 +32,7 @@ patch(AttendeeCalendarCommonRenderer.prototype, "hr_homeworking_calendar_common_
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
fcEventToRecord(event) {
|
fcEventToRecord(event) {
|
||||||
const res = this._super(...arguments);
|
const res = super.fcEventToRecord(...arguments);
|
||||||
res.homework = event.homework;
|
res.homework = event.homework;
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
@@ -53,7 +54,7 @@ patch(AttendeeCalendarCommonRenderer.prototype, "hr_homeworking_calendar_common_
|
|||||||
return events;
|
return events;
|
||||||
},
|
},
|
||||||
mapRecordsToEvents() {
|
mapRecordsToEvents() {
|
||||||
let event = this._super(...arguments);
|
let event = super.mapRecordsToEvents(...arguments);
|
||||||
let work = [];
|
let work = [];
|
||||||
if (this.props.model.multiCalendar) {
|
if (this.props.model.multiCalendar) {
|
||||||
for (const day in this.props.model.worklocations) {
|
for (const day in this.props.model.worklocations) {
|
||||||
@@ -114,7 +115,7 @@ patch(AttendeeCalendarCommonRenderer.prototype, "hr_homeworking_calendar_common_
|
|||||||
const {children } = new DOMParser().parseFromString(content, "text/html").body
|
const {children } = new DOMParser().parseFromString(content, "text/html").body
|
||||||
box.appendChild(...children)
|
box.appendChild(...children)
|
||||||
}
|
}
|
||||||
this._super(...arguments);
|
super.onDayRender(...arguments);
|
||||||
},
|
},
|
||||||
onEventRender(info) {
|
onEventRender(info) {
|
||||||
const { el, event } = info;
|
const { el, event } = info;
|
||||||
@@ -149,14 +150,14 @@ patch(AttendeeCalendarCommonRenderer.prototype, "hr_homeworking_calendar_common_
|
|||||||
const { children } = domParser.parseFromString(injectedContentStr, "text/html").body;
|
const { children } = domParser.parseFromString(injectedContentStr, "text/html").body;
|
||||||
el.querySelector(".fc-content").replaceWith(...children);
|
el.querySelector(".fc-content").replaceWith(...children);
|
||||||
} else {
|
} else {
|
||||||
this._super(...arguments);
|
super.onEventRender(...arguments);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onDblClick(info) {
|
onDblClick(info) {
|
||||||
if (info.event.extendedProps.worklocation) {
|
if (info.event.extendedProps.worklocation) {
|
||||||
this.onClick(info);
|
this.onClick(info);
|
||||||
} else {
|
} else {
|
||||||
this._super(...arguments);
|
super.onDblClick(...arguments);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onClick(info){
|
onClick(info){
|
||||||
@@ -185,7 +186,7 @@ patch(AttendeeCalendarCommonRenderer.prototype, "hr_homeworking_calendar_common_
|
|||||||
this.openPopover(info.el, wl);
|
this.openPopover(info.el, wl);
|
||||||
this.highlightEvent(info.event, "o_cw_custom_highlight");
|
this.highlightEvent(info.event, "o_cw_custom_highlight");
|
||||||
} else {
|
} else {
|
||||||
this._super(...arguments);
|
super.onClick(...arguments);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onDateClick(info){
|
onDateClick(info){
|
||||||
@@ -193,12 +194,11 @@ patch(AttendeeCalendarCommonRenderer.prototype, "hr_homeworking_calendar_common_
|
|||||||
info.homework = true
|
info.homework = true
|
||||||
this.props.createRecord(this.fcEventToRecord(info));
|
this.props.createRecord(this.fcEventToRecord(info));
|
||||||
} else {
|
} else {
|
||||||
this._super(...arguments)
|
super.onDateClick(...arguments)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
|
|
||||||
AttendeeCalendarCommonRenderer.WorklocationTemplate = "hr.homeworking.CalendarCommonRenderer.worklocation",
|
AttendeeCalendarCommonRenderer.WorklocationTemplate = "hr.homeworking.CalendarCommonRenderer.worklocation";
|
||||||
AttendeeCalendarCommonRenderer.HeaderCalendarTemplate = "hr.homeworking.CalendarCommonRenderer.buttonWorklocation",
|
AttendeeCalendarCommonRenderer.HeaderCalendarTemplate = "hr.homeworking.CalendarCommonRenderer.buttonWorklocation";
|
||||||
AttendeeCalendarCommonRenderer.ButtonWorklocationTemplate = "hr.homeworking.CalendarCommonRenderer.buttonWorklocation",
|
AttendeeCalendarCommonRenderer.ButtonWorklocationTemplate = "hr.homeworking.CalendarCommonRenderer.buttonWorklocation";
|
||||||
)
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { AttendeeCalendarModel } from "@calendar/views/attendee_calendar/attende
|
|||||||
import { serializeDateTime, deserializeDate } from "@web/core/l10n/dates";
|
import { serializeDateTime, deserializeDate } from "@web/core/l10n/dates";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(AttendeeCalendarModel.prototype, "calendar_model_calendarApp", {
|
patch(AttendeeCalendarModel.prototype, {
|
||||||
fetchEventLocation(data) {
|
fetchEventLocation(data) {
|
||||||
let attendeeIds;
|
let attendeeIds;
|
||||||
const filters = data.filterSections.partner_ids.filters;
|
const filters = data.filterSections.partner_ids.filters;
|
||||||
@@ -92,7 +92,7 @@ patch(AttendeeCalendarModel.prototype, "calendar_model_calendarApp", {
|
|||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
async updateData(data){
|
async updateData(data){
|
||||||
await this._super(...arguments)
|
await super.updateData(...arguments)
|
||||||
this.partnerColorMap = this.mapPartnersToColor(data);
|
this.partnerColorMap = this.mapPartnersToColor(data);
|
||||||
data.worklocations = await this.loadWorkLocations(data);
|
data.worklocations = await this.loadWorkLocations(data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import { patch } from "@web/core/utils/patch";
|
|||||||
import { AttendeeCalendarCommonPopover } from "@calendar/views/attendee_calendar/common/attendee_calendar_common_popover";
|
import { AttendeeCalendarCommonPopover } from "@calendar/views/attendee_calendar/common/attendee_calendar_common_popover";
|
||||||
import { Field } from "@web/views/fields/field"
|
import { Field } from "@web/views/fields/field"
|
||||||
|
|
||||||
patch(AttendeeCalendarCommonPopover.prototype, "hr_homeworking_calendar_common_popover",{
|
patch(AttendeeCalendarCommonPopover.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this.fieldNames = ["work_location_id", "work_location_name", "work_location_type", "employee_id", "weekday", "weekly", "start_date", "employee_name"];
|
this.fieldNames = ["work_location_id", "work_location_name", "work_location_type", "employee_id", "weekday", "weekly", "start_date", "employee_name"];
|
||||||
this._super(...arguments)
|
super.setup(...arguments)
|
||||||
},
|
},
|
||||||
isWorkLocationEvent(){
|
isWorkLocationEvent(){
|
||||||
return this.props.record.rawRecord['resModel'] === 'hr.employee.location';
|
return this.props.record.rawRecord['resModel'] === 'hr.employee.location';
|
||||||
@@ -19,19 +19,19 @@ patch(AttendeeCalendarCommonPopover.prototype, "hr_homeworking_calendar_common_p
|
|||||||
return this.isWorkLocationEvent() && this.props.record.userId === this.slot.record.model.user.userId;
|
return this.isWorkLocationEvent() && this.props.record.userId === this.slot.record.model.user.userId;
|
||||||
},
|
},
|
||||||
get isEventEditable() {
|
get isEventEditable() {
|
||||||
return ('resModel' in this.props.record.rawRecord) || this._super(...arguments)
|
return ('resModel' in this.props.record.rawRecord) || super.isEventEditable;
|
||||||
},
|
},
|
||||||
get isEventViewable() {
|
get isEventViewable() {
|
||||||
return !('resModel' in this.props.record.rawRecord) || this._super(...arguments)
|
return !('resModel' in this.props.record.rawRecord) || super.isEventViewable;
|
||||||
},
|
},
|
||||||
get isEventDeletable() {
|
get isEventDeletable() {
|
||||||
return ('resModel' in this.props.record.rawRecord) || this._super(...arguments)
|
return ('resModel' in this.props.record.rawRecord) || super.isEventDeletable;
|
||||||
},
|
},
|
||||||
get displayAttendeeAnswerChoice() {
|
get displayAttendeeAnswerChoice() {
|
||||||
return !('resModel' in this.props.record.rawRecord) && this._super(...arguments)
|
return !('resModel' in this.props.record.rawRecord) && super.displayAttendeeAnswerChoice;
|
||||||
},
|
},
|
||||||
get isCurrentUserAttendee() {
|
get isCurrentUserAttendee() {
|
||||||
return !('resModel' in this.props.record.rawRecord) && this._super(...arguments)
|
return !('resModel' in this.props.record.rawRecord) && super.isCurrentUserAttendee;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import { ConfirmationDialog } from "@web/core/confirmation_dialog/confirmation_d
|
|||||||
import { AttendeeCalendarController } from "@calendar/views/attendee_calendar/attendee_calendar_controller"
|
import { AttendeeCalendarController } from "@calendar/views/attendee_calendar/attendee_calendar_controller"
|
||||||
import { serializeDate} from "@web/core/l10n/dates";
|
import { serializeDate} from "@web/core/l10n/dates";
|
||||||
|
|
||||||
patch(AttendeeCalendarController.prototype, "hr_homeworking_calendar_controller",{
|
patch(AttendeeCalendarController.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super()
|
super.setup()
|
||||||
this.action = useService("action");
|
this.action = useService("action");
|
||||||
},
|
},
|
||||||
async editRecord(record, context = {}, shouldFetchFormViewId = true) {
|
async editRecord(record, context = {}, shouldFetchFormViewId = true) {
|
||||||
@@ -26,7 +26,7 @@ patch(AttendeeCalendarController.prototype, "hr_homeworking_calendar_controller"
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return this._super(...arguments)
|
return super.editRecord(...arguments)
|
||||||
},
|
},
|
||||||
createRecord(record) {
|
createRecord(record) {
|
||||||
if (record.homework) {
|
if (record.homework) {
|
||||||
@@ -42,7 +42,7 @@ patch(AttendeeCalendarController.prototype, "hr_homeworking_calendar_controller"
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return this._super(record);
|
return super.createRecord(record);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deleteRecord(record) {
|
deleteRecord(record) {
|
||||||
@@ -64,7 +64,7 @@ patch(AttendeeCalendarController.prototype, "hr_homeworking_calendar_controller"
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this._super(...arguments)
|
super.deleteRecord(...arguments)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||||
|
|
||||||
patch(MockServer.prototype, "hr_homeworking", {
|
patch(MockServer.prototype, {
|
||||||
async _performRPC(route, args) {
|
async _performRPC(route, args) {
|
||||||
if (args.method === "get_worklocation") {
|
if (args.method === "get_worklocation") {
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
}
|
}
|
||||||
return this._super(...arguments);
|
return super._performRPC(...arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -4,9 +4,9 @@ import { ChatWindow } from "@mail/core/common/chat_window";
|
|||||||
|
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(ChatWindow.prototype, "im_livechat", {
|
patch(ChatWindow.prototype, {
|
||||||
close(options) {
|
close(options) {
|
||||||
this._super(options);
|
super.close(options);
|
||||||
if (
|
if (
|
||||||
this.thread?.type === "livechat" &&
|
this.thread?.type === "livechat" &&
|
||||||
this.thread.isLoaded &&
|
this.thread.isLoaded &&
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import { Composer } from "@mail/core/common/composer";
|
|||||||
|
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(Composer.prototype, "im_livechat", {
|
patch(Composer.prototype, {
|
||||||
get allowUpload() {
|
get allowUpload() {
|
||||||
return this.thread?.type !== "livechat" && this._super();
|
return this.thread?.type !== "livechat" && super.allowUpload;
|
||||||
},
|
},
|
||||||
|
|
||||||
onKeydown(ev) {
|
onKeydown(ev) {
|
||||||
this._super(ev);
|
super.onKeydown(ev);
|
||||||
if (
|
if (
|
||||||
ev.key === "Tab" &&
|
ev.key === "Tab" &&
|
||||||
this.thread?.type === "livechat" &&
|
this.thread?.type === "livechat" &&
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import { cleanTerm } from "@mail/utils/common/format";
|
|||||||
import { _t } from "@web/core/l10n/translation";
|
import { _t } from "@web/core/l10n/translation";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(SuggestionService.prototype, "im_livechat", {
|
patch(SuggestionService.prototype, {
|
||||||
getSupportedDelimiters(thread) {
|
getSupportedDelimiters(thread) {
|
||||||
return thread?.model !== "discuss.channel" || thread.type === "livechat"
|
return thread?.model !== "discuss.channel" || thread.type === "livechat"
|
||||||
? [...this._super(...arguments), [":"]]
|
? [...super.getSupportedDelimiters(...arguments), [":"]]
|
||||||
: this._super(...arguments);
|
: super.getSupportedDelimiters(...arguments);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Returns suggestions that match the given search term from specified type.
|
* Returns suggestions that match the given search term from specified type.
|
||||||
@@ -27,7 +27,7 @@ patch(SuggestionService.prototype, "im_livechat", {
|
|||||||
if (delimiter === ":") {
|
if (delimiter === ":") {
|
||||||
return this.searchCannedResponseSuggestions(cleanTerm(term), sort);
|
return this.searchCannedResponseSuggestions(cleanTerm(term), sort);
|
||||||
}
|
}
|
||||||
return this._super(...arguments);
|
return super.searchSuggestions(...arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
searchCannedResponseSuggestions(cleanedSearchTerm, sort) {
|
searchCannedResponseSuggestions(cleanedSearchTerm, sort) {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
import { ChannelMemberList } from "@mail/discuss/core/common/channel_member_list";
|
import { ChannelMemberList } from "@mail/discuss/core/common/channel_member_list";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(ChannelMemberList.prototype, "im_livechat", {
|
patch(ChannelMemberList.prototype, {
|
||||||
canOpenChatWith(member) {
|
canOpenChatWith(member) {
|
||||||
return this._super(member) && !member.persona.is_public;
|
return super.canOpenChatWith(member) && !member.persona.is_public;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
import { ChannelMemberService } from "@mail/core/common/channel_member_service";
|
import { ChannelMemberService } from "@mail/core/common/channel_member_service";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(ChannelMemberService.prototype, "im_livechat", {
|
patch(ChannelMemberService.prototype, {
|
||||||
getName(member) {
|
getName(member) {
|
||||||
if (member.thread.type !== "livechat") {
|
if (member.thread.type !== "livechat") {
|
||||||
return this._super(member);
|
return super.getName(member);
|
||||||
}
|
}
|
||||||
if (member.persona.user_livechat_username) {
|
if (member.persona.user_livechat_username) {
|
||||||
return member.persona.user_livechat_username;
|
return member.persona.user_livechat_username;
|
||||||
@@ -14,6 +14,6 @@ patch(ChannelMemberService.prototype, "im_livechat", {
|
|||||||
if (member.persona.is_public) {
|
if (member.persona.is_public) {
|
||||||
return member.thread.anonymous_name;
|
return member.thread.anonymous_name;
|
||||||
}
|
}
|
||||||
return this._super(member);
|
return super.getName(member);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import { Store } from "@mail/core/common/store_service";
|
|||||||
import { _t } from "@web/core/l10n/translation";
|
import { _t } from "@web/core/l10n/translation";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(Store.prototype, "im_livechat", {
|
patch(Store.prototype, {
|
||||||
setup(env) {
|
setup(env) {
|
||||||
this._super(env);
|
super.setup(env);
|
||||||
this.discuss.livechat = {
|
this.discuss.livechat = {
|
||||||
extraClass: "o-mail-DiscussSidebarCategory-livechat",
|
extraClass: "o-mail-DiscussSidebarCategory-livechat",
|
||||||
id: "livechat",
|
id: "livechat",
|
||||||
|
|||||||
@@ -5,37 +5,37 @@ import { Thread } from "@mail/core/common/thread_model";
|
|||||||
|
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(Thread.prototype, "im_livechat", {
|
patch(Thread.prototype, {
|
||||||
get isChannel() {
|
get isChannel() {
|
||||||
return this.type === "livechat" || this._super();
|
return this.type === "livechat" || super.isChannel;
|
||||||
},
|
},
|
||||||
|
|
||||||
get hasMemberList() {
|
get hasMemberList() {
|
||||||
return this.type === "livechat" || this._super();
|
return this.type === "livechat" || super.hasMemberList;
|
||||||
},
|
},
|
||||||
|
|
||||||
get isChatChannel() {
|
get isChatChannel() {
|
||||||
return this.type === "livechat" || this._super();
|
return this.type === "livechat" || super.isChatChannel;
|
||||||
},
|
},
|
||||||
|
|
||||||
get allowSetLastSeenMessage() {
|
get allowSetLastSeenMessage() {
|
||||||
return this.type === "livechat" || this._super();
|
return this.type === "livechat" || super.allowSetLastSeenMessage;
|
||||||
},
|
},
|
||||||
|
|
||||||
get allowReactions() {
|
get allowReactions() {
|
||||||
return this.type === "livechat" ? false : this._super();
|
return this.type === "livechat" ? false : super.allowReactions;
|
||||||
},
|
},
|
||||||
|
|
||||||
get allowReplies() {
|
get allowReplies() {
|
||||||
return this.type === "livechat" ? false : this._super();
|
return this.type === "livechat" ? false : super.allowReplies;
|
||||||
},
|
},
|
||||||
|
|
||||||
get correspondents() {
|
get correspondents() {
|
||||||
return this._super().filter((correspondent) => !correspondent.is_bot);
|
return super.correspondents.filter((correspondent) => !correspondent.is_bot);
|
||||||
},
|
},
|
||||||
|
|
||||||
get correspondent() {
|
get correspondent() {
|
||||||
let correspondent = this._super();
|
let correspondent = super.correspondent;
|
||||||
if (this.type === "livechat" && !correspondent) {
|
if (this.type === "livechat" && !correspondent) {
|
||||||
// For livechat threads, the correspondent is the first
|
// For livechat threads, the correspondent is the first
|
||||||
// channel member that is not the operator.
|
// channel member that is not the operator.
|
||||||
@@ -52,7 +52,7 @@ patch(Thread.prototype, "im_livechat", {
|
|||||||
|
|
||||||
get displayName() {
|
get displayName() {
|
||||||
if (this.type !== "livechat" || !this.correspondent) {
|
if (this.type !== "livechat" || !this.correspondent) {
|
||||||
return this._super();
|
return super.displayName;
|
||||||
}
|
}
|
||||||
if (!this.correspondent.is_public && this.correspondent.country) {
|
if (!this.correspondent.is_public && this.correspondent.country) {
|
||||||
return `${this.getMemberName(this.correspondent)} (${this.correspondent.country.name})`;
|
return `${this.getMemberName(this.correspondent)} (${this.correspondent.country.name})`;
|
||||||
@@ -67,7 +67,7 @@ patch(Thread.prototype, "im_livechat", {
|
|||||||
|
|
||||||
get imgUrl() {
|
get imgUrl() {
|
||||||
if (this.type !== "livechat") {
|
if (this.type !== "livechat") {
|
||||||
return this._super();
|
return super.imgUrl;
|
||||||
}
|
}
|
||||||
return this.correspondent && !this.correspondent.is_public
|
return this.correspondent && !this.correspondent.is_public
|
||||||
? `/web/image/res.partner/${this.correspondent.id}/avatar_128`
|
? `/web/image/res.partner/${this.correspondent.id}/avatar_128`
|
||||||
@@ -80,7 +80,7 @@ patch(Thread.prototype, "im_livechat", {
|
|||||||
*/
|
*/
|
||||||
getMemberName(persona) {
|
getMemberName(persona) {
|
||||||
if (this.type !== "livechat") {
|
if (this.type !== "livechat") {
|
||||||
return this._super(persona);
|
return super.getMemberName(persona);
|
||||||
}
|
}
|
||||||
if (persona.user_livechat_username) {
|
if (persona.user_livechat_username) {
|
||||||
return persona.user_livechat_username;
|
return persona.user_livechat_username;
|
||||||
@@ -88,6 +88,6 @@ patch(Thread.prototype, "im_livechat", {
|
|||||||
if (persona.is_public && this.anonymous_name) {
|
if (persona.is_public && this.anonymous_name) {
|
||||||
return this.anonymous_name;
|
return this.anonymous_name;
|
||||||
}
|
}
|
||||||
return this._super(persona);
|
return super.getMemberName(persona);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import { assignDefined, createLocalId } from "@mail/utils/common/misc";
|
|||||||
|
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(ThreadService.prototype, "im_livechat", {
|
patch(ThreadService.prototype, {
|
||||||
insert(data) {
|
insert(data) {
|
||||||
const isUnknown = !(createLocalId(data.model, data.id) in this.store.threads);
|
const isUnknown = !(createLocalId(data.model, data.id) in this.store.threads);
|
||||||
const thread = this._super(data);
|
const thread = super.insert(data);
|
||||||
if (thread.type === "livechat") {
|
if (thread.type === "livechat") {
|
||||||
if (data?.channel) {
|
if (data?.channel) {
|
||||||
assignDefined(thread, data.channel, ["anonymous_name"]);
|
assignDefined(thread, data.channel, ["anonymous_name"]);
|
||||||
@@ -34,7 +34,7 @@ patch(ThreadService.prototype, "im_livechat", {
|
|||||||
* @param {boolean} pushState
|
* @param {boolean} pushState
|
||||||
*/
|
*/
|
||||||
setDiscussThread(thread, pushState) {
|
setDiscussThread(thread, pushState) {
|
||||||
this._super(thread, pushState);
|
super.setDiscussThread(thread, pushState);
|
||||||
if (this.ui.isSmall && thread.type === "livechat") {
|
if (this.ui.isSmall && thread.type === "livechat") {
|
||||||
this.store.discuss.activeTab = "livechat";
|
this.store.discuss.activeTab = "livechat";
|
||||||
}
|
}
|
||||||
@@ -43,29 +43,29 @@ patch(ThreadService.prototype, "im_livechat", {
|
|||||||
if (thread.type === "livechat") {
|
if (thread.type === "livechat") {
|
||||||
removeFromArray(this.store.discuss.livechat.threads, thread.localId);
|
removeFromArray(this.store.discuss.livechat.threads, thread.localId);
|
||||||
}
|
}
|
||||||
this._super(thread);
|
super.remove(thread);
|
||||||
},
|
},
|
||||||
|
|
||||||
canLeave(thread) {
|
canLeave(thread) {
|
||||||
return thread.type !== "livechat" && this._super(thread);
|
return thread.type !== "livechat" && super.canLeave(thread);
|
||||||
},
|
},
|
||||||
|
|
||||||
canUnpin(thread) {
|
canUnpin(thread) {
|
||||||
if (thread.type === "livechat") {
|
if (thread.type === "livechat") {
|
||||||
return thread.message_unread_counter === 0;
|
return thread.message_unread_counter === 0;
|
||||||
}
|
}
|
||||||
return this._super(thread);
|
return super.canUnpin(thread);
|
||||||
},
|
},
|
||||||
|
|
||||||
getCounter(thread) {
|
getCounter(thread) {
|
||||||
if (thread.type === "livechat") {
|
if (thread.type === "livechat") {
|
||||||
return thread.message_unread_counter;
|
return thread.message_unread_counter;
|
||||||
}
|
}
|
||||||
return this._super(thread);
|
return super.getCounter(thread);
|
||||||
},
|
},
|
||||||
|
|
||||||
sortChannels() {
|
sortChannels() {
|
||||||
this._super();
|
super.sortChannels();
|
||||||
// Live chats are sorted by most recent interest date time in the sidebar.
|
// Live chats are sorted by most recent interest date time in the sidebar.
|
||||||
this.store.discuss.livechat.threads.sort((localId_1, localId_2) => {
|
this.store.discuss.livechat.threads.sort((localId_1, localId_2) => {
|
||||||
const thread1 = this.store.threads[localId_1];
|
const thread1 = this.store.threads[localId_1];
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ import { patch } from "@web/core/utils/patch";
|
|||||||
|
|
||||||
Object.assign(ChatWindow.components, { FeedbackPanel });
|
Object.assign(ChatWindow.components, { FeedbackPanel });
|
||||||
|
|
||||||
patch(ChatWindow.prototype, "im_livechat", {
|
patch(ChatWindow.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super(...arguments);
|
super.setup(...arguments);
|
||||||
this.livechatService = useService("im_livechat.livechat");
|
this.livechatService = useService("im_livechat.livechat");
|
||||||
this.chatbotService = useState(useService("im_livechat.chatbot"));
|
this.chatbotService = useState(useService("im_livechat.chatbot"));
|
||||||
this.livechatState = useState({
|
this.livechatState = useState({
|
||||||
@@ -24,13 +24,13 @@ patch(ChatWindow.prototype, "im_livechat", {
|
|||||||
|
|
||||||
close() {
|
close() {
|
||||||
if (this.thread?.type !== "livechat") {
|
if (this.thread?.type !== "livechat") {
|
||||||
return this._super();
|
return super.close();
|
||||||
}
|
}
|
||||||
if (this.livechatService.state === SESSION_STATE.PERSISTED) {
|
if (this.livechatService.state === SESSION_STATE.PERSISTED) {
|
||||||
this.livechatState.hasFeedbackPanel = true;
|
this.livechatState.hasFeedbackPanel = true;
|
||||||
this.chatWindowService.show(this.props.chatWindow);
|
this.chatWindowService.show(this.props.chatWindow);
|
||||||
} else {
|
} else {
|
||||||
this._super();
|
super.close();
|
||||||
}
|
}
|
||||||
this.livechatService.leaveSession();
|
this.livechatService.leaveSession();
|
||||||
this.chatbotService.stop();
|
this.chatbotService.stop();
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import { Composer } from "@mail/core/common/composer";
|
|||||||
import { _t } from "@web/core/l10n/translation";
|
import { _t } from "@web/core/l10n/translation";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(Composer.prototype, "im_livechat", {
|
patch(Composer.prototype, {
|
||||||
get placeholder() {
|
get placeholder() {
|
||||||
if (this.thread?.type !== "livechat") {
|
if (this.thread?.type !== "livechat") {
|
||||||
return this._super();
|
return super.placeholder;
|
||||||
}
|
}
|
||||||
return options.input_placeholder || _t("Say something...");
|
return options.input_placeholder || _t("Say something...");
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,25 +9,25 @@ import { ThreadService } from "@mail/core/common/thread_service";
|
|||||||
|
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(Composer.prototype, "im_livechat/disabled", {
|
patch(Composer.prototype, {
|
||||||
get allowUpload() {
|
get allowUpload() {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
patch(MessageModel.prototype, "im_livechat/disabled", {
|
patch(MessageModel.prototype, {
|
||||||
get hasActions() {
|
get hasActions() {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
patch(Thread.prototype, "im_livechat/disabled", {
|
patch(Thread.prototype, {
|
||||||
get hasMemberList() {
|
get hasMemberList() {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
patch(ThreadService.prototype, "im_livechat/disabled", {
|
patch(ThreadService.prototype, {
|
||||||
async fetchNewMessages(thread) {
|
async fetchNewMessages(thread) {
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
@@ -36,9 +36,9 @@ patch(ThreadService.prototype, "im_livechat/disabled", {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
patch(Store.prototype, "im_livechat/disabled", {
|
patch(Store.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super(...arguments);
|
super.setup(...arguments);
|
||||||
this.hasLinkPreviewFeature = false;
|
this.hasLinkPreviewFeature = false;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import { Message } from "@mail/core/common/message_model";
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { session } from "@web/session";
|
import { session } from "@web/session";
|
||||||
|
|
||||||
patch(Message.prototype, "im_livechat", {
|
patch(Message.prototype, {
|
||||||
get isSelfAuthored() {
|
get isSelfAuthored() {
|
||||||
if (this.originThread.type !== "livechat") {
|
if (this.originThread.type !== "livechat") {
|
||||||
return this._super();
|
return super.isSelfAuthored;
|
||||||
}
|
}
|
||||||
return !this.author || this.author?.id === session.livechatData.options.current_partner_id;
|
return !this.author || this.author?.id === session.livechatData.options.current_partner_id;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import { MessageService } from "@mail/core/common/message_service";
|
|||||||
|
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(MessageService.prototype, "im_livechat", {
|
patch(MessageService.prototype, {
|
||||||
insert(data) {
|
insert(data) {
|
||||||
const message = this._super(data);
|
const message = super.insert(data);
|
||||||
if (data.chatbotStep) {
|
if (data.chatbotStep) {
|
||||||
message.chatbotStep = new ChatbotStep(data.chatbotStep);
|
message.chatbotStep = new ChatbotStep(data.chatbotStep);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { Messaging } from "@mail/core/common/messaging_service";
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { session } from "@web/session";
|
import { session } from "@web/session";
|
||||||
|
|
||||||
patch(Messaging.prototype, "im_livechat", {
|
patch(Messaging.prototype, {
|
||||||
initialize() {
|
initialize() {
|
||||||
if (session.livechatData?.options.current_partner_id) {
|
if (session.livechatData?.options.current_partner_id) {
|
||||||
this.store.user = this.personaService.insert({
|
this.store.user = this.personaService.insert({
|
||||||
|
|||||||
@@ -5,27 +5,27 @@ import { Thread } from "@mail/core/common/thread_model";
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { session } from "@web/session";
|
import { session } from "@web/session";
|
||||||
|
|
||||||
patch(Thread.prototype, "im_livechat", {
|
patch(Thread.prototype, {
|
||||||
chatbotScriptId: null,
|
chatbotScriptId: null,
|
||||||
|
|
||||||
get isChannel() {
|
get isChannel() {
|
||||||
return this.type === "livechat" || this._super();
|
return this.type === "livechat" || super.isChannel;
|
||||||
},
|
},
|
||||||
|
|
||||||
get isChatChannel() {
|
get isChatChannel() {
|
||||||
return this.type === "livechat" || this._super();
|
return this.type === "livechat" || super.isChatChannel;
|
||||||
},
|
},
|
||||||
|
|
||||||
get isLastMessageFromCustomer() {
|
get isLastMessageFromCustomer() {
|
||||||
if (this.type !== "livechat") {
|
if (this.type !== "livechat") {
|
||||||
return this._super();
|
return super.isLastMessageFromCustomer;
|
||||||
}
|
}
|
||||||
return this.newestMessage?.isSelfAuthored;
|
return this.newestMessage?.isSelfAuthored;
|
||||||
},
|
},
|
||||||
|
|
||||||
get imgUrl() {
|
get imgUrl() {
|
||||||
if (this.type !== "livechat") {
|
if (this.type !== "livechat") {
|
||||||
return this._super();
|
return super.imgUrl;
|
||||||
}
|
}
|
||||||
return `${session.origin}/im_livechat/operator/${this.operator.id}/avatar`;
|
return `${session.origin}/im_livechat/operator/${this.operator.id}/avatar`;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ threadService.dependencies.push(
|
|||||||
"notification"
|
"notification"
|
||||||
);
|
);
|
||||||
|
|
||||||
patch(ThreadService.prototype, "im_livechat", {
|
patch(ThreadService.prototype, {
|
||||||
TEMPORARY_ID: "livechat_temporary_thread",
|
TEMPORARY_ID: "livechat_temporary_thread",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,7 +32,7 @@ patch(ThreadService.prototype, "im_livechat", {
|
|||||||
* }} services
|
* }} services
|
||||||
*/
|
*/
|
||||||
setup(env, services) {
|
setup(env, services) {
|
||||||
this._super(env, services);
|
super.setup(env, services);
|
||||||
this.livechatService = services["im_livechat.livechat"];
|
this.livechatService = services["im_livechat.livechat"];
|
||||||
this.chatWindowService = services["mail.chat_window"];
|
this.chatWindowService = services["mail.chat_window"];
|
||||||
this.chatbotService = services["im_livechat.chatbot"];
|
this.chatbotService = services["im_livechat.chatbot"];
|
||||||
@@ -41,14 +41,14 @@ patch(ThreadService.prototype, "im_livechat", {
|
|||||||
|
|
||||||
getMessagePostRoute(thread) {
|
getMessagePostRoute(thread) {
|
||||||
if (thread.type !== "livechat") {
|
if (thread.type !== "livechat") {
|
||||||
return this._super(...arguments);
|
return super.getMessagePostRoute(...arguments);
|
||||||
}
|
}
|
||||||
return "/im_livechat/chat_post";
|
return "/im_livechat/chat_post";
|
||||||
},
|
},
|
||||||
|
|
||||||
async getMessagePostParams({ thread, body }) {
|
async getMessagePostParams({ thread, body }) {
|
||||||
if (thread.type !== "livechat") {
|
if (thread.type !== "livechat") {
|
||||||
return this._super(...arguments);
|
return super.getMessagePostParams(...arguments);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
uuid: thread.uuid,
|
uuid: thread.uuid,
|
||||||
@@ -60,7 +60,6 @@ patch(ThreadService.prototype, "im_livechat", {
|
|||||||
* @returns {Promise<import("@mail/core/common/message_model").Message}
|
* @returns {Promise<import("@mail/core/common/message_model").Message}
|
||||||
*/
|
*/
|
||||||
async post(thread, body, params) {
|
async post(thread, body, params) {
|
||||||
const _super = this._super;
|
|
||||||
const chatWindow = this.store.chatWindows.find((c) => c.threadLocalId === thread.localId);
|
const chatWindow = this.store.chatWindows.find((c) => c.threadLocalId === thread.localId);
|
||||||
if (
|
if (
|
||||||
this.livechatService.state !== SESSION_STATE.PERSISTED &&
|
this.livechatService.state !== SESSION_STATE.PERSISTED &&
|
||||||
@@ -80,7 +79,7 @@ patch(ThreadService.prototype, "im_livechat", {
|
|||||||
await this.chatbotService.postWelcomeSteps();
|
await this.chatbotService.postWelcomeSteps();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const message = await _super(thread, body, params);
|
const message = await super.post(thread, body, params);
|
||||||
if (!message) {
|
if (!message) {
|
||||||
this.notificationService.add(_t("Session expired... Please refresh and try again."));
|
this.notificationService.add(_t("Session expired... Please refresh and try again."));
|
||||||
this.chatWindowService.close(chatWindow);
|
this.chatWindowService.close(chatWindow);
|
||||||
@@ -111,7 +110,7 @@ patch(ThreadService.prototype, "im_livechat", {
|
|||||||
|
|
||||||
insert(data) {
|
insert(data) {
|
||||||
const isUnknown = !(createLocalId(data.model, data.id) in this.store.threads);
|
const isUnknown = !(createLocalId(data.model, data.id) in this.store.threads);
|
||||||
const thread = this._super(...arguments);
|
const thread = super.insert(...arguments);
|
||||||
if (thread.type === "livechat" && isUnknown) {
|
if (thread.type === "livechat" && isUnknown) {
|
||||||
if (
|
if (
|
||||||
this.livechatService.displayWelcomeMessage &&
|
this.livechatService.displayWelcomeMessage &&
|
||||||
@@ -154,7 +153,7 @@ patch(ThreadService.prototype, "im_livechat", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async update(thread, data) {
|
async update(thread, data) {
|
||||||
this._super(...arguments);
|
super.update(...arguments);
|
||||||
if (data.operator_pid) {
|
if (data.operator_pid) {
|
||||||
thread.operator = this.personaService.insert({
|
thread.operator = this.personaService.insert({
|
||||||
type: "partner",
|
type: "partner",
|
||||||
@@ -166,7 +165,7 @@ patch(ThreadService.prototype, "im_livechat", {
|
|||||||
|
|
||||||
avatarUrl(author, thread) {
|
avatarUrl(author, thread) {
|
||||||
if (thread.type !== "livechat") {
|
if (thread.type !== "livechat") {
|
||||||
return this._super(...arguments);
|
return super.avatarUrl(...arguments);
|
||||||
}
|
}
|
||||||
const isFromOperator =
|
const isFromOperator =
|
||||||
author && author.id !== this.livechatService.options.current_partner_id;
|
author && author.id !== this.livechatService.options.current_partner_id;
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import { session } from "@web/session";
|
|||||||
|
|
||||||
Message.props.push("isTypingMessage?");
|
Message.props.push("isTypingMessage?");
|
||||||
|
|
||||||
patch(Message.prototype, "im_livechat", {
|
patch(Message.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super();
|
super.setup();
|
||||||
this.session = session;
|
this.session = session;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import { useService } from "@web/core/utils/hooks";
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { session } from "@web/session";
|
import { session } from "@web/session";
|
||||||
|
|
||||||
patch(Thread.prototype, "im_livechat", {
|
patch(Thread.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super();
|
super.setup();
|
||||||
this.session = session;
|
this.session = session;
|
||||||
this.chatbotService = useState(useService("im_livechat.chatbot"));
|
this.chatbotService = useState(useService("im_livechat.chatbot"));
|
||||||
this.livechatService = useState(useService("im_livechat.livechat"));
|
this.livechatService = useState(useService("im_livechat.livechat"));
|
||||||
|
|||||||
+2
-2
@@ -6,10 +6,10 @@ import { serverUrl } from "@im_livechat/embed/livechat_data";
|
|||||||
|
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(busParametersService, "im_livechat", {
|
patch(busParametersService, {
|
||||||
start() {
|
start() {
|
||||||
return {
|
return {
|
||||||
...this._super(...arguments),
|
...super.start(...arguments),
|
||||||
serverURL: serverUrl.replace(/\/+$/, ""),
|
serverURL: serverUrl.replace(/\/+$/, ""),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { memoize } from "@web/core/utils/functions";
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { session } from "@web/session";
|
import { session } from "@web/session";
|
||||||
|
|
||||||
patch(loader, "im_livechat/emoji_loader", {
|
patch(loader, {
|
||||||
loadEmoji: memoize(() =>
|
loadEmoji: memoize(() =>
|
||||||
loadBundle({
|
loadBundle({
|
||||||
jsLibs: [`${session.origin}/im_livechat/emoji_bundle`],
|
jsLibs: [`${session.origin}/im_livechat/emoji_bundle`],
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { OverlayContainer } from "@web/core/overlay/overlay_container";
|
import { OverlayContainer } from "@web/core/overlay/overlay_container";
|
||||||
|
|
||||||
patch(OverlayContainer.prototype, "im_livechat", {
|
patch(OverlayContainer.prototype, {
|
||||||
isVisible(overlay) {
|
isVisible(overlay) {
|
||||||
const targetInShadow = overlay.props.target?.getRootNode() instanceof ShadowRoot;
|
const targetInShadow = overlay.props.target?.getRootNode() instanceof ShadowRoot;
|
||||||
return targetInShadow ? this.env.inShadow : !this.env.inShadow;
|
return targetInShadow ? this.env.inShadow : !this.env.inShadow;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { ListRenderer } from "@web/views/list/list_renderer";
|
|||||||
|
|
||||||
const fieldRegistry = registry.category("fields");
|
const fieldRegistry = registry.category("fields");
|
||||||
|
|
||||||
patch(X2ManyFieldDialog.prototype, "chatbot_script_step_sequence", {
|
patch(X2ManyFieldDialog.prototype, {
|
||||||
/**
|
/**
|
||||||
* Dirty patching of the 'X2ManyFieldDialog'.
|
* Dirty patching of the 'X2ManyFieldDialog'.
|
||||||
* It is done to force the "save and new" to close the dialog first, and then click again on
|
* It is done to force the "save and new" to close the dialog first, and then click again on
|
||||||
@@ -24,7 +24,7 @@ patch(X2ManyFieldDialog.prototype, "chatbot_script_step_sequence", {
|
|||||||
*/
|
*/
|
||||||
async save({ saveAndNew }) {
|
async save({ saveAndNew }) {
|
||||||
if (this.record.resModel !== "chatbot.script.step") {
|
if (this.record.resModel !== "chatbot.script.step") {
|
||||||
return this._super(...arguments);
|
return super.save(...arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (await this.record.checkValidity()) {
|
if (await this.record.checkValidity()) {
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ import { MessagingMenu } from "@mail/core/web/messaging_menu";
|
|||||||
import { _t } from "@web/core/l10n/translation";
|
import { _t } from "@web/core/l10n/translation";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(MessagingMenu.prototype, "im_livechat", {
|
patch(MessagingMenu.prototype, {
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
tabToThreadType(tab) {
|
tabToThreadType(tab) {
|
||||||
const threadTypes = this._super(tab);
|
const threadTypes = super.tabToThreadType(tab);
|
||||||
if (tab === "chat" && !this.ui.isSmall) {
|
if (tab === "chat" && !this.ui.isSmall) {
|
||||||
threadTypes.push("livechat");
|
threadTypes.push("livechat");
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@ patch(MessagingMenu.prototype, "im_livechat", {
|
|||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
get tabs() {
|
get tabs() {
|
||||||
const items = this._super();
|
const items = super.tabs;
|
||||||
const hasLivechats = Object.values(this.store.threads).some(
|
const hasLivechats = Object.values(this.store.threads).some(
|
||||||
({ type }) => type === "livechat"
|
({ type }) => type === "livechat"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import "@mail/discuss/core/web/message_patch"; // dependency ordering
|
|||||||
|
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(Message.prototype, "im_livechat/web", {
|
patch(Message.prototype, {
|
||||||
hasOpenChatFeature() {
|
hasOpenChatFeature() {
|
||||||
return this.message.originThread?.channel?.channel_type === "livechat"
|
return this.message.originThread?.channel?.channel_type === "livechat"
|
||||||
? false
|
? false
|
||||||
: this._super();
|
: super.hasOpenChatFeature();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -69,10 +69,10 @@ export async function loadDefaultConfig() {
|
|||||||
return livechatChannelId;
|
return livechatChannelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
patch(App.prototype, "im_livechat", {
|
patch(App.prototype, {
|
||||||
mount() {
|
mount() {
|
||||||
registerCleanup(() => this.destroy());
|
registerCleanup(() => this.destroy());
|
||||||
return this._super(...arguments);
|
return super.mount(...arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ export async function start({ mockRPC } = {}) {
|
|||||||
const livechatButtonAvailableDeferred = makeDeferred();
|
const livechatButtonAvailableDeferred = makeDeferred();
|
||||||
patchWithCleanup(LivechatButton.prototype, {
|
patchWithCleanup(LivechatButton.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super(...arguments);
|
super.setup(...arguments);
|
||||||
onMounted(() => livechatButtonAvailableDeferred.resolve());
|
onMounted(() => livechatButtonAvailableDeferred.resolve());
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||||
|
|
||||||
patch(MockServer.prototype, "im_livechat/controllers/main", {
|
patch(MockServer.prototype, {
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
@@ -50,7 +50,7 @@ patch(MockServer.prototype, "im_livechat/controllers/main", {
|
|||||||
if (route === "/im_livechat/chat_history") {
|
if (route === "/im_livechat/chat_history") {
|
||||||
return this._mockRouteImLivechatChatHistory(args.uuid, args.last_id, args.limit);
|
return this._mockRouteImLivechatChatHistory(args.uuid, args.last_id, args.limit);
|
||||||
}
|
}
|
||||||
return this._super(...arguments);
|
return super._performRPC(...arguments);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Simulates the `/im_livechat/get_session` route.
|
* Simulates the `/im_livechat/get_session` route.
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ import "@mail/../tests/helpers/mock_server/models/discuss_channel"; // ensure ma
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||||
|
|
||||||
patch(MockServer.prototype, "im_livechat/models/discuss_channel", {
|
patch(MockServer.prototype, {
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
_mockDiscussChannelChannelInfo(ids) {
|
_mockDiscussChannelChannelInfo(ids) {
|
||||||
const channelInfos = this._super(...arguments);
|
const channelInfos = super._mockDiscussChannelChannelInfo(...arguments);
|
||||||
for (const channelInfo of channelInfos) {
|
for (const channelInfo of channelInfos) {
|
||||||
const channel = this.getRecords("discuss.channel", [["id", "=", channelInfo.id]])[0];
|
const channel = this.getRecords("discuss.channel", [["id", "=", channelInfo.id]])[0];
|
||||||
channelInfo["channel"]["anonymous_name"] = channel.anonymous_name;
|
channelInfo["channel"]["anonymous_name"] = channel.anonymous_name;
|
||||||
|
|||||||
+2
-2
@@ -5,7 +5,7 @@ import "@mail/../tests/helpers/mock_server/models/discuss_channel_member"; // en
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||||
|
|
||||||
patch(MockServer.prototype, "im_livechat/models/discuss_channel_member", {
|
patch(MockServer.prototype, {
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
@@ -37,6 +37,6 @@ patch(MockServer.prototype, "im_livechat/models/discuss_channel_member", {
|
|||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
return this._super(ids);
|
return super._mockDiscussChannelMember_GetPartnerData(ids);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||||
|
|
||||||
patch(MockServer.prototype, "im_livechat/models/im_livechat_channel", {
|
patch(MockServer.prototype, {
|
||||||
/**
|
/**
|
||||||
* Simulates `_compute_available_operator_ids` on `im_livechat.channel`.
|
* Simulates `_compute_available_operator_ids` on `im_livechat.channel`.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import "@mail/../tests/helpers/mock_server/models/res_partner"; // ensure mail o
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||||
|
|
||||||
patch(MockServer.prototype, "im_livechat/models/res_partner", {
|
patch(MockServer.prototype, {
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
@@ -19,13 +19,13 @@ patch(MockServer.prototype, "im_livechat/models/res_partner", {
|
|||||||
["channel_type", "=", "livechat"],
|
["channel_type", "=", "livechat"],
|
||||||
["channel_member_ids", "in", members.map((member) => member.id)],
|
["channel_member_ids", "in", members.map((member) => member.id)],
|
||||||
]);
|
]);
|
||||||
return [...this._super(ids), ...livechats];
|
return [...super._mockResPartner_GetChannelsAsMember(ids), ...livechats];
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
_mockResPartnerSearchForChannelInvite(search_term, channel_id, limit = 30) {
|
_mockResPartnerSearchForChannelInvite(search_term, channel_id, limit = 30) {
|
||||||
const result = this._super(search_term, channel_id, limit);
|
const result = super._mockResPartnerSearchForChannelInvite(search_term, channel_id, limit);
|
||||||
const [channel] = this.pyEnv["discuss.channel"].searchRead([["id", "=", channel_id]]);
|
const [channel] = this.pyEnv["discuss.channel"].searchRead([["id", "=", channel_id]]);
|
||||||
if (channel.channel_type !== "livechat") {
|
if (channel.channel_type !== "livechat") {
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import { patch } from "@web/core/utils/patch";
|
|||||||
import { registry } from "@web/core/registry";
|
import { registry } from "@web/core/registry";
|
||||||
import "@account/js/tours/account";
|
import "@account/js/tours/account";
|
||||||
|
|
||||||
patch(registry.category("web_tour.tours").get("account_tour"), "patch_account_tour", {
|
patch(registry.category("web_tour.tours").get("account_tour"), {
|
||||||
steps() {
|
steps() {
|
||||||
const originalSteps = this._super();
|
const originalSteps = super.steps();
|
||||||
// Remove the step suggesting to change the name as it is done another way (document number)
|
// Remove the step suggesting to change the name as it is done another way (document number)
|
||||||
const filteredSteps = originalSteps.filter((step) => step.trigger != "input[name=name]");
|
const filteredSteps = originalSteps.filter((step) => step.trigger != "input[name=name]");
|
||||||
const stepIndex = filteredSteps.findIndex((step) => step.trigger == 'div[name=partner_id] input');
|
const stepIndex = filteredSteps.findIndex((step) => step.trigger == 'div[name=partner_id] input');
|
||||||
|
|||||||
@@ -3,9 +3,8 @@
|
|||||||
import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen";
|
import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(PaymentScreen.prototype, "l10n_co_pos.PaymentScreen", {
|
patch(PaymentScreen.prototype, {
|
||||||
async _postPushOrderResolve(order, order_server_ids) {
|
async _postPushOrderResolve(order, order_server_ids) {
|
||||||
const _super = this._super;
|
|
||||||
try {
|
try {
|
||||||
if (this.pos.is_colombian_country()) {
|
if (this.pos.is_colombian_country()) {
|
||||||
const result = await this.orm.searchRead(
|
const result = await this.orm.searchRead(
|
||||||
@@ -18,6 +17,6 @@ patch(PaymentScreen.prototype, "l10n_co_pos.PaymentScreen", {
|
|||||||
} catch {
|
} catch {
|
||||||
// FIXME this doesn't seem correct but is equivalent to return in finally which we had before.
|
// FIXME this doesn't seem correct but is equivalent to return in finally which we had before.
|
||||||
}
|
}
|
||||||
return _super(...arguments);
|
return super._postPushOrderResolve(...arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ import { PosStore } from "@point_of_sale/app/store/pos_store";
|
|||||||
import { Order } from "@point_of_sale/app/store/models";
|
import { Order } from "@point_of_sale/app/store/models";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(PosStore.prototype, "l10n_co_pos.PosStore", {
|
patch(PosStore.prototype, {
|
||||||
is_colombian_country() {
|
is_colombian_country() {
|
||||||
return this.company.country?.code === "CO";
|
return this.company.country?.code === "CO";
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
patch(Order.prototype, "l10n_co_pos.Order", {
|
patch(Order.prototype, {
|
||||||
export_for_printing() {
|
export_for_printing() {
|
||||||
const result = this._super(...arguments);
|
const result = super.export_for_printing(...arguments);
|
||||||
result.l10n_co_dian = this.get_l10n_co_dian();
|
result.l10n_co_dian = this.get_l10n_co_dian();
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
@@ -23,7 +23,7 @@ patch(Order.prototype, "l10n_co_pos.Order", {
|
|||||||
return this.l10n_co_dian;
|
return this.l10n_co_dian;
|
||||||
},
|
},
|
||||||
wait_for_push_order() {
|
wait_for_push_order() {
|
||||||
var result = this._super(...arguments);
|
var result = super.wait_for_push_order(...arguments);
|
||||||
result = Boolean(result || this.pos.is_colombian_country());
|
result = Boolean(result || this.pos.is_colombian_country());
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import { patch } from "@web/core/utils/patch";
|
|||||||
import { ClosePosPopup } from "@point_of_sale/app/navbar/closing_popup/closing_popup";
|
import { ClosePosPopup } from "@point_of_sale/app/navbar/closing_popup/closing_popup";
|
||||||
import { onMounted } from "@odoo/owl";
|
import { onMounted } from "@odoo/owl";
|
||||||
|
|
||||||
patch(Chrome.prototype, "l10n_fr_pos_cert.Chrome", {
|
patch(Chrome.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super(...arguments);
|
super.setup(...arguments);
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (this.pos.is_french_country() && this.pos.pos_session.start_at) {
|
if (this.pos.is_french_country() && this.pos.pos_session.start_at) {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
|
|||||||
@@ -3,9 +3,8 @@
|
|||||||
import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen";
|
import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(PaymentScreen.prototype, "l10n_fr_pos_cert.PaymentScreen", {
|
patch(PaymentScreen.prototype, {
|
||||||
async _postPushOrderResolve(order, order_server_ids) {
|
async _postPushOrderResolve(order, order_server_ids) {
|
||||||
const _super = this._super;
|
|
||||||
try {
|
try {
|
||||||
if (this.pos.is_french_country()) {
|
if (this.pos.is_french_country()) {
|
||||||
const result = await this.orm.searchRead(
|
const result = await this.orm.searchRead(
|
||||||
@@ -18,6 +17,6 @@ patch(PaymentScreen.prototype, "l10n_fr_pos_cert.PaymentScreen", {
|
|||||||
} catch {
|
} catch {
|
||||||
// FIXME this doesn't seem correct but is equivalent to return in finally which we had before.
|
// FIXME this doesn't seem correct but is equivalent to return in finally which we had before.
|
||||||
}
|
}
|
||||||
return _super(...arguments);
|
return super._postPushOrderResolve(...arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { ClosePosPopup } from "@point_of_sale/app/navbar/closing_popup/closing_popup";
|
import { ClosePosPopup } from "@point_of_sale/app/navbar/closing_popup/closing_popup";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(ClosePosPopup.prototype, "l10n_fr_pos_cert.ClosePosPopup", {
|
patch(ClosePosPopup.prototype, {
|
||||||
sessionIsOutdated() {
|
sessionIsOutdated() {
|
||||||
let isOutdated = false;
|
let isOutdated = false;
|
||||||
if (this.pos.is_french_country() && this.pos.pos_session.start_at) {
|
if (this.pos.is_french_country() && this.pos.pos_session.start_at) {
|
||||||
@@ -15,6 +15,6 @@ patch(ClosePosPopup.prototype, "l10n_fr_pos_cert.ClosePosPopup", {
|
|||||||
return isOutdated;
|
return isOutdated;
|
||||||
},
|
},
|
||||||
canCancel() {
|
canCancel() {
|
||||||
return this._super(...arguments) && !this.sessionIsOutdated();
|
return super.canCancel(...arguments) && !this.sessionIsOutdated();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
import { TicketScreen } from "@point_of_sale/app/screens/ticket_screen/ticket_screen";
|
import { TicketScreen } from "@point_of_sale/app/screens/ticket_screen/ticket_screen";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(TicketScreen.prototype, "l10n_fr_pos_cert.TicketScreen", {
|
patch(TicketScreen.prototype, {
|
||||||
shouldHideDeleteButton() {
|
shouldHideDeleteButton() {
|
||||||
return this.pos.is_french_country() || this._super(...arguments);
|
return this.pos.is_french_country() || super.shouldHideDeleteButton(...arguments);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { patch } from "@web/core/utils/patch";
|
|||||||
import { sprintf } from "@web/core/utils/strings";
|
import { sprintf } from "@web/core/utils/strings";
|
||||||
import { ErrorPopup } from "@point_of_sale/app/errors/popups/error_popup";
|
import { ErrorPopup } from "@point_of_sale/app/errors/popups/error_popup";
|
||||||
|
|
||||||
patch(PosStore.prototype, "l10n_fr_pos_cert.PosStore", {
|
patch(PosStore.prototype, {
|
||||||
is_french_country() {
|
is_french_country() {
|
||||||
var french_countries = ["FR", "MF", "MQ", "NC", "PF", "RE", "GF", "GP", "TF"];
|
var french_countries = ["FR", "MF", "MQ", "NC", "PF", "RE", "GF", "GP", "TF"];
|
||||||
if (!this.company.country) {
|
if (!this.company.country) {
|
||||||
@@ -20,19 +20,19 @@ patch(PosStore.prototype, "l10n_fr_pos_cert.PosStore", {
|
|||||||
return french_countries.includes(this.company.country?.code);
|
return french_countries.includes(this.company.country?.code);
|
||||||
},
|
},
|
||||||
disallowLineQuantityChange() {
|
disallowLineQuantityChange() {
|
||||||
const result = this._super(...arguments);
|
const result = super.disallowLineQuantityChange(...arguments);
|
||||||
return this.is_french_country() || result;
|
return this.is_french_country() || result;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
patch(Order.prototype, "l10n_fr_pos_cert.Order", {
|
patch(Order.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super(...arguments);
|
super.setup(...arguments);
|
||||||
this.l10n_fr_hash = this.l10n_fr_hash || false;
|
this.l10n_fr_hash = this.l10n_fr_hash || false;
|
||||||
this.save_to_db();
|
this.save_to_db();
|
||||||
},
|
},
|
||||||
export_for_printing() {
|
export_for_printing() {
|
||||||
var result = this._super(...arguments);
|
var result = super.export_for_printing(...arguments);
|
||||||
result.l10n_fr_hash = this.get_l10n_fr_hash();
|
result.l10n_fr_hash = this.get_l10n_fr_hash();
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
@@ -43,16 +43,16 @@ patch(Order.prototype, "l10n_fr_pos_cert.Order", {
|
|||||||
return this.l10n_fr_hash;
|
return this.l10n_fr_hash;
|
||||||
},
|
},
|
||||||
wait_for_push_order() {
|
wait_for_push_order() {
|
||||||
var result = this._super(...arguments);
|
var result = super.wait_for_push_order(...arguments);
|
||||||
result = Boolean(result || this.pos.is_french_country());
|
result = Boolean(result || this.pos.is_french_country());
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
patch(Orderline.prototype, "l10n_fr_pos_cert.Orderline", {
|
patch(Orderline.prototype, {
|
||||||
can_be_merged_with(orderline) {
|
can_be_merged_with(orderline) {
|
||||||
if (!this.pos.is_french_country()) {
|
if (!this.pos.is_french_country()) {
|
||||||
return this._super(...arguments);
|
return super.can_be_merged_with(...arguments);
|
||||||
}
|
}
|
||||||
const order = this.pos.get_order();
|
const order = this.pos.get_order();
|
||||||
const orderlines = order.orderlines;
|
const orderlines = order.orderlines;
|
||||||
@@ -61,7 +61,7 @@ patch(Orderline.prototype, "l10n_fr_pos_cert.Orderline", {
|
|||||||
if (lastOrderline.product.id !== orderline.product.id || lastOrderline.quantity < 0) {
|
if (lastOrderline.product.id !== orderline.product.id || lastOrderline.quantity < 0) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return this._super(...arguments);
|
return super.can_be_merged_with(...arguments);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import { OrderReceipt } from "@point_of_sale/app/screens/receipt_screen/receipt/receipt";
|
import { OrderReceipt } from "@point_of_sale/app/screens/receipt_screen/receipt/receipt";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(OrderReceipt.prototype, "l10n_gcc_pos.OrderReceipt", {
|
patch(OrderReceipt.prototype, {
|
||||||
get receiptEnv() {
|
get receiptEnv() {
|
||||||
const receipt_render_env = this._super(...arguments);
|
const receipt_render_env = super.receiptEnv;
|
||||||
const receipt = receipt_render_env.receipt;
|
const receipt = receipt_render_env.receipt;
|
||||||
const country = receipt_render_env.order.pos.company.country;
|
const country = receipt_render_env.order.pos.company.country;
|
||||||
receipt.is_gcc_country = country
|
receipt.is_gcc_country = country
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import { Orderline } from "@point_of_sale/app/store/models";
|
import { Orderline } from "@point_of_sale/app/store/models";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(Orderline.prototype, "l10n_in_pos.Orderline", {
|
patch(Orderline.prototype, {
|
||||||
export_for_printing() {
|
export_for_printing() {
|
||||||
const line = this._super(...arguments);
|
const line = super.export_for_printing(...arguments);
|
||||||
line.l10n_in_hsn_code = this.get_product().l10n_in_hsn_code;
|
line.l10n_in_hsn_code = this.get_product().l10n_in_hsn_code;
|
||||||
return line;
|
return line;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import { Order } from "@point_of_sale/app/store/models";
|
import { Order } from "@point_of_sale/app/store/models";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(Order.prototype, "l10n_sa_pos.Order", {
|
patch(Order.prototype, {
|
||||||
export_for_printing() {
|
export_for_printing() {
|
||||||
const result = this._super(...arguments);
|
const result = super.export_for_printing(...arguments);
|
||||||
if (this.pos.company.country && this.pos.company.country.code === "SA") {
|
if (this.pos.company.country && this.pos.company.country.code === "SA") {
|
||||||
result.is_settlement = this.is_settlement();
|
result.is_settlement = this.is_settlement();
|
||||||
if (!result.is_settlement) {
|
if (!result.is_settlement) {
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import { ChatWindow } from "@mail/core/common/chat_window";
|
|||||||
import { useService } from "@web/core/utils/hooks";
|
import { useService } from "@web/core/utils/hooks";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(ChatWindow.prototype, "mail/core/web", {
|
patch(ChatWindow.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super(...arguments);
|
super.setup(...arguments);
|
||||||
this.actionService = useService("action");
|
this.actionService = useService("action");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,9 +4,8 @@ import { ChatWindowService } from "@mail/core/common/chat_window_service";
|
|||||||
|
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(ChatWindowService.prototype, "mail/core/web", {
|
patch(ChatWindowService.prototype, {
|
||||||
async close() {
|
async close() {
|
||||||
const _super = this._super.bind(this);
|
|
||||||
if (this.ui.isSmall && !this.store.discuss.isActive) {
|
if (this.ui.isSmall && !this.store.discuss.isActive) {
|
||||||
// If we are in mobile and discuss is not open, it means the
|
// If we are in mobile and discuss is not open, it means the
|
||||||
// chat window was opened from the messaging menu. In that
|
// chat window was opened from the messaging menu. In that
|
||||||
@@ -16,6 +15,6 @@ patch(ChatWindowService.prototype, "mail/core/web", {
|
|||||||
// ensure messaging menu is opened before chat window is closed
|
// ensure messaging menu is opened before chat window is closed
|
||||||
await Promise.resolve();
|
await Promise.resolve();
|
||||||
}
|
}
|
||||||
await _super(...arguments);
|
await super.close(...arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { Dialog } from "@web/core/dialog/dialog";
|
import { Dialog } from "@web/core/dialog/dialog";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(Dialog.prototype, "mail/views/web", {
|
patch(Dialog.prototype, {
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
@@ -11,6 +11,6 @@ patch(Dialog.prototype, "mail/views/web", {
|
|||||||
if (this.data.model === "mail.compose.message") {
|
if (this.data.model === "mail.compose.message") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._super();
|
super.onEscape();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import fieldUtils from "@web/legacy/js/fields/field_utils";
|
|||||||
const format = fieldUtils.format
|
const format = fieldUtils.format
|
||||||
const formatters = registry.category("formatters");
|
const formatters = registry.category("formatters");
|
||||||
|
|
||||||
patch(Message.prototype, "mail/core/web", {
|
patch(Message.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super(...arguments);
|
super.setup(...arguments);
|
||||||
this.action = useService("action");
|
this.action = useService("action");
|
||||||
this.userService = useService("user");
|
this.userService = useService("user");
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { Thread } from "@mail/core/common/thread_model";
|
|||||||
|
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(Thread.prototype, "mail/core/web", {
|
patch(Thread.prototype, {
|
||||||
/**
|
/**
|
||||||
* @returns {import("@mail/core/web/activity_model").Activity[]}
|
* @returns {import("@mail/core/web/activity_model").Activity[]}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ import { patch } from "@web/core/utils/patch";
|
|||||||
|
|
||||||
let nextId = 1;
|
let nextId = 1;
|
||||||
|
|
||||||
patch(ThreadService.prototype, "mail/core/web", {
|
patch(ThreadService.prototype, {
|
||||||
setup(env, services) {
|
setup(env, services) {
|
||||||
this._super(env, services);
|
super.setup(env, services);
|
||||||
this.action = services.action;
|
this.action = services.action;
|
||||||
/** @type {import("@mail/core/common/attachment_service").AttachmentService} */
|
/** @type {import("@mail/core/common/attachment_service").AttachmentService} */
|
||||||
this.attachmentService = services["mail.attachment"];
|
this.attachmentService = services["mail.attachment"];
|
||||||
@@ -182,7 +182,7 @@ patch(ThreadService.prototype, "mail/core/web", {
|
|||||||
if (chatWindow) {
|
if (chatWindow) {
|
||||||
this.chatWindowService.close(chatWindow);
|
this.chatWindowService.close(chatWindow);
|
||||||
}
|
}
|
||||||
this._super(...arguments);
|
super.leaveChannel(...arguments);
|
||||||
},
|
},
|
||||||
async loadMoreFollowers(thread) {
|
async loadMoreFollowers(thread) {
|
||||||
const followers = await this.orm.call(thread.model, "message_get_followers", [
|
const followers = await this.orm.call(thread.model, "message_get_followers", [
|
||||||
@@ -217,7 +217,7 @@ patch(ThreadService.prototype, "mail/core/web", {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._super(thread, replaceNewMessageChatWindow);
|
super.open(thread, replaceNewMessageChatWindow);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @param {import("@mail/core/common/follower_model").Follower} follower
|
* @param {import("@mail/core/common/follower_model").Follower} follower
|
||||||
@@ -240,7 +240,7 @@ patch(ThreadService.prototype, "mail/core/web", {
|
|||||||
if (chatWindow) {
|
if (chatWindow) {
|
||||||
this.chatWindowService.close(chatWindow);
|
this.chatWindowService.close(chatWindow);
|
||||||
}
|
}
|
||||||
this._super(...arguments);
|
super.unpin(...arguments);
|
||||||
},
|
},
|
||||||
_openChatWindow(thread, replaceNewMessageChatWindow) {
|
_openChatWindow(thread, replaceNewMessageChatWindow) {
|
||||||
const chatWindow = this.chatWindowService.insert({
|
const chatWindow = this.chatWindowService.insert({
|
||||||
@@ -256,7 +256,7 @@ patch(ThreadService.prototype, "mail/core/web", {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
patch(threadService, "mail/core/web", {
|
patch(threadService, {
|
||||||
dependencies: [
|
dependencies: [
|
||||||
...threadService.dependencies,
|
...threadService.dependencies,
|
||||||
"action",
|
"action",
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import { patch } from "@web/core/utils/patch";
|
|||||||
|
|
||||||
Object.assign(Discuss.components, { Call });
|
Object.assign(Discuss.components, { Call });
|
||||||
|
|
||||||
patch(Discuss.prototype, "discuss/call/common", {
|
patch(Discuss.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super(...arguments);
|
super.setup(...arguments);
|
||||||
this.rtc = useRtc();
|
this.rtc = useRtc();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ import { useRtc } from "@mail/discuss/call/common/rtc_hook";
|
|||||||
import { browser } from "@web/core/browser/browser";
|
import { browser } from "@web/core/browser/browser";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(DiscussPublic.prototype, "discuss/call/public", {
|
patch(DiscussPublic.prototype, {
|
||||||
setup() {
|
setup() {
|
||||||
this._super(...arguments);
|
super.setup(...arguments);
|
||||||
this.rtc = useRtc();
|
this.rtc = useRtc();
|
||||||
},
|
},
|
||||||
async displayChannel() {
|
async displayChannel() {
|
||||||
this._super();
|
super.displayChannel();
|
||||||
const video = browser.localStorage.getItem("discuss_call_preview_join_video");
|
const video = browser.localStorage.getItem("discuss_call_preview_join_video");
|
||||||
const mute = browser.localStorage.getItem("discuss_call_preview_join_mute");
|
const mute = browser.localStorage.getItem("discuss_call_preview_join_mute");
|
||||||
if (this.thread.defaultDisplayMode === "video_full_screen") {
|
if (this.thread.defaultDisplayMode === "video_full_screen") {
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import { useChildSubEnv, useEffect, useState } from "@odoo/owl";
|
|||||||
|
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(Discuss.prototype, "discuss/call/web", {
|
patch(Discuss.prototype, {
|
||||||
setup(...args) {
|
setup(...args) {
|
||||||
this._super(...args);
|
super.setup(...args);
|
||||||
const state = useState({ openInviteButton: 0 });
|
const state = useState({ openInviteButton: 0 });
|
||||||
useChildSubEnv({
|
useChildSubEnv({
|
||||||
onStartMeeting: () => {
|
onStartMeeting: () => {
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import { Attachment } from "@mail/core/common/attachment_model";
|
|||||||
|
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(Attachment.prototype, "discuss/core/common", {
|
patch(Attachment.prototype, {
|
||||||
get isDeletable() {
|
get isDeletable() {
|
||||||
if (this.message && this.originThread?.model === "discuss.channel") {
|
if (this.message && this.originThread?.model === "discuss.channel") {
|
||||||
return this.message.editable;
|
return this.message.editable;
|
||||||
}
|
}
|
||||||
return this._super();
|
return super.isDeletable;
|
||||||
},
|
},
|
||||||
get urlRoute() {
|
get urlRoute() {
|
||||||
if (!this.accessToken && this.originThread?.model === "discuss.channel") {
|
if (!this.accessToken && this.originThread?.model === "discuss.channel") {
|
||||||
@@ -17,6 +17,6 @@ patch(Attachment.prototype, "discuss/core/common", {
|
|||||||
? `/discuss/channel/${this.originThread.id}/image/${this.id}`
|
? `/discuss/channel/${this.originThread.id}/image/${this.id}`
|
||||||
: `/discuss/channel/${this.originThread.id}/attachment/${this.id}`;
|
: `/discuss/channel/${this.originThread.id}/attachment/${this.id}`;
|
||||||
}
|
}
|
||||||
return this._super();
|
return super.urlRoute;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import { patch } from "@web/core/utils/patch";
|
|||||||
|
|
||||||
const commandRegistry = registry.category("discuss.channel_commands");
|
const commandRegistry = registry.category("discuss.channel_commands");
|
||||||
|
|
||||||
patch(SuggestionService.prototype, "discuss/core/common", {
|
patch(SuggestionService.prototype, {
|
||||||
getSupportedDelimiters(thread) {
|
getSupportedDelimiters(thread) {
|
||||||
const res = this._super(thread);
|
const res = super.getSupportedDelimiters(thread);
|
||||||
return thread?.model === "discuss.channel" ? [...res, ["/", 0]] : res;
|
return thread?.model === "discuss.channel" ? [...res, ["/", 0]] : res;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -20,7 +20,7 @@ patch(SuggestionService.prototype, "discuss/core/common", {
|
|||||||
if (delimiter === "/") {
|
if (delimiter === "/") {
|
||||||
return this.searchChannelCommand(cleanTerm(term), thread, sort);
|
return this.searchChannelCommand(cleanTerm(term), thread, sort);
|
||||||
}
|
}
|
||||||
return this._super(...arguments);
|
return super.searchSuggestions(...arguments);
|
||||||
},
|
},
|
||||||
searchChannelCommand(cleanedSearchTerm, thread, sort) {
|
searchChannelCommand(cleanedSearchTerm, thread, sort) {
|
||||||
if (!thread.isChannel) {
|
if (!thread.isChannel) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { assignDefined } from "@mail/utils/common/misc";
|
|||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
import { url } from "@web/core/utils/urls";
|
import { url } from "@web/core/utils/urls";
|
||||||
|
|
||||||
patch(Thread.prototype, "discuss/core/common", {
|
patch(Thread.prototype, {
|
||||||
get imgUrl() {
|
get imgUrl() {
|
||||||
if (this.type === "channel" || this.type === "group") {
|
if (this.type === "channel" || this.type === "group") {
|
||||||
return url(
|
return url(
|
||||||
@@ -17,6 +17,6 @@ patch(Thread.prototype, "discuss/core/common", {
|
|||||||
if (this.type === "chat") {
|
if (this.type === "chat") {
|
||||||
return `/web/image/res.partner/${this.chatPartnerId}/avatar_128`;
|
return `/web/image/res.partner/${this.chatPartnerId}/avatar_128`;
|
||||||
}
|
}
|
||||||
return this._super();
|
return super.imgUrl;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { patch } from "@web/core/utils/patch";
|
|||||||
|
|
||||||
const commandRegistry = registry.category("discuss.channel_commands");
|
const commandRegistry = registry.category("discuss.channel_commands");
|
||||||
|
|
||||||
patch(ThreadService.prototype, "discuss/core/common", {
|
patch(ThreadService.prototype, {
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
* @param {import("@mail/core/common/thread_model").Thread} thread
|
* @param {import("@mail/core/common/thread_model").Thread} thread
|
||||||
@@ -25,6 +25,6 @@ patch(ThreadService.prototype, "discuss/core/common", {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this._super(...arguments);
|
return super.post(...arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import { ChatWindowService } from "@mail/core/common/chat_window_service";
|
|||||||
|
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(ChatWindowService.prototype, "discuss/core/web", {
|
patch(ChatWindowService.prototype, {
|
||||||
close(chatWindow) {
|
close(chatWindow) {
|
||||||
this._super(...arguments);
|
super.close(...arguments);
|
||||||
this.notifyState(chatWindow);
|
this.notifyState(chatWindow);
|
||||||
},
|
},
|
||||||
hide(chatWindow) {
|
hide(chatWindow) {
|
||||||
this._super(...arguments);
|
super.hide(...arguments);
|
||||||
this.notifyState(chatWindow);
|
this.notifyState(chatWindow);
|
||||||
},
|
},
|
||||||
notifyState(chatWindow) {
|
notifyState(chatWindow) {
|
||||||
@@ -29,15 +29,15 @@ patch(ChatWindowService.prototype, "discuss/core/web", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
open() {
|
open() {
|
||||||
const chatWindow = this._super(...arguments);
|
const chatWindow = super.open(...arguments);
|
||||||
this.notifyState(chatWindow);
|
this.notifyState(chatWindow);
|
||||||
},
|
},
|
||||||
show(chatWindow) {
|
show(chatWindow) {
|
||||||
this._super(...arguments);
|
super.show(...arguments);
|
||||||
this.notifyState(chatWindow);
|
this.notifyState(chatWindow);
|
||||||
},
|
},
|
||||||
toggleFold(chatWindow) {
|
toggleFold(chatWindow) {
|
||||||
this._super(...arguments);
|
super.toggleFold(...arguments);
|
||||||
this.notifyState(chatWindow);
|
this.notifyState(chatWindow);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ import { markEventHandled } from "@web/core/utils/misc";
|
|||||||
import { _t } from "@web/core/l10n/translation";
|
import { _t } from "@web/core/l10n/translation";
|
||||||
import { patch } from "@web/core/utils/patch";
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
|
||||||
patch(Message.prototype, "discuss/core/web", {
|
patch(Message.prototype, {
|
||||||
getAuthorText() {
|
getAuthorText() {
|
||||||
return this.hasOpenChatFeature() ? _t("Open chat") : this._super();
|
return this.hasOpenChatFeature() ? _t("Open chat") : super.getAuthorText();
|
||||||
},
|
},
|
||||||
hasAuthorClickable() {
|
hasAuthorClickable() {
|
||||||
return (
|
return (
|
||||||
this._super() &&
|
super.hasAuthorClickable() &&
|
||||||
this.message.author.type !== "guest" &&
|
this.message.author.type !== "guest" &&
|
||||||
this.message.originThread?.channel?.channel_type !== "chat"
|
this.message.originThread?.channel?.channel_type !== "chat"
|
||||||
);
|
);
|
||||||
@@ -27,6 +27,6 @@ patch(Message.prototype, "discuss/core/web", {
|
|||||||
this.threadService.openChat({ partnerId: this.message.author.id });
|
this.threadService.openChat({ partnerId: this.message.author.id });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return this._super(ev);
|
return super.onClickAuthor(ev);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user