[REF] report, *: defines address area in external layout templates

This is needed because some reports we want to add later on, need to have
    the address field on the left or following a given format.

    Hence we moved the address div from each existing report on to the main report
    template itself, Since some reports uses up until 3 addresses, we have defined
    an area for the main address that each report can set (address used on the
    envelope's window for sending). The any other extra address, or additional
    information should be defined in the 'information_block' div

Was part of task: 35289
Was part of PR #25472
This commit is contained in:
Cédric Snauwaert
2018-07-24 17:12:52 +02:00
committed by qdp-odoo
parent 0ab6845ed8
commit c71da7db84
11 changed files with 126 additions and 130 deletions
+4 -7
View File
@@ -4,15 +4,12 @@
<template id="report_invoice_document">
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context({'lang': lang})"/>
<div class="page">
<div class="row">
<div name="invoice_address" class="col-xs-5 col-xs-offset-7">
<address t-field="o.partner_id"
<t t-set="address">
<address t-field="o.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<div t-if="o.partner_id.vat" class="mt16"><t t-esc="o.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="o.partner_id.vat"/></div>
</div>
</div>
</t>
<div class="page">
<h2>
<span t-if="o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')">Invoice</span>
<span t-if="o.type == 'out_invoice' and o.state == 'draft'">Draft Invoice</span>
@@ -3,22 +3,23 @@
<template id="report_purchaseorder_document">
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})"/>
<t t-set="address">
<div t-field="o.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
<p t-if="o.partner_id.vat"><t t-esc="o.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="o.partner_id.vat"/></p>
</t>
<t t-if="o.dest_address_id">
<t t-set="information_block">
<strong>Shipping address:</strong>
<div t-if="o.dest_address_id">
<div t-field="o.dest_address_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}' name="purchase_shipping_address"/>
</div>
</t>
</t>
<div class="page">
<div class="oe_structure"/>
<div class="row">
<div class="col-xs-6" name="purchase_shipping_address">
<strong>Shipping address:</strong>
<div t-if="o.dest_address_id">
<div t-field="o.dest_address_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
</div>
</div>
<div class="col-xs-5 col-xs-offset-1">
<div t-field="o.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
<p t-if="o.partner_id.vat"><t t-esc="o.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="o.partner_id.vat"/></p>
</div>
</div>
<h2 t-if="o.state == 'draft'">Request for Quotation #<span t-field="o.name"/></h2>
<h2 t-if="o.state in ['sent', 'to approve']">Purchase Order #<span t-field="o.name"/></h2>
@@ -3,23 +3,21 @@
<template id="report_purchasequotation_document">
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})"/>
<t t-set="address">
<div t-field="o.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
<p t-if="o.partner_id.vat"><t t-esc="o.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="o.partner_id.vat"/></p>
</t>
<t t-if="o.dest_address_id">
<t t-set="information_block">
<strong>Shipping address:</strong>
<div t-field="o.dest_address_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}' name="purchase_shipping_address"/>
</t>
</t>
<div class="page">
<div class="oe_structure"/>
<div class="row mt32 mb32">
<div class="col-xs-6" name="purchase_shipping_address">
<strong>Shipping address:</strong>
<div t-if="o.dest_address_id">
<div t-field="o.dest_address_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
</div>
</div>
<div class="col-xs-5 col-xs-offset-1">
<div t-field="o.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
<p t-if="o.partner_id.vat"><t t-esc="o.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="o.partner_id.vat"/></p>
</div>
</div>
<h2>Request for Quotation <span t-field="o.name"/></h2>
@@ -2,7 +2,7 @@
<odoo>
<template id="report_purchaseorder_document" inherit_id="purchase.report_purchaseorder_document">
<xpath expr="//div[@name='purchase_shipping_address']" position="inside">
<xpath expr="//div[@name='purchase_shipping_address']" position="after">
<div t-if="not o.dest_address_id and o.picking_type_id and o.picking_type_id.warehouse_id">
<span t-field="o.picking_type_id.warehouse_id.name"/>
<div t-field="o.picking_type_id.warehouse_id.partner_id" t-options='{"widget": "contact", "fields": ["address", "phone"], "no_marker": True, "phone_icons": True}'/>
@@ -11,7 +11,7 @@
</template>
<template id="report_purchasequotation_document" inherit_id="purchase.report_purchasequotation_document">
<xpath expr="//div[@name='purchase_shipping_address']" position="inside">
<xpath expr="//div[@name='purchase_shipping_address']" position="after">
<div t-if="not o.dest_address_id and o.picking_type_id.warehouse_id">
<span t-field="o.picking_type_id.warehouse_id.name"/>
<div t-field="o.picking_type_id.warehouse_id.partner_id" t-options='{"widget": "contact", "fields": ["address", "phone"], "no_marker": True, "phone_icons": True}'/>
@@ -5,30 +5,28 @@
<t t-set="o" t-value="doc"/>
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context({'lang': o.partner_id.lang})" />
<t t-set="information_block">
<strong t-if="o.address_id == o.partner_invoice_id">Invoice and shipping address:</strong>
<div t-if="o.partner_invoice_id">
<strong t-if="o.address_id != o.partner_invoice_id">Invoice address: </strong>
<div t-field="o.partner_invoice_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
<p t-if="o.partner_invoice_id.vat"><t t-esc="o.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="o.partner_invoice_id.vat"/></p>
</div>
<t t-if="o.address_id != o.partner_invoice_id">
<strong>Shipping address :</strong>
<div t-field="o.address_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
<p t-if="o.address_id.vat"><t t-esc="o.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="o.address_id.vat"/></p>
</t>
</t>
<t t-set="address">
<div t-field="o.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
</t>
<div class="page">
<div class="oe_structure"/>
<div class="row">
<div class="col-xs-6">
<strong t-if="o.address_id == o.partner_invoice_id">Invoice and shipping address:</strong>
<div t-if="o.partner_invoice_id">
<strong t-if="o.address_id != o.partner_invoice_id">Invoice address: </strong>
<div t-field="o.partner_invoice_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
<p t-if="o.partner_invoice_id.vat"><t t-esc="o.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="o.partner_invoice_id.vat"/></p>
</div>
<div t-if="o.address_id != o.partner_invoice_id">
<strong>Shipping address :</strong>
<div t-field="o.address_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
<p t-if="o.address_id.vat"><t t-esc="o.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="o.address_id.vat"/></p>
</div>
</div>
<div class="col-xs-5 col-xs-offset-1">
<div t-field="o.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
</div>
</div>
<h2>
<span t-if="o.state != 'draft'">Repair Order #:</span>
@@ -3,14 +3,12 @@
<template id="report_intrastatinvoice_document">
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context(lang = o.partner_id.lang)"/>
<t t-set="address">
<address t-field="o.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<span t-field="o.partner_id.vat"/>
</t>
<div class="page">
<div class="row">
<div class="col-xs-5 col-xs-offset-7">
<address t-field="o.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<span t-field="o.partner_id.vat"/>
</div>
</div>
<h2>
<span t-if="o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')">Invoice</span>
+14 -15
View File
@@ -1,23 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_invoice_document_inherit_sale" inherit_id="account.report_invoice_document">
<xpath expr="//div[@name='invoice_address']" position="attributes">
<xpath expr="//address" position="attributes">
<attribute name="groups">!sale.group_delivery_invoice_address</attribute>
</xpath>
<xpath expr="//div[@name='invoice_address']" position="before">
<div class="col-xs-6" groups="sale.group_delivery_invoice_address">
<div t-if="o.partner_shipping_id and (o.partner_shipping_id != o.partner_id)">
<strong>Shipping address:</strong>
<div t-field="o.partner_shipping_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/>
</div>
</div>
<div class="col-xs-5 col-xs-offset-1" groups="sale.group_delivery_invoice_address">
<div t-field="o.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/>
<div t-if="o.partner_id.vat" class="mt16"><t t-esc="o.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="o.partner_id.vat"/></div>
</div>
<xpath expr="//address" position="before">
<t t-if="o.partner_shipping_id and (o.partner_shipping_id != o.partner_id)">
<t t-set="information_block">
<div groups="sale.group_delivery_invoice_address">
<strong>Shipping address:</strong>
<div t-field="o.partner_shipping_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/>
</div>
</t>
</t>
<div t-field="o.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' groups="sale.group_delivery_invoice_address"/>
<div t-if="o.partner_id.vat" class="mt16" groups="sale.group_delivery_invoice_address"><t t-esc="o.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="o.partner_id.vat"/></div>
</xpath>
</template>
</odoo>
+19 -21
View File
@@ -3,30 +3,28 @@
<template id="report_saleorder_document">
<t t-call="web.external_layout">
<t t-set="doc" t-value="doc.with_context({'lang':doc.partner_id.lang})" />
<div class="page">
<div class="oe_structure"/>
<div class="row">
<div class="col-xs-6">
<t t-if="doc.partner_shipping_id == doc.partner_invoice_id
<t t-set="address">
<div t-field="doc.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<p t-if="doc.partner_id.vat"><t t-esc="doc.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="doc.partner_id.vat"/></p>
</t>
<t t-if="doc.partner_shipping_id == doc.partner_invoice_id
and doc.partner_invoice_id != doc.partner_id
or doc.partner_shipping_id != doc.partner_invoice_id">
<strong t-if="doc.partner_shipping_id == doc.partner_invoice_id">Invoicing and shipping address:</strong>
<strong t-if="doc.partner_shipping_id != doc.partner_invoice_id">Invoicing address:</strong>
<div t-field="doc.partner_invoice_id"
<t t-set="information_block">
<strong t-if="doc.partner_shipping_id == doc.partner_invoice_id">Invoicing and shipping address:</strong>
<strong t-if="doc.partner_shipping_id != doc.partner_invoice_id">Invoicing address:</strong>
<div t-field="doc.partner_invoice_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
<t t-if="doc.partner_shipping_id != doc.partner_invoice_id">
<strong>Shipping address:</strong>
<div t-field="doc.partner_shipping_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
<div t-if="doc.partner_shipping_id != doc.partner_invoice_id" class="mt8">
<strong>Shipping address:</strong>
<div t-field="doc.partner_shipping_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
</div>
</t>
</div>
<div class="col-xs-5 col-xs-offset-1">
<div t-field="doc.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<p t-if="doc.partner_id.vat"><t t-esc="doc.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="doc.partner_id.vat"/></p>
</div>
</div>
</t>
</t>
</t>
<div class="page">
<div class="oe_structure"/>
<h2>
<t t-if="not (env.context.get('proforma', False) or is_pro_forma)">
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_delivery_document_inherit_sale_stock" inherit_id="stock.report_delivery_document">
<xpath expr="//div[@name='customer_address']" position="after">
<xpath expr="//h2" position="before">
<div class="row" t-if="o.sale_id.client_order_ref">
<div class="col-xs-4 pull-right">
<strong>Customer Reference:</strong>
+12 -15
View File
@@ -5,22 +5,19 @@
<t t-call="web.html_container">
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})" />
<t t-if="o.move_lines and o.move_lines[0].partner_id and not o.partner_id" name="partner_header">
<t t-set="address">
<div t-field="o.move_lines[0].partner_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True}'/>
</t>
</t>
<t t-if="o.partner_id" name="partner_header">
<t t-set="address">
<div t-field="o.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True}'/>
</t>
</t>
<div class="page">
<div class="row" name="customer_address">
<div class="col-xs-4 pull-right">
<div>
<span><strong>Customer Address:</strong></span>
</div>
<div t-if="o.move_lines and o.move_lines[0].partner_id and not o.partner_id" name="partner_header">
<div t-field="o.move_lines[0].partner_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True}'/>
</div>
<div t-if="o.partner_id" name="partner_header">
<div t-field="o.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True}'/>
</div>
</div>
</div>
<h2>
<span t-field="o.name"/>
</h2>
+23 -13
View File
@@ -144,6 +144,23 @@
<!-- External layouts styles -->
<template id="address_layout">
<t t-set="colclass" t-value="'col-xs-5 col-xs-offset-7'"/>
<t t-if="address">
<div class="row">
<t t-if="information_block">
<t t-set="colclass" t-value="'col-xs-5 col-xs-offset-1'"/>
<div name="information_block" class="col-xs-6">
<t t-raw="information_block"/>
</div>
</t>
<div name="address" t-att-class="colclass">
<t t-raw="address"/>
</div>
</div>
</t>
</template>
<template id="external_layout_background">
<div class="header o_background_header">
<div class="pull-right">
@@ -161,6 +178,7 @@
</div>
<div class="article o_report_layout_background">
<t t-call="web.address_layout" />
<t t-raw="0" />
</div>
@@ -200,7 +218,8 @@
</div>
<div class="article o_report_layout_boxed">
<t t-raw="0" />
<t t-call="web.address_layout" />
<t t-raw="0" />
</div>
<div class="footer o_boxed_footer">
@@ -238,6 +257,7 @@
</div>
<div class="article o_report_layout_clean">
<t t-call="web.address_layout" />
<t t-raw="0" />
</div>
@@ -285,6 +305,7 @@
</div>
<div class="article o_report_layout_standard">
<t t-call="web.address_layout" />
<t t-raw="0" />
</div>
@@ -323,18 +344,7 @@
<t t-set="company" t-value="res_company"/>
</t>
<t t-if="company.external_report_layout == 'background'">
<t t-call="web.external_layout_background"><t t-raw="0"/></t>
</t>
<t t-if="company.external_report_layout == 'boxed'">
<t t-call="web.external_layout_boxed"><t t-raw="0"/></t>
</t>
<t t-if="company.external_report_layout == 'clean'">
<t t-call="web.external_layout_clean"><t t-raw="0"/></t>
</t>
<t t-if="company.external_report_layout in (False, 'standard')">
<t t-call="web.external_layout_standard"><t t-raw="0"/></t>
</t>
<t t-call="web.external_layout_{{company.external_report_layout or 'standard'}}"><t t-raw="0"/></t>
</template>
<template id="internal_layout">