Files
Odoo-Modules/fusion_reports_templates/report/report_invoice.xml
gsinghpal 2f8b6b3ae0 changes
2026-06-03 19:50:45 -04:00

404 lines
26 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2026 Nexa Systems Inc.
License OPL-1 (Odoo Proprietary License v1.0)
Customer Invoice / Vendor Bill / Credit Note — portrait + landscape.
-->
<odoo>
<!-- ============================================================= -->
<!-- PORTRAIT -->
<!-- ============================================================= -->
<template id="report_fr_invoice_portrait">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="doc">
<t t-call="web.external_layout">
<t t-set="doc" t-value="doc.with_context(lang=doc.partner_id.lang)"/>
<t t-call="fusion_reports_templates.fr_portrait_styles"/>
<div class="fr-report">
<div class="page">
<div style="display: flex; justify-content: space-between; align-items: center;">
<h4>
<t t-if="doc.move_type == 'out_invoice'">Invoice </t>
<t t-elif="doc.move_type == 'out_refund'">Credit Note </t>
<t t-elif="doc.move_type == 'in_invoice'">Vendor Bill </t>
<t t-elif="doc.move_type == 'in_refund'">Vendor Refund </t>
<t t-else="">Document </t>
<span t-field="doc.name"/>
</h4>
<t t-if="doc.payment_state == 'paid'">
<div class="paid-stamp">PAID</div>
</t>
</div>
<table class="bordered">
<thead>
<tr>
<th style="width: 50%;">BILL TO</th>
<th style="width: 50%;">SHIP TO</th>
</tr>
</thead>
<tbody>
<tr>
<td style="height: 70px;">
<div t-field="doc.partner_id"
t-options="{'widget': 'contact', 'fields': ['name', 'address', 'phone', 'email'], 'no_marker': True}"/>
</td>
<td style="height: 70px;">
<t t-if="doc.partner_shipping_id">
<div t-field="doc.partner_shipping_id"
t-options="{'widget': 'contact', 'fields': ['name', 'address', 'phone'], 'no_marker': True}"/>
</t>
<t t-else="">
<div t-field="doc.partner_id"
t-options="{'widget': 'contact', 'fields': ['name', 'address'], 'no_marker': True}"/>
</t>
</td>
</tr>
</tbody>
</table>
<table class="bordered">
<thead>
<tr>
<th class="info-header" style="width: 25%;">INVOICE DATE</th>
<th class="info-header" style="width: 25%;">DUE DATE</th>
<th class="info-header" style="width: 25%;">REFERENCE</th>
<th class="info-header" style="width: 25%;">PAYMENT TERMS</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-center"><span t-field="doc.invoice_date"/></td>
<td class="text-center"><span t-field="doc.invoice_date_due"/></td>
<td class="text-center"><span t-esc="doc.ref or doc.invoice_origin or '-'"/></td>
<td class="text-center"><span t-field="doc.invoice_payment_term_id"/></td>
</tr>
</tbody>
</table>
<t t-set="has_discount" t-value="any(l.discount for l in doc.invoice_line_ids)"/>
<t t-set="col_count" t-value="8 if has_discount else 7"/>
<t t-set="total_discount" t-value="sum(l.price_unit * l.quantity * l.discount / 100.0 for l in doc.invoice_line_ids if not l.display_type or l.display_type == 'product')"/>
<table class="bordered">
<thead>
<tr>
<th style="width: 11%;">SKU</th>
<th class="text-start" style="width: 33%;">DESCRIPTION</th>
<th style="width: 7%;">QTY</th>
<th style="width: 7%;">UOM</th>
<th style="width: 13%;">UNIT PRICE</th>
<th t-if="has_discount" style="width: 9%;">DISCOUNT</th>
<th style="width: 8%;">TAX</th>
<th style="width: 12%;">AMOUNT</th>
</tr>
</thead>
<tbody>
<t t-foreach="doc.invoice_line_ids" t-as="line">
<t t-if="line.display_type == 'line_section'">
<tr class="section-row"><td t-att-colspan="col_count"><strong t-field="line.name"/></td></tr>
</t>
<t t-elif="line.display_type == 'line_note'">
<tr class="note-row"><td t-att-colspan="col_count"><span t-field="line.name"/></td></tr>
</t>
<t t-elif="line.display_type == 'product' or not line.display_type">
<tr>
<td class="text-center"><span t-esc="line.product_id.default_code or ''"/></td>
<td><span t-esc="line.name"/></td>
<td class="text-center">
<span t-esc="int(line.quantity) if line.quantity == int(line.quantity) else line.quantity"/>
</td>
<td class="text-center"><span t-field="line.product_uom_id"/></td>
<td class="text-end">
<span t-field="line.price_unit" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</td>
<td t-if="has_discount" class="text-center">
<t t-if="line.discount"><span t-esc="line.discount"/>%</t>
<t t-else="">-</t>
</td>
<td class="text-center">
<t t-esc="', '.join([(tax.invoice_label or tax.name) for tax in line.tax_ids]) or '-'"/>
</td>
<td class="text-end">
<span t-field="line.price_subtotal" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</td>
</tr>
</t>
</t>
</tbody>
</table>
<div class="row" style="margin-top: 15px;">
<div class="col-6">
<t t-if="doc.invoice_payment_term_id.note">
<strong>Payment Terms:</strong><br/>
<span t-field="doc.invoice_payment_term_id.note"/>
</t>
<t t-if="doc.payment_reference">
<div style="margin-top: 10px;">
<strong>Payment Reference:</strong>
<span t-field="doc.payment_reference"/>
</div>
</t>
</div>
<div class="col-6" style="text-align: right;">
<table class="totals-table" style="width: auto; margin-left: auto;">
<tr>
<td style="min-width: 150px;">Subtotal</td>
<td class="text-end" style="min-width: 110px;">
<span t-out="doc.amount_untaxed + total_discount" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</td>
</tr>
<t t-if="has_discount">
<tr>
<td>Discount</td>
<td class="text-end">
<span t-out="-total_discount" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</td>
</tr>
<tr>
<td>Net Amount</td>
<td class="text-end">
<span t-field="doc.amount_untaxed" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</td>
</tr>
</t>
<tr>
<td>Taxes</td>
<td class="text-end">
<span t-field="doc.amount_tax" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</td>
</tr>
<tr style="background-color: #eaf2f8;">
<td><strong>Total</strong></td>
<td class="text-end"><strong>
<span t-field="doc.amount_total" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</strong></td>
</tr>
<t t-if="doc.amount_residual and doc.payment_state != 'paid'">
<tr>
<td><strong>Amount Due</strong></td>
<td class="text-end"><strong>
<span t-field="doc.amount_residual" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</strong></td>
</tr>
</t>
</table>
</div>
</div>
<t t-if="doc.narration">
<div style="margin-top: 15px;">
<strong>Notes:</strong>
<div t-field="doc.narration"/>
</div>
</t>
</div>
</div>
</t>
</t>
</t>
</template>
<!-- ============================================================= -->
<!-- LANDSCAPE -->
<!-- ============================================================= -->
<template id="report_fr_invoice_landscape">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="doc">
<t t-call="web.external_layout">
<t t-set="doc" t-value="doc.with_context(lang=doc.partner_id.lang)"/>
<t t-call="fusion_reports_templates.fr_landscape_styles"/>
<div class="fr-landscape">
<div class="page">
<div style="display: flex; justify-content: space-between; align-items: center;">
<h2>
<t t-if="doc.move_type == 'out_invoice'">Invoice </t>
<t t-elif="doc.move_type == 'out_refund'">Credit Note </t>
<t t-elif="doc.move_type == 'in_invoice'">Vendor Bill </t>
<t t-elif="doc.move_type == 'in_refund'">Vendor Refund </t>
<t t-else="">Document </t>
<span t-field="doc.name"/>
</h2>
<t t-if="doc.payment_state == 'paid'">
<div class="paid-stamp">PAID</div>
</t>
</div>
<table class="bordered">
<thead>
<tr>
<th style="width: 50%;">BILL TO</th>
<th style="width: 50%;">SHIP TO</th>
</tr>
</thead>
<tbody>
<tr>
<td style="height: 70px; font-size: 12pt;">
<div t-field="doc.partner_id"
t-options="{'widget': 'contact', 'fields': ['name', 'address', 'phone', 'email'], 'no_marker': True}"/>
</td>
<td style="height: 70px; font-size: 12pt;">
<t t-if="doc.partner_shipping_id">
<div t-field="doc.partner_shipping_id"
t-options="{'widget': 'contact', 'fields': ['name', 'address', 'phone'], 'no_marker': True}"/>
</t>
<t t-else="">
<div t-field="doc.partner_id"
t-options="{'widget': 'contact', 'fields': ['name', 'address'], 'no_marker': True}"/>
</t>
</td>
</tr>
</tbody>
</table>
<table class="bordered info-table">
<thead>
<tr>
<th>INVOICE DATE</th>
<th>DUE DATE</th>
<th>REFERENCE</th>
<th>PAYMENT TERMS</th>
<th>SALESPERSON</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-center"><span t-field="doc.invoice_date"/></td>
<td class="text-center"><span t-field="doc.invoice_date_due"/></td>
<td class="text-center"><span t-esc="doc.ref or doc.invoice_origin or '-'"/></td>
<td class="text-center"><span t-field="doc.invoice_payment_term_id"/></td>
<td class="text-center"><span t-field="doc.invoice_user_id"/></td>
</tr>
</tbody>
</table>
<t t-set="has_discount" t-value="any(l.discount for l in doc.invoice_line_ids)"/>
<t t-set="col_count" t-value="8 if has_discount else 7"/>
<t t-set="total_discount" t-value="sum(l.price_unit * l.quantity * l.discount / 100.0 for l in doc.invoice_line_ids if not l.display_type or l.display_type == 'product')"/>
<table class="bordered">
<thead>
<tr>
<th style="width: 10%;">SKU</th>
<th class="text-start" style="width: 32%;">DESCRIPTION</th>
<th style="width: 8%;">QTY</th>
<th style="width: 8%;">UOM</th>
<th style="width: 12%;">UNIT PRICE</th>
<th t-if="has_discount" style="width: 10%;">DISCOUNT</th>
<th style="width: 10%;">TAX</th>
<th style="width: 10%;">AMOUNT</th>
</tr>
</thead>
<tbody>
<t t-foreach="doc.invoice_line_ids" t-as="line">
<t t-if="line.display_type == 'line_section'">
<tr class="section-row"><td t-att-colspan="col_count"><strong t-field="line.name"/></td></tr>
</t>
<t t-elif="line.display_type == 'line_note'">
<tr class="note-row"><td t-att-colspan="col_count"><span t-field="line.name"/></td></tr>
</t>
<t t-elif="line.display_type == 'product' or not line.display_type">
<tr>
<td class="text-center"><span t-esc="line.product_id.default_code or ''"/></td>
<td><span t-esc="line.name"/></td>
<td class="text-center">
<span t-esc="int(line.quantity) if line.quantity == int(line.quantity) else line.quantity"/>
</td>
<td class="text-center"><span t-field="line.product_uom_id"/></td>
<td class="text-end">
<span t-field="line.price_unit" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</td>
<td t-if="has_discount" class="text-center">
<t t-if="line.discount"><span t-esc="line.discount"/>%</t>
<t t-else="">-</t>
</td>
<td class="text-center">
<t t-esc="', '.join([(tax.invoice_label or tax.name) for tax in line.tax_ids]) or '-'"/>
</td>
<td class="text-end">
<span t-field="line.price_subtotal" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</td>
</tr>
</t>
</t>
</tbody>
</table>
<div class="row" style="margin-top: 15px;">
<div class="col-7">
<t t-if="doc.invoice_payment_term_id.note">
<strong>Payment Terms:</strong><br/>
<span t-field="doc.invoice_payment_term_id.note"/>
</t>
<t t-if="doc.payment_reference">
<div style="margin-top: 10px;">
<strong>Payment Reference:</strong>
<span t-field="doc.payment_reference"/>
</div>
</t>
</div>
<div class="col-5" style="text-align: right;">
<table class="totals-table" style="width: auto; margin-left: auto;">
<tr>
<td style="min-width: 200px;">Subtotal</td>
<td class="text-end" style="min-width: 150px;">
<span t-out="doc.amount_untaxed + total_discount" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</td>
</tr>
<t t-if="has_discount">
<tr>
<td>Discount</td>
<td class="text-end">
<span t-out="-total_discount" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</td>
</tr>
<tr>
<td>Net Amount</td>
<td class="text-end">
<span t-field="doc.amount_untaxed" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</td>
</tr>
</t>
<tr>
<td>Taxes</td>
<td class="text-end">
<span t-field="doc.amount_tax" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</td>
</tr>
<tr style="background-color: #eaf2f8;">
<td><strong>Total</strong></td>
<td class="text-end"><strong>
<span t-field="doc.amount_total" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</strong></td>
</tr>
<t t-if="doc.amount_residual and doc.payment_state != 'paid'">
<tr>
<td><strong>Amount Due</strong></td>
<td class="text-end"><strong>
<span t-field="doc.amount_residual" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
</strong></td>
</tr>
</t>
</table>
</div>
</div>
<t t-if="doc.narration">
<div style="margin-top: 15px;">
<strong>Notes:</strong>
<div t-field="doc.narration"/>
</div>
</t>
</div>
</div>
</t>
</t>
</t>
</template>
</odoo>