Añadido módulo que modifica el ticket

This commit is contained in:
Luis 2022-07-05 10:27:23 +02:00
parent 8612e67566
commit 16980f388f
4 changed files with 635 additions and 0 deletions

View file

@ -0,0 +1,308 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="PosTicket">
<t t-jquery=".pos-sale-ticket" t-operation="replace">
<div class="pos-sale-ticket" style="padding-left: 18px; padding-right: 18px;">
<div class="pos-center-align"><img t-att-src="widget.pos.company_logo_base64" width="200px" /></div>
<div class="pos-left-align"><t t-esc="widget.pos.company.name" /><br /></div>
<div class="pos-left-align"><t t-esc="widget.pos.company.street" /> - <t t-esc="widget.pos.company.city" /> - <t t-esc="widget.pos.company.zip" /><br /></div>
<div class="pos-left-align"><t t-esc="widget.pos.company.vat" /><br /></div>
<div class="receipt-phone pos-left-align">
Phone: <t t-esc="widget.pos.company.phone || ''"/><br />
</div>
<br />
<div style="border-bottom: 1px dashed"></div>
<t t-if="order.get_client()">
<br/>
<span class="customer_title">Cooperativista: </span> <t t-esc="order.get_client().barcode_base ? order.get_client().barcode_base : ''"/><br />
Name: <t t-esc="order.get_client().name ? order.get_client().name : ''"/><br />
<t t-if="order.get_client().vat">
VAT: <t t-esc="order.get_client().vat" /><br />
</t>
<t t-if="order.get_client().address != ', , '">
<t t-esc="order.get_client().address" />
</t>
</t>
<t t-if="receipt.header">
<div style='text-align:center'>
<t t-esc="receipt.header" />
</div>
<br />
</t>
<div style="border-bottom: 1px dashed"></div>
<br />
<table width="100%" class='receipt-orderlines' >
<t t-foreach="orderlines" t-as="orderline">
<tr style="margin-top: 5px;">
<td colspan="4">
<t t-esc="orderline.get_product().display_name"/>
</td>
</tr>
<tr width="100%">
<td></td>
<td class="pos-right-align">
<t t-if="orderline.get_unit().name == 'Unidad(es)'">
<t t-esc="orderline.get_quantity()"/> Ud.
</t>
<t t-else="">
<t t-esc="orderline.get_quantity_str_with_unit()"/>
</t>
</td>
<td class="pos-right-align">
<div>
x <t t-esc="widget.format_currency(orderline.get_unit_display_price(), 'Product Price')"/>
</div>
</td>
<td class="pos-right-align">
<t t-esc="widget.format_currency(orderline.get_display_price())"/>
</td>
</tr>
</t>
</table>
<br />
<table class='receipt-total'>
<tr>
<td>Subtotal:</td>
<td class="pos-right-align">
<t t-esc="widget.format_currency(order.get_total_without_tax())"/>
</td>
</tr>
<t t-foreach="order.get_tax_details()" t-as="taxdetail">
<tr>
<td><t t-esc="taxdetail.name" /></td>
<td class="pos-right-align">
<t t-esc="widget.format_currency(taxdetail.amount)" />
</td>
</tr>
</t>
<tr>
<t t-if="order.get_total_discount() > 0">
<td>Discount:</td>
<td class="pos-right-align">
<t t-esc="widget.format_currency(order.get_total_discount())"/>
</td>
</t>
</tr>
<t t-if="order.get_rounding_applied()">
<tr>
<td>Total:</td>
<td class="pos-right-align">
<t t-esc="widget.format_currency(order.get_total_with_tax())"/>
</td>
</tr>
<tr class="emph">
<td>Total Redondeado:</td>
<td class="pos-right-align">
<t t-esc='widget.format_currency(receipt.total_rounded)' />
</td>
</tr>
</t>
<t t-else="">
<tr class="emph">
<td>Total:</td>
<td class="pos-right-align">
<t t-esc="widget.format_currency(order.get_total_with_tax())"/>
</td>
</tr>
</t>
</table>
<br />
<table class='receipt-paymentlines'>
<t t-foreach="paymentlines" t-as="line">
<tr>
<td>
<t t-esc="line.name"/>
</td>
<td class="pos-right-align">
<t t-esc="widget.format_currency(line.get_amount())"/>
</td>
</tr>
</t>
</table>
<br />
<table class='receipt-change'>
<tr><td>Change:</td><td class="pos-right-align">
<t t-esc="widget.format_currency(order.get_change())"/>
</td></tr>
</table>
<t t-if="receipt.footer">
<br />
<div style='text-align:center'>
<t t-esc="receipt.footer" />
</div>
</t>
<br />
<div class="pos-center-align">
<t t-esc="order.formatted_validation_date"/>
<t t-if="widget.pos.config.iface_l10n_es_simplified_invoice and !order.is_to_invoice()">
<br/><span>Simplified invoice: </span>
</t>
<t t-esc="order.name"/>
</div>
</div>
</t>
</t>
<t t-extend="XmlReceipt">
<t t-jquery="receipt" t-operation="replace">
<receipt align='center' width='45' value-thousands-separator='' >
<t t-if='receipt.company.logo'>
<img t-att-src='receipt.company.logo' alt="Logo"/>
<br/>
</t>
<t t-if='receipt.company.name'>
<div><t t-esc='receipt.company.name' /></div>
</t>
<t t-if='widget.pos.company.street'>
<div><t t-esc="widget.pos.company.street" /> - <t t-esc="widget.pos.company.city" /> - <t t-esc="widget.pos.company.zip" /></div>
</t>
<t t-if='receipt.company.vat'>
<div>VAT:<t t-esc='receipt.company.vat' /></div>
</t>
<t t-if='receipt.company.phone'>
<div>Tel:<t t-esc='receipt.company.phone' /></div>
</t>
<div>--------------------------------</div>
<t t-if="order.get_client()">
<span class="customer_title">Cooperativista: </span> <t t-esc="order.get_client().barcode_base ? order.get_client().barcode_base : ''"/><br />
Name: <t t-esc="order.get_client().name ? order.get_client().name : ''"/><br />
VAT: <t t-esc="order.get_client().vat ? order.get_client().vat : ''"/><br />
Address: <t t-esc="order.get_client().address ? order.get_client().address : ''"/>
</t>
<div>--------------------------------</div>
<t t-if='receipt.header_xml'>
<t t-raw='receipt.header_xml' />
</t>
<t t-if='!receipt.header_xml and receipt.header'>
<div><t t-esc='receipt.header' /></div>
</t>
<t t-if='receipt.cashier'>
<div class='cashier'>
<div>--------------------------------</div>
<div>Served by <t t-esc='receipt.cashier' /></div>
</div>
</t>
<div class='orderlines' line-ratio='0.6' >
<t t-foreach="receipt.orderlines" t-as="line">
<div align='left'>
<t t-esc="line.product_name_wrapped[0]" /><t t-esc="line.product_name_wrapped[1]" />
</div>
<t t-if="line.product_name_wrapped[2]">
<div align='left'>
<t t-esc="line.product_name_wrapped[2]" /><t t-esc="line.product_name_wrapped[3]" />
</div>
</t>
<line indent='1'>
<left>
<t t-if="line.unit_name == 'Unidad(es)'">
<t t-esc="line.quantity"/> Ud.
</t>
<t t-else="">
<value t-att-value-decimals='pos.dp["Product Unit of Measure"]'><t t-esc="line.quantity"/></value>
<t t-esc="line.unit_name" />
</t>
<div>
x <t t-esc="widget.format_currency(line.price, 'Product Price')"/>
</div>
</left>
<right>
<value t-att-value-decimals='pos.dp["Product Price"]'>
<t t-esc='line.price_display' />
</value>
</right>
</line>
</t>
</div>
<div>--------------------------------</div>
<div class='receipt-total'>
<line>
<left>Subtotal:</left>
<right>
<t t-esc="widget.format_currency(order.get_total_without_tax())"/>
</right>
</line>
<t t-foreach="order.get_tax_details()" t-as="taxdetail">
<line>
<left><t t-esc="taxdetail.name" /></left>
<right>
<t t-esc="widget.format_currency(taxdetail.amount)" />
</right>
</line>
</t>
<t t-if="order.get_total_discount() > 0">
<line>
<left>Discount:</left>
<right>
<t t-esc="widget.format_currency(order.get_total_discount())"/>
</right>
</line>
</t>
<t t-if="receipt.rounding_applied">
<line>
<left>Total:</left>
<right>
<t t-esc="widget.format_currency(order.get_total_with_tax())"/>
</right>
</line>
<line size="double-height">
<left>Total (Redondeado):</left>
<right>
<t t-esc='widget.format_currency(receipt.total_rounded)' />
</right>
</line>
</t>
<t t-else="">
<line size="double-height">
<left>Total:</left>
<right>
<t t-esc="widget.format_currency(order.get_total_with_tax())"/>
</right>
</line>
</t>
</div>
<div>--------------------------------</div>
<div class='receipt-paymentlines'>
<t t-foreach="paymentlines" t-as="line">
<line>
<left>
<t t-esc="line.name"/>
</left>
<right class="pos-right-align">
<t t-esc="widget.format_currency(line.get_amount())"/>
</right>
</line>
</t>
</div>
<div class='receipt-change'>
<line><left>Change:</left>
<right>
<t t-esc="widget.format_currency(order.get_change())"/>
</right>
</line>
</div>
<!-- Footer -->
<t t-if='receipt.footer_xml'>
<t t-raw='receipt.footer_xml' />
</t>
<t t-if='!receipt.footer_xml and receipt.footer'>
<br/>
<t t-esc='receipt.footer' />
<br/>
<br/>
</t>
<div class="pos-center-align">
<t t-esc="order.formatted_validation_date"/>
<t t-if="widget.pos.config.iface_l10n_es_simplified_invoice and !order.is_to_invoice()">
<br/><span>Simplified invoice: </span>
</t>
<t t-esc="order.name"/>
</div>
</receipt>
</t>
</t>
</templates>