fix: incorrect batch return from sales return

(cherry picked from commit 317047c808)
This commit is contained in:
Rohit Waghchaure
2024-06-17 10:15:54 +05:30
committed by Mergify
parent 69de359728
commit b64b4330a3
2 changed files with 107 additions and 0 deletions

View File

@@ -883,6 +883,9 @@ def get_serial_batches_based_on_bundle(field, _bundle_ids):
if frappe.get_cached_value(row.voucher_type, row.voucher_no, "is_return"):
key = frappe.get_cached_value(row.voucher_type + " Item", row.voucher_detail_no, field)
if row.voucher_type in ["Sales Invoice", "Delivery Note"]:
row.qty = -1 * row.qty
if key not in available_dict:
available_dict[key] = frappe._dict(
{"qty": 0.0, "serial_nos": defaultdict(float), "batches": defaultdict(float)}