[FIX] l10n_sa_pos: fix blank screen and receipt issues

Before this commit, validating an order with the l10n_sa_pos module
installed resulted in a blank screen. Additionally, there was an issue
with the display of receipts when no rounding was applied.

opw-3594564

closes odoo/odoo#142510

Signed-off-by: Vlad Stroia (vlst) <vlst@odoo.com>
This commit is contained in:
Pedram (PEBR)
2023-11-21 17:17:05 +00:00
parent d3bf03ff79
commit 1ece1e780a
3 changed files with 24 additions and 20 deletions
@@ -35,18 +35,20 @@
</div>
</xpath>
<xpath expr="//t[@t-if='props.data.rounding_applied']/.." position="attributes">
<attribute name="t-if">!props.data.is_gcc_country</attribute>
<xpath expr="//t[@t-if='props.data.rounding_applied']" position="attributes">
<attribute name="t-if" add=" and !props.data.is_gcc_country" separator=" "/>
</xpath>
<xpath expr="//t[@t-if='props.data.rounding_applied']/.." position="after">
<div t-if="props.data.is_gcc_country" class="pos-receipt-amount pos-receipt-amount-arabic" t-translation="off">
Rounding / التقريب
<span t-esc="props.formatCurrency(props.data.rounding_applied)" class="pos-receipt-right-align"/>
</div>
<div class="pos-receipt-amount">
To Pay
<span t-esc="props.formatCurrency(props.data.amount_total + props.data.rounding_applied)" class="pos-receipt-right-align"/>
</div>
<xpath expr="//t[@t-if='props.data.rounding_applied and !props.data.is_gcc_country']" position="after">
<t t-elif="props.data.rounding_applied and props.data.is_gcc_country">
<div class="pos-receipt-amount pos-receipt-amount-arabic" t-translation="off">
Rounding / التقريب
<span t-esc="props.formatCurrency(props.data.rounding_applied)" class="pos-receipt-right-align"/>
</div>
<div class="pos-receipt-amount">
To Pay
<span t-esc="props.formatCurrency(props.data.amount_total + props.data.rounding_applied)" class="pos-receipt-right-align"/>
</div>
</t>
</xpath>
<xpath expr="//span[@t-esc='props.formatCurrency(props.data.change)']/.." position="attributes">
@@ -9,13 +9,14 @@ patch(Order.prototype, {
if (this.pos.company.country && this.pos.company.country.code === "SA") {
result.is_settlement = this.is_settlement();
if (!result.is_settlement) {
const company = this.pos.company;
const codeWriter = new window.ZXing.BrowserQRCodeSvgWriter();
const qr_values = this.compute_sa_qr_code(
result.company.name,
result.company.vat,
result.date.isostring,
result.total_with_tax,
result.total_tax
company.name,
company.vat,
this.date_order.toISO(),
this.get_total_with_tax(),
this.get_total_tax()
);
const qr_code_svg = new XMLSerializer().serializeToString(
codeWriter.write(qr_values, 150, 150)
@@ -9,13 +9,14 @@ patch(PosStore.prototype, {
if (this.company?.country?.code === "SA") {
result.is_settlement = this.get_order().is_settlement();
if (!result.is_settlement) {
const order = this.get_order();
const codeWriter = new window.ZXing.BrowserQRCodeSvgWriter();
const qr_values = this.get_order().compute_sa_qr_code(
const qr_values = order.compute_sa_qr_code(
result.company.name,
result.company.vat,
result.date.isostring,
result.total_with_tax,
result.total_tax
order.date_order.toISO(),
order.get_total_with_tax(),
order.get_total_tax()
);
const qr_code_svg = new XMLSerializer().serializeToString(
codeWriter.write(qr_values, 150, 150)