This commit is contained in:
Luis 2025-10-09 10:09:32 +02:00
parent 6aec5669be
commit 7ad70064a7
9 changed files with 640 additions and 0 deletions

View file

@ -0,0 +1,202 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="action_report_pos_order_ticket" model="ir.actions.report">
<field name="name">POS Receipt</field>
<field name="model">pos.order</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">pos_order_backend_receipt.report_pos_order_ticket</field>
<field name="report_file">pos_order_backend_receipt.report_pos_order_ticket</field>
<field name="print_report_name">'Receipt-%s' % (object.name)</field>
<field name="binding_model_id" ref="model_pos_order" />
<field name="binding_type">report</field>
</record>
<template id="report_pos_order_ticket">
<t t-foreach="docs" t-as="o">
<t t-call="web.html_container">
<t t-call="web.basic_layout">
<t t-set="o" t-value="o.with_context(lang=o.partner_id.lang)" />
<div class="receipt">
<div class="receipt-container">
<div class="sale-ticket">
<div class="center-align">
<img t-if="o.company_id.logo" t-att-src="image_data_uri(o.company_id.logo)" class="company_logo"/>
<t t-if="o.is_l10n_es_simplified_invoice">
<span>Simplified Invoice</span>
<span t-field="o.l10n_es_unique_id"/>
</t>
<t t-else="">
<span t-field="o.name"/>
</t>
<br/>
<h5 t-field="o.company_id.name" />
<span t-field="o.company_id.street" />
<span t-field="o.company_id.city" />
<span t-field="o.company_id.zip" />
<br />
<t t-if="o.company_id.phone">
<div class="receipt-phone">
Phone:
<span t-field="o.company_id.phone" />
</div>
</t>
<t t-if="o.company_id.vat">
<div class="receipt-vat">
VAT:
<span t-field="o.company_id.vat" />
</div>
</t>
<t t-if="o.company_id.email">
<div class="receipt-email">
Email:
<span t-field="o.company_id.email" />
</div>
</t>
<t t-if="o.company_id.website">
<div class="receipt-website">
Website:
<span t-field="o.company_id.website" />
</div>
</t>
<t t-if="o.user_id.name">
<div class="receipt-cashier">
Served by:
<span t-field="o.user_id.name" />
</div>
</t>
<t t-if="o.partner_id.name">
<div class="receipt-customer">
Customer:
<span t-field="o.partner_id.name" />
</div>
</t>
<br />
</div>
<br />
<table class='receipt-orderlines'>
<colgroup>
<col width='50%' />
<col width='25%' />
<col width='25%' />
</colgroup>
<tr t-foreach="o.lines" t-as="line">
<td>
<span t-field="line.product_id.name" />
<t t-if="line.discount > 0">
<div class="disc-font">
With a <span
t-field="line.discount"
/>% discount
</div>
</t>
</td>
<td class="right-align">
<span t-field="line.qty" /> <span
t-field="line.product_id.uom_id.name"
/>
</td>
<td class="right-align">
<span
t-field="line.price_subtotal_incl"
t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"
/>
</td>
</tr>
</table>
<table class='receipt-total'>
<t t-set="tax_breakdown" t-value="o._get_backend_tax_breakdown()"/>
<tr t-if="tax_breakdown">
<td colspan="2">
<table class="receipt-taxdetail">
<thead>
<tr>
<th class="right-align">Base</th>
<th class="right-align">VAT %</th>
<th class="right-align">Amount</th>
</tr>
</thead>
<tbody>
<tr t-foreach="tax_breakdown" t-as="tax">
<td class="right-align">
<span t-esc="tax['base']" t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"/>
</td>
<td class="right-align"><t t-esc="tax['rate']"/>%</td>
<td class="right-align">
<span t-esc="tax['amount']" t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"/>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- Tax breakdown (IVA) -->
<tr>
<td>Total Taxes:</td>
<td class="right-align">
<span
t-field="o.amount_tax"
t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"
/>
</td>
</tr>
<br/>
<br/>
<!-- Total discount row -->
<t t-set="total_discount" t-value="sum(line.price_unit * line.qty * (line.discount or 0.0)/100.0 for line in o.lines)"/>
<tr t-if="total_discount">
<td>Total Discount:</td>
<td class="right-align">
<span t-esc="-total_discount" t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"/>
</td>
</tr>
<br/>
<tr class="emph">
<td>Total:</td>
<td class="right-align">
<span
t-out="o.amount_total"
t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"
/>
</td>
</tr>
<br />
<table class='receipt-paymentlines'>
<t t-foreach="o.payment_ids" t-as="line">
<t t-if="line.amount > 0">
<tr>
<td>
<span t-field="line.payment_method_id" />
</td>
<td class="right-align">
<span
t-field="line.amount"
t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"
/>
</td>
</tr>
</t>
</t>
</table>
<table class='receipt-change'>
<tr>
<td>Change:</td>
<td class="right-align">
<span
t-field="o.amount_return"
t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"
/>
</td>
</tr>
</table>
</table>
<br/>
<div class="center-align"><span t-field="o.pos_reference" /></div>
</div>
</div>
</div>
</t>
</t>
</t>
</template>
</odoo>