[FIX] base: avoid systematic invalidation of web.report_assets_common
[FIX] base: avoid systematic invalidation of web.report_assets_common

The issue is: the user wants to send an invoice to a customer, changes
the email template, and after the onchange, the field "Template" of the
wizard is empty.

Here is what happens.  The onchange on the template renders a PDF file
with the corresponding invoice document.  The rendering builds some
assets to convert the invoice to a PDF document, and former assets are
deleted.  The deletion of former assets (`ir.attachment` records)
invalidates the whole record cache, which implicitly clears all the
fields of the record of the onchange.

The problem is that the asset is systematically invalidated by the
rendering of the report itself.  This hack changes the CSS assets to
introduce company-specific colors for the rendering of reports.  This
implementation is actually not consistent with the fact that assets are
kept in cache by the server.

This patch does not fix the root cause of the problem, but it reduces
the sides effects of it, and makes the issue above less frequent.  It
simply consists in not updating the asset's attachment when its value is
already correct.

OPW 2168623
OPW 2171040

closes odoo/odoo#44295

X-original-commit: b1ddd9c95bc642e42eb0d3d51066902d5283ba04
Signed-off-by: Raphael Collet (rco) <fcee45b878db1f337818c5c606c1542797080a40@openerp.com>

ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo