From 1ece1e780aad856a174889d7a6fa3f5ecf9ef5c2 Mon Sep 17 00:00:00 2001 From: "Pedram (PEBR)" Date: Fri, 17 Nov 2023 13:19:22 +0100 Subject: [PATCH] [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) --- .../receipt_screen/receipt/order_receipt.xml | 24 ++++++++++--------- .../static/src/overrides/models/models.js | 11 +++++---- .../static/src/overrides/models/pos_store.js | 9 +++---- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/addons/l10n_gcc_pos/static/src/overrides/app/screens/receipt_screen/receipt/order_receipt.xml b/addons/l10n_gcc_pos/static/src/overrides/app/screens/receipt_screen/receipt/order_receipt.xml index ebd64798cec..eae37d5e0b5 100644 --- a/addons/l10n_gcc_pos/static/src/overrides/app/screens/receipt_screen/receipt/order_receipt.xml +++ b/addons/l10n_gcc_pos/static/src/overrides/app/screens/receipt_screen/receipt/order_receipt.xml @@ -35,18 +35,20 @@ - - !props.data.is_gcc_country + + - -
- Rounding / التقريب - -
-
- To Pay - -
+ + +
+ Rounding / التقريب + +
+
+ To Pay + +
+
diff --git a/addons/l10n_sa_pos/static/src/overrides/models/models.js b/addons/l10n_sa_pos/static/src/overrides/models/models.js index 1f25d57ce87..2940c2576cf 100644 --- a/addons/l10n_sa_pos/static/src/overrides/models/models.js +++ b/addons/l10n_sa_pos/static/src/overrides/models/models.js @@ -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) diff --git a/addons/l10n_sa_pos/static/src/overrides/models/pos_store.js b/addons/l10n_sa_pos/static/src/overrides/models/pos_store.js index 053da53e17c..593ca182429 100644 --- a/addons/l10n_sa_pos/static/src/overrides/models/pos_store.js +++ b/addons/l10n_sa_pos/static/src/overrides/models/pos_store.js @@ -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)