diff options
| author | Cédric Snauwaert <csn@openerp.com> | 2018-07-24 17:01:28 +0200 |
|---|---|---|
| committer | qdp-odoo <qdp@odoo.com> | 2018-07-24 17:12:52 +0200 |
| commit | c71da7db84f20ba8fb8c4da83d6a3ee063bb1c01 (patch) | |
| tree | 2848f3731d548f80613f6f5cb1cddad1e4a531e6 /addons | |
| parent | 0ab6845ed87d50af838f7390b7141911323ee150 (diff) | |
[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
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/views/report_invoice.xml | 11 | ||||
| -rw-r--r-- | addons/purchase/report/purchase_order_templates.xml | 29 | ||||
| -rw-r--r-- | addons/purchase/report/purchase_quotation_templates.xml | 26 | ||||
| -rw-r--r-- | addons/purchase_stock/report/purchase_report_templates.xml | 4 | ||||
| -rw-r--r-- | addons/repair/report/repair_templates_repair_order.xml | 40 | ||||
| -rw-r--r-- | addons/report_intrastat/report/report_intrastat_invoice_template.xml | 12 | ||||
| -rw-r--r-- | addons/sale/report/invoice_report_templates.xml | 29 | ||||
| -rw-r--r-- | addons/sale/report/sale_report_templates.xml | 40 | ||||
| -rw-r--r-- | addons/sale_stock/report/stock_report_deliveryslip.xml | 2 | ||||
| -rw-r--r-- | addons/stock/report/report_deliveryslip.xml | 27 | ||||
| -rw-r--r-- | addons/web/views/report_templates.xml | 36 |
11 files changed, 126 insertions, 130 deletions
diff --git a/addons/account/views/report_invoice.xml b/addons/account/views/report_invoice.xml index f2017dc3e53..b58476017f8 100644 --- a/addons/account/views/report_invoice.xml +++ b/addons/account/views/report_invoice.xml @@ -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> diff --git a/addons/purchase/report/purchase_order_templates.xml b/addons/purchase/report/purchase_order_templates.xml index 4adf82c3bc4..5a364ce680e 100644 --- a/addons/purchase/report/purchase_order_templates.xml +++ b/addons/purchase/report/purchase_order_templates.xml @@ -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> diff --git a/addons/purchase/report/purchase_quotation_templates.xml b/addons/purchase/report/purchase_quotation_templates.xml index b63329ccb5a..c0822f025a1 100644 --- a/addons/purchase/report/purchase_quotation_templates.xml +++ b/addons/purchase/report/purchase_quotation_templates.xml @@ -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> diff --git a/addons/purchase_stock/report/purchase_report_templates.xml b/addons/purchase_stock/report/purchase_report_templates.xml index a98ed53f891..8e5adc9d45d 100644 --- a/addons/purchase_stock/report/purchase_report_templates.xml +++ b/addons/purchase_stock/report/purchase_report_templates.xml @@ -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}'/> diff --git a/addons/repair/report/repair_templates_repair_order.xml b/addons/repair/report/repair_templates_repair_order.xml index ccd7dcfa53c..254da4aac8e 100644 --- a/addons/repair/report/repair_templates_repair_order.xml +++ b/addons/repair/report/repair_templates_repair_order.xml @@ -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> diff --git a/addons/report_intrastat/report/report_intrastat_invoice_template.xml b/addons/report_intrastat/report/report_intrastat_invoice_template.xml index d445efa38a5..018a445f928 100644 --- a/addons/report_intrastat/report/report_intrastat_invoice_template.xml +++ b/addons/report_intrastat/report/report_intrastat_invoice_template.xml @@ -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> diff --git a/addons/sale/report/invoice_report_templates.xml b/addons/sale/report/invoice_report_templates.xml index cbe0665f036..fcb9153efbf 100644 --- a/addons/sale/report/invoice_report_templates.xml +++ b/addons/sale/report/invoice_report_templates.xml @@ -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> diff --git a/addons/sale/report/sale_report_templates.xml b/addons/sale/report/sale_report_templates.xml index 1c24126dbf8..99cea9ca118 100644 --- a/addons/sale/report/sale_report_templates.xml +++ b/addons/sale/report/sale_report_templates.xml @@ -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)"> diff --git a/addons/sale_stock/report/stock_report_deliveryslip.xml b/addons/sale_stock/report/stock_report_deliveryslip.xml index ea8ca1c0612..459b279e7f2 100644 --- a/addons/sale_stock/report/stock_report_deliveryslip.xml +++ b/addons/sale_stock/report/stock_report_deliveryslip.xml @@ -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> diff --git a/addons/stock/report/report_deliveryslip.xml b/addons/stock/report/report_deliveryslip.xml index 50289bee840..631925cae8b 100644 --- a/addons/stock/report/report_deliveryslip.xml +++ b/addons/stock/report/report_deliveryslip.xml @@ -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> diff --git a/addons/web/views/report_templates.xml b/addons/web/views/report_templates.xml index e427153bb74..d8d6f72dca7 100644 --- a/addons/web/views/report_templates.xml +++ b/addons/web/views/report_templates.xml @@ -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"> |
