Skip to Content
Menu
This question has been flagged
2193 Views

How to get the custom field value from Pay Invoice and add it in invoice report?

I have a custom field that is autoincrement under pay invoice but I there is an error when i try to add it in invoice. this is the code i added:

<template id="account.report_receiptdetails">

<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_receiptdetails_document')"/>

</t>

</t>

</template>

<template id="account.report_receiptdetails_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>

<h2>

<span t-if="o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')">Receipt</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>

<div class="col-xs-2" t-if="o.voucher_id.inc_num">

<strong>Number:</strong>

<p t-field="o.voucher_id.inc_num"/>

</div>

<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>

.....

</template>

</data>

</openerp>



the error that appear on the invoice is:

qwebexception: ""'account.invoice' object has no attribute 'voucher_id'" while evaluating

'o.voucher_id.inc_num'" while evaluating

"translate_doc(doc_id, doc_model, 'partner_id.lang', 'account.report_receiptdetails_document')"

Avatar
Discard