From de631e65cc0d15ed6616d20000a5d3248095006d Mon Sep 17 00:00:00 2001 From: Vishal Date: Tue, 14 Feb 2023 18:43:48 +0530 Subject: [PATCH 1/4] fix: multiple pos conversion issue resolved (cherry picked from commit 1de531e56e8820b19f3aa85cc194e7174dc4d678) --- erpnext/accounts/doctype/pos_invoice/pos_invoice.py | 6 +++--- erpnext/selling/page/point_of_sale/pos_controller.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py index 6f1434d429b..0c2700eaa21 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py @@ -161,7 +161,7 @@ class POSInvoice(SalesInvoice): bold_item_name = frappe.bold(item.item_name) bold_extra_batch_qty_needed = frappe.bold( - abs(available_batch_qty - reserved_batch_qty - item.qty) + abs(available_batch_qty - reserved_batch_qty - item.qty * item.conversion_factor) ) bold_invalid_batch_no = frappe.bold(item.batch_no) @@ -172,7 +172,7 @@ class POSInvoice(SalesInvoice): ).format(item.idx, bold_invalid_batch_no, bold_item_name), title=_("Item Unavailable"), ) - elif (available_batch_qty - reserved_batch_qty - item.qty) < 0: + elif (available_batch_qty - reserved_batch_qty - item.qty * item.conversion_factor) < 0: frappe.throw( _( "Row #{}: Batch No. {} of item {} has less than required stock available, {} more required" @@ -246,7 +246,7 @@ class POSInvoice(SalesInvoice): ), title=_("Item Unavailable"), ) - elif is_stock_item and flt(available_stock) < flt(d.qty): + elif is_stock_item and flt(available_stock) < flt(d.qty * d.conversion_factor): frappe.throw( _( "Row #{}: Stock quantity not enough for Item Code: {} under warehouse {}. Available quantity {}." diff --git a/erpnext/selling/page/point_of_sale/pos_controller.js b/erpnext/selling/page/point_of_sale/pos_controller.js index 595b9196e84..77d8fd8f403 100644 --- a/erpnext/selling/page/point_of_sale/pos_controller.js +++ b/erpnext/selling/page/point_of_sale/pos_controller.js @@ -522,7 +522,7 @@ erpnext.PointOfSale.Controller = class { const from_selector = field === 'qty' && value === "+1"; if (from_selector) - value = flt(item_row.qty) + flt(value); + value = flt(item_row.qty * item_row.conversion_factor) + flt(value); if (item_row_exists) { if (field === 'qty') From 1ebf2dd2bf525d99273e9022cb6b0b8904937ce0 Mon Sep 17 00:00:00 2001 From: Vishal Date: Thu, 23 Feb 2023 12:23:05 +0530 Subject: [PATCH 2/4] chore: minor changes added to code (cherry picked from commit 3ebe7d861d45a6e0b83bcf5df275923bb882c5e0) --- erpnext/accounts/doctype/pos_invoice/pos_invoice.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py index 0c2700eaa21..85d8efe2c49 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py @@ -161,7 +161,7 @@ class POSInvoice(SalesInvoice): bold_item_name = frappe.bold(item.item_name) bold_extra_batch_qty_needed = frappe.bold( - abs(available_batch_qty - reserved_batch_qty - item.qty * item.conversion_factor) + abs(available_batch_qty - reserved_batch_qty - item.stock_qty) ) bold_invalid_batch_no = frappe.bold(item.batch_no) @@ -172,7 +172,7 @@ class POSInvoice(SalesInvoice): ).format(item.idx, bold_invalid_batch_no, bold_item_name), title=_("Item Unavailable"), ) - elif (available_batch_qty - reserved_batch_qty - item.qty * item.conversion_factor) < 0: + elif (available_batch_qty - reserved_batch_qty - item.stock_qty) < 0: frappe.throw( _( "Row #{}: Batch No. {} of item {} has less than required stock available, {} more required" @@ -652,7 +652,7 @@ def get_bundle_availability(bundle_item_code, warehouse): item_pos_reserved_qty = get_pos_reserved_qty(item.item_code, warehouse) available_qty = item_bin_qty - item_pos_reserved_qty - max_available_bundles = available_qty / item.qty + max_available_bundles = available_qty / item.stock_qty if bundle_bin_qty > max_available_bundles and frappe.get_value( "Item", item.item_code, "is_stock_item" ): From c66dc5658f6421719a1c1cea918dd31aea187773 Mon Sep 17 00:00:00 2001 From: Vishal Date: Thu, 23 Feb 2023 12:26:42 +0530 Subject: [PATCH 3/4] chore: minor change (cherry picked from commit a51bec02690120c55bd265bae23d34e113a652bd) --- erpnext/accounts/doctype/pos_invoice/pos_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py index 85d8efe2c49..64071597eab 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py @@ -246,7 +246,7 @@ class POSInvoice(SalesInvoice): ), title=_("Item Unavailable"), ) - elif is_stock_item and flt(available_stock) < flt(d.qty * d.conversion_factor): + elif is_stock_item and flt(available_stock) < flt(d.stock_qty): frappe.throw( _( "Row #{}: Stock quantity not enough for Item Code: {} under warehouse {}. Available quantity {}." From fd1d2cd203a758890aeb5c95f8bc66ca4e41c174 Mon Sep 17 00:00:00 2001 From: Vishal Date: Tue, 28 Feb 2023 11:01:54 +0530 Subject: [PATCH 4/4] chore: minor changes in pos_controller (cherry picked from commit f18ae5856f0bd8594dd7141b2b85b7ab6a02497b) --- erpnext/selling/page/point_of_sale/pos_controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/page/point_of_sale/pos_controller.js b/erpnext/selling/page/point_of_sale/pos_controller.js index 77d8fd8f403..da798ab6d2d 100644 --- a/erpnext/selling/page/point_of_sale/pos_controller.js +++ b/erpnext/selling/page/point_of_sale/pos_controller.js @@ -522,7 +522,7 @@ erpnext.PointOfSale.Controller = class { const from_selector = field === 'qty' && value === "+1"; if (from_selector) - value = flt(item_row.qty * item_row.conversion_factor) + flt(value); + value = flt(item_row.stock_qty) + flt(value); if (item_row_exists) { if (field === 'qty')