Browse Source

Jun 18: [FIX] Bug Fixed 'pos_low_sales_price'

pull/331/head
RisvanaCybro 10 months ago
parent
commit
04f24771ab
  1. 46
      pos_low_sales_price/static/src/js/payment_screen.js

46
pos_low_sales_price/static/src/js/payment_screen.js

@ -6,35 +6,41 @@ import { ConfirmPopup } from "@point_of_sale/app/utils/confirm_popup/confirm_pop
patch(PaymentScreen.prototype, { patch(PaymentScreen.prototype, {
async validateOrder(isForceValidate) { async validateOrder(isForceValidate) {
var self = this var self = this
var condition = true var product_list = [];
var flag = true
var number = 1
var orderlines = this.pos.selectedOrder.orderlines var orderlines = this.pos.selectedOrder.orderlines
// Checking condition for each orderlines // Checking condition for each orderlines
orderlines.forEach(async function (lines) { for (const line of orderlines) {
if (lines.product.lst_price < lines.product.standard_price || lines.price < lines.product.standard_price){ if (line.product.lst_price < line.product.standard_price || line.price < line.product.standard_price) {
condition = false product_list.push("'" + line.product.display_name + "'");
}
}
if (product_list.length > 0) {
var content = '';
if (product_list.length === 1) {
content = 'The Sales Price of ' + product_list.join(' ') +
' is less than the Cost Price. Do you want to continue validation?';
} else {
var lastIndex = product_list.length - 1;
product_list[lastIndex] = "and " + product_list[lastIndex];
content = 'The Sales Prices of ' + product_list.join(', ') +
' are less than the Cost Price. Do you want to continue validation?';
}
const { confirmed } = await self.popup.add(ConfirmPopup,{ const { confirmed } = await self.popup.add(ConfirmPopup,{
title:'Alert', title:'Alert',
body: 'The Sales Price of ' + lines.product.display_name + body: content,
' is less than the Cost Price.Do you want to continue validation?',
}); });
if (confirmed) { if (confirmed) {
if (orderlines.length==number) {
self.pos.showScreen(self.nextScreen)
}
}
}
number = number + 1
})
if (flag==false && condition== false){
super.validateOrder(isForceValidate); super.validateOrder(isForceValidate);
} }
orderlines.forEach(async function (lines) { } else {
if ((lines.product.lst_price > lines.product.standard_price || lines.price < lines.product.standard_price) && condition==true ){ super.validateOrder(isForceValidate);
self.pos.showScreen(self.nextScreen)
} }
})
} }
}); });
export default PaymentScreen; export default PaymentScreen;
Loading…
Cancel
Save