multiple minor fixes (#5756)

This commit is contained in:
Nabin Hait 2018-07-01 16:40:18 +05:30 committed by GitHub
parent c4fac7a09c
commit 8d0b3e1828
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 9 deletions

View file

@ -17,7 +17,7 @@ class UserPermission(Document):
'name': ['!=', self.name]
}, limit=1)
if duplicate_exists:
frappe.msgprint(_("User permission already exists"), raise_exception=True)
frappe.throw(_("User permission already exists"), frappe.DuplicateEntryError)
def on_update(self):
frappe.cache().delete_value('user_permissions')

View file

@ -339,11 +339,12 @@ def get_messages_from_doctype(name):
messages = [('DocType: ' + name, message) for message in messages if is_translatable(message)]
# extract from js, py files
doctype_file_path = frappe.get_module_path(meta.module, "doctype", meta.name, meta.name)
messages.extend(get_messages_from_file(doctype_file_path + ".js"))
messages.extend(get_messages_from_file(doctype_file_path + "_list.js"))
messages.extend(get_messages_from_file(doctype_file_path + "_list.html"))
messages.extend(get_messages_from_file(doctype_file_path + "_calendar.js"))
if not meta.custom:
doctype_file_path = frappe.get_module_path(meta.module, "doctype", meta.name, meta.name)
messages.extend(get_messages_from_file(doctype_file_path + ".js"))
messages.extend(get_messages_from_file(doctype_file_path + "_list.js"))
messages.extend(get_messages_from_file(doctype_file_path + "_list.html"))
messages.extend(get_messages_from_file(doctype_file_path + "_calendar.js"))
# workflow based on doctype
messages.extend(get_messages_from_workflow(doctype=name))

View file

@ -82,9 +82,10 @@ def get_monthly_goal_graph_data(title, doctype, docname, goal_value_field, goal_
values = []
values_formatted = []
for i in range(0, 12):
month_value = formatdate(add_months(today(), -i), "MM-yyyy")
month_word = getdate(month_value).strftime('%b')
month_year = getdate(month_value).strftime('%B') + ', ' + getdate(month_value).strftime('%Y')
date_value = add_months(today(), -i)
month_value = formatdate(date_value, "MM-yyyy")
month_word = getdate(date_value).strftime('%b')
month_year = getdate(date_value).strftime('%B') + ', ' + getdate(date_value).strftime('%Y')
months.insert(0, month_word)
months_formatted.insert(0, month_year)
if month_value in month_to_value_dict: