From 0cf9469f86de4b90b1d55f5797d45850e421d92a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 19 May 2015 18:43:45 +0530 Subject: [PATCH 1/3] validate disabled fiscal year --- erpnext/accounts/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 1853fc9316..59e3e7c88a 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -29,14 +29,14 @@ def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verb or exists(select company from `tabFiscal Year Company` fyc where fyc.parent = fy.name and fyc.company=%(company)s ))""" fy = frappe.db.sql("""select fy.name, fy.year_start_date, fy.year_end_date from `tabFiscal Year` fy - where %s order by fy.year_start_date desc""" % cond, { + where %s and ifnull(disabled, 0) = 0 order by fy.year_start_date desc""" % cond, { "fiscal_year": fiscal_year, "transaction_date": transaction_date, "company": company }) if not fy: - error_msg = _("""{0} {1} not in any Fiscal Year. For more details check {2}.""").format(label, formatdate(transaction_date), "https://erpnext.com/kb/accounts/fiscal-year-error") + error_msg = _("""{0} {1} not in any active Fiscal Year. For more details check {2}.""").format(label, formatdate(transaction_date), "https://erpnext.com/kb/accounts/fiscal-year-error") if verbose==1: frappe.msgprint(error_msg) raise FiscalYearError, error_msg return fy From 8d50eb32c159d42261d004cd4c66772ace88465f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 20 May 2015 12:26:07 +0530 Subject: [PATCH 2/3] validate diabled fiscal year --- erpnext/accounts/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 59e3e7c88a..3ae36c18f9 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -18,18 +18,18 @@ def get_fiscal_year(date=None, fiscal_year=None, label="Date", verbose=1, compan def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verbose=1, company=None): # if year start date is 2012-04-01, year end date should be 2013-03-31 (hence subdate) - cond = "" + cond = " ifnull(disabled, 0) = 0" if fiscal_year: - cond = "fy.name = %(fiscal_year)s" + cond = " and fy.name = %(fiscal_year)s" else: - cond = "%(transaction_date)s >= fy.year_start_date and %(transaction_date)s <= fy.year_end_date" + cond = " and %(transaction_date)s >= fy.year_start_date and %(transaction_date)s <= fy.year_end_date" if company: cond += """ and (not exists(select name from `tabFiscal Year Company` fyc where fyc.parent = fy.name) or exists(select company from `tabFiscal Year Company` fyc where fyc.parent = fy.name and fyc.company=%(company)s ))""" fy = frappe.db.sql("""select fy.name, fy.year_start_date, fy.year_end_date from `tabFiscal Year` fy - where %s and ifnull(disabled, 0) = 0 order by fy.year_start_date desc""" % cond, { + where %s order by fy.year_start_date desc""" % cond, { "fiscal_year": fiscal_year, "transaction_date": transaction_date, "company": company From 8980ce6052a6f4bbb967d78c79985b34fbff1cb0 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Wed, 20 May 2015 12:57:47 +0600 Subject: [PATCH 3/3] bumped to version 5.0.4 --- erpnext/__version__.py | 2 +- erpnext/hooks.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/__version__.py b/erpnext/__version__.py index e78a8c3102..54d8de2063 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1,2 +1,2 @@ from __future__ import unicode_literals -__version__ = '5.0.3' +__version__ = '5.0.4' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index ae1bb5708d..483172aa74 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -5,7 +5,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd. and Contributors" app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations" app_icon = "icon-th" app_color = "#e74c3c" -app_version = "5.0.3" +app_version = "5.0.4" error_report_email = "support@erpnext.com" diff --git a/setup.py b/setup.py index 93f31f0b30..ad111d6dc8 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = "5.0.3" +version = "5.0.4" with open("requirements.txt", "r") as f: install_requires = f.readlines()