[IMP] web: improve patch function
This PR refactors the patch function in order to simplify its code but also and most of all remove the `this._super` bound on each patched method call. The patch function now supports the javascript keyword `super` to get the parent's property. This removes constraints we had with `this._super`. We had to create a rather complicated intermediate function to bind `this._super` and this function was called each time before we called a patched method. It was annoying for debugging but necessary. Because of this intermediate function `this._super` was also had to re-bind each time we entered a patched method which was annoying with async method, we had to save the parent method in the patch before awaiting its execution. Finally, not a big issue but still, objects could not have a `_super` property as it would be hidden in the patch. task 3410198 closes odoo/odoo#125716 Related: odoo/enterprise#43852 Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
This commit is contained in:
@@ -32,7 +32,7 @@ QUnit.module("Views", {}, function (hooks) {
|
||||
});
|
||||
patchWithCleanup(AccountMoveFormRenderer.prototype, {
|
||||
saveBeforeTabChange() {
|
||||
this._super();
|
||||
super.saveBeforeTabChange();
|
||||
assert.step("tab saved");
|
||||
},
|
||||
});
|
||||
|
||||
@@ -104,7 +104,7 @@ QUnit.module("Fields", (hooks) => {
|
||||
patchWithCleanup(FormController.prototype, {
|
||||
onPagerUpdate() {
|
||||
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);
|
||||
|
||||
patch(BarcodeParser, "barcodes_gs1_nomenclature.BarcodeParser static", {
|
||||
patch(BarcodeParser, {
|
||||
barcodeNomenclatureFields: [
|
||||
...BarcodeParser.barcodeNomenclatureFields,
|
||||
"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
|
||||
*
|
||||
* @param {string} gs1Date YYMMDD string date, length must be 6
|
||||
* @returns {Date}
|
||||
*/
|
||||
gs1_date_to_date: function(gs1Date) {
|
||||
gs1_date_to_date(gs1Date) {
|
||||
// See 7.12 Determination of century in dates:
|
||||
// https://www.gs1.org/sites/default/files/docs/barcodes/GS1_General_Specifications.pdfDetermination of century
|
||||
const now = new Date();
|
||||
@@ -58,7 +58,7 @@ patch(BarcodeParser.prototype, "barcodes_gs1_nomenclature.BarcodeParser", {
|
||||
* @param {Object} rule Matched Barcode Rule
|
||||
* @returns {Object|null}
|
||||
*/
|
||||
parse_gs1_rule_pattern: function(match, rule) {
|
||||
parse_gs1_rule_pattern(match, rule) {
|
||||
const result = {
|
||||
rule: Object.assign({}, rule),
|
||||
ai: match[1],
|
||||
@@ -103,7 +103,7 @@ patch(BarcodeParser.prototype, "barcodes_gs1_nomenclature.BarcodeParser", {
|
||||
* @param {string} barcode
|
||||
* @returns {Array} Array of object
|
||||
*/
|
||||
gs1_decompose_extanded: function(barcode) {
|
||||
gs1_decompose_extanded(barcode) {
|
||||
const results = [];
|
||||
const rules = this.nomenclature.rules.filter(rule => rule.encoding === 'gs1-128');
|
||||
const separatorReg = FNC1_CHAR + "?";
|
||||
@@ -137,10 +137,10 @@ patch(BarcodeParser.prototype, "barcodes_gs1_nomenclature.BarcodeParser", {
|
||||
* @override
|
||||
* @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) {
|
||||
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";
|
||||
|
||||
|
||||
patch(barcodeService, 'barcodes_gs1_nomenclature', {
|
||||
patch(barcodeService, {
|
||||
// Use the regex given by the session, else use an impossible one
|
||||
gs1SeparatorRegex: new RegExp(session.gs1_group_separator_encodings || '.^', 'g'),
|
||||
|
||||
cleanBarcode: function(barcode) {
|
||||
cleanBarcode(barcode) {
|
||||
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,
|
||||
"Received the correct error context"
|
||||
);
|
||||
this._super();
|
||||
super.setup();
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1054,7 +1054,7 @@ QUnit.module("Base Import Tests", (hooks) => {
|
||||
|
||||
patchWithCleanup(ImportBlockUI.prototype, {
|
||||
setup() {
|
||||
this._super();
|
||||
super.setup();
|
||||
if (this.props.message === "Importing") {
|
||||
assert.step("Block UI received the right text");
|
||||
}
|
||||
@@ -1063,7 +1063,7 @@ QUnit.module("Base Import Tests", (hooks) => {
|
||||
|
||||
patchWithCleanup(ImportDataProgress.prototype, {
|
||||
setup() {
|
||||
this._super();
|
||||
super.setup();
|
||||
useEffect(
|
||||
() => {
|
||||
if (this.props.importProgress.step === 1) {
|
||||
@@ -1146,7 +1146,7 @@ QUnit.module("Base Import Tests", (hooks) => {
|
||||
|
||||
patchWithCleanup(ImportBlockUI.prototype, {
|
||||
setup() {
|
||||
this._super();
|
||||
super.setup();
|
||||
if (this.props.message === "Testing") {
|
||||
assert.step("Block UI received the right text");
|
||||
}
|
||||
@@ -1155,7 +1155,7 @@ QUnit.module("Base Import Tests", (hooks) => {
|
||||
|
||||
patchWithCleanup(ImportDataProgress.prototype, {
|
||||
setup() {
|
||||
this._super();
|
||||
super.setup();
|
||||
useEffect(
|
||||
() => {
|
||||
if (this.props.importProgress.step === 1) {
|
||||
|
||||
@@ -24,7 +24,7 @@ QUnit.module("Bus Assets WatchDog", (hooks) => {
|
||||
serviceRegistry.add("multi_tab", multiTabService);
|
||||
patchWithCleanup(browser, {
|
||||
setTimeout(fn) {
|
||||
return this._super(fn, 0);
|
||||
return super.setTimeout(fn, 0);
|
||||
},
|
||||
location: {
|
||||
reload: () => assert.step("reloadPage"),
|
||||
|
||||
@@ -113,8 +113,7 @@ QUnit.module(
|
||||
window,
|
||||
{
|
||||
setTimeout: (callback) => oldSetTimeout(callback, 0),
|
||||
},
|
||||
{ pure: true }
|
||||
}
|
||||
);
|
||||
|
||||
const pyEnv = await startServer();
|
||||
@@ -217,7 +216,7 @@ QUnit.module(
|
||||
if (eventName === "pagehide") {
|
||||
return;
|
||||
}
|
||||
this._super(eventName, callback);
|
||||
super.addEventListener(eventName, callback);
|
||||
},
|
||||
});
|
||||
const secondEnv = await makeTestEnv({ activateMockServer: true });
|
||||
@@ -255,22 +254,22 @@ QUnit.module(
|
||||
QUnit.test("two tabs calling addChannel simultaneously", async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
const channelPatch = {
|
||||
const channelPatch = () => ({
|
||||
addChannel(channel) {
|
||||
assert.step("Tab " + this.__tabId__ + ": addChannel " + channel);
|
||||
this._super.apply(this, arguments);
|
||||
super.addChannel(...arguments);
|
||||
},
|
||||
deleteChannel(channel) {
|
||||
assert.step("Tab " + this.__tabId__ + ": deleteChannel " + channel);
|
||||
this._super.apply(this, arguments);
|
||||
super.deleteChannel(...arguments);
|
||||
},
|
||||
};
|
||||
});
|
||||
const firstTabEnv = await makeTestEnv({ activateMockServer: true });
|
||||
const secondTabEnv = await makeTestEnv({ activateMockServer: true });
|
||||
firstTabEnv.services["bus_service"].__tabId__ = 1;
|
||||
secondTabEnv.services["bus_service"].__tabId__ = 2;
|
||||
patchWithCleanup(firstTabEnv.services["bus_service"], channelPatch);
|
||||
patchWithCleanup(secondTabEnv.services["bus_service"], channelPatch);
|
||||
patchWithCleanup(firstTabEnv.services["bus_service"], channelPatch());
|
||||
patchWithCleanup(secondTabEnv.services["bus_service"], channelPatch());
|
||||
firstTabEnv.services["bus_service"].addChannel("alpha");
|
||||
secondTabEnv.services["bus_service"].addChannel("alpha");
|
||||
firstTabEnv.services["bus_service"].addChannel("beta");
|
||||
@@ -391,7 +390,7 @@ QUnit.module(
|
||||
assert.step(`${action} - ${data["lastNotificationId"]}`);
|
||||
updateLastNotificationDeferred.resolve();
|
||||
}
|
||||
return this._super(...arguments);
|
||||
return super._onClientMessage(...arguments);
|
||||
},
|
||||
});
|
||||
const env1 = await makeTestEnv();
|
||||
@@ -426,7 +425,7 @@ QUnit.module(
|
||||
let connectionOpenedDeferred = makeDeferred();
|
||||
patchWebsocketWorkerWithCleanup({
|
||||
_initializeConnection(client, data) {
|
||||
this._super(client, data);
|
||||
super._initializeConnection(client, data);
|
||||
connectionInitializedDeferred.resolve();
|
||||
},
|
||||
});
|
||||
@@ -466,7 +465,7 @@ QUnit.module(
|
||||
let websocketConnectedDeferred = makeDeferred();
|
||||
patchWebsocketWorkerWithCleanup({
|
||||
_initializeConnection(client, data) {
|
||||
this._super(client, data);
|
||||
super._initializeConnection(client, data);
|
||||
connectionInitializedDeferred.resolve();
|
||||
},
|
||||
});
|
||||
@@ -503,7 +502,7 @@ QUnit.module(
|
||||
patchWithCleanup(busParametersService, {
|
||||
start() {
|
||||
return {
|
||||
...this._super(...arguments),
|
||||
...super.start(...arguments),
|
||||
serverURL,
|
||||
};
|
||||
},
|
||||
@@ -517,8 +516,7 @@ QUnit.module(
|
||||
websocketCreatedDeferred.resolve();
|
||||
return new EventTarget();
|
||||
},
|
||||
},
|
||||
{ pure: true }
|
||||
}
|
||||
);
|
||||
const env = await makeTestEnv();
|
||||
env.services["bus_service"].start();
|
||||
@@ -573,7 +571,7 @@ QUnit.module(
|
||||
let openDeferred = makeDeferred();
|
||||
const worker = patchWebsocketWorkerWithCleanup({
|
||||
_onWebsocketOpen() {
|
||||
this._super();
|
||||
super._onWebsocketOpen();
|
||||
openDeferred.resolve();
|
||||
},
|
||||
_sendToServer({ event_name }) {
|
||||
@@ -589,14 +587,13 @@ QUnit.module(
|
||||
patchWithCleanup(worker.websocket, {
|
||||
close(code = WEBSOCKET_CLOSE_CODES.CLEAN, reason) {
|
||||
this.readyState = 2;
|
||||
const _super = this._super;
|
||||
if (code === WEBSOCKET_CLOSE_CODES.CLEAN) {
|
||||
closeDeferred.then(() => {
|
||||
// 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 {
|
||||
_super(code, reason);
|
||||
super.close(code, reason);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -659,8 +656,7 @@ QUnit.module(
|
||||
assert.step("worker creation");
|
||||
return new originalWorker(url, options);
|
||||
},
|
||||
},
|
||||
{ pure: true }
|
||||
}
|
||||
);
|
||||
patchWithCleanup(window.console, {
|
||||
warn(message) {
|
||||
|
||||
@@ -6,15 +6,15 @@ import { patchWebsocketWorkerWithCleanup } from "@bus/../tests/helpers/mock_webs
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||
|
||||
patch(MockServer.prototype, "bus", {
|
||||
patch(MockServer.prototype, {
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
super.init(...arguments);
|
||||
Object.assign(this, TEST_USER_IDS);
|
||||
const self = this;
|
||||
this.websocketWorker = patchWebsocketWorkerWithCleanup({
|
||||
_sendToServer(message) {
|
||||
self._performWebsocketRequest(message);
|
||||
this._super(message);
|
||||
super._sendToServer(message);
|
||||
},
|
||||
});
|
||||
this.notificationsToBeResolved = [];
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||
|
||||
patch(MockServer.prototype, "bus/models/ir_websocket", {
|
||||
patch(MockServer.prototype, {
|
||||
/**
|
||||
* Simulates `_update_presence` on `ir.websocket`.
|
||||
*
|
||||
|
||||
@@ -69,8 +69,7 @@ export function patchWebsocketWorkerWithCleanup(params = {}) {
|
||||
WebSocket: function () {
|
||||
return new WebSocketMock();
|
||||
},
|
||||
},
|
||||
{ pure: true }
|
||||
}
|
||||
);
|
||||
patchWithCleanup(websocketWorker || WebsocketWorker.prototype, params);
|
||||
websocketWorker = websocketWorker || new WebsocketWorker();
|
||||
@@ -85,8 +84,7 @@ export function patchWebsocketWorkerWithCleanup(params = {}) {
|
||||
});
|
||||
return sharedWorker;
|
||||
},
|
||||
},
|
||||
{ pure: true }
|
||||
}
|
||||
);
|
||||
registerCleanup(() => {
|
||||
if (websocketWorker) {
|
||||
|
||||
@@ -27,7 +27,7 @@ QUnit.module("bus", function () {
|
||||
if (eventName === "pagehide") {
|
||||
return;
|
||||
}
|
||||
this._super(eventName, callback);
|
||||
super.addEventListener(eventName, callback);
|
||||
},
|
||||
});
|
||||
const secondTabEnv = await makeTestEnv();
|
||||
@@ -95,7 +95,7 @@ QUnit.module("bus", function () {
|
||||
if (eventName === "pagehide") {
|
||||
return;
|
||||
}
|
||||
this._super(eventName, callback);
|
||||
super.addEventListener(eventName, callback);
|
||||
},
|
||||
});
|
||||
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
|
||||
* 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(() => {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import { ActivityListPopoverItem } from "@mail/core/web/activity_list_popover_item";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(ActivityListPopoverItem.prototype, "calendar", {
|
||||
patch(ActivityListPopoverItem.prototype, {
|
||||
get hasEditButton() {
|
||||
return this._super() && !this.props.activity.calendar_event_id;
|
||||
return super.hasEditButton && !this.props.activity.calendar_event_id;
|
||||
},
|
||||
|
||||
async onClickReschedule() {
|
||||
|
||||
@@ -5,9 +5,9 @@ import { patch } from "@web/core/utils/patch";
|
||||
import { deserializeDateTime, formatDateTime } from "@web/core/l10n/dates";
|
||||
import { localization } from "@web/core/l10n/localization";
|
||||
|
||||
patch(ActivityMenu.prototype, "calendar", {
|
||||
patch(ActivityMenu.prototype, {
|
||||
async fetchSystrayActivities() {
|
||||
await this._super();
|
||||
await super.fetchSystrayActivities();
|
||||
for (const group of Object.values(this.store.activityGroups)) {
|
||||
if (group.type === "meeting") {
|
||||
for (const meeting of group.meetings) {
|
||||
@@ -31,7 +31,7 @@ patch(ActivityMenu.prototype, "calendar", {
|
||||
clearBreadcrumbs: true,
|
||||
});
|
||||
} 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 { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(Activity.prototype, "calendar", {
|
||||
patch(Activity.prototype, {
|
||||
setup() {
|
||||
this._super();
|
||||
super.setup();
|
||||
this.orm = useService("orm");
|
||||
},
|
||||
async onClickReschedule() {
|
||||
@@ -20,7 +20,7 @@ patch(Activity.prototype, "calendar", {
|
||||
await this.orm.call("mail.activity", "unlink_w_meeting", [[this.props.data.id]]);
|
||||
this.props.onUpdate();
|
||||
} else {
|
||||
this._super();
|
||||
super.unlink();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import { ActivityService } from "@mail/core/web/activity_service";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(ActivityService.prototype, "calendar/activity_service", {
|
||||
patch(ActivityService.prototype, {
|
||||
insert(data) {
|
||||
const activity = this._super(...arguments);
|
||||
const activity = super.insert(...arguments);
|
||||
const { calendar_event_id: calendarEventId } = data;
|
||||
if (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 } });
|
||||
patchWithCleanup(ListController.prototype, {
|
||||
setup() {
|
||||
this._super();
|
||||
super.setup();
|
||||
const selectRecord = this.props.selectRecord;
|
||||
this.props.selectRecord = (...args) => {
|
||||
assert.step(`select_record ${JSON.stringify(args)}`);
|
||||
|
||||
@@ -27,7 +27,7 @@ QUnit.module("Calendar Notification", (hooks) => {
|
||||
serviceRegistry.add("multi_tab", multiTabService);
|
||||
patchWithCleanup(browser, {
|
||||
setTimeout(fn) {
|
||||
this._super(fn, 0);
|
||||
super.setTimeout(fn, 0);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { patch } from '@web/core/utils/patch';
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { MockServer } from '@web/../tests/helpers/mock_server';
|
||||
|
||||
patch(MockServer.prototype, 'calendar/models/calendar_event', {
|
||||
patch(MockServer.prototype, {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
@@ -12,6 +12,6 @@ patch(MockServer.prototype, 'calendar/models/calendar_event', {
|
||||
if (args.model === 'calendar.event' && args.method === 'check_access_rights') {
|
||||
return true;
|
||||
}
|
||||
return this._super(...arguments);
|
||||
return super._performRPC(...arguments);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
// ensure mail override is applied first.
|
||||
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';
|
||||
|
||||
patch(MockServer.prototype, 'calendar/models/mail_activity', {
|
||||
patch(MockServer.prototype, {
|
||||
//--------------------------------------------------------------------------
|
||||
// Private
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -25,6 +25,6 @@ patch(MockServer.prototype, 'calendar/models/mail_activity', {
|
||||
target: 'current',
|
||||
};
|
||||
}
|
||||
return this._super(...arguments);
|
||||
return super._performRPC(...arguments);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
// ensure mail override is applied first.
|
||||
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 { 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`.
|
||||
*
|
||||
@@ -41,7 +41,7 @@ patch(MockServer.prototype, 'calendar/models/res_users', {
|
||||
* @override
|
||||
*/
|
||||
_mockResUsersSystrayGetActivities() {
|
||||
const activities = this._super(...arguments);
|
||||
const activities = super._mockResUsersSystrayGetActivities(...arguments);
|
||||
const meetingsLines = this.pyEnv['calendar.event'].searchRead(
|
||||
this._mockResUsers_SystrayGetCalendarEventDomain(),
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { ActivityMenu } from "@mail/core/web/activity_menu";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(ActivityMenu.prototype, "crm", {
|
||||
patch(ActivityMenu.prototype, {
|
||||
availableViews(group) {
|
||||
if (group.model === "crm.lead") {
|
||||
return [
|
||||
@@ -16,7 +16,7 @@ patch(ActivityMenu.prototype, "crm", {
|
||||
[false, "activity"],
|
||||
];
|
||||
}
|
||||
return this._super(...arguments);
|
||||
return super.availableViews(...arguments);
|
||||
},
|
||||
|
||||
openActivityGroup(group, filter = "all") {
|
||||
@@ -38,7 +38,7 @@ patch(ActivityMenu.prototype, "crm", {
|
||||
clearBreadcrumbs: true,
|
||||
});
|
||||
} 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 { deserializeDateTime } from "@web/core/l10n/dates";
|
||||
|
||||
patch(MockServer.prototype, "CRM", {
|
||||
patch(MockServer.prototype, {
|
||||
//--------------------------------------------------------------------------
|
||||
// Private
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -51,6 +51,6 @@ patch(MockServer.prototype, "CRM", {
|
||||
}
|
||||
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";
|
||||
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() {
|
||||
const originalSteps = this._super();
|
||||
const originalSteps = super.steps();
|
||||
const DragOppToWonStepIndex = originalSteps.findIndex(
|
||||
(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";
|
||||
|
||||
|
||||
patch(SaleOrderLineProductField.prototype, 'event_booth_sale', {
|
||||
patch(SaleOrderLineProductField.prototype, {
|
||||
|
||||
async _onProductUpdate() {
|
||||
this._super(...arguments);
|
||||
super._onProductUpdate(...arguments);
|
||||
if (this.props.record.data.product_type === 'event_booth') {
|
||||
this._openEventBoothConfigurator(false);
|
||||
}
|
||||
},
|
||||
|
||||
_editLineConfiguration() {
|
||||
this._super(...arguments);
|
||||
super._editLineConfiguration(...arguments);
|
||||
if (this.props.record.data.product_type === 'event_booth') {
|
||||
this._openEventBoothConfigurator(true);
|
||||
}
|
||||
},
|
||||
|
||||
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) {
|
||||
|
||||
@@ -4,24 +4,24 @@ import { patch } from "@web/core/utils/patch";
|
||||
import { SaleOrderLineProductField } from '@sale/js/sale_product_field';
|
||||
|
||||
|
||||
patch(SaleOrderLineProductField.prototype, 'event_sale', {
|
||||
patch(SaleOrderLineProductField.prototype, {
|
||||
|
||||
async _onProductUpdate() {
|
||||
this._super(...arguments);
|
||||
super._onProductUpdate(...arguments);
|
||||
if (this.props.record.data.product_type === 'event') {
|
||||
this._openEventConfigurator();
|
||||
}
|
||||
},
|
||||
|
||||
_editLineConfiguration() {
|
||||
this._super(...arguments);
|
||||
super._editLineConfiguration(...arguments);
|
||||
if (this.props.record.data.product_type === 'event') {
|
||||
this._openEventConfigurator();
|
||||
}
|
||||
},
|
||||
|
||||
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() {
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
import { AttendeeCalendarCommonPopover } from "@calendar/views/attendee_calendar/common/attendee_calendar_common_popover";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(AttendeeCalendarCommonPopover.prototype, "google_calendar_google_calendar_common_popover", {
|
||||
patch(AttendeeCalendarCommonPopover.prototype, {
|
||||
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 { ConfirmationDialog, AlertDialog } from "@web/core/confirmation_dialog/confirmation_dialog";
|
||||
|
||||
patch(AttendeeCalendarController.prototype, "google_calendar_google_calendar_controller", {
|
||||
patch(AttendeeCalendarController.prototype, {
|
||||
setup() {
|
||||
this._super(...arguments);
|
||||
super.setup(...arguments);
|
||||
this.dialog = useService("dialog");
|
||||
this.notification = useService("notification");
|
||||
},
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
import { AttendeeCalendarModel } from "@calendar/views/attendee_calendar/attendee_calendar_model";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(AttendeeCalendarModel, "google_calendar_google_calendar_model", {
|
||||
patch(AttendeeCalendarModel, {
|
||||
services: [...AttendeeCalendarModel.services, "rpc"],
|
||||
});
|
||||
|
||||
patch(AttendeeCalendarModel.prototype, "google_calendar_google_calendar_model_functions", {
|
||||
patch(AttendeeCalendarModel.prototype, {
|
||||
setup(params, { rpc }) {
|
||||
this._super(...arguments);
|
||||
super.setup(...arguments);
|
||||
this.rpc = rpc;
|
||||
this.googleIsSync = true;
|
||||
this.googlePendingSync = false;
|
||||
@@ -19,9 +19,8 @@ patch(AttendeeCalendarModel.prototype, "google_calendar_google_calendar_model_fu
|
||||
* @override
|
||||
*/
|
||||
async updateData() {
|
||||
const _super = this._super.bind(this);
|
||||
if (this.googlePendingSync) {
|
||||
return _super(...arguments);
|
||||
return super.updateData(...arguments);
|
||||
}
|
||||
try {
|
||||
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);
|
||||
this.googlePendingSync = false;
|
||||
}
|
||||
return _super(...arguments);
|
||||
return super.updateData(...arguments);
|
||||
},
|
||||
|
||||
async syncGoogleCalendar(silent = false) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
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
|
||||
* by receiving a list of slots.
|
||||
@@ -13,6 +13,6 @@ patch(MockServer.prototype, "google_calendar_mock_server", {
|
||||
if (route === '/google_calendar/sync_data') {
|
||||
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 = {
|
||||
setup() {
|
||||
this._super();
|
||||
super.setup();
|
||||
this.userInfoTemplate = "hr.avatarCardUserInfos",
|
||||
this.actionService = useService("action");
|
||||
},
|
||||
get fieldNames(){
|
||||
let fields = this._super();
|
||||
let fields = super.fieldNames;
|
||||
return fields.concat([
|
||||
"work_phone",
|
||||
"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";
|
||||
|
||||
patch(Persona.prototype, "hr", {
|
||||
patch(Persona.prototype, {
|
||||
employeeId: undefined,
|
||||
});
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
import { helpers } from "@mail/core/web/open_chat_hook";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(helpers, "hr_m2x_avatar_employee", {
|
||||
patch(helpers, {
|
||||
SUPPORTED_M2X_AVATAR_MODELS: [
|
||||
...helpers.SUPPORTED_M2X_AVATAR_MODELS,
|
||||
"hr.employee",
|
||||
"hr.employee.public",
|
||||
],
|
||||
buildOpenChatParams: function (resModel, id) {
|
||||
buildOpenChatParams(resModel, id) {
|
||||
if (["hr.employee", "hr.employee.public"].includes(resModel)) {
|
||||
return { employeeId: id };
|
||||
}
|
||||
return this._super(...arguments);
|
||||
},
|
||||
return super.buildOpenChatParams(...arguments);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import { unpatch } from "@web/core/utils/patch";
|
||||
import { AvatarCardPopover } from "@mail/discuss/web/avatar_card/avatar_card_popover";
|
||||
import { unpatchAvatarCardPopover } from "@hr/components/avatar_card/avatar_card_popover_patch";
|
||||
|
||||
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
|
||||
* 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() {
|
||||
return [
|
||||
{
|
||||
|
||||
@@ -4,9 +4,9 @@ import { useBus, useService } from '@web/core/utils/hooks';
|
||||
|
||||
const { useRef, useEffect, useState } = owl;
|
||||
|
||||
export const ExpenseDocumentDropZone = {
|
||||
export const ExpenseDocumentDropZone = (T) => class ExpenseDocumentDropZone extends T {
|
||||
setup() {
|
||||
this._super();
|
||||
super.setup();
|
||||
this.dragState = useState({
|
||||
showDragZone: false,
|
||||
});
|
||||
@@ -31,31 +31,31 @@ export const ExpenseDocumentDropZone = {
|
||||
},
|
||||
() => [document.querySelector('.o_content')]
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
highlight(ev) {
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
this.dragState.showDragZone = true;
|
||||
},
|
||||
}
|
||||
|
||||
unhighlight(ev) {
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
this.dragState.showDragZone = false;
|
||||
},
|
||||
}
|
||||
|
||||
async onDrop(ev) {
|
||||
ev.preventDefault();
|
||||
await this.env.bus.trigger("change_file_input", {
|
||||
files: ev.dataTransfer.files,
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const ExpenseDocumentUpload = {
|
||||
export const ExpenseDocumentUpload = (T) => class ExpenseDocumentUpload extends T {
|
||||
setup() {
|
||||
this._super();
|
||||
super.setup();
|
||||
this.actionService = useService('action');
|
||||
this.notification = useService('notification');
|
||||
this.orm = useService('orm');
|
||||
@@ -67,11 +67,11 @@ export const ExpenseDocumentUpload = {
|
||||
this.fileInput.el.files = ev.detail.files;
|
||||
await this.onChangeFileInput();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
uploadDocument() {
|
||||
this.fileInput.el.click();
|
||||
},
|
||||
}
|
||||
|
||||
async onChangeFileInput() {
|
||||
const params = {
|
||||
@@ -87,7 +87,7 @@ export const ExpenseDocumentUpload = {
|
||||
throw new Error(attachments.error);
|
||||
}
|
||||
this.onUpload(attachments);
|
||||
},
|
||||
}
|
||||
|
||||
async onUpload(attachments) {
|
||||
const attachmentIds = attachments.map((a) => a.id);
|
||||
@@ -100,5 +100,5 @@ export const ExpenseDocumentUpload = {
|
||||
|
||||
const action = await this.orm.call('hr.expense', 'create_expense_from_attachments', ["", attachmentIds]);
|
||||
this.actionService.doAction(action);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,15 +4,15 @@ import { useService } from "@web/core/utils/hooks";
|
||||
|
||||
const { onMounted, onPatched, useRef } = owl;
|
||||
|
||||
export const ExpenseMobileQRCode = {
|
||||
export const ExpenseMobileQRCode = (T) => class ExpenseMobileQRCode extends T {
|
||||
setup() {
|
||||
this._super();
|
||||
super.setup();
|
||||
this.root = useRef('root');
|
||||
this.actionService = useService('action');
|
||||
|
||||
onMounted(this.bindAppsIcons);
|
||||
onPatched(this.bindAppsIcons);
|
||||
},
|
||||
}
|
||||
|
||||
bindAppsIcons() {
|
||||
const apps = this.root.el.querySelectorAll('.o_expense_mobile_app');
|
||||
@@ -24,7 +24,7 @@ export const ExpenseMobileQRCode = {
|
||||
for (const app of apps) {
|
||||
app.addEventListener('click', handler);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
handleClick(ev) {
|
||||
ev.preventDefault();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import { registry } from '@web/core/registry';
|
||||
import { patch } from '@web/core/utils/patch';
|
||||
|
||||
import { ExpenseDashboard } from '../components/expense_dashboard';
|
||||
import { ExpenseMobileQRCode } from '../mixins/qrcode';
|
||||
@@ -11,12 +10,9 @@ import { kanbanView } from '@web/views/kanban/kanban_view';
|
||||
import { KanbanController } from '@web/views/kanban/kanban_controller';
|
||||
import { KanbanRenderer } from '@web/views/kanban/kanban_renderer';
|
||||
|
||||
export class ExpenseKanbanController extends KanbanController {}
|
||||
patch(ExpenseKanbanController.prototype, 'expense_kanban_controller_upload', ExpenseDocumentUpload);
|
||||
export class ExpenseKanbanController extends ExpenseDocumentUpload(KanbanController) {}
|
||||
|
||||
export class ExpenseKanbanRenderer extends KanbanRenderer {}
|
||||
patch(ExpenseKanbanRenderer.prototype, 'expense_kanban_renderer_qrcode', ExpenseMobileQRCode);
|
||||
patch(ExpenseKanbanRenderer.prototype, 'expense_kanban_renderer_qrcode_dzone', ExpenseDocumentDropZone);
|
||||
export class ExpenseKanbanRenderer extends ExpenseDocumentDropZone(ExpenseMobileQRCode(KanbanRenderer)) {}
|
||||
ExpenseKanbanRenderer.template = 'hr_expense.KanbanRenderer';
|
||||
|
||||
export class ExpenseDashboardKanbanRenderer extends ExpenseKanbanRenderer {}
|
||||
|
||||
@@ -5,7 +5,6 @@ import { ExpenseMobileQRCode } from '../mixins/qrcode';
|
||||
import { ExpenseDocumentUpload, ExpenseDocumentDropZone } from '../mixins/document_upload';
|
||||
|
||||
import { registry } from '@web/core/registry';
|
||||
import { patch } from '@web/core/utils/patch';
|
||||
import { useService } from '@web/core/utils/hooks';
|
||||
import { listView } from "@web/views/list/list_view";
|
||||
|
||||
@@ -14,7 +13,7 @@ import { ListRenderer } from "@web/views/list/list_renderer";
|
||||
|
||||
const { onWillStart } = owl;
|
||||
|
||||
export class ExpenseListController extends ListController {
|
||||
export class ExpenseListController extends ExpenseDocumentUpload(ListController) {
|
||||
setup() {
|
||||
super.setup();
|
||||
this.orm = useService('orm');
|
||||
@@ -81,11 +80,8 @@ export class ExpenseListController extends ListController {
|
||||
}
|
||||
}
|
||||
}
|
||||
patch(ExpenseListController.prototype, 'expense_list_controller_upload', ExpenseDocumentUpload);
|
||||
|
||||
export class ExpenseListRenderer extends ListRenderer {}
|
||||
patch(ExpenseListRenderer.prototype, 'expense_list_renderer_qrcode', ExpenseMobileQRCode);
|
||||
patch(ExpenseListRenderer.prototype, 'expense_list_renderer_qrcode_dzone', ExpenseDocumentDropZone);
|
||||
export class ExpenseListRenderer extends ExpenseDocumentDropZone(ExpenseMobileQRCode(ListRenderer)) {}
|
||||
ExpenseListRenderer.template = 'hr_expense.ListRenderer';
|
||||
|
||||
export class ExpenseDashboardListRenderer extends ExpenseListRenderer {}
|
||||
|
||||
@@ -8,13 +8,13 @@ import { sprintf } from "@web/core/utils/strings";
|
||||
|
||||
const { DateTime } = luxon;
|
||||
|
||||
patch(personaService, "hr_holidays", {
|
||||
patch(personaService, {
|
||||
dependencies: [...new Set([...personaService.dependencies, "user"])],
|
||||
});
|
||||
|
||||
patch(PersonaService.prototype, "hr_holidays", {
|
||||
patch(PersonaService.prototype, {
|
||||
setup(env, services) {
|
||||
this._super(env, services);
|
||||
super.setup(env, services);
|
||||
this.userService = services.user;
|
||||
},
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import { Thread } from "@mail/core/common/thread";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(Thread.prototype, "hr_holidays", {
|
||||
patch(Thread.prototype, {
|
||||
setup() {
|
||||
this._super();
|
||||
super.setup();
|
||||
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 { 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.
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
_mockResPartnerMailPartnerFormat(ids) {
|
||||
const partnerFormats = this._super(...arguments);
|
||||
const partnerFormats = super._mockResPartnerMailPartnerFormat(...arguments);
|
||||
const partners = this.getRecords(
|
||||
'res.partner',
|
||||
[['id', 'in', ids]],
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
import { AttendeeCalendarCommonRenderer } from "@calendar/views/attendee_calendar/common/attendee_calendar_common_renderer"
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { renderToString } from "@web/core/utils/render";
|
||||
patch(AttendeeCalendarCommonRenderer.prototype, "hr_homeworking_calendar_common_renderer", {
|
||||
|
||||
patch(AttendeeCalendarCommonRenderer.prototype, {
|
||||
get options(){
|
||||
let a = Object.assign(this._super(), {
|
||||
let a = Object.assign(super.options, {
|
||||
columnHeaderHtml: function(date) {
|
||||
if (this.props.model.scale === 'week'){
|
||||
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) {
|
||||
const res = this._super(...arguments);
|
||||
const res = super.fcEventToRecord(...arguments);
|
||||
res.homework = event.homework;
|
||||
return res;
|
||||
},
|
||||
@@ -53,7 +54,7 @@ patch(AttendeeCalendarCommonRenderer.prototype, "hr_homeworking_calendar_common_
|
||||
return events;
|
||||
},
|
||||
mapRecordsToEvents() {
|
||||
let event = this._super(...arguments);
|
||||
let event = super.mapRecordsToEvents(...arguments);
|
||||
let work = [];
|
||||
if (this.props.model.multiCalendar) {
|
||||
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
|
||||
box.appendChild(...children)
|
||||
}
|
||||
this._super(...arguments);
|
||||
super.onDayRender(...arguments);
|
||||
},
|
||||
onEventRender(info) {
|
||||
const { el, event } = info;
|
||||
@@ -149,14 +150,14 @@ patch(AttendeeCalendarCommonRenderer.prototype, "hr_homeworking_calendar_common_
|
||||
const { children } = domParser.parseFromString(injectedContentStr, "text/html").body;
|
||||
el.querySelector(".fc-content").replaceWith(...children);
|
||||
} else {
|
||||
this._super(...arguments);
|
||||
super.onEventRender(...arguments);
|
||||
}
|
||||
},
|
||||
onDblClick(info) {
|
||||
if (info.event.extendedProps.worklocation) {
|
||||
this.onClick(info);
|
||||
} else {
|
||||
this._super(...arguments);
|
||||
super.onDblClick(...arguments);
|
||||
}
|
||||
},
|
||||
onClick(info){
|
||||
@@ -185,7 +186,7 @@ patch(AttendeeCalendarCommonRenderer.prototype, "hr_homeworking_calendar_common_
|
||||
this.openPopover(info.el, wl);
|
||||
this.highlightEvent(info.event, "o_cw_custom_highlight");
|
||||
} else {
|
||||
this._super(...arguments);
|
||||
super.onClick(...arguments);
|
||||
}
|
||||
},
|
||||
onDateClick(info){
|
||||
@@ -193,12 +194,11 @@ patch(AttendeeCalendarCommonRenderer.prototype, "hr_homeworking_calendar_common_
|
||||
info.homework = true
|
||||
this.props.createRecord(this.fcEventToRecord(info));
|
||||
} else {
|
||||
this._super(...arguments)
|
||||
super.onDateClick(...arguments)
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
AttendeeCalendarCommonRenderer.WorklocationTemplate = "hr.homeworking.CalendarCommonRenderer.worklocation",
|
||||
AttendeeCalendarCommonRenderer.HeaderCalendarTemplate = "hr.homeworking.CalendarCommonRenderer.buttonWorklocation",
|
||||
AttendeeCalendarCommonRenderer.ButtonWorklocationTemplate = "hr.homeworking.CalendarCommonRenderer.buttonWorklocation",
|
||||
)
|
||||
AttendeeCalendarCommonRenderer.WorklocationTemplate = "hr.homeworking.CalendarCommonRenderer.worklocation";
|
||||
AttendeeCalendarCommonRenderer.HeaderCalendarTemplate = "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 { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(AttendeeCalendarModel.prototype, "calendar_model_calendarApp", {
|
||||
patch(AttendeeCalendarModel.prototype, {
|
||||
fetchEventLocation(data) {
|
||||
let attendeeIds;
|
||||
const filters = data.filterSections.partner_ids.filters;
|
||||
@@ -92,7 +92,7 @@ patch(AttendeeCalendarModel.prototype, "calendar_model_calendarApp", {
|
||||
* @override
|
||||
*/
|
||||
async updateData(data){
|
||||
await this._super(...arguments)
|
||||
await super.updateData(...arguments)
|
||||
this.partnerColorMap = this.mapPartnersToColor(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 { Field } from "@web/views/fields/field"
|
||||
|
||||
patch(AttendeeCalendarCommonPopover.prototype, "hr_homeworking_calendar_common_popover",{
|
||||
patch(AttendeeCalendarCommonPopover.prototype, {
|
||||
setup() {
|
||||
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(){
|
||||
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;
|
||||
},
|
||||
get isEventEditable() {
|
||||
return ('resModel' in this.props.record.rawRecord) || this._super(...arguments)
|
||||
return ('resModel' in this.props.record.rawRecord) || super.isEventEditable;
|
||||
},
|
||||
get isEventViewable() {
|
||||
return !('resModel' in this.props.record.rawRecord) || this._super(...arguments)
|
||||
return !('resModel' in this.props.record.rawRecord) || super.isEventViewable;
|
||||
},
|
||||
get isEventDeletable() {
|
||||
return ('resModel' in this.props.record.rawRecord) || this._super(...arguments)
|
||||
return ('resModel' in this.props.record.rawRecord) || super.isEventDeletable;
|
||||
},
|
||||
get displayAttendeeAnswerChoice() {
|
||||
return !('resModel' in this.props.record.rawRecord) && this._super(...arguments)
|
||||
return !('resModel' in this.props.record.rawRecord) && super.displayAttendeeAnswerChoice;
|
||||
},
|
||||
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 { serializeDate} from "@web/core/l10n/dates";
|
||||
|
||||
patch(AttendeeCalendarController.prototype, "hr_homeworking_calendar_controller",{
|
||||
patch(AttendeeCalendarController.prototype, {
|
||||
setup() {
|
||||
this._super()
|
||||
super.setup()
|
||||
this.action = useService("action");
|
||||
},
|
||||
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) {
|
||||
if (record.homework) {
|
||||
@@ -42,7 +42,7 @@ patch(AttendeeCalendarController.prototype, "hr_homeworking_calendar_controller"
|
||||
},
|
||||
});
|
||||
} else {
|
||||
return this._super(record);
|
||||
return super.createRecord(record);
|
||||
}
|
||||
},
|
||||
deleteRecord(record) {
|
||||
@@ -64,7 +64,7 @@ patch(AttendeeCalendarController.prototype, "hr_homeworking_calendar_controller"
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this._super(...arguments)
|
||||
super.deleteRecord(...arguments)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||
|
||||
patch(MockServer.prototype, "hr_homeworking", {
|
||||
patch(MockServer.prototype, {
|
||||
async _performRPC(route, args) {
|
||||
if (args.method === "get_worklocation") {
|
||||
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";
|
||||
|
||||
patch(ChatWindow.prototype, "im_livechat", {
|
||||
patch(ChatWindow.prototype, {
|
||||
close(options) {
|
||||
this._super(options);
|
||||
super.close(options);
|
||||
if (
|
||||
this.thread?.type === "livechat" &&
|
||||
this.thread.isLoaded &&
|
||||
|
||||
@@ -4,13 +4,13 @@ import { Composer } from "@mail/core/common/composer";
|
||||
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(Composer.prototype, "im_livechat", {
|
||||
patch(Composer.prototype, {
|
||||
get allowUpload() {
|
||||
return this.thread?.type !== "livechat" && this._super();
|
||||
return this.thread?.type !== "livechat" && super.allowUpload;
|
||||
},
|
||||
|
||||
onKeydown(ev) {
|
||||
this._super(ev);
|
||||
super.onKeydown(ev);
|
||||
if (
|
||||
ev.key === "Tab" &&
|
||||
this.thread?.type === "livechat" &&
|
||||
|
||||
@@ -6,11 +6,11 @@ import { cleanTerm } from "@mail/utils/common/format";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(SuggestionService.prototype, "im_livechat", {
|
||||
patch(SuggestionService.prototype, {
|
||||
getSupportedDelimiters(thread) {
|
||||
return thread?.model !== "discuss.channel" || thread.type === "livechat"
|
||||
? [...this._super(...arguments), [":"]]
|
||||
: this._super(...arguments);
|
||||
? [...super.getSupportedDelimiters(...arguments), [":"]]
|
||||
: super.getSupportedDelimiters(...arguments);
|
||||
},
|
||||
/**
|
||||
* Returns suggestions that match the given search term from specified type.
|
||||
@@ -27,7 +27,7 @@ patch(SuggestionService.prototype, "im_livechat", {
|
||||
if (delimiter === ":") {
|
||||
return this.searchCannedResponseSuggestions(cleanTerm(term), sort);
|
||||
}
|
||||
return this._super(...arguments);
|
||||
return super.searchSuggestions(...arguments);
|
||||
},
|
||||
|
||||
searchCannedResponseSuggestions(cleanedSearchTerm, sort) {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
import { ChannelMemberList } from "@mail/discuss/core/common/channel_member_list";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(ChannelMemberList.prototype, "im_livechat", {
|
||||
patch(ChannelMemberList.prototype, {
|
||||
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 { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(ChannelMemberService.prototype, "im_livechat", {
|
||||
patch(ChannelMemberService.prototype, {
|
||||
getName(member) {
|
||||
if (member.thread.type !== "livechat") {
|
||||
return this._super(member);
|
||||
return super.getName(member);
|
||||
}
|
||||
if (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) {
|
||||
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 { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(Store.prototype, "im_livechat", {
|
||||
patch(Store.prototype, {
|
||||
setup(env) {
|
||||
this._super(env);
|
||||
super.setup(env);
|
||||
this.discuss.livechat = {
|
||||
extraClass: "o-mail-DiscussSidebarCategory-livechat",
|
||||
id: "livechat",
|
||||
|
||||
@@ -5,37 +5,37 @@ import { Thread } from "@mail/core/common/thread_model";
|
||||
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(Thread.prototype, "im_livechat", {
|
||||
patch(Thread.prototype, {
|
||||
get isChannel() {
|
||||
return this.type === "livechat" || this._super();
|
||||
return this.type === "livechat" || super.isChannel;
|
||||
},
|
||||
|
||||
get hasMemberList() {
|
||||
return this.type === "livechat" || this._super();
|
||||
return this.type === "livechat" || super.hasMemberList;
|
||||
},
|
||||
|
||||
get isChatChannel() {
|
||||
return this.type === "livechat" || this._super();
|
||||
return this.type === "livechat" || super.isChatChannel;
|
||||
},
|
||||
|
||||
get allowSetLastSeenMessage() {
|
||||
return this.type === "livechat" || this._super();
|
||||
return this.type === "livechat" || super.allowSetLastSeenMessage;
|
||||
},
|
||||
|
||||
get allowReactions() {
|
||||
return this.type === "livechat" ? false : this._super();
|
||||
return this.type === "livechat" ? false : super.allowReactions;
|
||||
},
|
||||
|
||||
get allowReplies() {
|
||||
return this.type === "livechat" ? false : this._super();
|
||||
return this.type === "livechat" ? false : super.allowReplies;
|
||||
},
|
||||
|
||||
get correspondents() {
|
||||
return this._super().filter((correspondent) => !correspondent.is_bot);
|
||||
return super.correspondents.filter((correspondent) => !correspondent.is_bot);
|
||||
},
|
||||
|
||||
get correspondent() {
|
||||
let correspondent = this._super();
|
||||
let correspondent = super.correspondent;
|
||||
if (this.type === "livechat" && !correspondent) {
|
||||
// For livechat threads, the correspondent is the first
|
||||
// channel member that is not the operator.
|
||||
@@ -52,7 +52,7 @@ patch(Thread.prototype, "im_livechat", {
|
||||
|
||||
get displayName() {
|
||||
if (this.type !== "livechat" || !this.correspondent) {
|
||||
return this._super();
|
||||
return super.displayName;
|
||||
}
|
||||
if (!this.correspondent.is_public && this.correspondent.country) {
|
||||
return `${this.getMemberName(this.correspondent)} (${this.correspondent.country.name})`;
|
||||
@@ -67,7 +67,7 @@ patch(Thread.prototype, "im_livechat", {
|
||||
|
||||
get imgUrl() {
|
||||
if (this.type !== "livechat") {
|
||||
return this._super();
|
||||
return super.imgUrl;
|
||||
}
|
||||
return this.correspondent && !this.correspondent.is_public
|
||||
? `/web/image/res.partner/${this.correspondent.id}/avatar_128`
|
||||
@@ -80,7 +80,7 @@ patch(Thread.prototype, "im_livechat", {
|
||||
*/
|
||||
getMemberName(persona) {
|
||||
if (this.type !== "livechat") {
|
||||
return this._super(persona);
|
||||
return super.getMemberName(persona);
|
||||
}
|
||||
if (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) {
|
||||
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";
|
||||
|
||||
patch(ThreadService.prototype, "im_livechat", {
|
||||
patch(ThreadService.prototype, {
|
||||
insert(data) {
|
||||
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 (data?.channel) {
|
||||
assignDefined(thread, data.channel, ["anonymous_name"]);
|
||||
@@ -34,7 +34,7 @@ patch(ThreadService.prototype, "im_livechat", {
|
||||
* @param {boolean} pushState
|
||||
*/
|
||||
setDiscussThread(thread, pushState) {
|
||||
this._super(thread, pushState);
|
||||
super.setDiscussThread(thread, pushState);
|
||||
if (this.ui.isSmall && thread.type === "livechat") {
|
||||
this.store.discuss.activeTab = "livechat";
|
||||
}
|
||||
@@ -43,29 +43,29 @@ patch(ThreadService.prototype, "im_livechat", {
|
||||
if (thread.type === "livechat") {
|
||||
removeFromArray(this.store.discuss.livechat.threads, thread.localId);
|
||||
}
|
||||
this._super(thread);
|
||||
super.remove(thread);
|
||||
},
|
||||
|
||||
canLeave(thread) {
|
||||
return thread.type !== "livechat" && this._super(thread);
|
||||
return thread.type !== "livechat" && super.canLeave(thread);
|
||||
},
|
||||
|
||||
canUnpin(thread) {
|
||||
if (thread.type === "livechat") {
|
||||
return thread.message_unread_counter === 0;
|
||||
}
|
||||
return this._super(thread);
|
||||
return super.canUnpin(thread);
|
||||
},
|
||||
|
||||
getCounter(thread) {
|
||||
if (thread.type === "livechat") {
|
||||
return thread.message_unread_counter;
|
||||
}
|
||||
return this._super(thread);
|
||||
return super.getCounter(thread);
|
||||
},
|
||||
|
||||
sortChannels() {
|
||||
this._super();
|
||||
super.sortChannels();
|
||||
// Live chats are sorted by most recent interest date time in the sidebar.
|
||||
this.store.discuss.livechat.threads.sort((localId_1, localId_2) => {
|
||||
const thread1 = this.store.threads[localId_1];
|
||||
|
||||
@@ -12,9 +12,9 @@ import { patch } from "@web/core/utils/patch";
|
||||
|
||||
Object.assign(ChatWindow.components, { FeedbackPanel });
|
||||
|
||||
patch(ChatWindow.prototype, "im_livechat", {
|
||||
patch(ChatWindow.prototype, {
|
||||
setup() {
|
||||
this._super(...arguments);
|
||||
super.setup(...arguments);
|
||||
this.livechatService = useService("im_livechat.livechat");
|
||||
this.chatbotService = useState(useService("im_livechat.chatbot"));
|
||||
this.livechatState = useState({
|
||||
@@ -24,13 +24,13 @@ patch(ChatWindow.prototype, "im_livechat", {
|
||||
|
||||
close() {
|
||||
if (this.thread?.type !== "livechat") {
|
||||
return this._super();
|
||||
return super.close();
|
||||
}
|
||||
if (this.livechatService.state === SESSION_STATE.PERSISTED) {
|
||||
this.livechatState.hasFeedbackPanel = true;
|
||||
this.chatWindowService.show(this.props.chatWindow);
|
||||
} else {
|
||||
this._super();
|
||||
super.close();
|
||||
}
|
||||
this.livechatService.leaveSession();
|
||||
this.chatbotService.stop();
|
||||
|
||||
@@ -7,10 +7,10 @@ import { Composer } from "@mail/core/common/composer";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(Composer.prototype, "im_livechat", {
|
||||
patch(Composer.prototype, {
|
||||
get placeholder() {
|
||||
if (this.thread?.type !== "livechat") {
|
||||
return this._super();
|
||||
return super.placeholder;
|
||||
}
|
||||
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";
|
||||
|
||||
patch(Composer.prototype, "im_livechat/disabled", {
|
||||
patch(Composer.prototype, {
|
||||
get allowUpload() {
|
||||
return false;
|
||||
},
|
||||
});
|
||||
|
||||
patch(MessageModel.prototype, "im_livechat/disabled", {
|
||||
patch(MessageModel.prototype, {
|
||||
get hasActions() {
|
||||
return false;
|
||||
},
|
||||
});
|
||||
|
||||
patch(Thread.prototype, "im_livechat/disabled", {
|
||||
patch(Thread.prototype, {
|
||||
get hasMemberList() {
|
||||
return false;
|
||||
},
|
||||
});
|
||||
|
||||
patch(ThreadService.prototype, "im_livechat/disabled", {
|
||||
patch(ThreadService.prototype, {
|
||||
async fetchNewMessages(thread) {
|
||||
return;
|
||||
},
|
||||
@@ -36,9 +36,9 @@ patch(ThreadService.prototype, "im_livechat/disabled", {
|
||||
},
|
||||
});
|
||||
|
||||
patch(Store.prototype, "im_livechat/disabled", {
|
||||
patch(Store.prototype, {
|
||||
setup() {
|
||||
this._super(...arguments);
|
||||
super.setup(...arguments);
|
||||
this.hasLinkPreviewFeature = false;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -5,10 +5,10 @@ import { Message } from "@mail/core/common/message_model";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { session } from "@web/session";
|
||||
|
||||
patch(Message.prototype, "im_livechat", {
|
||||
patch(Message.prototype, {
|
||||
get isSelfAuthored() {
|
||||
if (this.originThread.type !== "livechat") {
|
||||
return this._super();
|
||||
return super.isSelfAuthored;
|
||||
}
|
||||
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";
|
||||
|
||||
patch(MessageService.prototype, "im_livechat", {
|
||||
patch(MessageService.prototype, {
|
||||
insert(data) {
|
||||
const message = this._super(data);
|
||||
const message = super.insert(data);
|
||||
if (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 { session } from "@web/session";
|
||||
|
||||
patch(Messaging.prototype, "im_livechat", {
|
||||
patch(Messaging.prototype, {
|
||||
initialize() {
|
||||
if (session.livechatData?.options.current_partner_id) {
|
||||
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 { session } from "@web/session";
|
||||
|
||||
patch(Thread.prototype, "im_livechat", {
|
||||
patch(Thread.prototype, {
|
||||
chatbotScriptId: null,
|
||||
|
||||
get isChannel() {
|
||||
return this.type === "livechat" || this._super();
|
||||
return this.type === "livechat" || super.isChannel;
|
||||
},
|
||||
|
||||
get isChatChannel() {
|
||||
return this.type === "livechat" || this._super();
|
||||
return this.type === "livechat" || super.isChatChannel;
|
||||
},
|
||||
|
||||
get isLastMessageFromCustomer() {
|
||||
if (this.type !== "livechat") {
|
||||
return this._super();
|
||||
return super.isLastMessageFromCustomer;
|
||||
}
|
||||
return this.newestMessage?.isSelfAuthored;
|
||||
},
|
||||
|
||||
get imgUrl() {
|
||||
if (this.type !== "livechat") {
|
||||
return this._super();
|
||||
return super.imgUrl;
|
||||
}
|
||||
return `${session.origin}/im_livechat/operator/${this.operator.id}/avatar`;
|
||||
},
|
||||
|
||||
@@ -19,7 +19,7 @@ threadService.dependencies.push(
|
||||
"notification"
|
||||
);
|
||||
|
||||
patch(ThreadService.prototype, "im_livechat", {
|
||||
patch(ThreadService.prototype, {
|
||||
TEMPORARY_ID: "livechat_temporary_thread",
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ patch(ThreadService.prototype, "im_livechat", {
|
||||
* }} services
|
||||
*/
|
||||
setup(env, services) {
|
||||
this._super(env, services);
|
||||
super.setup(env, services);
|
||||
this.livechatService = services["im_livechat.livechat"];
|
||||
this.chatWindowService = services["mail.chat_window"];
|
||||
this.chatbotService = services["im_livechat.chatbot"];
|
||||
@@ -41,14 +41,14 @@ patch(ThreadService.prototype, "im_livechat", {
|
||||
|
||||
getMessagePostRoute(thread) {
|
||||
if (thread.type !== "livechat") {
|
||||
return this._super(...arguments);
|
||||
return super.getMessagePostRoute(...arguments);
|
||||
}
|
||||
return "/im_livechat/chat_post";
|
||||
},
|
||||
|
||||
async getMessagePostParams({ thread, body }) {
|
||||
if (thread.type !== "livechat") {
|
||||
return this._super(...arguments);
|
||||
return super.getMessagePostParams(...arguments);
|
||||
}
|
||||
return {
|
||||
uuid: thread.uuid,
|
||||
@@ -60,7 +60,6 @@ patch(ThreadService.prototype, "im_livechat", {
|
||||
* @returns {Promise<import("@mail/core/common/message_model").Message}
|
||||
*/
|
||||
async post(thread, body, params) {
|
||||
const _super = this._super;
|
||||
const chatWindow = this.store.chatWindows.find((c) => c.threadLocalId === thread.localId);
|
||||
if (
|
||||
this.livechatService.state !== SESSION_STATE.PERSISTED &&
|
||||
@@ -80,7 +79,7 @@ patch(ThreadService.prototype, "im_livechat", {
|
||||
await this.chatbotService.postWelcomeSteps();
|
||||
}
|
||||
}
|
||||
const message = await _super(thread, body, params);
|
||||
const message = await super.post(thread, body, params);
|
||||
if (!message) {
|
||||
this.notificationService.add(_t("Session expired... Please refresh and try again."));
|
||||
this.chatWindowService.close(chatWindow);
|
||||
@@ -111,7 +110,7 @@ patch(ThreadService.prototype, "im_livechat", {
|
||||
|
||||
insert(data) {
|
||||
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 (
|
||||
this.livechatService.displayWelcomeMessage &&
|
||||
@@ -154,7 +153,7 @@ patch(ThreadService.prototype, "im_livechat", {
|
||||
},
|
||||
|
||||
async update(thread, data) {
|
||||
this._super(...arguments);
|
||||
super.update(...arguments);
|
||||
if (data.operator_pid) {
|
||||
thread.operator = this.personaService.insert({
|
||||
type: "partner",
|
||||
@@ -166,7 +165,7 @@ patch(ThreadService.prototype, "im_livechat", {
|
||||
|
||||
avatarUrl(author, thread) {
|
||||
if (thread.type !== "livechat") {
|
||||
return this._super(...arguments);
|
||||
return super.avatarUrl(...arguments);
|
||||
}
|
||||
const isFromOperator =
|
||||
author && author.id !== this.livechatService.options.current_partner_id;
|
||||
|
||||
@@ -7,9 +7,9 @@ import { session } from "@web/session";
|
||||
|
||||
Message.props.push("isTypingMessage?");
|
||||
|
||||
patch(Message.prototype, "im_livechat", {
|
||||
patch(Message.prototype, {
|
||||
setup() {
|
||||
this._super();
|
||||
super.setup();
|
||||
this.session = session;
|
||||
},
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ import { useService } from "@web/core/utils/hooks";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { session } from "@web/session";
|
||||
|
||||
patch(Thread.prototype, "im_livechat", {
|
||||
patch(Thread.prototype, {
|
||||
setup() {
|
||||
this._super();
|
||||
super.setup();
|
||||
this.session = session;
|
||||
this.chatbotService = useState(useService("im_livechat.chatbot"));
|
||||
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";
|
||||
|
||||
patch(busParametersService, "im_livechat", {
|
||||
patch(busParametersService, {
|
||||
start() {
|
||||
return {
|
||||
...this._super(...arguments),
|
||||
...super.start(...arguments),
|
||||
serverURL: serverUrl.replace(/\/+$/, ""),
|
||||
};
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@ import { memoize } from "@web/core/utils/functions";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { session } from "@web/session";
|
||||
|
||||
patch(loader, "im_livechat/emoji_loader", {
|
||||
patch(loader, {
|
||||
loadEmoji: memoize(() =>
|
||||
loadBundle({
|
||||
jsLibs: [`${session.origin}/im_livechat/emoji_bundle`],
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { OverlayContainer } from "@web/core/overlay/overlay_container";
|
||||
|
||||
patch(OverlayContainer.prototype, "im_livechat", {
|
||||
patch(OverlayContainer.prototype, {
|
||||
isVisible(overlay) {
|
||||
const targetInShadow = overlay.props.target?.getRootNode() instanceof ShadowRoot;
|
||||
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");
|
||||
|
||||
patch(X2ManyFieldDialog.prototype, "chatbot_script_step_sequence", {
|
||||
patch(X2ManyFieldDialog.prototype, {
|
||||
/**
|
||||
* Dirty patching of the 'X2ManyFieldDialog'.
|
||||
* 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 }) {
|
||||
if (this.record.resModel !== "chatbot.script.step") {
|
||||
return this._super(...arguments);
|
||||
return super.save(...arguments);
|
||||
}
|
||||
|
||||
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 { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(MessagingMenu.prototype, "im_livechat", {
|
||||
patch(MessagingMenu.prototype, {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
tabToThreadType(tab) {
|
||||
const threadTypes = this._super(tab);
|
||||
const threadTypes = super.tabToThreadType(tab);
|
||||
if (tab === "chat" && !this.ui.isSmall) {
|
||||
threadTypes.push("livechat");
|
||||
}
|
||||
@@ -23,7 +23,7 @@ patch(MessagingMenu.prototype, "im_livechat", {
|
||||
* @override
|
||||
*/
|
||||
get tabs() {
|
||||
const items = this._super();
|
||||
const items = super.tabs;
|
||||
const hasLivechats = Object.values(this.store.threads).some(
|
||||
({ type }) => type === "livechat"
|
||||
);
|
||||
|
||||
@@ -5,10 +5,10 @@ import "@mail/discuss/core/web/message_patch"; // dependency ordering
|
||||
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(Message.prototype, "im_livechat/web", {
|
||||
patch(Message.prototype, {
|
||||
hasOpenChatFeature() {
|
||||
return this.message.originThread?.channel?.channel_type === "livechat"
|
||||
? false
|
||||
: this._super();
|
||||
: super.hasOpenChatFeature();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -69,10 +69,10 @@ export async function loadDefaultConfig() {
|
||||
return livechatChannelId;
|
||||
}
|
||||
|
||||
patch(App.prototype, "im_livechat", {
|
||||
patch(App.prototype, {
|
||||
mount() {
|
||||
registerCleanup(() => this.destroy());
|
||||
return this._super(...arguments);
|
||||
return super.mount(...arguments);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -108,7 +108,7 @@ export async function start({ mockRPC } = {}) {
|
||||
const livechatButtonAvailableDeferred = makeDeferred();
|
||||
patchWithCleanup(LivechatButton.prototype, {
|
||||
setup() {
|
||||
this._super(...arguments);
|
||||
super.setup(...arguments);
|
||||
onMounted(() => livechatButtonAvailableDeferred.resolve());
|
||||
},
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||
|
||||
patch(MockServer.prototype, "im_livechat/controllers/main", {
|
||||
patch(MockServer.prototype, {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
@@ -50,7 +50,7 @@ patch(MockServer.prototype, "im_livechat/controllers/main", {
|
||||
if (route === "/im_livechat/chat_history") {
|
||||
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.
|
||||
|
||||
@@ -5,12 +5,12 @@ import "@mail/../tests/helpers/mock_server/models/discuss_channel"; // ensure ma
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||
|
||||
patch(MockServer.prototype, "im_livechat/models/discuss_channel", {
|
||||
patch(MockServer.prototype, {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
_mockDiscussChannelChannelInfo(ids) {
|
||||
const channelInfos = this._super(...arguments);
|
||||
const channelInfos = super._mockDiscussChannelChannelInfo(...arguments);
|
||||
for (const channelInfo of channelInfos) {
|
||||
const channel = this.getRecords("discuss.channel", [["id", "=", channelInfo.id]])[0];
|
||||
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 { MockServer } from "@web/../tests/helpers/mock_server";
|
||||
|
||||
patch(MockServer.prototype, "im_livechat/models/discuss_channel_member", {
|
||||
patch(MockServer.prototype, {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
@@ -37,6 +37,6 @@ patch(MockServer.prototype, "im_livechat/models/discuss_channel_member", {
|
||||
}
|
||||
return data;
|
||||
}
|
||||
return this._super(ids);
|
||||
return super._mockDiscussChannelMember_GetPartnerData(ids);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
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`.
|
||||
*
|
||||
|
||||
@@ -5,7 +5,7 @@ import "@mail/../tests/helpers/mock_server/models/res_partner"; // ensure mail o
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||
|
||||
patch(MockServer.prototype, "im_livechat/models/res_partner", {
|
||||
patch(MockServer.prototype, {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
@@ -19,13 +19,13 @@ patch(MockServer.prototype, "im_livechat/models/res_partner", {
|
||||
["channel_type", "=", "livechat"],
|
||||
["channel_member_ids", "in", members.map((member) => member.id)],
|
||||
]);
|
||||
return [...this._super(ids), ...livechats];
|
||||
return [...super._mockResPartner_GetChannelsAsMember(ids), ...livechats];
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
_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]]);
|
||||
if (channel.channel_type !== "livechat") {
|
||||
return result;
|
||||
|
||||
@@ -3,9 +3,9 @@ import { patch } from "@web/core/utils/patch";
|
||||
import { registry } from "@web/core/registry";
|
||||
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() {
|
||||
const originalSteps = this._super();
|
||||
const originalSteps = super.steps();
|
||||
// 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 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 { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(PaymentScreen.prototype, "l10n_co_pos.PaymentScreen", {
|
||||
patch(PaymentScreen.prototype, {
|
||||
async _postPushOrderResolve(order, order_server_ids) {
|
||||
const _super = this._super;
|
||||
try {
|
||||
if (this.pos.is_colombian_country()) {
|
||||
const result = await this.orm.searchRead(
|
||||
@@ -18,6 +17,6 @@ patch(PaymentScreen.prototype, "l10n_co_pos.PaymentScreen", {
|
||||
} catch {
|
||||
// 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 { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(PosStore.prototype, "l10n_co_pos.PosStore", {
|
||||
patch(PosStore.prototype, {
|
||||
is_colombian_country() {
|
||||
return this.company.country?.code === "CO";
|
||||
},
|
||||
});
|
||||
|
||||
patch(Order.prototype, "l10n_co_pos.Order", {
|
||||
patch(Order.prototype, {
|
||||
export_for_printing() {
|
||||
const result = this._super(...arguments);
|
||||
const result = super.export_for_printing(...arguments);
|
||||
result.l10n_co_dian = this.get_l10n_co_dian();
|
||||
return result;
|
||||
},
|
||||
@@ -23,7 +23,7 @@ patch(Order.prototype, "l10n_co_pos.Order", {
|
||||
return this.l10n_co_dian;
|
||||
},
|
||||
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());
|
||||
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 { onMounted } from "@odoo/owl";
|
||||
|
||||
patch(Chrome.prototype, "l10n_fr_pos_cert.Chrome", {
|
||||
patch(Chrome.prototype, {
|
||||
setup() {
|
||||
this._super(...arguments);
|
||||
super.setup(...arguments);
|
||||
onMounted(async () => {
|
||||
if (this.pos.is_french_country() && this.pos.pos_session.start_at) {
|
||||
const now = Date.now();
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(PaymentScreen.prototype, "l10n_fr_pos_cert.PaymentScreen", {
|
||||
patch(PaymentScreen.prototype, {
|
||||
async _postPushOrderResolve(order, order_server_ids) {
|
||||
const _super = this._super;
|
||||
try {
|
||||
if (this.pos.is_french_country()) {
|
||||
const result = await this.orm.searchRead(
|
||||
@@ -18,6 +17,6 @@ patch(PaymentScreen.prototype, "l10n_fr_pos_cert.PaymentScreen", {
|
||||
} catch {
|
||||
// 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 { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(ClosePosPopup.prototype, "l10n_fr_pos_cert.ClosePosPopup", {
|
||||
patch(ClosePosPopup.prototype, {
|
||||
sessionIsOutdated() {
|
||||
let isOutdated = false;
|
||||
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;
|
||||
},
|
||||
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 { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(TicketScreen.prototype, "l10n_fr_pos_cert.TicketScreen", {
|
||||
patch(TicketScreen.prototype, {
|
||||
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 { ErrorPopup } from "@point_of_sale/app/errors/popups/error_popup";
|
||||
|
||||
patch(PosStore.prototype, "l10n_fr_pos_cert.PosStore", {
|
||||
patch(PosStore.prototype, {
|
||||
is_french_country() {
|
||||
var french_countries = ["FR", "MF", "MQ", "NC", "PF", "RE", "GF", "GP", "TF"];
|
||||
if (!this.company.country) {
|
||||
@@ -20,19 +20,19 @@ patch(PosStore.prototype, "l10n_fr_pos_cert.PosStore", {
|
||||
return french_countries.includes(this.company.country?.code);
|
||||
},
|
||||
disallowLineQuantityChange() {
|
||||
const result = this._super(...arguments);
|
||||
const result = super.disallowLineQuantityChange(...arguments);
|
||||
return this.is_french_country() || result;
|
||||
},
|
||||
});
|
||||
|
||||
patch(Order.prototype, "l10n_fr_pos_cert.Order", {
|
||||
patch(Order.prototype, {
|
||||
setup() {
|
||||
this._super(...arguments);
|
||||
super.setup(...arguments);
|
||||
this.l10n_fr_hash = this.l10n_fr_hash || false;
|
||||
this.save_to_db();
|
||||
},
|
||||
export_for_printing() {
|
||||
var result = this._super(...arguments);
|
||||
var result = super.export_for_printing(...arguments);
|
||||
result.l10n_fr_hash = this.get_l10n_fr_hash();
|
||||
return result;
|
||||
},
|
||||
@@ -43,16 +43,16 @@ patch(Order.prototype, "l10n_fr_pos_cert.Order", {
|
||||
return this.l10n_fr_hash;
|
||||
},
|
||||
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());
|
||||
return result;
|
||||
},
|
||||
});
|
||||
|
||||
patch(Orderline.prototype, "l10n_fr_pos_cert.Orderline", {
|
||||
patch(Orderline.prototype, {
|
||||
can_be_merged_with(orderline) {
|
||||
if (!this.pos.is_french_country()) {
|
||||
return this._super(...arguments);
|
||||
return super.can_be_merged_with(...arguments);
|
||||
}
|
||||
const order = this.pos.get_order();
|
||||
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) {
|
||||
return false;
|
||||
} 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 { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(OrderReceipt.prototype, "l10n_gcc_pos.OrderReceipt", {
|
||||
patch(OrderReceipt.prototype, {
|
||||
get receiptEnv() {
|
||||
const receipt_render_env = this._super(...arguments);
|
||||
const receipt_render_env = super.receiptEnv;
|
||||
const receipt = receipt_render_env.receipt;
|
||||
const country = receipt_render_env.order.pos.company.country;
|
||||
receipt.is_gcc_country = country
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import { Orderline } from "@point_of_sale/app/store/models";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(Orderline.prototype, "l10n_in_pos.Orderline", {
|
||||
patch(Orderline.prototype, {
|
||||
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;
|
||||
return line;
|
||||
},
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import { Order } from "@point_of_sale/app/store/models";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(Order.prototype, "l10n_sa_pos.Order", {
|
||||
patch(Order.prototype, {
|
||||
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") {
|
||||
result.is_settlement = this.is_settlement();
|
||||
if (!result.is_settlement) {
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
import { useBus, useService } from "@web/core/utils/hooks";
|
||||
|
||||
export const LunchRendererMixin = {
|
||||
export const LunchRendererMixin = (T) => class LunchRendererMixin extends T {
|
||||
setup() {
|
||||
this._super(...arguments);
|
||||
super.setup(...arguments);
|
||||
|
||||
this.action = useService("action");
|
||||
useBus(this.env.bus, 'lunch_open_order', (ev) => this.openOrderLine(ev.detail.productId));
|
||||
},
|
||||
}
|
||||
|
||||
openOrderLine(productId, orderId) {
|
||||
let context = {};
|
||||
@@ -36,5 +36,5 @@ export const LunchRendererMixin = {
|
||||
this.action.doAction(action, {
|
||||
onClose: () => this.env.bus.trigger('lunch_update_dashboard')
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import { patch } from '@web/core/utils/patch';
|
||||
import { registry } from '@web/core/registry';
|
||||
|
||||
import { kanbanView } from '@web/views/kanban/kanban_view';
|
||||
@@ -19,8 +18,7 @@ export class LunchKanbanRecord extends KanbanRecord {
|
||||
}
|
||||
}
|
||||
|
||||
export class LunchKanbanRenderer extends KanbanRenderer {}
|
||||
patch(LunchKanbanRenderer.prototype, 'lunch_kanban_renderer_mixin', LunchRendererMixin);
|
||||
export class LunchKanbanRenderer extends LunchRendererMixin(KanbanRenderer) {}
|
||||
|
||||
LunchKanbanRenderer.template = 'lunch.KanbanRenderer';
|
||||
LunchKanbanRenderer.components = {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import { patch } from '@web/core/utils/patch';
|
||||
import { registry } from '@web/core/registry';
|
||||
|
||||
import { listView } from '@web/views/list/list_view';
|
||||
@@ -12,12 +11,11 @@ import { LunchRendererMixin } from '../mixins/lunch_renderer_mixin';
|
||||
import { LunchSearchModel } from './search_model';
|
||||
|
||||
|
||||
export class LunchListRenderer extends ListRenderer {
|
||||
export class LunchListRenderer extends LunchRendererMixin(ListRenderer) {
|
||||
onCellClicked(record, column) {
|
||||
this.openOrderLine(record.resId);
|
||||
}
|
||||
}
|
||||
patch(LunchListRenderer.prototype, 'lunch_list_renderer_mixin', LunchRendererMixin);
|
||||
|
||||
LunchListRenderer.template = 'lunch.ListRenderer';
|
||||
LunchListRenderer.components = {
|
||||
|
||||
@@ -5,9 +5,9 @@ import { ChatWindow } from "@mail/core/common/chat_window";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(ChatWindow.prototype, "mail/core/web", {
|
||||
patch(ChatWindow.prototype, {
|
||||
setup() {
|
||||
this._super(...arguments);
|
||||
super.setup(...arguments);
|
||||
this.actionService = useService("action");
|
||||
},
|
||||
});
|
||||
|
||||
@@ -4,9 +4,8 @@ import { ChatWindowService } from "@mail/core/common/chat_window_service";
|
||||
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(ChatWindowService.prototype, "mail/core/web", {
|
||||
patch(ChatWindowService.prototype, {
|
||||
async close() {
|
||||
const _super = this._super.bind(this);
|
||||
if (this.ui.isSmall && !this.store.discuss.isActive) {
|
||||
// If we are in mobile and discuss is not open, it means the
|
||||
// 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
|
||||
await Promise.resolve();
|
||||
}
|
||||
await _super(...arguments);
|
||||
await super.close(...arguments);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { Dialog } from "@web/core/dialog/dialog";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(Dialog.prototype, "mail/views/web", {
|
||||
patch(Dialog.prototype, {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
@@ -11,6 +11,6 @@ patch(Dialog.prototype, "mail/views/web", {
|
||||
if (this.data.model === "mail.compose.message") {
|
||||
return;
|
||||
}
|
||||
this._super();
|
||||
super.onEscape();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -14,9 +14,9 @@ import fieldUtils from "@web/legacy/js/fields/field_utils";
|
||||
const format = fieldUtils.format
|
||||
const formatters = registry.category("formatters");
|
||||
|
||||
patch(Message.prototype, "mail/core/web", {
|
||||
patch(Message.prototype, {
|
||||
setup() {
|
||||
this._super(...arguments);
|
||||
super.setup(...arguments);
|
||||
this.action = useService("action");
|
||||
this.userService = useService("user");
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Thread } from "@mail/core/common/thread_model";
|
||||
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(Thread.prototype, "mail/core/web", {
|
||||
patch(Thread.prototype, {
|
||||
/**
|
||||
* @returns {import("@mail/core/web/activity_model").Activity[]}
|
||||
*/
|
||||
|
||||
@@ -12,9 +12,9 @@ import { patch } from "@web/core/utils/patch";
|
||||
|
||||
let nextId = 1;
|
||||
|
||||
patch(ThreadService.prototype, "mail/core/web", {
|
||||
patch(ThreadService.prototype, {
|
||||
setup(env, services) {
|
||||
this._super(env, services);
|
||||
super.setup(env, services);
|
||||
this.action = services.action;
|
||||
/** @type {import("@mail/core/common/attachment_service").AttachmentService} */
|
||||
this.attachmentService = services["mail.attachment"];
|
||||
@@ -182,7 +182,7 @@ patch(ThreadService.prototype, "mail/core/web", {
|
||||
if (chatWindow) {
|
||||
this.chatWindowService.close(chatWindow);
|
||||
}
|
||||
this._super(...arguments);
|
||||
super.leaveChannel(...arguments);
|
||||
},
|
||||
async loadMoreFollowers(thread) {
|
||||
const followers = await this.orm.call(thread.model, "message_get_followers", [
|
||||
@@ -217,7 +217,7 @@ patch(ThreadService.prototype, "mail/core/web", {
|
||||
});
|
||||
return;
|
||||
}
|
||||
this._super(thread, replaceNewMessageChatWindow);
|
||||
super.open(thread, replaceNewMessageChatWindow);
|
||||
},
|
||||
/**
|
||||
* @param {import("@mail/core/common/follower_model").Follower} follower
|
||||
@@ -240,7 +240,7 @@ patch(ThreadService.prototype, "mail/core/web", {
|
||||
if (chatWindow) {
|
||||
this.chatWindowService.close(chatWindow);
|
||||
}
|
||||
this._super(...arguments);
|
||||
super.unpin(...arguments);
|
||||
},
|
||||
_openChatWindow(thread, replaceNewMessageChatWindow) {
|
||||
const chatWindow = this.chatWindowService.insert({
|
||||
@@ -256,7 +256,7 @@ patch(ThreadService.prototype, "mail/core/web", {
|
||||
},
|
||||
});
|
||||
|
||||
patch(threadService, "mail/core/web", {
|
||||
patch(threadService, {
|
||||
dependencies: [
|
||||
...threadService.dependencies,
|
||||
"action",
|
||||
|
||||
@@ -8,9 +8,9 @@ import { patch } from "@web/core/utils/patch";
|
||||
|
||||
Object.assign(Discuss.components, { Call });
|
||||
|
||||
patch(Discuss.prototype, "discuss/call/common", {
|
||||
patch(Discuss.prototype, {
|
||||
setup() {
|
||||
this._super(...arguments);
|
||||
super.setup(...arguments);
|
||||
this.rtc = useRtc();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -6,13 +6,13 @@ import { useRtc } from "@mail/discuss/call/common/rtc_hook";
|
||||
import { browser } from "@web/core/browser/browser";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(DiscussPublic.prototype, "discuss/call/public", {
|
||||
patch(DiscussPublic.prototype, {
|
||||
setup() {
|
||||
this._super(...arguments);
|
||||
super.setup(...arguments);
|
||||
this.rtc = useRtc();
|
||||
},
|
||||
async displayChannel() {
|
||||
this._super();
|
||||
super.displayChannel();
|
||||
const video = browser.localStorage.getItem("discuss_call_preview_join_video");
|
||||
const mute = browser.localStorage.getItem("discuss_call_preview_join_mute");
|
||||
if (this.thread.defaultDisplayMode === "video_full_screen") {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user