Merge pull request #1761 from anandpdoshi/hotfix
Improved FIscal Year Error Messages, Reset Permissions for some DocTypes
This commit is contained in:
commit
0b31a163a3
@ -25,15 +25,15 @@ class FiscalYear(Document):
|
|||||||
|
|
||||||
if year_start_end_dates:
|
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]:
|
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):
|
def on_update(self):
|
||||||
# validate year start date and year end date
|
# validate year start date and year end date
|
||||||
if getdate(self.year_start_date) > getdate(self.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:
|
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
|
year_start_end_dates = frappe.db.sql("""select name, year_start_date, year_end_date
|
||||||
from `tabFiscal Year` where name!=%s""", (self.name))
|
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:
|
for fiscal_year, ysd, yed in year_start_end_dates:
|
||||||
if (getdate(self.year_start_date) == ysd and getdate(self.year_end_date) == yed) \
|
if (getdate(self.year_start_date) == ysd and getdate(self.year_end_date) == yed) \
|
||||||
and (not frappe.flags.in_test):
|
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))
|
||||||
|
|||||||
@ -182,9 +182,9 @@
|
|||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"max_attachments": 3,
|
"max_attachments": 3,
|
||||||
"modified": "2014-05-27 03:49:12.957706",
|
"modified": "2014-06-06 05:06:44.594229",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "Hr",
|
||||||
"name": "Leave Application",
|
"name": "Leave Application",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
@ -200,6 +200,20 @@
|
|||||||
"role": "Employee",
|
"role": "Employee",
|
||||||
"write": 1
|
"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,
|
"amend": 0,
|
||||||
"cancel": 0,
|
"cancel": 0,
|
||||||
|
|||||||
@ -47,3 +47,6 @@ erpnext.patches.v4_0.update_account_root_type
|
|||||||
execute:frappe.delete_doc("Report", "Purchase In Transit")
|
execute:frappe.delete_doc("Report", "Purchase In Transit")
|
||||||
erpnext.patches.v4_0.new_address_template
|
erpnext.patches.v4_0.new_address_template
|
||||||
execute:frappe.delete_doc("DocType", "SMS Control")
|
execute:frappe.delete_doc("DocType", "SMS Control")
|
||||||
|
|
||||||
|
# WATCHOUT: This patch reload's documents
|
||||||
|
erpnext.patches.v4_0.reset_permissions_for_masters
|
||||||
|
|||||||
21
erpnext/patches/v4_0/reset_permissions_for_masters.py
Normal file
21
erpnext/patches/v4_0/reset_permissions_for_masters.py
Normal file
@ -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
|
||||||
Loading…
x
Reference in New Issue
Block a user