1
0
forked from Mapan/odoo17e

[custom] font size for point of sale receipt

This commit is contained in:
Suherdy Yacob 2024-12-11 15:39:27 +07:00
parent 28c904f96a
commit 4397d8f2ce
5 changed files with 53 additions and 64 deletions

View File

@ -2,7 +2,7 @@
<templates id="template" xml:space="preserve"> <templates id="template" xml:space="preserve">
<t t-name="point_of_sale.OrderWidget"> <t t-name="point_of_sale.OrderWidget">
<t t-if="props.lines?.length"> <t t-if="props.lines?.length">
<div t-ref="scrollable" class="order-container bg-view overflow-y-auto flex-grow-1 d-flex flex-column text-start"> <div style="font-size: 12px" t-ref="scrollable" class="order-container bg-view overflow-y-auto flex-grow-1 d-flex flex-column text-start">
<t t-foreach="props.lines" t-as="line" t-key="line_index"> <t t-foreach="props.lines" t-as="line" t-key="line_index">
<t t-slot="default" line="line"/> <t t-slot="default" line="line"/>
</t> </t>

View File

@ -5,10 +5,10 @@
<div class="popup close-pos-popup"> <div class="popup close-pos-popup">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title">Closing Session</h4> <h4 class="modal-title">Closing Session</h4>
<div class="total-orders fw-bolder"> <!-- <div class="total-orders fw-bolder">
Total <t t-esc="props.orders_details.quantity"/> orders: Total <t t-esc="props.orders_details.quantity"/> orders:
<span class="amount" t-esc="env.utils.formatCurrency(props.orders_details.amount)"/> <span class="amount" t-esc="env.utils.formatCurrency(props.orders_details.amount)"/>
</div> </div> -->
</div> </div>
<main class="modal-body"> <main class="modal-body">
<div class="payment-methods-overview overflow-auto"> <div class="payment-methods-overview overflow-auto">
@ -16,16 +16,16 @@
<thead> <thead>
<tr class="text-dark"> <tr class="text-dark">
<th>Payment Method</th> <th>Payment Method</th>
<th>Expected</th> <!-- <th>Expected</th>
<th style="width:20%">Counted</th> <th style="width:20%">Counted</th>
<th>Difference</th> <th>Difference</th> -->
</tr> </tr>
</thead> </thead>
<t t-if="pos.config.cash_control"> <t t-if="pos.config.cash_control">
<tbody> <tbody>
<tr> <tr>
<td t-esc="props.default_cash_details.name"/> <td t-esc="props.default_cash_details.name"/>
<td t-esc="env.utils.formatCurrency(props.default_cash_details.amount)"/> <!-- <td t-esc="env.utils.formatCurrency(props.default_cash_details.amount)"/> -->
<td class="d-flex"> <td class="d-flex">
<Input tModel="[state.payments[props.default_cash_details.id], 'counted']" <Input tModel="[state.payments[props.default_cash_details.id], 'counted']"
callback.bind="(value) => this.setManualCashInput(value)" callback.bind="(value) => this.setManualCashInput(value)"
@ -34,11 +34,11 @@
<i class="fa fa-money fa-2x" role="img" title="Open the money details popup"/> <i class="fa fa-money fa-2x" role="img" title="Open the money details popup"/>
</div> </div>
</td> </td>
<td t-esc="env.utils.formatCurrency(getDifference(props.default_cash_details.id))" <!-- <td t-esc="env.utils.formatCurrency(getDifference(props.default_cash_details.id))"
t-att-class="{'warning text-danger fw-bolder': !env.utils.floatIsZero(getDifference(props.default_cash_details.id))}"/> t-att-class="{'warning text-danger fw-bolder': !env.utils.floatIsZero(getDifference(props.default_cash_details.id))}"/> -->
</tr> </tr>
</tbody> </tbody>
<tbody class="cash-overview border-start small text-muted"> <!-- <tbody class="cash-overview border-start small text-muted">
<tr> <tr>
<td>Opening</td> <td>Opening</td>
<td class="align-top" t-esc="env.utils.formatCurrency(props.default_cash_details.opening)"/> <td class="align-top" t-esc="env.utils.formatCurrency(props.default_cash_details.opening)"/>
@ -61,9 +61,9 @@
</td> </td>
<td class="align-top" t-esc="env.utils.formatCurrency(Math.abs(props.default_cash_details.payment_amount))"/> <td class="align-top" t-esc="env.utils.formatCurrency(Math.abs(props.default_cash_details.payment_amount))"/>
</tr> </tr>
</tbody> </tbody> -->
</t> </t>
<tbody t-if="props.other_payment_methods.length > 0"> <!-- <tbody t-if="props.other_payment_methods.length > 0">
<tr t-foreach="props.other_payment_methods" t-as="pm" t-key="pm.id"> <tr t-foreach="props.other_payment_methods" t-as="pm" t-key="pm.id">
<td t-esc="pm.name"/> <td t-esc="pm.name"/>
<td t-esc="env.utils.formatCurrency(pm.amount)"/> <td t-esc="env.utils.formatCurrency(pm.amount)"/>
@ -75,7 +75,7 @@
<td t-if="_showDiff" t-esc="env.utils.formatCurrency(getDifference(pm.id))" <td t-if="_showDiff" t-esc="env.utils.formatCurrency(getDifference(pm.id))"
t-att-class="{'warning text-danger fw-bolder': getDifference(pm.id)}"/> t-att-class="{'warning text-danger fw-bolder': getDifference(pm.id)}"/>
</tr> </tr>
</tbody> </tbody> -->
</table> </table>
</div> </div>
<div class="notes-container d-flex flex-column flex-sm-row gap-3 border-top mt-3 pt-3"> <div class="notes-container d-flex flex-column flex-sm-row gap-3 border-top mt-3 pt-3">
@ -113,4 +113,4 @@
</div> </div>
</t> </t>
</templates> </templates>

