How To Create Accounting Purchase Bill Qweb report In Odoo14
How To Create Accounting Purchase Invoice in Odoo14
Purchase Receipts are not invoices but rather confirmations of received payments, such as a ticket or a receipt.This feature is meant to be used when you pay directly with your company’s money for an expense. Vendor Bills, on the other hand, are recorded when an invoice is issued to you and that the amount is first credited on a debt account before a later payment reconciliation
How A ACccounting Purchase Bill Can Print In Odoo 14 ?
1: Under report add new file named “report.xml”
Under “report.xml” add :
syntax as follws
<report id="report_id" model="module.name" string="report related name" report_type="qweb-pdf" name="custom_module_name.body_template_id" file="custom_module_name.body_template_id"/>
in practical:
<report id="accounting_purchase_report_id" model="account.move" string="Accounting Purchase Report" report_type="qweb-pdf" name="odoo_training.accounting_purchase_body_format" file="odoo_training.accounting_purchase_body_format"/>
-> Here name and file should be custom addon name . body template id from corresponding xml file 2: You can create an xml file inside the report directory
syntax as follows:
<?xml version="1.0" encoding="UTF-8" ?> <odoo> <template id="report_header_template_id"> <t t-call="web.html_container"> <t t-if="not o" t-set="o" t-value="doc"/> <t t-if="not company"> <!-- Multicompany --> <t t-if="company_id"> <t t-set="company" t-value="company_id"/> </t> <t t-elif="o and 'company_id' in o"> <t t-set="company" t-value="o.company_id.sudo()"/> </t> <t t-else="else"> <t t-set="company" t-value="res_company"/> </t> </t> <div class="header" t-att-style="report_header_style"> <div class="row"> </div> </div> <div class="col-9 text-right" t-field="company.report_header" name="moto"> <div t-field="company.partner_id" t-options="{"widget": "contact", "fields": ["address", "name"], "no_marker": true}"/> </div> <div class="article" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id" t-att-data-oe-lang="o and o.env.context.get('lang')"> <t t-raw="0"/>
</div>
<div class="footer o_background_footer"> <div> <div t-field="company.report_footer"/> <div t-if="report_type == 'pdf'" class="text-muted"> <hr style="width:100%;" color="red"/> <div class="row"> <div class="col-6" style="text-align:right;"> Page: <span class="page"/> / <span class="topage"/> </div> </div> </div> </div> </div> </t> </template>
<template id="body_template_id"> <t t-call="web.html_container"> <t t-foreach="docs" t-as="o"> <t t-call="module_name.header_template_id"> <div class="page">
</div> </t> </t> </t> </template> </odoo>
-> here you have to change header template_id, body template_id and under body template_id change this one also <t t-call=”module_name.header_template_id”>
In Practical Case:
<?xml version="1.0" encoding="UTF-8" ?> <odoo> <template id="accounting_purchase_header_format"> <t t-call="web.html_container"> <t t-if="not o" t-set="o" t-value="doc"/> <t t-if="not company"> <!-- Multicompany --> <t t-if="company_id"> <t t-set="company" t-value="company_id"/> </t> <t t-elif="o and 'company_id' in o"> <t t-set="company" t-value="o.company_id.sudo()"/> </t> <t t-else="else"> <t t-set="company" t-value="res_company"/> </t> </t> <div class="header" t-att-style="report_header_style"> <div class="row"> </div> </div> <div class="col-9 text-right" t-field="company.report_header" name="moto"> <div t-field="company.partner_id" t-options="{"widget": "contact", "fields": ["address", "name"], "no_marker": true}"/> </div> <div class="article" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id" t-att-data-oe-lang="o and o.env.context.get('lang')"> <t t-raw="0"/> </div> <div class="footer o_background_footer"> <div> <div t-field="company.report_footer"/> <div t-if="report_type == 'pdf'" class="text-muted"> <hr style="width:100%;" color="red"/> <div class="row"> <div class="col-6" style="text-align:right;"> Page: <span class="page"/> / <span class="topage"/> </div> </div> </div> </div> </div> </t> </template> <template id="accounting_purchase_body_format"> <t t-call="web.html_container"> <t t-foreach="docs" t-as="o"> <t t-call="odoo_training.accounting_purchase_header_format"> <div class="page"> <div class="col-12"> <h5 style="text-align:left">Vendor Bill</h5> <h2 style="text-align:left"><t t-esc="o.name"/> </h2> </div> <table style="border:1px solid black;width:100%"> <tr> <td>Vendor</td> <td><t t-esc="o.partner_id.name"/></td> <td>Bill Date</td> <td><t t-esc="o.invoice_date"/></td> </tr> <tr> <td> Bill Reference</td> <td><t t-esc="o.ref"/> </td> <td>Accounting Date</td> <td><t t-esc="o.date"/> </td> </tr> <tr> <td>Payment Reference</td> <td><t t-esc="o.payment_reference"/> </td> <td>Due Date</td> <td><t t-esc="o.invoice_date_due"/> </td> </tr> <tr> <td>Recepient Bank</td> <td><t t-esc="o.partner_bank_id.id"/> </td> <td>Journal</td> <td><t t-esc="o.journal_id.name"/> </td> </tr> </table> <table style="border:1px solid black;width:100%"> <tr> <td style="border:1px solid black">Product</td> <td style="border:1px solid black">Label</td> <td style="border:1px solid black">Account</td> <td style="border:1px solid black">Quantity</td> <td style="border:1px solid black">UOM</td> <td style="border:1px solid black">Price</td> <td style="border:1px solid black">Tax</td> <td style="border:1px solid black"> SubTotal</td> </tr> <t t-foreach="o.invoice_line_ids" t-as="one_to_many"> <tr> <td style="border:1px solid black"><t t-esc="one_to_many.product_id.name"/> </td> <td style="border:1px solid black"><t t-esc="one_to_many.name"/> </td> <td style="border:1px solid black"><t t-esc="one_to_many.account_id.name"/> </td> <td style="border:1px solid black"><t t-esc="one_to_many.quantity"/> </td> <td style="border:1px solid black"><t t-esc="one_to_many.product_uom_id.name"/> </td> <td style="border:1px solid black"><t t-esc="one_to_many.price_unit"/></td> <td style="border:1px solid black"><t t-esc="one_to_many.tax_ids.name"/></td> <td style="border:1px solid black"><t t-esc="one_to_many.price_subtotal"/></td> </tr> </t> </table> <h6 style="text-align:right">Total <t t-esc="o.amount_total"/> </h6> <h6 style="text-align:right">Amount Due <t t-esc="o.amount_residual"/> </h6> </div> </t> </t> </t> </template> </odoo> * Do not forget to add Header template id ,body template id and under body template id you need change <t t-call="module name.header template id" h The Print Be Like This These two xml files you need to add in __manifest__.py file.
To know more about us