Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Removing default invoice template

By
E.M.
on 9/27/15, 1:26 PM 954 views

Hi, I have created a module which installs a new custom invoice template.

So from PRINT menu the user can choose either the "Standard Invoice" or the new "Custom Invoice".

I would like to remove the "Standard Invoice", what should I do? 

Is it possible to do it via XML?

You want to override the default invoice template by your custom module?

Akhil P Sivan
on 9/28/15, 2:31 AM
1

Emipro Technologies Pvt. Ltd.

--Emipro Technologies Pvt. Ltd.--
Tiny ERP Pvt Ltd
http://www.odoo.com
5975
| 6 7 8
Rajkot, India
--Emipro Technologies Pvt. Ltd.--

Being an emerging leader in IT market since 2011, Emipro Technologies Pvt. Ltd. has been providing a wide range of business solutions in Odoo & Magento. We are pleased to have a large pool of contented customers with our meticulous work in the domain of ERP & e-Commerce. A ray of relief & satisfaction to  our customers heart by our successful deployment in their organization, purely represents our success in Odoo platform. Hence, we take pride for being an Odoo partner with a vision of expanding our strategic alliances with our customers to offer them high value-added, trustworthy & cost effective solutions.

 

Since establishment, our business has span across 11 countries of the world. Our customers are companies of all sizes ranging from start-ups to large enterprises, who realize that they need a professional business solutions to generate revenue streams, establish proper communication channels or streamline business operations. Standing with strong determination of customer satisfaction, observing each minute detail of their business processes, providing proper guidance and moving forth to develop product accordingly adds our value and reliability among our customers. 

 

We are blessed with efficient, passionate & eclectic young developers who have come across almost all kinds of business profiles, working with full dedication, applying creativity & new features in existing modules and completing customer's projects successfully on predefined target. Our in-depth knowledge while giving business solutions in Odoo allows us to offer following services to our customers :

 

  • Consulting
  • Installation, Configuration & Customization
  • Training & Support
  • Maintenance
  • Upgradation
  • Documentation
  • Crafting community modules
  • Drafting videos on demand
  • Smart Apps development

We will be :) to welcome you @ www.emiprotechnologies.com to solve any kind of your business needs around Odoo. However we are just an inch away from you by email info@emiprotechnologies.com or a tweet to @EmiproTech

Emipro Technologies Pvt. Ltd.
On 9/28/15, 1:31 AM

There are two different ways to remove the already available report.

1) Override new report on existing (default) report.

This is simple way to hide / delete existing (default) report. While creating new report we just need to give External ID same as like existing report. In your case while you create your report you have to define it as like below.

 <report 
id="account.account_invoices"
model="account.invoice"
string="New Invoice Report"
report_type="qweb-pdf"
name="account.new_report_invoice"
file="new_report_invoice"
/>

2) Create new report and delete existing (default) report

This is complex method as compare to first. In this method we have to use <delete> tag to delete existing (default) report. While use of the <delete> tag we have to take care about noupdate parameter of <data> tag. In your case we have to define <delete> tag as like below.

<data noupdate="1">
<delete model="ir.actions.report.xml" id="account.account_invoices" />
</data>

It will helpful to you.

Thanks.


1

Akhil P Sivan

--Akhil P Sivan--
3423
| 5 3 6
Kochi, India
--Akhil P Sivan--

Interested in exploring Odoo both technically & functionality wise.

email-id : akhilpsivan01@gmail.com

Akhil P Sivan
On 9/28/15, 2:36 AM

If you want to override the default invoice template by your custom module, with different header and footer, refer the following code:

<openerp>
<data>
<template id="report_invoice_document_inherited" inherit_id="account.report_invoice_document">
<xpath expr="//t[@t-call='report.external_layout']" position="replace">
<t t-call="report.new_layout">
<div class="page">
<t t-set="company" t-value="res_company">
</t>
<br />

<div class="row mt16 mb16">
<div class="col-xs-5">

<br />
<div style="background:#01008A; font-size:13.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:white" valign="top">
<strong><center>Bill To</center></strong>
</div>
<address style="padding:5px 5px 5px 5px;border-width: 1px; border-style: solid; border-color: #002b49;" t-field="o.address_shipping_id" t-field-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;], &quot;no_marker&quot;: true}"/>
</div>
<div class="col-xs-5 col-xs-push-2" >
<br />
<div style="background:#01008A; font-size:13.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:white" valign="top">
<strong><center>Ship To</center></strong>
</div>
<address style="padding:5px 5px 5px 5px;border-width: 1px; border-style: solid; border-color: #002b49;" 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}"/>
</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-2" t-if="o.name">
<strong>Description:</strong>
<p t-field="o.name"/>
</div>
<div class="col-xs-2" t-if="o.date_invoice">
<strong>Invoice Date:</strong>
<p t-field="o.date_invoice"/>
</div>
<div class="col-xs-2" t-if="o.origin">
<strong>Source:</strong>
<p t-field="o.origin"/>
</div>
<div class="col-xs-2" t-if="o.partner_id.ref">
<strong>Customer Code:</strong>
<p t-field="o.partner_id.ref"/>
</div>
<div class="col-xs-2" t-if="o.reference">
<strong>Reference:</strong>
<p t-field="o.reference"/>
</div>
</div>
<div class="row mt16 mb16">
<div class="col-xs-12">

