[14.0][MIG] report_layout_config

pull/571/head
Iryna Vyshnevska 2021-12-30 10:58:06 +02:00
parent c591573301
commit 1468fb3237
6 changed files with 11 additions and 43 deletions

View File

@ -4,7 +4,7 @@
{
"name": "Report layout configuration",
"summary": "Add possibility to easily modify the global report layout",
"version": "13.0.1.0.1",
"version": "14.0.1.0.0",
"category": "Reporting",
"website": "https://github.com/OCA/reporting-engine",
"author": "Camptocamp, " "Odoo Community Association (OCA)",

View File

@ -25,22 +25,8 @@ class BaseDocumentLayout(models.TransientModel):
self.need_images_layout = self.external_report_layout_id == img_lay
@api.depends(
"report_layout_id",
"logo",
"font",
"primary_color",
"secondary_color",
"full_footer_img",
"full_header_img",
)
def _compute_preview(self):
self.ensure_one()
if not self.need_images_layout or not self.report_layout_id:
super()._compute_preview()
else:
ir_qweb = self.env["ir.qweb"]
qweb_ctx = self.env["ir.ui.view"]._prepare_qcontext()
qweb_ctx.update({"company": self})
self.preview = ir_qweb.render(
"report_layout_config.layout_preview", qweb_ctx
)

View File

@ -85,25 +85,5 @@
/>
</div>
</template>
<!-- Same as odoo/src/odoo/addons/base/wizard/base_document_layout_views.xml -->
<!-- the footer and the t-if for other template color was removed -->
<!-- this template is used by the BaseDocumentLayout wizard to display a live preview of a dummy report -->
<template
id="layout_preview"
name="layout preview"
primary="True"
inherit_id="base.layout_preview"
>
<!-- compute some layout specific variables -->
<xpath expr="//div[hasclass('header')]" position="before">
<t t-if="company.full_header_img">
<t t-call="report_layout_config.header_image" />
</t>
</xpath>
<xpath expr="//div[hasclass('text-center')]" position="replace">
<t t-if="company.full_footer_img">
<t t-call="report_layout_config.footer_image" />
</t>
</xpath>
</template>
</odoo>

View File

@ -3,7 +3,7 @@
<record id="base_document_layout" model="ir.ui.view">
<field name="name">base.document.layout</field>
<field name="model">base.document.layout</field>
<field name="inherit_id" ref="base.view_base_document_layout" />
<field name="inherit_id" ref="web.view_base_document_layout" />
<field name="arch" type="xml">
<xpath expr="//field[@name='logo']" position="attributes">
<attribute
@ -25,11 +25,6 @@
name='attrs'
>{'invisible': [('need_images_layout', '=', True)]}</attribute>
</xpath>
<xpath expr="//field[@name='preview_logo']" position="attributes">
<attribute
name='attrs'
>{'invisible': [('need_images_layout', '=', True)]}</attribute>
</xpath>
<xpath expr="//field[@name='logo']" position="after">
<field name="need_images_layout" invisible="True" />
<field

View File

@ -0,0 +1 @@
../../../../report_layout_config

View File

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)