Hi everybody
I've set up a second report for invoices. I want an alternative report option in the print dropdown so I created a second report in the account module.
I've added a report in account_report.xml under /addons/account/ like this:
<report
id="account_invoices"
model="account.invoice"
string="Invoices"
report_type="qweb-pdf"
name="account.report_invoice"
file="account.report_invoice"
attachment_use="True"
attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
/><!--Custom report link->
<report
id="account_aangetekend"
model="account.invoice"
string="Aangetekende zending"
report_type="qweb-pdf"
name="account.report_aangetekend"
file="account.report_aangetekend"
/>
Then I added an XML file, named report_aangetekend.xml with 95% the same code as the 'normal' report (coming from report_invoice.xml). I've only changed the names and added one field.
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_aangetekend_document">
<t t-call="report.external_layout">
<div class="page">
<div class="row">
<div class="col-xs-5 col-xs-offset-7">
<address t-field="o.partner_id"
t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}' />
<span t-field="o.partner_id.vat"/>
</div>
</div>
<p>TEST</p>
<!--Lots of other, irrelevant code here-->
</div>
</t>
</template>
<template id="report_aangetekend">
<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', 'account.report_aangetekend_document')"/>
</t>
</t>
</template>
</data>
</openerp>
The report works, is showing up and I can print it. There is however a strange effect.
If I now create a new invoice (in draft modus) and choose the two different print options I'll get two different report prints, so far so good, as you can see here.
If I now make a second invoice, validate this and then print out the two different reports I'll get the same report twice. Both coming from the file report_invoice.xml (addons/account/views/). As you can see here:
Is there a reason why my custom report is not being printed in validated state but it is in draft? Do I have to define something more elsewhere or what am I missing?
With kind regards
Yenthe