Browse Source

MAY 02: [FIX] Bug Fixed 'custom_receipts_for_pos'

pull/346/merge
Cybrosys Technologies 2 months ago
parent
commit
ce6c46aa2a
  1. 19
      custom_receipts_for_pos/data/pos_receipt_design1_data.xml
  2. 37
      custom_receipts_for_pos/data/pos_receipt_design2_data.xml
  3. 16
      custom_receipts_for_pos/static/src/js/receipt_design.js
  4. 19
      custom_receipts_for_pos/static/src/xml/order_receipt.xml

19
custom_receipts_for_pos/data/pos_receipt_design1_data.xml

@ -4,6 +4,7 @@
<record id="pos_receipt_design1" model="pos.receipt">
<field name="name">Design 1</field>
<field name="design_receipt"><![CDATA[
<div class="pos-receipt">
<t t-if="env.services.pos.config.logo">
<img t-att-src="'data:image/png;base64,' + env.services.pos.config.logo"
@ -44,7 +45,8 @@
<br />
</t>
<div>
<table class='receipt-orderlines' style="font-size:15px; border-style:double; border-left:none; border-right:none; border-bottom:none; width:100%;">
<table class='receipt-orderlines' style="font-size:15px; border-style:double;
border-left:none; border-right:none; border-bottom:none; width:100%;">
<colgroup>
<col width='40%' />
<col width='30%' />
@ -59,7 +61,7 @@
<t t-if="props.order.pos.mainScreen.props">
<tr t-foreach="props.order.pos.mainScreen.props.order.orderlines" t-as="orderline" t-key="index_orderlines">
<td style="padding-top:1%; padding-bottom:1%; text-align:left;">
<t t-esc="orderline.get_product().display_name"/>
<t t-esc="orderline.productName"/>
<t t-if="orderline.get_discount() > 0">
<div style="font-size:12px; font-style:italic; color:#808080;">
<t t-esc="orderline.get_discount()"/>% discount
@ -82,10 +84,10 @@
<t t-if="props.orderlines and props.orderlines.length">
<tr t-foreach="props.orderlines" t-as="orderline" t-key="orderline.id">
<td style="padding-top:1%; padding-bottom:1%; text-align:left;">
<t t-esc="orderline.get_product().display_name"/>
<t t-if="orderline.get_discount() > 0">
<t t-esc="orderline.productName"/>
<t t-if="orderline.discount > 0">
<div style="font-size:12px; font-style:italic; color:#808080;">
<t t-esc="orderline.get_discount()"/>% discount
<t t-esc="orderline.discount"/>% discount
</div>
</t>
<t t-if="orderline.customerNote">
@ -93,10 +95,10 @@
</t>
</td>
<td style="text-align:right; font-size:14px;">
<t t-esc="orderline.get_quantity_str_with_unit()"/>
<t t-esc="orderline.qty"/>
</td>
<td style="text-align:right; font-size:14px;">
<t t-esc="env.utils.formatCurrency(orderline.get_display_price())"/>
<t t-esc="orderline.price"/>
</td>
</tr>
</t>
@ -114,10 +116,9 @@
<span t-esc='env.utils.formatCurrency(props.data.total_without_tax)'
class="pos-receipt-right-align"/>
</div>
<t t-log='props'/>
<t t-foreach='props.data.tax_details' t-as='tax' t-key="index_tax_details">
<div style="font-weight:700; font-size:14px;">
<span style="margin-left:40%;"><t t-esc='tax.name' /></span>
<span style="margin-left:40%;"><t t-esc='tax.tax.name' /></span>
<span t-esc='env.utils.formatCurrency(tax.amount)'
class="pos-receipt-right-align"/>
</div>

37
custom_receipts_for_pos/data/pos_receipt_design2_data.xml

@ -4,6 +4,7 @@
<record id="pos_receipt_design2_demo" model="pos.receipt">
<field name="name">Design 2</field>
<field name="design_receipt"><![CDATA[
<div class="pos-receipt">
<t t-if="env.services.pos.config.logo">
<img t-att-src="'data:image/png;base64,' + env.services.pos.config.logo"
@ -58,10 +59,10 @@
<t t-if="props.order.pos.mainScreen.props">
<tr t-foreach="props.order.pos.mainScreen.props.order.orderlines" t-as="orderline" t-key="index_orderlines">
<td style="padding-top:1%; padding-bottom:1%; text-align:left;">
<t t-esc="orderline.get_product().display_name"/>
<t t-if="orderline.get_discount() > 0">
<t t-esc="orderline.productName"/>
<t t-if="orderline.discount > 0">
<div style="font-size:12px; font-style:italic; color:#808080;">
<t t-esc="orderline.get_discount()"/>% discount
<t t-esc="orderline.discount"/>% discount
</div>
</t>
<t t-if="orderline.customerNote">
@ -69,10 +70,10 @@
</t>
</td>
<td style="text-align:right; font-size:14px;">
<t t-esc="orderline.get_quantity_str_with_unit()"/>
<t t-esc="orderline.qty"/>
</td>
<td style="text-align:right; font-size:14px;">
<t t-esc="env.utils.formatCurrency(orderline.get_display_price())"/>
<t t-esc="orderline.price"/>
</td>
</tr>
</t>
@ -81,10 +82,10 @@
<t t-if="props.orderlines and props.orderlines.length">
<tr t-foreach="props.orderlines" t-as="orderline" t-key="orderline.id">
<td style="padding-top:1%; padding-bottom:1%; text-align:left;">
<t t-esc="orderline.get_product().display_name"/>
<t t-if="orderline.get_discount() > 0">
<t t-esc="orderline.productName"/>
<t t-if="orderline.discount > 0">
<div style="font-size:12px; font-style:italic; color:#808080;">
<t t-esc="orderline.get_discount()"/>% discount
<t t-esc="orderline.discount"/>% discount
</div>
</t>
<t t-if="orderline.customerNote">
@ -92,10 +93,10 @@
</t>
</td>
<td style="text-align:right; font-size:14px;">
<t t-esc="orderline.get_quantity_str_with_unit()"/>
<t t-esc="orderline.qty"/>
</td>
<td style="text-align:right; font-size:14px;">
<t t-esc="env.utils.formatCurrency(orderline.get_display_price())"/>
<t t-esc="orderline.price"/>
</td>
</tr>
</t>
@ -111,8 +112,8 @@
<t t-if="props.data.tax_details">
<t t-foreach='props.data.tax_details' t-as='tax' t-key="index_tax_details">
<div style="font-weight:700; font-size:14px;">
<span style="margin-left:40%;"><t t-esc='tax.name' /></span>
<span t-esc='env.utils.formatCurrency(tax.amount)' class="pos-receipt-right-align"/>
<span style="margin-left:40%;"><t t-esc='tax.tax.name' /></span>
<span t-esc='tax.amount' class="pos-receipt-right-align"/>
</div>
</t>
</t>
@ -121,7 +122,7 @@
<br/>
<div style="font-weight:700; font-size:14px;">
<span style="margin-left:40%;">TOTAL : </span>
<span t-esc='env.utils.formatCurrency(props.data.amount_total)' class="pos-receipt-right-align"/>
<span t-esc='props.data.amount_total' class="pos-receipt-right-align"/>
</div>
<br/><br/>
</div>
@ -129,7 +130,7 @@
<t t-foreach='props.paymentlines' t-as='line' t-key="index_paymentlines">
<div style="font-size:14px; border-top:1px dashed; padding-top:5px;">
<span style="margin-left:40%;"><t t-esc='line.name' /></span>
<span t-esc='env.utils.formatCurrency(line.amount)' class="pos-receipt-right-align"/>
<span t-esc='line.amount' class="pos-receipt-right-align"/>
</div>
</t>
<br/>
@ -142,21 +143,21 @@
<t t-if='props.receipt.total_discount'>
<div style="font-size:14px; border-top:1px dashed; padding-top:5px;">
<span style="margin-left:40%;">Discounts : </span>
<span t-esc='env.utils.formatCurrency(props.receipt.total_discount)' class="pos-receipt-right-align"/>
<span t-esc='props.receipt.total_discount' class="pos-receipt-right-align"/>
</div>
</t>
<t t-if='taxincluded'>
<t t-if="props.receipt.tax_details">
<t t-foreach='props.receipt.tax_details' t-as='tax' t-key="index_receipt_tax_details">
<div style="font-size:14px;">
<span style="margin-left:40%;"><t t-esc='tax.name' /></span>
<span t-esc='env.utils.formatCurrency(tax.amount)' class="pos-receipt-right-align"/>
<span style="margin-left:40%;"><t t-esc='tax.tax.name' /></span>
<span t-esc='tax.amount' class="pos-receipt-right-align"/>
</div>
</t>
</t>
<div style="font-size:14px;">
<span style="margin-left:40%;">Total Taxes : </span>
<span t-esc='env.utils.formatCurrency(props.receipt.total_tax)' class="pos-receipt-right-align"/>
<span t-esc='props.receipt.total_tax' class="pos-receipt-right-align"/>
</div>
</t>
<div class='before-footer' />

16
custom_receipts_for_pos/static/src/js/receipt_design.js

@ -11,20 +11,20 @@ patch(OrderReceipt.prototype, {
template: true,
})
this.pos = useState(useService("pos"));
const templateProps = {
data: this.props.data,
order: this.pos.get_order(),
receipt: this.pos.get_order().export_for_printing(),
orderlines: this.pos.get_order().get_orderlines(),
paymentlines: this.pos.get_order().export_for_printing().paymentlines
};
// const templateProps = {
// data: this.props.data,
// order: this.pos.get_order(),
// receipt: this.pos.get_order().export_for_printing(),
// orderlines: this.pos.get_order().get_orderlines(),
// paymentlines: this.pos.get_order().export_for_printing().paymentlines
// };
},
get templateProps() {
return {
data: this.props.data,
order: this.pos.get_order(),
receipt: this.pos.get_order().export_for_printing(),
orderlines: this.pos.get_order().get_orderlines(),
orderlines: this.props.data.orderlines,
paymentlines: this.pos.get_order().export_for_printing().paymentlines
};
},

19
custom_receipts_for_pos/static/src/xml/order_receipt.xml

@ -37,7 +37,7 @@
style="visibility: hidden;">A</span>
<span class="fw-bolder"
t-out="subtotal.name"/>
<span t-esc="props.formatCurrency(subtotal.base_amount_currency)"
<span t-esc="props.formatCurrency(subtotal.base_amount_currency).toFixed()"
class="ms-auto"/>
</div>
@ -55,10 +55,10 @@
<span t-esc="tax_group.group_name"/>
<t t-if="!taxTotals.same_tax_base">
on
<span t-esc="props.formatCurrency(tax_group.base_amount_currency)"/>
<span t-esc="props.formatCurrency(tax_group.base_amount_currency).toFixed()"/>
</t>
</span>
<span t-esc="props.formatCurrency(tax_group.tax_amount_currency)"
<span t-esc="props.formatCurrency(tax_group.tax_amount_currency).toFixed()"
class="ms-auto"/>
</div>
</t>
@ -67,18 +67,18 @@
<div class="text-center">--------------------------------</div>
<div class="pos-receipt-amount receipt-total">
<t t-out="props.data.label_total"/>
<span t-esc="props.formatCurrency(taxTotals.order_total)"
<span t-esc="props.formatCurrency(taxTotals.order_total).toFixed()"
class="pos-receipt-right-align"/>
</div>
<t t-if="'order_rounding' in taxTotals">
<div class="pos-receipt-amount receipt-rounding">
<t t-out="props.data.label_rounding"/>
<span t-esc="props.formatCurrency(taxTotals.order_rounding)"
<span t-esc="props.formatCurrency(taxTotals.order_rounding).toFixed()"
class="pos-receipt-right-align"/>
</div>
<div class="pos-receipt-amount receipt-to-pay">
To Pay
<span t-esc="props.formatCurrency(taxTotals.order_to_pay)"
<span t-esc="props.formatCurrency(taxTotals.order_to_pay).toFixed()"
class="pos-receipt-right-align"/>
</div>
</t>
@ -87,22 +87,23 @@
t-foreach="props.data.paymentlines" t-as="line"
t-key="line_index">
<t t-esc="line.name"/>
<span t-esc="props.formatCurrency(line.amount)"
<span t-esc="props.formatCurrency(line.amount).toFixed()"
class="pos-receipt-right-align"/>
</div>
<div t-if="'order_change' in taxTotals"
class="pos-receipt-amount receipt-change">
<t t-out="props.data.label_change"/>
<span t-esc="props.formatCurrency(taxTotals.order_change)"
<span t-esc="props.formatCurrency(taxTotals.order_change).toFixed()"
class="pos-receipt-right-align"/>
</div>
<!-- Extra Payment Info -->
<t t-if="props.data.total_discount">
<div class="text-center">
<t t-out="props.data.label_discounts"/>
<span t-esc="props.formatCurrency(props.data.total_discount)"
<span t-esc="props.formatCurrency(props.data.total_discount).toFixed()"
class="pos-receipt-right-align"/>
</div>
</t>
<div class="before-footer"/>

Loading…
Cancel
Save