Skip to content

Commit

Permalink
fix: serial no is mandatory for zero qty validation
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitwaghchaure committed Feb 15, 2025
1 parent c65f421 commit 6f6133f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ frappe.ui.form.on("Stock Reconciliation Item", {

qty: function (frm, cdt, cdn) {
frm.events.set_amount_quantity(frm, cdt, cdn);

let row = locals[cdt][cdn];
if (!row.qty) {
frappe.model.set_value(cdt, cdn, "serial_no", "");
}
},

valuation_rate: function (frm, cdt, cdn) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def validate_item(self, item_code, row):
validate_is_stock_item(item_code, item.is_stock_item)

# item should not be serialized
if item.has_serial_no and not row.serial_no and not item.serial_no_series:
if item.has_serial_no and row.qty and not row.serial_no and not item.serial_no_series:
raise frappe.ValidationError(
_("Serial no(s) required for serialized item {0}").format(item_code)
)
Expand Down

0 comments on commit 6f6133f

Please sign in to comment.