[IMP] point_of_sale: error handler belgian blackbox

This commit aims to handle the belgian blackbox error properly just as the sweden blackbox do.
Add an error code of 701 to handle the error messages.

closes odoo/odoo#104233

Part-of: odoo/odoo#96583
X-original-commit: 7d1e52bcd11a1c20a6c6829c56d3fabe5b0f0fef
Signed-off-by: Masereel Pierre <pim@odoo.com>
This commit is contained in:
rhe-odoo
2022-10-27 14:41:11 +02:00
parent 9b60a1bfc1
commit a0639cd152
2 changed files with 13 additions and 4 deletions
@@ -211,9 +211,7 @@ odoo.define('point_of_sale.PaymentScreen', function (require) {
}
}
} catch (error) {
hasError = true;
if (error.code == 700)
if (error.code == 700 || error.code == 701)
this.error = true;
if ('code' in error) {
@@ -38,13 +38,24 @@ odoo.define('point_of_sale.custom_hooks', function (require) {
this.env._t('The server encountered an error while receiving your order.'),
});
} else if (error.code === 700) {
// Fiscal module errors
// Sweden Fiscal module errors
await this.showPopup('ErrorPopup', {
title: this.env._t('Fiscal data module error'),
body:
error.data.error.status ||
this.env._t('The fiscal data module encountered an error while receiving your order.'),
});
} else if (error.code === 701) {
// Belgian Fiscal module errors
let bodyMessage = "";
if(error.error.errorCode)
bodyMessage = "'" + error.error.errorCode + "': " + error.error.errorMessage;
else
bodyMessage = "Fiscal data module is not on.";
await this.showPopup('ErrorPopup', {
title: this.env._t('Fiscal data module error'),
body: bodyMessage
});
} else {
// ???
await this.showPopup('ErrorPopup', {