Community mailing list archives

community@mail.odoo.com

Re: Sales order and Invoice design...

by
Matjaž Mozetič
- 06/29/2015 07:07:27

If your target are the default reports (qweb), you'll have to make a custom module with the views, that inherit the original reports, and insert the fields that you want, like (example invoice):


<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <template id="account.report_invoice_document_ext" inherit_id="account.report_invoice_document">
            <xpath expr="//div[@class='page']" position="replace">
                <div class="page">
                    <div class="row">
                        <div class="col-xs-5 col-xs-offset-7">
                            <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-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>
                    <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'">Supplier Refund</span>
                    <span t-if="o.type == 'in_invoice'">Supplier Invoice</span>
                    <span t-field="o.number"/>
                </h2>

                <div class="row mt32 mb32">
                    <div class="col-xs-4" t-if="o.company_id.city">
                        <span>Place of Issue:</span>
                        <span t-field="o.company_id.city"/>
                        <div style="border-bottom: 1px solid black;"/>
                    </div>
                    <div class="col-xs-4" t-if="o.date_invoice">
                        <span>Debt Start Date:</span>
                        <span t-field="o.date_invoice"/>
                        <div style="border-bottom: 1px solid black;"/>
                    </div>
                    <div class="col-xs-4" t-if="o.origin">
                        <span>Source:</span>
                        <span t-field="o.origin"/>
                        <div style="border-bottom: 1px solid black;"/>
                    </div>
                    <div class="col-xs-4" t-if="o.date_invoice_creation">
                        <span>Invoice Date:</span>
                        <span t-field="o.date_invoice_creation"/>
                        <div style="border-bottom: 1px solid black;"/>
                    </div>
                    <div class="col-xs-4" t-if="o.date_due">
                        <span>Due Date:</span>
                        <span t-field="o.date_due"/>
                        <div style="border-bottom: 1px solid black;"/>
                    </div>
                    <div class="col-xs-4" t-if="o.name">
                        <span>Description:</span>
                        <span t-field="o.name"/>
                        <div style="border-bottom: 1px solid black;"/>
                    </div>
                    <div class="col-xs-2" t-if="o.partner_id.ref">
                        <span>Customer Code:</span>
                        <span t-field="o.partner_id.ref"/>
                        <div style="border-bottom: 1px solid black;"/>
                    </div>
                </div>
    
                <table class="table table-condensed">
                    <thead>
                        <tr>
                            <th>Description</th>
                            <th>Quantity</th>
                            <th class="text-right">Unit Price</th>
                            <th class="text-right" groups="sale.group_discount_per_so_line">Discount (%)</th>
                            <th class="text-right">Taxes</th>
                            <th class="text-right">Amount</th>
                        </tr>
                    </thead>
                    <tbody class="invoice_tbody">
                        <tr t-foreach="o.invoice_line" t-as="l">
                            <td><span t-field="l.name"/></td>
                            <td>
                                <span t-field="l.quantity"/>
                                <span t-field="l.uos_id" groups="product.group_uom"/>
                            </td>
                            <td class="text-right">
                                <span t-field="l.price_unit"/>
                            </td>
                            <td groups="sale.group_discount_per_so_line"><span t-field="l.discount"/></td>
                            <td class="text-right">
                                <span t-esc="', '.join(map(lambda x: x.name, l.invoice_line_tax_id))"/>
                            </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>
    
                <div class="row">
                    <div class="col-xs-4 pull-right">
                        <table class="table table-condensed">
                            <tr class="border-black">
                                <td><strong>Total Without Taxes</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>
                            <tr>
                                <td>Taxes</td>
                                <td class="text-right">
                                    <span t-field="o.amount_tax" t-field-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: &quot;o.currency_id&quot;}"/>
                                </td>
                            </tr>
                            <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>
    
                <div class="row" t-if="o.tax_line">
                    <div class="col-xs-6">
                        <table class="table table-condensed">
                            <thead>
                                <tr>
                                    <th>Tax</th>
                                    <th class="text-right">Base</th>
                                    <th class="text-right">Amount</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr t-foreach="o.tax_line" t-as="t">
                                    <td><span t-field="t.name"/></td>
                                    <td class="text-right">
                                        <span t-field="t.base" t-field-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: &quot;o.currency_id&quot;}"/>
                                    </td>
                                    <td class="text-right">
                                        <span t-field="t.amount" t-field-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: &quot;o.currency_id&quot;}"/>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
    
                <p t-if="o.comment">
                    <strong>Comment:</strong>
                    <span t-field="o.comment"/>
                </p>
                <p t-if="o.payment_term">
                    <strong>Payment Term:</strong>
                    <span t-field="o.payment_term"/>
                </p>
                <p t-if="o.fiscal_position">
                    <strong>Fiscal Position:</strong>
                    <span t-field="o.fiscal_position"/>
                </p>
                </div>
            </xpath>
        </template>
        <template id="matmoz_reports.report_invoice_document_ext">
            <t t-call="report.html_container">
                <t t-foreach="doc_ids" t-as="doc_id">
                    <t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'matmoz_reports.report_invoice_document_ext')"/>
                </t>
            </t>
        </template>
    </data>
</openerp>


and so on.... for every report you wish to customize.


Regards,



On Mon, Jun 29, 2015 at 12:38 PM, Luke Branch <odoocommunitywidgets@gmail.com> wrote:
Hi Todd,

It depends on what formatting changes you're looking to do, and what file formats you'd like them in.

There are a number of different reporting engines including QWeb (default), Jasper Reports, Aeroo Reports and Pentaho among others.

I personally prefer Aeroo Reports as I can 'print' reports directly to Excel format, and allow users with no technical knowledge beyond excel to style the documents in excel the way they want.

You can find an install script for Aeroo + Odoo here:


Although this script assumes you have a clean Ubuntu 14.04 system with no prior Odoo installation.

What invoice/formatting changes did you have in mind?

Regards,

Luke

On 29 Jun, 2015, at 5:43 pm, Todd Abraham <todd@rainbarrel.consulting> wrote:

Hello all,

Would anyone care to share pointers on where I should be looking in the system to custom design my business documents that are sent to customers?

Thank you,

Todd

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Matjaž Mozetič, CEO
+386 41 745 131