Before this commit, the company specific colors and font were implemented by systematically overwriting a "virtual" report SCSS asset file before rendering each report. This caused many issues, forced frequent asset bundles recomputations (performance problem + cache invalidation causing random bugs). And it could simply not work in a multi-company setup where multiple styles are involved, as the asset management could be made not thread-safe. PR #44225 was a first attempt to mitigate the numerous problems by making the asset bundle invalidation less frequent. But the problems were still present and a more complete solution was necessary for multi-company setups. Besides, the design of the bundle forbade making company specific assets. This commit uses a different approach: instead of having a company-specific asset that needs to be constantly updated, a global "multi-company" asset is maintained and included in the report assets. It only needs to be generated when a company style changes, not for every rendering operation. Unfortunately this change cannot be fully performed without updating the template declarations, so it will require an update of the `web` (or `base`) module to be operational. As this represents a rather invasive change in a stable branch, extensive testing was conducted to minimize the effects and ensure proper degradation of features for production deployments where the new code would be deployed without forcing an update of the `web` module: - The report SCSS files were left untouched, to prevent any bundle invalidation, ensuring that old cached assets would remain valid. This means that single-company setups should not see any visible difference after pulling the code (with or without updating `web`). SCSS cleanup will be done later. - Existing Python methods were kept but emptied, to make sure that old templates and code would not crash. - For multi-companies, the last used colors will be applied for all reports until the `web` module is updated. The old behavior was not working correctly anyways, so the degradation is actually limited. - For all setups, changing the colors after deploying this patch will have no effect unless the `web` module is updated. /UPDATED FOR master on top of #44393/: - removed the `res_company.update_scss()` method entirely - fixed the report SCSS styles, as the variable names referred to the old behavior, e.g. "$o-company-primary-color" is nonsense. Renamed to "$o-default-report-primary-color" etc. -- Improves #44225 Forward of #44393 opw-2168623 opw-2171040 closes odoo/odoo#46647 X-original-commit: a5b1421aecf27b1de408434d3bb6d7ac81f57dc3 Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
37 lines
1.9 KiB
XML
37 lines
1.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<data>
|
|
<record id="report_layout_standard" model="report.layout">
|
|
<field name="name">Standard</field>
|
|
<field name="view_id" ref="web.external_layout_standard"/>
|
|
<field name="image">/web/static/img/preview_standard.png</field>
|
|
<field name="pdf">/web/static/pdf/preview_standard.pdf</field>
|
|
</record>
|
|
<record id="report_layout_background" model="report.layout">
|
|
<field name="name">Background</field>
|
|
<field name="view_id" ref="web.external_layout_background"/>
|
|
<field name="image">/web/static/img/preview_background.png</field>
|
|
<field name="pdf">/web/static/pdf/preview_background.pdf</field>
|
|
</record>
|
|
<record id="report_layout_boxed" model="report.layout">
|
|
<field name="name">Boxed</field>
|
|
<field name="view_id" ref="web.external_layout_boxed"/>
|
|
<field name="image">/web/static/img/preview_boxed.png</field>
|
|
<field name="pdf">/web/static/pdf/preview_boxed.pdf</field>
|
|
</record>
|
|
<record id="report_layout_clean" model="report.layout">
|
|
<field name="name">Clean</field>
|
|
<field name="view_id" ref="web.external_layout_clean"/>
|
|
<field name="image">/web/static/img/preview_clean.png</field>
|
|
<field name="pdf">/web/static/pdf/preview_clean.pdf</field>
|
|
</record>
|
|
<record id="asset_styles_company_report" model="ir.attachment">
|
|
<field name="datas" model="res.company" eval="obj()._get_asset_style_b64()"/>
|
|
<field name="mimetype">text/scss</field>
|
|
<field name="name">res.company.scss</field>
|
|
<field name="type">binary</field>
|
|
<field name="url">/web/static/src/scss/asset_styles_company_report.scss</field>
|
|
</record>
|
|
</data>
|
|
</odoo>
|