fix: stock adjustment entry to make stock balance zero (#48245)
This commit is contained in:
@@ -175,6 +175,9 @@ class StockLedgerEntry(Document):
|
||||
if frappe.in_test and frappe.flags.ignore_serial_batch_bundle_validation:
|
||||
return
|
||||
|
||||
if self.is_adjustment_entry:
|
||||
return
|
||||
|
||||
if not self.get("via_landed_cost_voucher"):
|
||||
SerialBatchBundle(
|
||||
sle=self,
|
||||
|
||||
@@ -479,6 +479,8 @@ class StockReconciliation(StockController):
|
||||
frappe.db.set_value("Serial and Batch Entry", batch.name, update_values)
|
||||
|
||||
def remove_items_with_no_change(self):
|
||||
from erpnext.stock.stock_ledger import get_stock_value_difference
|
||||
|
||||
"""Remove items if qty or rate is not changed"""
|
||||
self.difference_amount = 0.0
|
||||
|
||||
@@ -514,6 +516,14 @@ class StockReconciliation(StockController):
|
||||
company=self.company,
|
||||
)
|
||||
|
||||
if not item_dict.get("qty") and not item.qty and not item.valuation_rate and not item.current_qty:
|
||||
difference_amount = get_stock_value_difference(
|
||||
item.item_code, item.warehouse, self.posting_date, self.posting_time, self.name
|
||||
)
|
||||
|
||||
if abs(difference_amount) > 0:
|
||||
return True
|
||||
|
||||
if (
|
||||
(item.qty is None or item.qty == item_dict.get("qty"))
|
||||
and (item.valuation_rate is None or item.valuation_rate == item_dict.get("rate"))
|
||||
|
||||
Reference in New Issue
Block a user