mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-13 17:53:49 +00:00
fix: not able to make purchase return for serial nos
This commit is contained in:
@@ -580,6 +580,14 @@ def make_return_doc(doctype: str, source_name: str, target_doc=None, return_agai
|
||||
):
|
||||
target_doc.set("use_serial_batch_fields", 1)
|
||||
|
||||
if (
|
||||
not source_doc.serial_no
|
||||
and not source_doc.batch_no
|
||||
and source_doc.serial_and_batch_bundle
|
||||
and source_doc.use_serial_batch_fields
|
||||
):
|
||||
target_doc.set("use_serial_batch_fields", 0)
|
||||
|
||||
if source_doc.item_code and target_doc.get("use_serial_batch_fields"):
|
||||
item_details = frappe.get_cached_value(
|
||||
"Item", source_doc.item_code, ["has_batch_no", "has_serial_no"], as_dict=1
|
||||
|
||||
@@ -4093,6 +4093,7 @@ class TestPurchaseReceipt(IntegrationTestCase):
|
||||
sn_return.items[0].qty = -1
|
||||
sn_return.items[0].received_qty = -1
|
||||
sn_return.items[0].serial_no = pr1_serial_nos[0]
|
||||
sn_return.items[0].use_serial_batch_fields = 1
|
||||
sn_return.save()
|
||||
self.assertRaises(frappe.ValidationError, sn_return.submit)
|
||||
|
||||
@@ -4127,6 +4128,7 @@ class TestPurchaseReceipt(IntegrationTestCase):
|
||||
batch_return.items[0].qty = -1
|
||||
batch_return.items[0].received_qty = -1
|
||||
batch_return.items[0].batch_no = batch_no
|
||||
batch_return.items[0].use_serial_batch_fields = 1
|
||||
batch_return.save()
|
||||
self.assertRaises(frappe.ValidationError, batch_return.submit)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user