0ecf1636eb
Before this commit, owl was in the linter's accepted global variables.
This allowed direct access to owl global object.
For instance, to use xml from owl, you could do :
`const { xml } = owl;`
or you could use it directly:
`owl.xml`
Now, owl is not accepted on linter's global variables anymore, so to
import xml, now you need to use a proper import:
`import { xml } from "@odoo/owl";`
task-id 3498859
closes odoo/design-themes#709
Related: odoo/odoo#137517
Related: odoo/enterprise#48364
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
/** @odoo-module **/
|
|
|
|
import { patch } from "@web/core/utils/patch";
|
|
import { useService } from '@web/core/utils/hooks';
|
|
import { WebsiteSwitcherSystray } from '@website/systray_items/website_switcher';
|
|
import { onMounted, useState } from "@odoo/owl";
|
|
|
|
patch(WebsiteSwitcherSystray.prototype, {
|
|
setup() {
|
|
super.setup();
|
|
|
|
this.orm = useService('orm');
|
|
this.tooltips = useState({});
|
|
// Disable the notification service to avoid having a notification for each theme.
|
|
this.notificationService = { add: () => () => null };
|
|
|
|
onMounted(async () => {
|
|
const themesWebsites = await this.orm.call('website', 'get_test_themes_websites_theme_preview');
|
|
for (const themeId in themesWebsites) {
|
|
this.tooltips[themeId] = {
|
|
tooltipTemplate: 'test_themes.ThemeTooltip',
|
|
tooltipPosition: 'left',
|
|
tooltipDelay: 100,
|
|
tooltipInfo: JSON.stringify({url: themesWebsites[themeId]}),
|
|
};
|
|
}
|
|
});
|
|
},
|
|
template: 'test_themes.WebsiteSwitcherSystray',
|
|
});
|