diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index d17207a70a..eb09bdd962 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -18,10 +18,6 @@ from erpnext.stock import get_warehouse_account_map
from erpnext.stock.utils import get_stock_value_on
-class StockValueAndAccountBalanceOutOfSync(frappe.ValidationError):
- pass
-
-
class FiscalYearError(frappe.ValidationError):
pass
@@ -1246,47 +1242,6 @@ def compare_existing_and_expected_gle(existing_gle, expected_gle, precision):
return matched
-def check_if_stock_and_account_balance_synced(
- posting_date, company, voucher_type=None, voucher_no=None
-):
- if not cint(erpnext.is_perpetual_inventory_enabled(company)):
- return
-
- accounts = get_stock_accounts(company, voucher_type, voucher_no)
- stock_adjustment_account = frappe.db.get_value("Company", company, "stock_adjustment_account")
-
- for account in accounts:
- account_bal, stock_bal, warehouse_list = get_stock_and_account_balance(
- account, posting_date, company
- )
-
- if abs(account_bal - stock_bal) > 0.1:
- precision = get_field_precision(
- frappe.get_meta("GL Entry").get_field("debit"),
- currency=frappe.get_cached_value("Company", company, "default_currency"),
- )
-
- diff = flt(stock_bal - account_bal, precision)
-
- error_reason = _(
- "Stock Value ({0}) and Account Balance ({1}) are out of sync for account {2} and it's linked warehouses as on {3}."
- ).format(stock_bal, account_bal, frappe.bold(account), posting_date)
- error_resolution = _("Please create an adjustment Journal Entry for amount {0} on {1}").format(
- frappe.bold(diff), frappe.bold(posting_date)
- )
-
- frappe.msgprint(
- msg="""{0}
{1}
""".format(error_reason, error_resolution),
- raise_exception=StockValueAndAccountBalanceOutOfSync,
- title=_("Values Out Of Sync"),
- primary_action={
- "label": _("Make Journal Entry"),
- "client_action": "erpnext.route_to_adjustment_jv",
- "args": get_journal_entry(account, stock_adjustment_account, diff),
- },
- )
-
-
def get_stock_accounts(company, voucher_type=None, voucher_no=None):
stock_accounts = [
d.name
diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
index 54c00d1a21..c7d65c6bde 100644
--- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
+++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
@@ -4,15 +4,12 @@
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import cint, get_link_to_form, get_weekday, now, nowtime, today
+from frappe.utils import cint, get_link_to_form, get_weekday, now, nowtime
from frappe.utils.user import get_users_with_role
from rq.timeouts import JobTimeoutException
import erpnext
-from erpnext.accounts.utils import (
- check_if_stock_and_account_balance_synced,
- update_gl_entries_after,
-)
+from erpnext.accounts.utils import update_gl_entries_after
from erpnext.stock.stock_ledger import get_items_to_be_repost, repost_future_sle
@@ -224,6 +221,10 @@ def notify_error_to_stock_managers(doc, traceback):
def repost_entries():
+ """
+ Reposts 'Repost Item Valuation' entries in queue.
+ Called hourly via hooks.py.
+ """
if not in_configured_timeslot():
return
@@ -239,9 +240,6 @@ def repost_entries():
if riv_entries:
return
- for d in frappe.get_all("Company", filters={"enable_perpetual_inventory": 1}):
- check_if_stock_and_account_balance_synced(today(), d.name)
-
def get_repost_item_valuation_entries():
return frappe.db.sql(