[FIX] stock: no formatting while printing traceability report for the first time

While generating the traceability report for the first time,
if the assets are not in cache, the report will be having simple markup with
no styles applied. To workaround this issue, we manually commit the writes
in the `ir.attachment` table. It is done thanks to a key in the context.

Task-1974338
This commit is contained in:
Kaushalya Mandaliya
2019-05-21 09:35:59 +00:00
parent ff02bf1137
commit 7b65e6c6bb
+6 -1
View File
@@ -2,6 +2,7 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models, _
from odoo.tools import config
rec = 0
@@ -206,7 +207,11 @@ class MrpStockReport(models.TransientModel):
'base_url': base_url,
}
body = self.env['ir.ui.view'].render_template(
context = dict(self.env.context)
if not config['test_enable']:
context['commit_assetsbundle'] = True
body = self.env['ir.ui.view'].with_context(context).render_template(
"stock.report_stock_inventory_print",
values=dict(rcontext, lines=lines, report=self, context=self),
)