View File

@ -10,6 +10,7 @@
<i class="fa fa-sticky-note me-1" role="img" aria-label="Customer Note" title="Customer Note"/> <i class="fa fa-sticky-note me-1" role="img" aria-label="Customer Note" title="Customer Note"/>
<t t-esc="line.customerNote" /> <t t-esc="line.customerNote" />
</li> </li>
<ul t-if="line.pack_lot_lines"> <ul t-if="line.pack_lot_lines">
<li t-foreach="line.pack_lot_lines" t-as="lot" t-key="lot.cid"> <li t-foreach="line.pack_lot_lines" t-as="lot" t-key="lot.cid">
<t t-if="lot.order_line.product.tracking == 'lot'"> <t t-if="lot.order_line.product.tracking == 'lot'">
@ -19,59 +20,55 @@
SN <t t-esc="lot.lot_name"/> SN <t t-esc="lot.lot_name"/>
</t> </t>
</li> </li>
</ul> </ul>
</Orderline> </Orderline>
</OrderWidget> </OrderWidget>
<!-- Total --> <!-- Total -->
<div class="pos-receipt-right-align">--------</div> <div style="font-size: 10px" class="pos-receipt-amount">
<br/>
<div class="pos-receipt-amount">
TOTAL TOTAL
<span t-esc="props.formatCurrency(props.data.amount_total)" class="pos-receipt-right-align"/> <span t-esc="props.formatCurrency(props.data.amount_total)" class="pos-receipt-right-align"/>
</div> </div>
<t t-if="props.data.rounding_applied"> <t t-if="props.data.rounding_applied">
<div class="pos-receipt-amount"> <div style="font-size: 10px" class="pos-receipt-amount">
Rounding Rounding
<span t-esc='props.formatCurrency(props.data.rounding_applied)' class="pos-receipt-right-align"/> <span style="font-size: 10px" t-esc='props.formatCurrency(props.data.rounding_applied)' class="pos-receipt-right-align"/>
</div> </div>
<div class="pos-receipt-amount"> <div style="font-size: 10px" class="pos-receipt-amount">
To Pay To Pay
<span t-esc='props.formatCurrency(props.data.amount_total + props.data.rounding_applied)' class="pos-receipt-right-align"/> <span style="font-size: 10px" t-esc='props.formatCurrency(props.data.amount_total + props.data.rounding_applied)' class="pos-receipt-right-align"/>
</div> </div>
</t> </t>
<br/><br/>
<!-- Payment Lines --> <!-- Payment Lines -->
<div class="paymentlines" t-foreach="props.data.paymentlines" t-as="line" t-key="line_index"> <div style="font-size: 10px" class="paymentlines" t-foreach="props.data.paymentlines" t-as="line" t-key="line_index">
<t t-esc="line.name" /> <t t-esc="line.name" />
<span t-esc="props.formatCurrency(line.amount, false)" class="pos-receipt-right-align"/> <span style="font-size: 10px" t-esc="props.formatCurrency(line.amount, false)" class="pos-receipt-right-align"/>
</div> </div>
<div class="pos-receipt-amount receipt-change mt-2"> <div style="font-size: 10px" class="pos-receipt-amount receipt-change mt-2">
CHANGE CHANGE
<span t-esc="props.formatCurrency(props.data.change)" class="pos-receipt-right-align"/> <span style="font-size: 10px" t-esc="props.formatCurrency(props.data.change)" class="pos-receipt-right-align"/>
</div> </div>
<!-- Extra Payment Info --> <!-- Extra Payment Info -->
<t t-if="props.data.total_discount"> <t t-if="props.data.total_discount">
<div> <div style="font-size: 10px">
Discounts Discounts
<span t-esc="props.formatCurrency(props.data.total_discount)" class="pos-receipt-right-align"/> <span style="font-size: 10px" t-esc="props.formatCurrency(props.data.total_discount)" class="pos-receipt-right-align"/>
</div> </div>
</t> </t>
<div t-if="props.data.tax_details.length > 0" class="pos-receipt-taxes"> <div style="font-size: 10px" t-if="props.data.tax_details.length > 0" class="pos-receipt-taxes">
<span /> <span />
<span>PB1</span>
<span>Tax</span> <span>Tax</span>
<span>Amount</span>
<span>Base</span> <span>Base</span>
<span>Total</span> <span>Total</span>
<t t-foreach="props.data.tax_details" t-as="tax" t-key="tax.tax.id"> <t t-foreach="props.data.tax_details" t-as="tax" t-key="tax.tax.id">
<span t-esc="tax.tax.letter || ''"/> <span t-esc="tax.tax.letter || ''"/>
<span t-if="tax.tax.amount_type != 'fixed'"><t t-esc="tax.tax.amount"/>%</span> <span><t t-esc="tax.tax.amount"/>%</span>
<span t-else="" t-esc="tax.tax.name"/>
<span t-esc="props.formatCurrency(tax.amount, false)" /> <span t-esc="props.formatCurrency(tax.amount, false)" />
<span t-esc="props.formatCurrency(tax.base, false)" /> <span t-esc="props.formatCurrency(tax.base, false)" />
<span t-esc="props.formatCurrency(tax.amount + tax.base, false)" /> <span t-esc="props.formatCurrency(tax.amount + tax.base, false)" />
@ -88,15 +85,15 @@
<div class="before-footer" /> <div class="before-footer" />
<div t-if="props.data.pos_qr_code"> <div t-if="props.data.pos_qr_code">
<br /><br /> <br />
<div class="pos-receipt-order-data mb-2"> <div style="font-size: 10px" class="pos-receipt-order-data mb-2">
Scan me to request an invoice for your purchase. Scan me to request an invoice for your purchase.
</div> </div>
<img id="posqrcode" t-att-src="props.data.pos_qr_code" class="pos-receipt-qrcode"/> <img id="posqrcode" t-att-src="props.data.pos_qr_code" class="pos-receipt-logo"/>
</div> </div>
<div t-if="props.data.ticket_code"> <div t-if="props.data.ticket_code">
<br /><br /> <br />
<div class="pos-receipt-order-data"> <div class="pos-receipt-order-data">
You can go to <t t-out="props.data.base_url"/>/pos/ticket and use the code below to request an invoice online You can go to <t t-out="props.data.base_url"/>/pos/ticket and use the code below to request an invoice online
</div> </div>
@ -106,11 +103,8 @@
</div> </div>
<!-- Footer --> <!-- Footer -->
<div t-if="props.data.footer" class="pos-receipt-center-align" style="white-space:pre-line"> <div t-if="props.data.footer" class="pos-receipt-center-align" style="white-space:normal">
<br/>
<t t-esc="props.data.footer" /> <t t-esc="props.data.footer" />
<br/>
<br/>
</div> </div>
<div class="after-footer"> <div class="after-footer">
@ -124,20 +118,18 @@
</t> </t>
</div> </div>
<br/> <t style="font-size: 9px" t-if="props.shippingDate">
<t t-if="props.data.shippingDate">
<div class="pos-receipt-order-data"> <div class="pos-receipt-order-data">
Expected delivery: Expected delivery:
<div><t t-esc="props.data.shippingDate" /></div> <div><t t-esc="props.shippingDate" /></div>
</div> </div>
</t> </t>
<br/> <div style="font-size: 9px" class="pos-receipt-order-data">
<div class="pos-receipt-order-data">
<p>Powered by Odoo</p> <p>Powered by Odoo</p>
<div t-esc="props.data.name" /> <div t-esc="props.data.name" />
<div id="order-date" t-esc="props.data.date" /> <div t-esc="props.data.date" />
</div> </div>
</div> </div>
</t> </t>
</templates> </templates>

