mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-28 02:58:30 +00:00
fix: validation for zero qty in SABB
(cherry picked from commit 497f560b4b)
This commit is contained in:
committed by
Mergify
parent
a1fb289290
commit
85796b3534
@@ -305,6 +305,7 @@ def create_asset_repair(**args):
|
|||||||
"serial_nos": args.serial_no,
|
"serial_nos": args.serial_no,
|
||||||
"posting_date": today(),
|
"posting_date": today(),
|
||||||
"posting_time": nowtime(),
|
"posting_time": nowtime(),
|
||||||
|
"do_not_submit": 1,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
).name
|
).name
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ class TestBatch(FrappeTestCase):
|
|||||||
"batches": frappe._dict({batch_no: 20}),
|
"batches": frappe._dict({batch_no: 20}),
|
||||||
"type_of_transaction": "Inward",
|
"type_of_transaction": "Inward",
|
||||||
"company": receipt.company,
|
"company": receipt.company,
|
||||||
|
"do_not_submit": 1,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.make_serial_and_batch_bundle()
|
.make_serial_and_batch_bundle()
|
||||||
@@ -176,6 +177,7 @@ class TestBatch(FrappeTestCase):
|
|||||||
"batches": frappe._dict({batch_no: batch_qty}),
|
"batches": frappe._dict({batch_no: batch_qty}),
|
||||||
"type_of_transaction": "Outward",
|
"type_of_transaction": "Outward",
|
||||||
"company": receipt.company,
|
"company": receipt.company,
|
||||||
|
"do_not_submit": 1,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.make_serial_and_batch_bundle()
|
.make_serial_and_batch_bundle()
|
||||||
@@ -249,6 +251,7 @@ class TestBatch(FrappeTestCase):
|
|||||||
"batches": frappe._dict({batch_no: batch_qty}),
|
"batches": frappe._dict({batch_no: batch_qty}),
|
||||||
"type_of_transaction": "Outward",
|
"type_of_transaction": "Outward",
|
||||||
"company": receipt.company,
|
"company": receipt.company,
|
||||||
|
"do_not_submit": 1,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.make_serial_and_batch_bundle()
|
.make_serial_and_batch_bundle()
|
||||||
@@ -341,6 +344,7 @@ class TestBatch(FrappeTestCase):
|
|||||||
"batches": frappe._dict({batch_name: 90}),
|
"batches": frappe._dict({batch_name: 90}),
|
||||||
"type_of_transaction": "Inward",
|
"type_of_transaction": "Inward",
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
|
"do_not_submit": 1,
|
||||||
}
|
}
|
||||||
).make_serial_and_batch_bundle()
|
).make_serial_and_batch_bundle()
|
||||||
|
|
||||||
|
|||||||
@@ -2968,6 +2968,7 @@ def make_purchase_receipt(**args):
|
|||||||
"serial_nos": serial_nos,
|
"serial_nos": serial_nos,
|
||||||
"posting_date": args.posting_date or today(),
|
"posting_date": args.posting_date or today(),
|
||||||
"posting_time": args.posting_time,
|
"posting_time": args.posting_time,
|
||||||
|
"do_not_submit": 1,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
).name
|
).name
|
||||||
|
|||||||
@@ -596,6 +596,13 @@ class SerialandBatchBundle(Document):
|
|||||||
|
|
||||||
serial_batches = {}
|
serial_batches = {}
|
||||||
for row in self.entries:
|
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:
|
if self.has_serial_no and not row.serial_no:
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_("At row {0}: Serial No is mandatory for Item {1}").format(
|
_("At row {0}: Serial No is mandatory for Item {1}").format(
|
||||||
@@ -831,7 +838,12 @@ class SerialandBatchBundle(Document):
|
|||||||
for batch in batches:
|
for batch in batches:
|
||||||
frappe.db.set_value("Batch", batch.name, {"reference_name": None, "reference_doctype": None})
|
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):
|
def before_submit(self):
|
||||||
|
self.validate_serial_and_batch_data()
|
||||||
self.validate_serial_and_batch_no_for_returned()
|
self.validate_serial_and_batch_no_for_returned()
|
||||||
self.set_purchase_document_no()
|
self.set_purchase_document_no()
|
||||||
|
|
||||||
|
|||||||
@@ -1483,7 +1483,7 @@ def create_delivery_note_entries_for_batchwise_item_valuation_test(dn_entry_list
|
|||||||
"posting_date": dn.posting_date,
|
"posting_date": dn.posting_date,
|
||||||
"posting_time": dn.posting_time,
|
"posting_time": dn.posting_time,
|
||||||
"voucher_type": "Delivery Note",
|
"voucher_type": "Delivery Note",
|
||||||
"do_not_submit": dn.name,
|
"do_not_submit": 1,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
).name
|
).name
|
||||||
|
|||||||
@@ -1085,7 +1085,7 @@ def create_stock_reconciliation(**args):
|
|||||||
)
|
)
|
||||||
|
|
||||||
bundle_id = None
|
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({})
|
batches = frappe._dict({})
|
||||||
if args.batch_no:
|
if args.batch_no:
|
||||||
batches[args.batch_no] = args.qty
|
batches[args.batch_no] = args.qty
|
||||||
|
|||||||
Reference in New Issue
Block a user