fix: serial / batch barcode scanner (backport #39114) (#39143)

fix: serial / batch barcode scanner (#39114)

(cherry picked from commit f09e2130a1)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
mergify[bot]
2024-01-04 16:02:29 +05:30
committed by GitHub
parent 7a5a4be02f
commit 2db1e1a737
6 changed files with 286 additions and 67 deletions

View File

@@ -591,6 +591,13 @@ def scan_barcode(search_value: str) -> BarcodeScanResult:
as_dict=True,
)
if batch_no_data:
if frappe.get_cached_value("Item", batch_no_data.item_code, "has_serial_no"):
frappe.throw(
_(
"Batch No {0} is linked with Item {1} which has serial no. Please scan serial no instead."
).format(search_value, batch_no_data.item_code)
)
_update_item_info(batch_no_data)
set_cache(batch_no_data)
return batch_no_data