fix: update validation and test cases

This commit is contained in:
Khushi Rawat
2025-06-18 01:04:51 +05:30
committed by khushi8112
parent cd540ab4cc
commit 6da10b9f97
5 changed files with 105 additions and 19 deletions

View File

@@ -19,6 +19,7 @@ from erpnext.accounts.doctype.financial_report_template.financial_report_templat
sync_financial_report_templates,
)
from erpnext.setup.setup_wizard.operations.taxes_setup import setup_taxes_and_charges
from erpnext.stock.utils import check_pending_reposting
class Company(NestedSet):
@@ -153,6 +154,7 @@ class Company(NestedSet):
return exists
def validate(self):
old_doc = self.get_doc_before_save()
self.update_default_account = False
if self.is_new():
self.update_default_account = True
@@ -171,6 +173,7 @@ class Company(NestedSet):
self.set_reporting_currency()
self.validate_inventory_account_settings()
self.cant_change_valuation_method()
self.validate_pending_reposts(old_doc)
def cant_change_valuation_method(self):
doc_before_save = self.get_doc_before_save()
@@ -599,6 +602,11 @@ class Company(NestedSet):
)
self.reporting_currency = parent_reporting_currency
def validate_pending_reposts(self, old_doc):
if old_doc.accounts_frozen_till_date != self.accounts_frozen_till_date:
if self.accounts_frozen_till_date:
check_pending_reposting(self.accounts_frozen_till_date)
def set_default_accounts(self):
default_accounts = {
"default_cash_account": "Cash",