[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
This commit is contained in:
@@ -1,7 +1,24 @@
|
||||
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;
|
||||
});
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
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');
|
||||
|
||||
Reference in New Issue
Block a user