Skip to content
Snippets Groups Projects
Commit 3a77deb6 authored by Romain Derie's avatar Romain Derie
Browse files

[FIX] account, portal: use new syntax in sidebar widget

There is a new syntax for widgets, among other things it allows the widget code
to be partly executed before the DOM is ready, speeding the process.

Courtesy of QSM
opw-39876
parent a7e2bd86
Branches
Tags
No related merge requests found
odoo.define('account.AccountPortalSidebar', function (require) {
odoo.define('account.AccountPortalSidebar.instance', function (require) {
"use strict";
require('web.dom_ready');
var AccountPortalSidebar = require('account.AccountPortalSidebar');
if (!$('.o_portal_invoice_sidebar').length) {
return $.Deferred().reject("DOM doesn't contain '.o_portal_invoice_sidebar'");
}
var account_portal_sidebar = new AccountPortalSidebar();
return account_portal_sidebar.attachTo($('.o_portal_invoice_sidebar')).then(function () {
return account_portal_sidebar;
});
});
//==============================================================================
odoo.define('account.AccountPortalSidebar', function (require) {
"use strict";
var PortalSidebar = require('portal.PortalSidebar');
var AccountPortalSidebar = PortalSidebar.extend({
......@@ -46,13 +63,6 @@ var AccountPortalSidebar = PortalSidebar.extend({
},
});
$(function () {
if (!$('.o_portal_invoice_sidebar').length) {
return $.Deferred().reject("DOM doesn't contain '.o_portal_invoice_sidebar'");
}
var account_portal_sidebar = new AccountPortalSidebar();
account_portal_sidebar.attachTo($('.o_portal_invoice_sidebar'));
});
return AccountPortalSidebar;
});
odoo.define('portal.PortalSidebar', function (require) {
"use strict";
require('web.dom_ready');
var config = require('web.config');
var core = require('web.core');
var Widget = require('web.Widget');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment