Merge pull request #34648 from rohitwaghchaure/fixed-serial-no-qty-issue-in-stock-reco
fix: serial no with zero quantity issue in stock reco
This commit is contained in:
commit
448afa2b7c
@ -4,7 +4,7 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _, msgprint
|
from frappe import _, bold, msgprint
|
||||||
from frappe.utils import cint, cstr, flt
|
from frappe.utils import cint, cstr, flt
|
||||||
|
|
||||||
import erpnext
|
import erpnext
|
||||||
@ -89,7 +89,7 @@ class StockReconciliation(StockController):
|
|||||||
|
|
||||||
if item_dict.get("serial_nos"):
|
if item_dict.get("serial_nos"):
|
||||||
item.current_serial_no = 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.serial_no = item.current_serial_no
|
||||||
|
|
||||||
item.current_qty = item_dict.get("qty")
|
item.current_qty = item_dict.get("qty")
|
||||||
@ -140,6 +140,14 @@ class StockReconciliation(StockController):
|
|||||||
|
|
||||||
self.validate_item(row.item_code, row)
|
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
|
# validate warehouse
|
||||||
if not frappe.db.get_value("Warehouse", row.warehouse):
|
if not frappe.db.get_value("Warehouse", row.warehouse):
|
||||||
self.validation_messages.append(_get_msg(row_num, _("Warehouse not found in the system")))
|
self.validation_messages.append(_get_msg(row_num, _("Warehouse not found in the system")))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user