<table class="table table-condensed" style="border-left:1px solid #000000;border-top:1px solid #000000;border-right:1px solid #000000;">
<thead>
<tr style="background-color:#F4F4F4;">
<th style="border:1px solid #000000;">Quantity</th>
<th style="border:1px solid #000000;">Item Code</th>
<th style="border:1px solid #000000;">Description</th>
<th class="text-right" style="border:1px solid #000000;">Price Each</th>
<th class="text-right" style="border:1px solid #000000;">Amount</th>
</tr>
</thead>
<tbody class="invoice_tbody">
<t t-set="item_no" t-value="1" />
<tr style="border:1px solid #000000;" t-foreach="o.invoice_line" t-as="l">
<t t-if="item_no%2!=0">

<td style="border-left:1px solid #000000;">

<span t-field="l.quantity"/>


</td>
<td style="border-left:1px solid #000000;">
<span t-field="l.product_id.name"/>
</td>
<td style="border-left:1px solid #000000;">
<span t-field="l.name"/>
</td>

<td style="border-left:1px solid #000000;" class="text-right">
<span t-field="l.price_unit"/>
</td>

<td style="border-left:1px solid #000000;" class="text-right">
<span t-field="l.price_subtotal" t-field-options='{"widget": "monetary", "display_currency":
"o.currency_id"}'/>
</td>
</t>
<t t-if="item_no%2==0">

<td style="border-left:1px solid #000000;background-color:#F4F4F4;">

<span t-field="l.quantity"/>


</td>
<td style="border-left:1px solid #000000;background-color:#F4F4F4;">
<span t-field="l.product_id.name"/>
</td>
<td style="border-left:1px solid #000000;background-color:#F4F4F4;">
<span t-field="l.name"/>
</td>

<td style="border-left:1px solid #000000;background-color:#F4F4F4;" class="text-right">
<span t-field="l.price_unit"/>
</td>

<td style="border-left:1px solid #000000;background-color:#F4F4F4;" class="text-right">
<span t-field="l.price_subtotal" t-field-options='{"widget": "monetary", "display_currency":
"o.currency_id"}'/>
</td>
</t>
<t t-set="item_no" t-value="item_no+1" />

</tr>
<tr style="border-top:1px solid #000000;">
<td style="border-left:2px solid #ffffff;border-top:1px solid #000000;"></td>
<td style="border-top:1px solid #000000;"></td>
<td style="border-top:1px solid #000000;"></td>
<td style="border-left:1px solid #000000;border-bottom:1px solid #000000;border-top:1px solid #000000;"><strong>Total:</strong></td>
<td style="border-bottom:1px solid #000000;border-top:1px solid #000000;"><span t-field="o.amount_total" t-field-options='{"widget": "monetary", "display_currency":
"o.currency_id"}'/></td>
</tr>

</tbody>
</table>
</div>

</div>
<p t-if="o.comment">
<span t-field="o.comment"/>
</p>
<p t-if="o.fiscal_position.note">
<strong>Fiscal Position Remark:</strong>
<span t-field="o.fiscal_position.note"/>
</p>
</div>
</t>
</xpath>


</template>


<template id="report.new_layout">
<!-- Multicompany -->
<t t-if="o and 'company_id' in o">
<t t-set="company" t-value="o.company_id"></t>
</t>
<t t-if="not o or not 'company_id' in o">
<t t-set="company" t-value="res_company"></t>
</t>

<t t-call="report.new_layout_header" />
<t t-raw="0" />
<t t-call="report.new_layout_footer" />
</template>

<template id="report.new_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:20px;" t-field="company.rml_header1"/>
</div>
<div class="row zero_min_height">
<div class="col-xs-12">
<div style="border-bottom: 1px solid black;"></div>
</div>
</div>
<div class="row mt8 mb8">
<div class="col-xs-5">
<div t-field="company.partner_id"
t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}'
style="border:1px solid #000000;"/>
</div>
</div>

</div>
</template>

<template id="report.new_layout_footer">

<div class="footer">

<div t-if="company.sale_note" class="row mt16 mb16">
<div class="col-xs-6">
<div style="border:1px solid #000000;background-color:#01008A;color:#ffffff">
<strong>International Banking Detail</strong>
</div>
<div style="border:1px solid #000000;">
<div t-field="company.sale_note"/>
</div>
</div>

</div>

</div>
</template>

</data>
</openerp>


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/27/15, 1:26 PM
Seen: 954 times
Last updated: 9/28/15, 3:08 AM