From 93d281837a030873a5c1f4774617f9cd098a494f Mon Sep 17 00:00:00 2001 From: khushi8112 Date: Thu, 26 Jun 2025 11:51:57 +0530 Subject: [PATCH] fix: validate pending reposting till acc frozen date --- erpnext/setup/doctype/company/company.py | 1 + erpnext/stock/utils.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 96fca9dd6bc..7cbde082b6a 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -162,6 +162,7 @@ class Company(NestedSet): self.check_parent_changed() self.set_chart_of_accounts() self.validate_parent_company() + self.set_reporting_currency() self.validate_pending_reposts(old_doc) def validate_abbr(self): diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py index bee190e13a1..3e39afec64d 100644 --- a/erpnext/stock/utils.py +++ b/erpnext/stock/utils.py @@ -556,7 +556,7 @@ def is_reposting_item_valuation_in_progress(): ) -def check_pending_reposting(posting_date: str, throw_error: bool = True) -> bool: +def check_pending_reposting(posting_date: str, company: str | None = None, throw_error: bool = True) -> bool: """Check if there are pending reposting job till the specified posting date.""" filters = { @@ -564,6 +564,8 @@ def check_pending_reposting(posting_date: str, throw_error: bool = True) -> bool "status": ["in", ["Queued", "In Progress"]], "posting_date": ["<=", posting_date], } + if company: + filters["company"] = company reposting_pending = frappe.db.exists("Repost Item Valuation", filters) if reposting_pending and throw_error: