diff --git a/addons/bus/static/src/js/services/assets_watchdog_service.js b/addons/bus/static/src/js/services/assets_watchdog_service.js index bf26600cc45b6..114988a2afa6e 100644 --- a/addons/bus/static/src/js/services/assets_watchdog_service.js +++ b/addons/bus/static/src/js/services/assets_watchdog_service.js @@ -4,7 +4,9 @@ import { browser } from "@web/core/browser/browser"; import { registry } from "@web/core/registry"; export const assetsWatchdogService = { - start(env) { + dependencies: ["notification"], + + start(env, { notification }) { const assets = {}; let assetsChangedNotificationId = null; let bundleNotifTimerID = null; @@ -32,7 +34,7 @@ export const assetsWatchdogService = { // We wait until things settle down browser.clearTimeout(bundleNotifTimerID); bundleNotifTimerID = browser.setTimeout(() => { - assetsChangedNotificationId = env.services.notification.create( + assetsChangedNotificationId = notification.create( env._t("The page appears to be out of date."), { title: env._t("Refresh"), diff --git a/addons/calendar/static/src/js/services/calendar_notification_service.js b/addons/calendar/static/src/js/services/calendar_notification_service.js index e8d07d96d28d2..1890947ed849c 100644 --- a/addons/calendar/static/src/js/services/calendar_notification_service.js +++ b/addons/calendar/static/src/js/services/calendar_notification_service.js @@ -5,7 +5,9 @@ import { ConnectionLostError } from "@web/core/network/rpc_service"; import { registry } from "@web/core/registry"; export const calendarNotificationService = { - start(env) { + dependencies: ["action", "notification", "rpc"], + + start(env, { action, notification, rpc }) { let calendarNotifTimeouts = {}; let nextCalendarNotifTimeout = null; const calendarNotif = {}; @@ -40,7 +42,7 @@ export const calendarNotificationService = { return; } calendarNotifTimeouts[key] = browser.setTimeout(function () { - const notificationID = env.services.notification.create(notif.message, { + const notificationID = notification.create(notif.message, { title: notif.title, type: "warning", sticky: true, @@ -52,26 +54,26 @@ export const calendarNotificationService = { name: env._t("OK"), primary: true, onClick: async () => { - await env.services.rpc("/calendar/notify_ack"); - env.services.notification.close(calendarNotif[key]); + await rpc("/calendar/notify_ack"); + notification.close(calendarNotif[key]); }, }, { name: env._t("Details"), onClick: async () => { - await env.services.action.doAction( + await action.doAction( "calendar.action_calendar_event_notify", { resId: notif.event_id, } ); - env.services.notification.close(calendarNotif[key]); + notification.close(calendarNotif[key]); }, }, { name: env._t("Snooze"), onClick: () => { - env.services.notification.close(calendarNotif[key]); + notification.close(calendarNotif[key]); }, }, ], @@ -92,7 +94,7 @@ export const calendarNotificationService = { async function getNextCalendarNotif() { try { - const result = await env.services.rpc("/calendar/notify", {}, { shadow: true }); + const result = await rpc("/calendar/notify", {}, { shadow: true }); displayCalendarNotification(result); } catch (error) { if (!(error instanceof ConnectionLostError)) { diff --git a/addons/partner_autocomplete/static/src/js/web_company_autocomplete.js b/addons/partner_autocomplete/static/src/js/web_company_autocomplete.js index a36425a48c6ec..6a253d255384f 100644 --- a/addons/partner_autocomplete/static/src/js/web_company_autocomplete.js +++ b/addons/partner_autocomplete/static/src/js/web_company_autocomplete.js @@ -1,26 +1,18 @@ -// odoo.define('web.company_autocomplete', function (require) { -// "use strict"; +/** @odoo-module **/ -// const AbstractWebClient = require('web.AbstractWebClient'); -// const session = require('web.session'); +import { registry } from "@web/core/registry"; -// return AbstractWebClient.include({ +export const companyAutocompleteService = { + dependencies: ["orm", "user"], -// start: function () { -// if (session.iap_company_enrich) { -// const current_company_id = session.user_companies.current_company; -// this._rpc({ -// model: 'res.company', -// method: 'iap_enrich_auto', -// args: [current_company_id], -// }, { -// shadow: true, -// }); -// } + start(env, { orm, user }) { + if (odoo.session_info.iap_company_enrich) { + const currentCompanyId = user.current_company.id; + orm.call("res.company", "iap_enrich_auto", [currentCompanyId], {}, { shadow: true }); + } + }, +}; -// return this._super.apply(this, arguments); -// }, - -// }); - -// }); +registry + .category("services") + .add("partner_autocomplete.companyAutocomplete", companyAutocompleteService);