View File

@ -1,29 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve"> <templates id="template" xml:space="preserve">
<t t-name="point_of_sale.ReceiptHeader"> <t t-name="point_of_sale.ReceiptHeader">
<img t-attf-src="/web/image?model=res.company&amp;id={{props.data.company.id}}&amp;field=logo" alt="Logo" class="pos-receipt-logo"/> <img t-attf-src="/web/image?model=res.company&amp;id={{props.data.company.id}}&amp;field=logo" alt="Logo" class="pos-receipt-logo" width="60" height="120"/>
<br/>
<h1 class="tracking-number text-center" style="font-size: 100px" t-if="props.data.trackingNumber and props.data.bigTrackingNumber" t-esc="props.data.trackingNumber" /> <h1 class="tracking-number text-center" style="font-size: 100px" t-if="props.data.trackingNumber and props.data.bigTrackingNumber" t-esc="props.data.trackingNumber" />
<div class="pos-receipt-contact"> <div class="pos-receipt-contact">
<!-- contact address --> <!-- contact address -->
<div t-if="props.data.company.partner_id?.[1]" t-esc="props.data.company.partner_id[1]" /> <!-- <div t-if="props.data.company.partner_id?.[1]" t-esc="props.data.company.partner_id[1]" /> -->
<t t-if="props.data.company.phone"> <t t-if="props.data.company.phone">
<div>Tel:<t t-esc="props.data.company.phone" /></div> <!-- <div>Tel:<t t-esc="props.data.company.phone" /></div> -->
</t> </t>
<t t-if="props.data.company.vat"> <t t-if="props.data.company.vat">
<div><t t-esc="props.data.company.country?.vat_label || 'Tax ID'"/>: <t t-esc="props.data.company.vat" /></div> <!-- <div><t t-esc="props.data.company.country?.vat_label || 'Tax ID'"/>: <t t-esc="props.data.company.vat" /></div> -->
</t> </t>
<!--
<div t-if="props.data.company.email" t-esc="props.data.company.email" /> <div t-if="props.data.company.email" t-esc="props.data.company.email" />
<div t-if="props.data.company.website" t-esc="props.data.company.website" /> <div t-if="props.data.company.website" t-esc="props.data.company.website" />
<div t-if="props.data.header" style="white-space:pre-line" t-esc="props.data.header" /> <div t-if="props.data.header" style="white-space:pre-line" t-esc="props.data.header" /> -->
<div t-if="props.data.cashier" class="cashier"> <div t-if="props.data.cashier" class="cashier">
<div>--------------------------------</div> <!--
<div>Served by <t t-esc="props.data.cashier" /></div> <div>Served by <t t-esc="props.data.cashier" /></div> -->
</div> </div>
<div class="fw-bolder" t-if="props.data.trackingNumber and !props.data.bigTrackingNumber"> <div class="fw-bolder" t-if="props.data.trackingNumber and !props.data.bigTrackingNumber">
<span class="fs-2" t-esc="props.data.trackingNumber" /> <span class="fs-2" t-esc="props.data.trackingNumber" />
</div> </div>
</div> </div>
<br /><br /> <br />
</t> </t>
</templates> </templates>

