This question has been flagged
3 Replies
5593 Views

Sales -> Customers -> Sales & Purchases Tab -> Contact Reference

I want to print this information in the Sales Order Invoice Report PDF, is this possible?

 
Avatar
Discard

Which report ? SO, ...

Author

Sales Order , Invoice

Best Answer

Hi,

You may try like this in your module.

Create a file custom_saleorder.xml under views folder in your module. Also mention it in __openerp__.py file.

Then add following code in the file, to have customer reference in sale order:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_saleorder_inherited" inherit_id="sale.report_saleorder_document">

<xpath expr="//t/div/div[3]/div[1]" position="after">
<div t-if="o.partner_id.ref" class="col-xs-3">
<strong>Customer Reference:</strong>
<p t-field="o.partner_id.ref"/>
</div>
</xpath>

</template>
</data>
</openerp>

Restart the server and upgrade your module. Then try.

Similarly you can override the invoice report by inheriting the corresponding invoice template.

For eg: create a file custom_invoice_report.xml file under views folder in your module. And add the following code:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_invoice_document_inherited" inherit_id="account.report_invoice_document">

<xpath expr="/t/div/div[2]/div[5]" position="after">
<div t-if="o.partner_id.ref" class="col-xs-3">
<strong>Customer Reference:</strong>
<p t-field="o.partner_id.ref"/>
</div>
</xpath>

</template>
</data>
</openerp>

Also don't forget to mention sale, account as depends in your __openerp__.py file.

Avatar
Discard
Author

worked for me, thanks!