From 667d056b63f4391746f64943c2fcd615b8cf780a Mon Sep 17 00:00:00 2001 From: Joseph Caburnay Date: Thu, 22 Jun 2023 11:11:32 +0000 Subject: [PATCH] [FIX] pos_*: properly check country from company pos_*: l10n_ae_pos,l10n_co_pos,l10n_fr_pos_cert In many pos l10n addons, we assume that country is present in the company, and this is a wrong assumption. Thanks to the runbot error that we are able to detect these mistakes in the code. In this commit, we fix the issue by checking the presence of country first before actually accession the country code. Runbot Error: 20917 closes odoo/odoo#126117 X-original-commit: 172a5bc8628f8b774d9738c05c2eb7b0ef4db5ae Related: odoo/enterprise#43019 Signed-off-by: Robin Heinz (rhe) --- .../static/src/xml/Screens/ReceiptScreen/OrderReceipt.xml | 2 +- addons/l10n_co_pos/static/src/js/pos.js | 2 +- addons/l10n_fr_pos_cert/static/src/js/pos.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/l10n_ae_pos/static/src/xml/Screens/ReceiptScreen/OrderReceipt.xml b/addons/l10n_ae_pos/static/src/xml/Screens/ReceiptScreen/OrderReceipt.xml index c9b25b4b5f2..8b01e246d78 100644 --- a/addons/l10n_ae_pos/static/src/xml/Screens/ReceiptScreen/OrderReceipt.xml +++ b/addons/l10n_ae_pos/static/src/xml/Screens/ReceiptScreen/OrderReceipt.xml @@ -3,7 +3,7 @@
- VAT + VAT Total Taxes
diff --git a/addons/l10n_co_pos/static/src/js/pos.js b/addons/l10n_co_pos/static/src/js/pos.js index baff30f355b..018be37fb42 100644 --- a/addons/l10n_co_pos/static/src/js/pos.js +++ b/addons/l10n_co_pos/static/src/js/pos.js @@ -6,7 +6,7 @@ import { patch } from "@web/core/utils/patch"; patch(PosStore.prototype, "l10n_co_pos.PosStore", { is_colombian_country() { - return this.company.country.code === "CO"; + return this.company.country?.code === "CO"; }, }); diff --git a/addons/l10n_fr_pos_cert/static/src/js/pos.js b/addons/l10n_fr_pos_cert/static/src/js/pos.js index 06e0490f11b..16e0854b0c2 100644 --- a/addons/l10n_fr_pos_cert/static/src/js/pos.js +++ b/addons/l10n_fr_pos_cert/static/src/js/pos.js @@ -17,7 +17,7 @@ patch(PosStore.prototype, "l10n_fr_pos_cert.PosStore", { }); return false; } - return french_countries.includes(this.company.country.code); + return french_countries.includes(this.company.country?.code); }, disallowLineQuantityChange() { const result = this._super(...arguments);