Skip to content

Commit

Permalink
fix: serial no with zero quantity issue in stock reco
Browse files Browse the repository at this point in the history
(cherry picked from commit 17131e5)
  • Loading branch information
rohitwaghchaure authored and mergify[bot] committed Mar 30, 2023
1 parent ab06cb4 commit 46638b1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


import frappe
from frappe import _, msgprint
from frappe import _, bold, msgprint
from frappe.utils import cint, cstr, flt

import erpnext
Expand Down Expand Up @@ -88,7 +88,7 @@ def _changed(item):

if item_dict.get("serial_nos"):
item.current_serial_no = item_dict.get("serial_nos")
if self.purpose == "Stock Reconciliation" and not item.serial_no:
if self.purpose == "Stock Reconciliation" and not item.serial_no and item.qty:
item.serial_no = item.current_serial_no

item.current_qty = item_dict.get("qty")
Expand Down Expand Up @@ -139,6 +139,14 @@ def _get_msg(row_num, msg):

self.validate_item(row.item_code, row)

if row.serial_no and not row.qty:
self.validation_messages.append(
_get_msg(
row_num,
f"Quantity should not be zero for the {bold(row.item_code)} since serial nos are specified",
)
)

# validate warehouse
if not frappe.db.get_value("Warehouse", row.warehouse):
self.validation_messages.append(_get_msg(row_num, _("Warehouse not found in the system")))
Expand Down

0 comments on commit 46638b1

Please sign in to comment.