diff --git a/l10n_br_pos/static/src/js/Screens/PaymentScreen/PaymentScreen.js b/l10n_br_pos/static/src/js/Screens/PaymentScreen/PaymentScreen.js index 4877ddedc895..127443b35369 100644 --- a/l10n_br_pos/static/src/js/Screens/PaymentScreen/PaymentScreen.js +++ b/l10n_br_pos/static/src/js/Screens/PaymentScreen/PaymentScreen.js @@ -39,6 +39,24 @@ odoo.define("l10n_br_pos.PaymentScreen", function (require) { return result; } + showScreen(name, props) { + if (name == "ProductScreen") { + var order = this.env.pos.get_order(); + order.isTransmissionProcessing = false; + } + + super.showScreen(name, props); + } + + async validateOrder(isForceValidate) { + var order = this.env.pos.get_order(); + if (order.isTransmissionProcessing) { + return; + } + order.isTransmissionProcessing = true; + return super.validateOrder(isForceValidate); + } + async _isOrderValid(isForceValidate) { var result = super._isOrderValid(isForceValidate); var order = this.env.pos.get_order(); @@ -51,6 +69,7 @@ odoo.define("l10n_br_pos.PaymentScreen", function (require) { title: _t("Invalid CNPJ / CPF !"), body: _t("Enter a valid CNPJ / CPF number"), }); + order.isTransmissionProcessing = false; } }; diff --git a/l10n_br_pos/static/src/js/models.js b/l10n_br_pos/static/src/js/models.js index d7b8d32474ae..99dd2226987c 100644 --- a/l10n_br_pos/static/src/js/models.js +++ b/l10n_br_pos/static/src/js/models.js @@ -171,6 +171,8 @@ odoo.define("l10n_br_pos.models", function (require) { // Campo em que são armazenados as mensagens do processo de comunicação. this.document_event_messages = this.document_event_messages || []; + this.isTransmissionProcessing = false; + this.init_locked = false; this.save_to_db(); }, @@ -399,10 +401,15 @@ odoo.define("l10n_br_pos.models", function (require) { result = await this._document_check_result(processor_result); if (result) { component.trigger("close-popup"); + } else { + this.isTransmissionProcessing = false; } } else { result = false; + this.isTransmissionProcessing = false; } + } else { + this.isTransmissionProcessing = false; } return result; },