Loading... (0%)

Post published: Post last modified: 29 December 2015

Just a little reminder to myself of modified report layouts with full code examples.

Paper Format

Path: Settings > Reports > Paper Format > European A4

Name:				European A4
Paper size:			A4 0 210 x 297 mm, 8.26 x 11.69 inches
Orientation:			Portrait
Top Margin (mm):		10.00
Bottom Margin (mm):		30.00
Left Margin (mm):		20.00
Right Margin (mm):		10.00
Display a header line:	
Header spacing:			0
Output DPI:			150
Associated reports:		

Header

Path: Accounting > Settings > Configure your company data > Report Configuration > Edit external header

<?xml version="1.0"?> <t t-name="report.external_layout_header"> <div class="header"> <div class="row"> <div class="col-xs-3"> <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 45px;"/> </div> <div class="col-xs-9 text-right" style="margin-top:0px;"> <span t-field="company.rml_header1" /><br /> <address> <span t-field="company.partner_id" />, <span t-field="company.partner_id.street" />, <span t-field="company.partner_id.city" />, <span t-field="company.partner_id.zip" />, <span t-field="company.partner_id.country_id" /> </address> </div> </div> <div class="row zero_min_height"> <div class="col-xs-12"> <div style="border-bottom: 1px solid black;"/> </div> </div> </div> </t>

Footer

Path: Accounting > Settings > Configure your company data > Report Configuration > Edit external footer

<?xml version="1.0"?> <t t-name="report.external_layout_footer"> <div class="footer"> <div class="text-center" style="border-top: 1px solid black;"> <ul t-if="not company.custom_footer" class="list-inline"> <li t-if="company.phone">Phone: <span t-field="company.phone"/></li> <li t-if="company.fax and company.phone">&amp;bull;</li> <li t-if="company.fax">Fax: <span t-field="company.fax"/></li> <li t-if="company.email and company.fax or company.email and company.phone">&amp;bull;</li> <li t-if="company.email">Email: <span t-field="company.email"/></li> <li t-if="company.website and company.email or company.website and company.fax or company.website and company.phone">&amp;bull;</li> <li t-if="company.website">Website: <span t-field="company.website"/></li> <li t-if="company.company_registry or company.vat">&amp;bull;</li> <li t-if="company.company_registry">Reg: <span t-field="company.company_registry"/></li> </ul> <ul t-if="not company.custom_footer" class="list-inline" name="financial_infos"> <li t-if="company.vat">TIN: <span t-field="company.vat"/></li> </ul> <t t-if="company.custom_footer"> <span t-raw="company.rml_footer"/> </t> <ul class="list-inline"> <li>Page</li> <li><span class="page"/></li> <li>of</li> <li><span class="topage"/></li> </ul> </div> </div> </t>

Invoice Report

Path: Settings > Reports > Reports > Invoices > Search associated QWeb views > report_invoice_document

<?xml version="1.0"?> <t t-name="account.report_invoice_document"> <t t-call="report.external_layout"> <t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})"/> <div class="page"> <!-- Invoice information row (12 columns) --> <div class="row" style="margin-bottom:15px;"> <!-- Invoice data (9 out of 12 columns) --> <div class="col-xs-9" style="margin-top:100px;"> <h2 style="margin-top:0px;"> <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 == 'proforma2'">PRO-FORMA</span> <span t-if="o.type == 'out_invoice' and o.state == 'draft'">Draft Invoice</span> <span t-if="o.type == 'out_invoice' and o.state == 'cancel'">Cancelled Invoice</span> <span t-if="o.type == 'out_refund'">Refund</span> <span t-if="o.type == 'in_refund'">Vendor Refund</span> <span t-if="o.type == 'in_invoice'">Vendor Bill</span> <span t-field="o.number"/> </h2> <!-- Invoice data row 1 (9 out of 9 columns) --> <div class="row mt32 mb32"> <div class="col-xs-3" t-if="o.date_invoice"> <strong>Invoice Date:</strong> <p t-field="o.date_invoice"/> </div> <div class="col-xs-3" t-if="o.partner_id.ref"> <strong>Customer Code:</strong> <p t-field="o.partner_id.ref"/> </div> <div class="col-xs-3" t-if="o.name"> <strong>Description:</strong> <p t-field="o.name"/> </div> </div> <!-- Invoice data row 2 (9 out of 9 columns) --> <div class="row mt32 mb32"> <div class="col-xs-3" t-if="o.date_due and o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')"> <strong>Due Date:</strong> <p t-field="o.date_due"/> </div> <div class="col-xs-3" t-if="o.origin"> <strong>Source:</strong> <p t-field="o.origin"/> </div> <div name="reference" class="col-xs-3" t-if="o.reference"> <strong>Reference:</strong> <p t-field="o.reference"/> </div> </div> </div> <!-- Invoice customer address (3 out of 12 columns) --> <div class="col-xs-3" style="margin-top:100px;"> <h4 style="margin-top:0px;">Customer:</h4> <address t-field="o.partner_id" t-field-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;], &quot;no_marker&quot;: true}"/> <span t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></span> </div> </div> <!-- Is there a discount on at least one line? --> <t t-set="display_discount" t-value="any([l.discount for l in o.invoice_line_ids])"/> <!-- Invoice lines (12 columns) --> <table class="table table-condensed"> <thead> <tr> <th>Description</th> <th class="text-right">Qty</th> <th class="text-right">Unit Price</th> <th t-if="display_discount" class="text-right" groups="sale.group_discount_per_so_line">Disc.(%)</th> <th class="text-right">Taxes</th> <th class="text-right">Price</th> </tr> </thead> <tbody class="invoice_tbody"> <tr t-foreach="o.invoice_line_ids" t-as="l"> <td><span t-field="l.name"/></td> <td class="text-right"> <span t-field="l.quantity"/> <span t-field="l.uom_id" groups="product.group_uom"/> </td> <td class="text-right"> <span t-field="l.price_unit"/> </td> <td t-if="display_discount" class="text-right" groups="sale.group_discount_per_so_line"> <span t-field="l.discount"/> </td> <td> <span t-esc="', '.join(map(lambda x: (x.description or x.name), l.invoice_line_tax_ids))"/> </td> <td class="text-right"> <span t-field="l.price_subtotal" t-field-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: &quot;o.currency_id&quot;}"/> </td> </tr> </tbody> </table> <!-- Invoice totals (4 out of 12 columns) --> <div class="row"> <div class="col-xs-4 pull-right"> <table class="table table-condensed"> <tr class="border-black"> <td><strong>Subtotal</strong></td> <td class="text-right"> <span t-field="o.amount_untaxed" t-field-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: &quot;o.currency_id&quot;}"/> </td> </tr> <t t-foreach="o._get_tax_amount_by_group()" t-as="amount_by_group"> <tr> <td><span t-esc="amount_by_group[0]"/></td> <td class="text-right"> <span t-esc="amount_by_group[1]"/> </td> </tr> </t> <tr class="border-black"> <td><strong>Total</strong></td> <td class="text-right"> <span t-field="o.amount_total" t-field-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: &quot;o.currency_id&quot;}"/> </td> </tr> </table> </div> </div> <!-- Additional invoice information (12 columns) --> <p t-if="o.comment"> <strong>Comment:</strong> <span t-field="o.comment"/> </p> <p t-if="o.payment_term_id"> <span t-field="o.payment_term_id.note"/> </p> <p t-if="o.fiscal_position_id.note"> <strong>Fiscal Position Remark:</strong> <span t-field="o.fiscal_position_id.note"/> </p> </div> </t> </t>

Print Friendly, PDF & Email

Related Images: