Files
odoo_source/addons/report/views/views.xml
T
Simon Lejeune 2e16296099 [REF] base, report: preview internal/external qweb reports
Added two dummy reports to print an empty internal and external report
and added direct link to edit header/footers template in the form view
(in technical features) for convenience.

Also moved the 'preview rml report' under the rml configuration and
tried to make the company form as clean as possible but i think it's
failed.
2015-09-28 14:35:22 +02:00

152 lines
6.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- report.paperformat -->
<record id="paperformat_view_tree" model="ir.ui.view">
<field name="name">paper_format_view_tree</field>
<field name="model">report.paperformat</field>
<field name="arch" type="xml">
<tree string="Paper format configuration">
<field name="name" />
</tree>
</field>
</record>
<record id="paperformat_view_form" model="ir.ui.view">
<field name="name">paper_format_view_form</field>
<field name="model">report.paperformat</field>
<field name="arch" type="xml">
<form string="Paper format configuration">
<group>
<field name="name" />
<field name="format" />
<field name="page_height" attrs="{'invisible': [('format','!=','custom')]}" />
<field name="page_width" attrs="{'invisible': [('format','!=','custom')]}" />
<field name="orientation" />
<field name="margin_top" />
<field name="margin_bottom" />
<field name="margin_left" />
<field name="margin_right" />
<field name="header_line" />
<field name="header_spacing" />
<field name="dpi" />
<field name="report_ids" widget="many2many_tags"/>
</group>
</form>
</field>
</record>
<record id="paper_format_action" model="ir.actions.act_window">
<field name="name">Paper Format General Configuration</field>
<field name="res_model">report.paperformat</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<record id='reports_action' model='ir.actions.act_window'>
<field name="name">Reports</field>
<field name="res_model">ir.actions.report.xml</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem
id="reporting_menuitem"
name="Reports"
parent="base.menu_custom"
sequence="15"
groups="base.group_no_one"
/>
<menuitem
id="paper_format_menuitem"
name="Paper Format"
parent="reporting_menuitem"
action="paper_format_action"
sequence="2"
groups="base.group_no_one"
/>
<menuitem
id="reports_menuitem"
name="Reports"
parent="reporting_menuitem"
action="reports_action"
sequence="3"
groups="base.group_no_one"
/>
<!-- Add a paperformat and web button to the report form view -->
<record id="act_report_xml_view_inherit" model="ir.ui.view">
<field name="name">act_report_xml_view_inherit</field>
<field name="inherit_id" ref="base.act_report_xml_view" />
<field name="model">ir.actions.report.xml</field>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='attachment']" position="after">
<field name="paperformat_id" attrs="{'invisible':[('report_type','not in',['qweb-pdf'])]}"/>
<button
type="object"
class="oe_link"
string="Search associated QWeb views"
name="associated_view"
attrs="{'invisible':[('report_type', 'not in', ['qweb-pdf', 'qweb-html'])]}"
/>
</xpath>
</data>
</field>
</record>
<!-- Customize the company form view by adding paperformat field as well as demo reports -->
<!-- Demo reports definition -->
<template id="preview_internalreport">
<t t-call="report.html_container">
<t t-call="report.internal_layout">
<div class="page">
<p>This is a sample of an internal report.</p>
</div>
</t>
</t>
</template>
<template id="preview_externalreport">
<t t-call="report.html_container">
<t t-call="report.external_layout">
<div class="page">
<p>This is a sample of an external report.</p>
</div>
</t>
</t>
</template>
<report id="action_report_internalpreview"
model="res.company"
name="report.preview_internalreport"
file="report.preview_internalreport"
string="Preview Internal Report"
report_type="qweb-pdf"/>
<report id="action_report_externalpreview"
model="res.company"
name="report.preview_externalreport"
file="report.preview_externalreport"
string="Preview External Report"
report_type="qweb-pdf"/>
<record id="reporting_settings_form_inherited" model="ir.ui.view">
<field name="name">view_company_form_inherited</field>
<field name="inherit_id" ref="base.view_company_form" />
<field name="model">res.company</field>
<field name="arch" type="xml">
<data>
<xpath expr="//page[@name='report']/group[1]" position="inside">
<group col="2" colspan="2">
<field name="paperformat_id" />
</group>
<group col="1" colspan="2" groups="base.group_no_one">
<button name="%(action_report_internalpreview)d" string="Preview Internal Report" type="action"/>
<button name="%(action_report_externalpreview)d" string="Preview External Report" type="action"/>
<button name="edit_external_header" string="Edit external header" type="object" class="oe_link"/>
<button name="edit_external_footer" string="Edit external footer" type="object" class="oe_link"/>
<button name="edit_internal_header" string="Edit internal header" type="object" class="oe_link"/>
</group>
</xpath>
</data>
</field>
</record>
</data>
</openerp>