diff --git a/pos_low_sales_price/__manifest__.py b/pos_low_sales_price/__manifest__.py index d2029e7e4..ba14ba78a 100644 --- a/pos_low_sales_price/__manifest__.py +++ b/pos_low_sales_price/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################# { 'name': 'Pos Alert in Low Sales Price', - 'version': '16.0.1.0.0', + 'version': '16.0.1.0.1', 'category': 'Point of Sale', 'summary': 'Helps to get alert message at the time of validation, ' 'when sales price is lower than cost price for corresponding ' diff --git a/pos_low_sales_price/doc/RELEASE_NOTES.md b/pos_low_sales_price/doc/RELEASE_NOTES.md index ba80c3bd7..259ca3549 100644 --- a/pos_low_sales_price/doc/RELEASE_NOTES.md +++ b/pos_low_sales_price/doc/RELEASE_NOTES.md @@ -1,6 +1,6 @@ ## Module -#### 16.08.2023 -#### Version 16.0.1.0.0 -#### ADD -- Initial commit for Pos Alert in Low Sales Price \ No newline at end of file +#### 6.05.2024 +#### Version 16.0.1.0.1 +#### BUGFIX +- Fixed the issue of POS orders not saving in the backend. \ No newline at end of file diff --git a/pos_low_sales_price/static/src/js/high_cost.js b/pos_low_sales_price/static/src/js/high_cost.js index 60845ad0a..1aeeaf3f1 100644 --- a/pos_low_sales_price/static/src/js/high_cost.js +++ b/pos_low_sales_price/static/src/js/high_cost.js @@ -5,38 +5,48 @@ const Registries = require('point_of_sale.Registries'); // Created new class validation that extends PaymentScreen and overrides the validateOrder const validation = PaymentScreen => class extends PaymentScreen { - validateOrder(isForceValidate) { + async validateOrder(isForceValidate) { var self = this var condition = true var flag = true + var normal_flow = false var number = 1 var orderlines = this.env.pos.selectedOrder.orderlines // Checking condition for each orderlines - orderlines.forEach(async function (lines) { - if (lines.product.lst_price < lines.product.standard_price || lines.price < lines.product.standard_price){ - condition = false - const { confirmed } = await self.showPopup('ConfirmPopup',{ - title:'Alert', - body: 'The Sales Price of ' + lines.product.display_name + - ' is less than the Cost Price.Do you want to continue validation?', - }); - if (confirmed) { - if (orderlines.length==number) { - self.showScreen(self.nextScreen) - } - } - } - number = number + 1 - }) - if (flag==false && condition== false){ + for (const lines of orderlines) { + if (lines.product.lst_price < lines.product.standard_price || lines.price < lines.product.standard_price) { + condition = false; + const { confirmed } = await self.showPopup('ConfirmPopup', { + title: 'Alert', + body: 'The Sales Price of ' + lines.product.display_name + + ' is less than the Cost Price. Do you want to continue validation?', + }); + if (confirmed) { + // Set flag to false if popup is confirmed + if (orderlines.length === number) { + flag = false; + } + } + } + else{ + // Set normal_flow to true if there is no pop-up + normal_flow = true + + } + number = number + 1 + } + + + if (normal_flow == true){ + // Order validation for normal flow super.validateOrder(isForceValidate); } - orderlines.forEach(async function (lines) { - if ((lines.product.lst_price > lines.product.standard_price || lines.price < lines.product.standard_price) && condition==true ){ - self.showScreen(self.nextScreen) - } - }) + if (flag==false && condition== false && normal_flow== false){ + // Order validation for low price product after confirming the pop-up + super.validateOrder(isForceValidate); } + + } }; Registries.Component.extend(PaymentScreen, validation); return PaymentScreen;