mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-17 03:42:38 +00:00
fix: fiscal year check on validation (#55930)
(cherry picked from commit 380b005659)
# Conflicts:
# erpnext/controllers/accounts_controller.py
Co-authored-by: Jatin3128 <140256508+Jatin3128@users.noreply.github.com>
This commit is contained in:
@@ -51,12 +51,11 @@ from erpnext.accounts.utils import (
|
||||
create_gain_loss_journal,
|
||||
get_account_currency,
|
||||
get_currency_precision,
|
||||
get_fiscal_year,
|
||||
get_fiscal_years,
|
||||
validate_fiscal_year,
|
||||
)
|
||||
from erpnext.accounts.utils import (
|
||||
get_advance_payment_doctypes as _get_advance_payment_doctypes,
|
||||
)
|
||||
from erpnext.accounts.utils import get_advance_payment_doctypes as _get_advance_payment_doctypes
|
||||
from erpnext.buying.utils import update_last_purchase_rate
|
||||
from erpnext.controllers.print_settings import (
|
||||
set_print_templates_for_item_table,
|
||||
@@ -749,21 +748,29 @@ class AccountsController(TransactionBase):
|
||||
self.calculate_contribution()
|
||||
|
||||
def validate_date_with_fiscal_year(self):
|
||||
if self.meta.get_field("fiscal_year"):
|
||||
date_field = None
|
||||
if self.meta.get_field("posting_date"):
|
||||
date_field = "posting_date"
|
||||
elif self.meta.get_field("transaction_date"):
|
||||
date_field = "transaction_date"
|
||||
date_field = None
|
||||
if self.meta.get_field("posting_date"):
|
||||
date_field = "posting_date"
|
||||
elif self.meta.get_field("transaction_date"):
|
||||
date_field = "transaction_date"
|
||||
|
||||
if date_field and self.get(date_field):
|
||||
validate_fiscal_year(
|
||||
self.get(date_field),
|
||||
self.fiscal_year,
|
||||
self.company,
|
||||
self.meta.get_label(date_field),
|
||||
self,
|
||||
)
|
||||
if not date_field or not self.get(date_field):
|
||||
return
|
||||
|
||||
if self.meta.get_field("fiscal_year"):
|
||||
validate_fiscal_year(
|
||||
self.get(date_field),
|
||||
self.fiscal_year,
|
||||
self.company,
|
||||
self.meta.get_label(date_field),
|
||||
self,
|
||||
)
|
||||
else:
|
||||
get_fiscal_year(
|
||||
self.get(date_field),
|
||||
company=self.company,
|
||||
label=self.meta.get_label(date_field),
|
||||
)
|
||||
|
||||
def validate_party_accounts(self):
|
||||
if self.doctype not in ("Sales Invoice", "Purchase Invoice"):
|
||||
|
||||
Reference in New Issue
Block a user