XML files are now declared in python module manifests. During the qweb 't-call-asset' directive, assetbundle will fetch the declared xml files, apply the inheritance (t-inherit) and create a javascript service (for eg: 'web.assets_backend.bundle.xml') which is added at the end of the *.js mimifier file. When the debug mode is activated, comments are added in the template indicating which file the template comes from as well as the inheritances applied to it. **** JavaScript: assets.js (module @web/core/assets) takes care of loading libraries, javascripts and styles. `loadJS(url)` (loads the javascript and returns a resolved promise when the templates are also loaded via the '*.bundle.xml' service) `loadCSS(url)` (loads the style a resolved promise when the file is loaded) `loadXML(xml, app=assets.defaultApp)` (load template into application/owl, used by the `*.bundle.xml` services) `getBundle(bundleName)` (get the bundle descriptor) `loadBundle(desc)` (load the files and bundle from a descriptor) templates (XML element content all owl templates) A new `ready(serviceName)` method on boot.js lets you know when a service is loaded are the require. The xmlDependencies attribute no longer exists. Python: The xmls taken into account by assetbundle.py, applying `t-inherit` inheritances and adding an `name_of_the_bundle.bundle.xml` service in the generated JavaScript file. **** Every manifest changes is into the next commit, except 'web_tour' in this current commit as example. Part-of: odoo/odoo#95500
55 lines
1.5 KiB
Python
55 lines
1.5 KiB
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
import warnings
|
|
from odoo import http
|
|
from odoo.tools import lazy
|
|
from odoo.addons.web.controllers import (
|
|
action, binary, database, dataset, export, home, report, session,
|
|
utils, view, webclient,
|
|
)
|
|
|
|
_MOVED_TO_MAP = {
|
|
'_get_login_redirect_url': utils,
|
|
'_local_web_translations': webclient,
|
|
'Action': action,
|
|
'allow_empty_iterable': export,
|
|
'Binary': binary,
|
|
'clean': binary,
|
|
'clean_action': utils,
|
|
'content_disposition': http,
|
|
'CONTENT_MAXAGE': webclient,
|
|
'CSVExport': export,
|
|
'Database': database,
|
|
'DataSet': dataset,
|
|
'DBNAME_PATTERN': database,
|
|
'ensure_db': utils,
|
|
'ExcelExport': export,
|
|
'Export': export,
|
|
'ExportFormat': export,
|
|
'ExportXlsxWriter': export,
|
|
'fix_view_modes': utils,
|
|
'generate_views': utils,
|
|
'GroupExportXlsxWriter': export,
|
|
'GroupsTreeNode': export,
|
|
'Home': home,
|
|
'none_values_filtered': export,
|
|
'OPERATOR_MAPPING': export,
|
|
'ReportController': report,
|
|
'Session': session,
|
|
'SIGN_UP_REQUEST_PARAMS': home,
|
|
'View': view,
|
|
'WebClient': webclient,
|
|
}
|
|
|
|
def __getattr__(attr):
|
|
module = _MOVED_TO_MAP.get(attr)
|
|
if not module:
|
|
raise AttributeError(f"Module {__name__!r} has not attribute {attr!r}.")
|
|
|
|
@lazy
|
|
def only_one_warn():
|
|
warnings.warn(f"{__name__!r} has been split over multiple files, you'll find {attr!r} at {module.__name__!r}", DeprecationWarning, stacklevel=4)
|
|
return getattr(module, attr)
|
|
|
|
return only_one_warn
|