View File

@ -9,25 +9,22 @@
<span class="pos-receipt-center-align"> <span class="pos-receipt-center-align">
<div>--------------------------------</div> <div>--------------------------------</div>
<br/> <br/>
<div t-esc='_loyaltyStat.program.name' class="pos-receipt-title" /> <div style="font-size: 10px" t-esc='_loyaltyStat.program.name' class="pos-receipt-title" />
<br />
</span> </span>
<t t-if='_loyaltyStat.points.won'> <t t-if='_loyaltyStat.points.won'>
<div><t t-esc="_loyaltyStat.points.name"/> Won: <span t-esc='_loyaltyStat.points.won' class="pos-receipt-right-align"/></div> <div style="font-size: 10px"><t t-esc="_loyaltyStat.points.name"/> Won: <span t-esc='_loyaltyStat.points.won' class="pos-receipt-right-align"/></div>
</t> </t>
<t t-if='_loyaltyStat.points.spent'> <t t-if='_loyaltyStat.points.spent'>
<div><t t-esc="_loyaltyStat.points.name"/> Spent: <span t-esc='_loyaltyStat.points.spent' class="pos-receipt-right-align"/></div> <div style="font-size: 10px"><t t-esc="_loyaltyStat.points.name"/> Spent: <span t-esc='_loyaltyStat.points.spent' class="pos-receipt-right-align"/></div>
</t> </t>
<!-- Don't use points.total, it's wrong in this context (after the order synced). --> <!-- Don't use points.total, it's wrong in this context (after the order synced). -->
<!-- Show balance as it's updated during _postPushOrderResolve. --> <!-- Show balance as it's updated during _postPushOrderResolve. -->
<t t-if='_loyaltyStat.points.balance'> <t t-if='_loyaltyStat.points.balance'>
<div>Balance <t t-esc="_loyaltyStat.points.name"/>: <span t-esc='_loyaltyStat.points.balance' class="pos-receipt-right-align"/></div> <div style="font-size: 10px">Balance <t t-esc="_loyaltyStat.points.name"/>: <span t-esc='_loyaltyStat.points.balance' class="pos-receipt-right-align"/></div>
</t> </t>
<br />
</div> </div>
</t> </t>
<t t-if="props.data.partner"> <t t-if="props.data.partner">
<br/>
<div>Customer <span t-esc='props.data.partner.name' class='pos-receipt-right-align'/></div> <div>Customer <span t-esc='props.data.partner.name' class='pos-receipt-right-align'/></div>
</t> </t>
<t t-if="props.data.new_coupon_info and props.data.new_coupon_info.length !== 0"> <t t-if="props.data.new_coupon_info and props.data.new_coupon_info.length !== 0">
@ -64,4 +61,4 @@
</xpath> </xpath>
</t> </t>
</templates> </templates>