From 2769ed9bdbe3c0783a0b085b0414d8eae67deefd Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Mon, 18 Dec 2023 16:18:42 +0530 Subject: [PATCH] chore: fix test case --- .../serial_and_batch_bundle/serial_and_batch_bundle.py | 2 +- .../subcontracting_receipt/test_subcontracting_receipt.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py index 52ef26e641a2..37916e21c892 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py @@ -459,7 +459,7 @@ def validate_quantity(self, row, qty_field=None): qty_field = "qty" precision = row.precision - if self.voucher_type in ["Subcontracting Receipt"]: + if row.get("doctype") in ["Subcontracting Receipt Supplied Item"]: qty_field = "consumed_qty" if abs(abs(flt(self.total_qty, precision)) - abs(flt(row.get(qty_field), precision))) > 0.01: diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py index a4188407d801..9d7be36adbcc 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py +++ b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py @@ -1014,7 +1014,9 @@ def test_subcontracting_receipt_cancel_with_batch(self): "item_code": fg_item, "warehouse": sco.items[0].warehouse, "has_batch_no": 1, - "entries": [{"batch_no": batch_doc.name, "qty": sco.items[0].qty}], + "type_of_transaction": "Inward", + "voucher_type": "Subcontracting Receipt", + "entries": [{"batch_no": batch_doc.name, "qty": 100}], } ).insert(ignore_permissions=True)