Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Web
Entity: base.document.layout
Compute Method: _compute_preview
| Inputs | Method | Outputs |
|---|---|---|
|
""" compute a qweb based preview to display on the wizard """
styles = self._get_asset_style()
for wizard in self:
if wizard.report_layout_id:
- # guarantees that bin_size is always set to False,
- # so the logo always contains the bin data instead of the binary size
if wizard.env.context.get('bin_size'):
- wizard_with_logo = wizard.with_context(bin_size=False)
- else:
- wizard_with_logo = wizard
- preview_css = markupsafe.Markup(self._get_css_for_preview(styles, wizard_with_logo.id))
- ir_ui_view = wizard_with_logo.env['ir.ui.view']
- wizard.preview = ir_ui_view._render_template('web.report_invoice_wizard_preview', {
- 'company': wizard_with_logo,
- 'preview_css': preview_css,
- 'is_html_empty': is_html_empty,
- })
+ # guarantees that bin_size is always set to False,
+ # so the logo always contains the bin data instead of the binary size
+ wizard = wizard.with_context(bin_size=False)
+ wizard.preview = wizard.env['ir.ui.view']._render_template(
+ wizard._get_preview_template(),
+ wizard._get_render_information(styles),
+ )
else:
wizard.preview = False
|
|
