diff --git a/erpnext/assets/doctype/asset_repair/test_asset_repair.py b/erpnext/assets/doctype/asset_repair/test_asset_repair.py index b3e09541e56fbfee6036767951e865011d3569a8..6d75871a3516f1a76fed06eef19a7c62aaec63b0 100644 --- a/erpnext/assets/doctype/asset_repair/test_asset_repair.py +++ b/erpnext/assets/doctype/asset_repair/test_asset_repair.py @@ -309,6 +309,7 @@ def create_asset_repair(**args): "serial_nos": args.serial_no, "posting_date": today(), "posting_time": nowtime(), + "do_not_submit": 1, } ) ).name diff --git a/erpnext/stock/doctype/batch/test_batch.py b/erpnext/stock/doctype/batch/test_batch.py index 7fb672c0cb1c09ed15cfefa875b2cf9f6f905a36..0be0a23c09a07bde706cdcbdf619977e3b40f5e6 100644 --- a/erpnext/stock/doctype/batch/test_batch.py +++ b/erpnext/stock/doctype/batch/test_batch.py @@ -86,6 +86,7 @@ class TestBatch(FrappeTestCase): "batches": frappe._dict({batch_no: 20}), "type_of_transaction": "Inward", "company": receipt.company, + "do_not_submit": 1, } ) .make_serial_and_batch_bundle() @@ -178,6 +179,7 @@ class TestBatch(FrappeTestCase): "batches": frappe._dict({batch_no: batch_qty}), "type_of_transaction": "Outward", "company": receipt.company, + "do_not_submit": 1, } ) .make_serial_and_batch_bundle() @@ -251,6 +253,7 @@ class TestBatch(FrappeTestCase): "batches": frappe._dict({batch_no: batch_qty}), "type_of_transaction": "Outward", "company": receipt.company, + "do_not_submit": 1, } ) .make_serial_and_batch_bundle() @@ -343,6 +346,7 @@ class TestBatch(FrappeTestCase): "batches": frappe._dict({batch_name: 90}), "type_of_transaction": "Inward", "company": "_Test Company", + "do_not_submit": 1, } ).make_serial_and_batch_bundle() diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index 574380df42382c20e401362884be3081aa0dfe35..fc2996da42c33bf0bfada338803bd099a7f23dbc 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -2973,6 +2973,7 @@ def make_purchase_receipt(**args): "serial_nos": serial_nos, "posting_date": args.posting_date or today(), "posting_time": args.posting_time, + "do_not_submit": 1, } ) ).name 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 b9e1b297f8cfe2ec08b336926dbbede4a14159b4..b14b08797040d2ae586a42ee659919b843c3c415 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 @@ -605,6 +605,11 @@ class SerialandBatchBundle(Document): serial_batches = {} for row in self.entries: + if not row.qty and row.batch_no and not row.serial_no: + frappe.throw( + _("At row {0}: Qty is mandatory for the batch {1}").format(bold(row.idx), bold(row.batch_no)) + ) + if self.has_serial_no and not row.serial_no: frappe.throw( _("At row {0}: Serial No is mandatory for Item {1}").format( @@ -837,7 +842,12 @@ class SerialandBatchBundle(Document): for batch in batches: frappe.db.set_value("Batch", batch.name, {"reference_name": None, "reference_doctype": None}) + def validate_serial_and_batch_data(self): + if not self.voucher_no: + frappe.throw(_("Voucher No is mandatory")) + def before_submit(self): + self.validate_serial_and_batch_data() self.validate_serial_and_batch_no_for_returned() self.set_purchase_document_no() diff --git a/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py index 7ac43c732d0356467fe123699378cf637802246c..148b91ddd8e9936652cbcee8808ef5df90c07439 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py +++ b/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py @@ -1507,7 +1507,7 @@ def create_delivery_note_entries_for_batchwise_item_valuation_test(dn_entry_list "posting_date": dn.posting_date, "posting_time": dn.posting_time, "voucher_type": "Delivery Note", - "do_not_submit": dn.name, + "do_not_submit": 1, } ) ).name diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py index bed578ebf7993a69c909d7aa2ee8ec233f4ef5cb..81fc2f886eec158d44b7cff2b3a89e19bd6be848 100644 --- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py @@ -1093,7 +1093,7 @@ def create_stock_reconciliation(**args): ) bundle_id = None - if not args.use_serial_batch_fields and (args.batch_no or args.serial_no): + if not args.use_serial_batch_fields and (args.batch_no or args.serial_no) and args.qty: batches = frappe._dict({}) if args.batch_no: batches[args.batch_no] = args.qty