From b5cefa92fa42eca1ad137aedeaaff5ac6cd485b4 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 6 Jun 2014 11:17:00 +0530 Subject: [PATCH 1/2] Improved Fiscal Year validation messages --- erpnext/accounts/doctype/fiscal_year/fiscal_year.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py index 0a7a98565ac..cb365813020 100644 --- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py +++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py @@ -25,15 +25,15 @@ class FiscalYear(Document): 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 @@ class FiscalYear(Document): 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)) From 171c00cfd6ca3fc688fe6137ed3f426e6ae07715 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 6 Jun 2014 15:09:26 +0530 Subject: [PATCH 2/2] Reload permissions for master and setting documents --- .../leave_application/leave_application.json | 18 ++++++++++++++-- erpnext/patches.txt | 3 +++ .../v4_0/reset_permissions_for_masters.py | 21 +++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 erpnext/patches/v4_0/reset_permissions_for_masters.py diff --git a/erpnext/hr/doctype/leave_application/leave_application.json b/erpnext/hr/doctype/leave_application/leave_application.json index 7a7e1295261..beda3de7c17 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": [ @@ -200,6 +200,20 @@ "role": "Employee", "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, diff --git a/erpnext/patches.txt b/erpnext/patches.txt index f68af6a0018..1ff3136bb79 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -47,3 +47,6 @@ erpnext.patches.v4_0.update_account_root_type 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 00000000000..fdafb870112 --- /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