From f60d404f20732d458e335148c6a918fccf91352f Mon Sep 17 00:00:00 2001 From: Sarah Bellefroid Date: Fri, 22 Mar 2024 07:50:16 +0000 Subject: [PATCH] [FIX] l10n_fr_pos_cert: disable qrcode for pos french users Currently, when the company has a french localization and activates the qr code option on the pos bill, if a customer scans the qr code, he will 'inevitably' meet an error: > According to the french law, you cannot modify a point of sale order. Forbidden fields: date_order, user_id, lines, payment_ids, ... Steps to reproduce: ------------------- * Install **France - Accounting** * Switch to `FR Company` * Go to the app **Point of Sale** * Select **Configuration** > **Settings** * Enable `Use QR code on ticket` * Open a shop session * Add anything * Select/or not a customer * Select **Payment** * Select any payment method then validate * Scan the qr code on the ticket * Try filling the form and saving > Observation: Error Why the fix: ------------ We understand the confusion for french localization users to be presented with a feature which they are not able to use as intended. The Qr code feature was implemented to make it easier and quicker at the cashier but will always end up in an error, unless a client was selected and the invoice was created when validating the payment at the register. But then, it doesn't save time. Since they are not able to use the feature as intended, we decided to make it unavailable for companies with a french localization. There has been a lot of discussion about how to solve this issue. However, a lot of the ideas discussed were not doable instable versions and this is the only solution we agreed on. opw-3704767 closes odoo/odoo#160884 X-original-commit: 6c64c30edbcc660738e66baa46646a3909a93c09 Signed-off-by: Adrien Guilliams (adgu) --- addons/l10n_fr_pos_cert/__manifest__.py | 1 + addons/l10n_fr_pos_cert/static/src/js/pos.js | 3 +++ .../views/res_config_settings_views.xml | 16 ++++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 addons/l10n_fr_pos_cert/views/res_config_settings_views.xml diff --git a/addons/l10n_fr_pos_cert/__manifest__.py b/addons/l10n_fr_pos_cert/__manifest__.py index c856f9d46d9..e9802e9ef28 100644 --- a/addons/l10n_fr_pos_cert/__manifest__.py +++ b/addons/l10n_fr_pos_cert/__manifest__.py @@ -29,6 +29,7 @@ The module adds following features: 'views/pos_views.xml', 'views/account_sale_closure.xml', 'views/pos_inalterability_menuitem.xml', + 'views/res_config_settings_views.xml', 'report/pos_hash_integrity.xml', 'data/account_sale_closure_cron.xml', 'security/ir.model.access.csv', 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 2e44ee74b06..ab1f4db6a13 100644 --- a/addons/l10n_fr_pos_cert/static/src/js/pos.js +++ b/addons/l10n_fr_pos_cert/static/src/js/pos.js @@ -39,6 +39,9 @@ patch(Order.prototype, { export_for_printing() { var result = super.export_for_printing(...arguments); result.l10n_fr_hash = this.get_l10n_fr_hash(); + if (this.pos.is_french_country()){ + result.pos_qr_code = false; + } return result; }, set_l10n_fr_hash(l10n_fr_hash) { diff --git a/addons/l10n_fr_pos_cert/views/res_config_settings_views.xml b/addons/l10n_fr_pos_cert/views/res_config_settings_views.xml new file mode 100644 index 00000000000..c45a97de7a1 --- /dev/null +++ b/addons/l10n_fr_pos_cert/views/res_config_settings_views.xml @@ -0,0 +1,16 @@ + + + + res.config.settings.view.form.inherit.l10n_fr_pos_cert + res.config.settings + + +
+ + + + country_code in ['FR', 'MF', 'MQ', 'NC', 'PF', 'RE', 'GF', 'GP', 'TF'] + +
+
+