fix: bugs

(cherry picked from commit 19ae405742)
This commit is contained in:
Mihir Kandoi
2026-01-16 13:15:22 +05:30
committed by Mergify
parent f04221417e
commit accce1fe59
2 changed files with 12 additions and 12 deletions

View File

@@ -3449,19 +3449,19 @@ def move_sample_to_retention_warehouse(company, items):
sabe = next(item for item in sabb.entries if item.batch_no == batch_no)
if sample_quantity:
total_qty += sample_quantity
if sabb.has_serial_no:
sabe_list.extend(
[
entry
for entry in sabb.entries
if entry.batch_no == batch_no
and frappe.db.exists(
"Serial No", {"name": entry.serial_no, "warehouse": warehouse}
)
][: int(sample_quantity)]
)
new_sabe = [
entry
for entry in sabb.entries
if entry.batch_no == batch_no
and frappe.db.exists(
"Serial No", {"name": entry.serial_no, "warehouse": warehouse}
)
][: int(sample_quantity)]
sabe_list.extend(new_sabe)
total_qty += len(new_sabe)
else:
total_qty += sample_quantity
sabe.qty = sample_quantity
else:
sabb.entries.remove(sabe)

View File

@@ -2291,7 +2291,7 @@ class TestStockEntry(IntegrationTestCase):
"retain_sample": 1,
"sample_quantity": 2,
"has_batch_no": 1,
"has_seral_no": 1,
"has_serial_no": 1,
"create_new_batch": 1,
"batch_number_series": "SAMPLE-RET-.#####",
"serial_no_series": "SAMPLE-RET-SN-.#####",