Merge pull request #1761 from anandpdoshi/hotfix
Improved FIscal Year Error Messages, Reset Permissions for some DocTypes
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
index 0a7a985..cb36581 100644
--- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
@@ -25,15 +25,15 @@
if year_start_end_dates:
if getdate(self.year_start_date) != year_start_end_dates[0][0] or getdate(self.year_end_date) != year_start_end_dates[0][1]:
- frappe.throw(_("Cannot change Year Start Date and Year End Date once the Fiscal Year is saved."))
+ frappe.throw(_("Cannot change Fiscal Year Start Date and Fiscal Year End Date once the Fiscal Year is saved."))
def on_update(self):
# validate year start date and year end date
if getdate(self.year_start_date) > getdate(self.year_end_date):
- frappe.throw(_("Year Start Date should not be greater than Year End Date"))
+ frappe.throw(_("Fiscal Year Start Date should not be greater than Fiscal Year End Date"))
if (getdate(self.year_end_date) - getdate(self.year_start_date)).days > 366:
- frappe.throw(_("Year Start Date and Year End Date are not within Fiscal Year."))
+ frappe.throw(_("Fiscal Year Start Date and Fiscal Year End Date cannot be more than a year apart."))
year_start_end_dates = frappe.db.sql("""select name, year_start_date, year_end_date
from `tabFiscal Year` where name!=%s""", (self.name))
@@ -41,4 +41,4 @@
for fiscal_year, ysd, yed in year_start_end_dates:
if (getdate(self.year_start_date) == ysd and getdate(self.year_end_date) == yed) \
and (not frappe.flags.in_test):
- frappe.throw(_("Year Start Date and Year End Date are already set in Fiscal Year {0}").format(fiscal_year))
+ frappe.throw(_("Fiscal Year Start Date and Fiscal Year End Date are already set in Fiscal Year {0}").format(fiscal_year))
diff --git a/erpnext/hr/doctype/leave_application/leave_application.json b/erpnext/hr/doctype/leave_application/leave_application.json
index 7a7e129..beda3de 100644
--- a/erpnext/hr/doctype/leave_application/leave_application.json
+++ b/erpnext/hr/doctype/leave_application/leave_application.json
@@ -182,9 +182,9 @@
"idx": 1,
"is_submittable": 1,
"max_attachments": 3,
- "modified": "2014-05-27 03:49:12.957706",
+ "modified": "2014-06-06 05:06:44.594229",
"modified_by": "Administrator",
- "module": "HR",
+ "module": "Hr",
"name": "Leave Application",
"owner": "Administrator",
"permissions": [
@@ -201,6 +201,20 @@
"write": 1
},
{
+ "amend": 1,
+ "cancel": 1,
+ "create": 1,
+ "email": 1,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "HR Manager",
+ "set_user_permissions": 1,
+ "submit": 1,
+ "write": 1
+ },
+ {
"amend": 0,
"cancel": 0,
"create": 0,
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index f68af6a..1ff3136 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -47,3 +47,6 @@
execute:frappe.delete_doc("Report", "Purchase In Transit")
erpnext.patches.v4_0.new_address_template
execute:frappe.delete_doc("DocType", "SMS Control")
+
+# WATCHOUT: This patch reload's documents
+erpnext.patches.v4_0.reset_permissions_for_masters
diff --git a/erpnext/patches/v4_0/reset_permissions_for_masters.py b/erpnext/patches/v4_0/reset_permissions_for_masters.py
new file mode 100644
index 0000000..fdafb87
--- /dev/null
+++ b/erpnext/patches/v4_0/reset_permissions_for_masters.py
@@ -0,0 +1,21 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ for doctype in ("About Us Settings", "Accounts Settings", "Activity Type",
+ "Blog Category", "Blog Settings", "Blogger", "Branch", "Brand", "Buying Settings",
+ "Comment", "Communication", "Company", "Contact Us Settings",
+ "Country", "Currency", "Currency Exchange", "Deduction Type", "Department",
+ "Designation", "Earning Type", "Event", "Feed", "File Data", "Fiscal Year",
+ "HR Settings", "Industry Type", "Jobs Email Settings", "Leave Type", "Letter Head",
+ "Mode of Payment", "Module Def", "Naming Series", "POS Setting", "Print Heading",
+ "Report", "Role", "Sales Email Settings", "Selling Settings", "Shopping Cart Settings",
+ "Stock Settings", "Supplier Type", "UOM"):
+ try:
+ frappe.reset_perms(doctype)
+ except:
+ print "Error resetting perms for", doctype
+ raise