diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py index 0a1678da9eb..9e446d84a21 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py +++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py @@ -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, diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 9b98307dec0..47fed1531ea 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -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"))