[FIX] web: restore HTML report CSS
Steps to reproduce: - Open base runbot with no installations > Install Account > Check an invoice preview. - Install Website > Check invoice preview > It looks narrow and does not fill the available width. Starting from [1], the code that sets the `container-fluid` class on HTML web reports was replaced with the Owl version on the `ReportAction` [2] but since some reports are not using this system, the code was restored in a separate JS module on 16.0. Starting from `16.1` (exactly after [3]), the JS code in `web.report_assets_common` bundle was removed completely from the report template, and reports are only using CSS [4]. So instead of a separate JS module, a temporary script was added to the template to maintain the same legacy behavior when a report is in iframe until all reports are fully converted. [1]: https://github.com/odoo/odoo/commit/feef532b417828905ce09675043b55b2b3736e43 [2]: https://github.com/odoo/odoo/commit/feef532b417828905ce09675043b55b2b3736e43#diff-ed0708a6c1a18e945a7829b2f8b17df7a2fbe4ab83e27fe6140dba79465c2832R39-R43 [3]: https://github.com/odoo/odoo/pull/104794/commits/37f009772ccb6bc9ed5733374e104e39c1e11792#diff-d9b97c730b0213bde5b18ab515e1e94fdb0809b8f760440ef7ca70163263101fL29-L30 [4]: Even after completely removing the JS code from HTML reports, the `web.report_assets_common` bundle still contains some unused legacy report JS code on stock: https://github.com/odoo/odoo/blob/saas-16.1/addons/stock/__manifest__.py#L98-L100 Maybe this code should be removed if it is not used anymore. opw-3209231 closes odoo/odoo#126716 X-original-commit: 98d14a0b657efcfd365a4e7a28bef91f57758e6b Signed-off-by: Romain Derie (rde) <rde@odoo.com> Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
This commit is contained in:
@@ -15,6 +15,16 @@
|
||||
<meta name="viewport" content="initial-scale=1"/>
|
||||
<title><t t-esc="title or 'Odoo Report'"/></title>
|
||||
<t t-call-assets="web.report_assets_common"/>
|
||||
<!-- Temporary code: only used to maintain CSS for legacy HTML reports (full width...) -->
|
||||
<!-- Should be removed once the reports are fully converted. -->
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
if (window.self !== window.top) {
|
||||
document.body.classList.add("o_in_iframe", "container-fluid");
|
||||
document.body.classList.remove("container");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body t-att-class="'container' if not full_width else 'container-fluid'">
|
||||
<div id="wrapwrap">
|
||||
|
||||
Reference in New Issue
Block a user