Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Check if order is in transmission to sefaz #153

Open
wants to merge 2 commits into
base: 14.0-mig-l10n_br_pos
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions l10n_br_pos/static/src/js/Screens/PaymentScreen/PaymentScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
}
};

Expand Down
7 changes: 7 additions & 0 deletions l10n_br_pos/static/src/js/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},
Expand Down Expand Up @@ -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;
},
Expand Down