From d5390deba92d9d23d19fbcc525352e7a8d30faed Mon Sep 17 00:00:00 2001 From: Joseph Caburnay Date: Thu, 9 Dec 2021 22:58:58 +0000 Subject: [PATCH] [FIX] l10n_fr_pos_cert: should only prevent on explicit order deletion It's not allowed to delete order for french certification which was supposed to be fixed here: 46ffe6d3fba3baf1d84af732feaac71dabaaf35f However, it introduced another problem of not being able to delete the finalized/validated orders. It's because the check of preventing the deletion, we are not discriminating the validated order. This commit fixes the issue by only applying the rule on orders that are being explicitly deleted (reason of deletion is "abandon"). closes odoo/odoo#81289 Ticket-id: 2710892 X-original-commit: d477be7cd5f7820ea6925dcfb42a26e67977b052 Signed-off-by: Masereel Pierre --- addons/l10n_fr_pos_cert/static/src/js/pos.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 1c131bd0e88..79e06ed6cb1 100644 --- a/addons/l10n_fr_pos_cert/static/src/js/pos.js +++ b/addons/l10n_fr_pos_cert/static/src/js/pos.js @@ -54,10 +54,10 @@ models.Order = models.Order.extend({ result = Boolean(result || this.pos.is_french_country()); return result; }, - destroy: function(reason) { + destroy: function(option) { // SUGGESTION: It's probably more appropriate to apply this restriction // in the TicketScreen. - if (this.pos.is_french_country() && this.get_orderlines().length) { + if (option && option.reason == 'abandon' && this.pos.is_french_country() && this.get_orderlines().length) { Gui.showPopup("ErrorPopup", { 'title': _t("Fiscal Data Module error"), 'body': _t("Deleting of orders is not allowed."),