[fix] Non Profit Domain clean up after review

This commit is contained in:
Vishal 2017-11-24 13:14:23 +05:30
parent a68234d345
commit fe0c6c8e28
6 changed files with 25 additions and 23 deletions

View File

@ -189,7 +189,7 @@
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@ -297,7 +297,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-11-20 17:41:43.021123",
"modified": "2017-11-23 17:31:44.669507",
"modified_by": "Administrator",
"module": "Non Profit",
"name": "Chapter",

View File

@ -5,8 +5,19 @@
from __future__ import unicode_literals
import frappe
from frappe.website.website_generator import WebsiteGenerator
from frappe.model.document import Document
from frappe import _
class Chapter(WebsiteGenerator):
def get_context(self, context):
context.no_cache = True
def validate(self):
chapter_head = self.chapter_head
chapter = frappe.get_all('Chapter', filters={'published': True}, fields=['chapter_head'])
if not self.route: #pylint: disable=E0203
self.route = 'chapter/' + self.scrub(self.name)
def enable(self):
chapter = frappe.get_doc('Chapter', frappe.form_dict.name)
chapter.append('members', dict(enable=self.value))

View File

@ -114,7 +114,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-11-20 17:43:02.485914",
"modified": "2017-11-24 12:30:33.976935",
"modified_by": "Administrator",
"module": "Non Profit",
"name": "Chapter Message",
@ -149,6 +149,7 @@
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "subject",
"track_changes": 1,
"track_seen": 0
}

View File

@ -11,30 +11,20 @@ class ChapterMessage(Document):
def validate(self):
chapter = frappe.get_doc('Chapter', self.chapter)
if frappe.session.user != chapter.chapter_head:
frappe.throw(_('You are not athourize to send message for this Chapter.'))
frappe.throw(_('You are not athourized to send message for this Chapter.'))
def on_update(self):
chapter = frappe.get_doc('Chapter', self.chapter)
recipients = [d.user for d in chapter.members]
message = self.message
message += "Chapter Title: " + self.chapter
# chapter_title = self.chapter
frappe.sendmail(recipients = recipients,
sender=frappe.session.user,
subject = self.subject,
message = self.message,
subject = self.subject)
# reference_doctype=self.doctype, reference_name=self.name)
reference_doctype=chapter.doctype,
reference_name=chapter.name
)
def get_members_emails(chapterTitle):
frappe.msgprint(_("Invitation Sent"))
members_list = frappe.get_all('User', fields=['email'],
filters={'chapter.title': chapterTitle})
out = []
for e in members_list:
if e.email:
# don't add if holiday
out.append(e.email)
print out
return out

View File

@ -237,7 +237,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-11-20 17:42:50.809691",
"modified": "2017-11-24 13:12:13.481086",
"modified_by": "Administrator",
"module": "Non Profit",
"name": "Membership",
@ -265,7 +265,7 @@
"write": 1
}
],
"quick_entry": 1,
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"restrict_to_domain": "Non Profit",

View File

@ -18,7 +18,7 @@
"is_standard": 1,
"login_required": 1,
"max_attachment_size": 0,
"modified": "2017-10-31 13:25:40.670895",
"modified": "2017-11-23 17:16:30.181215",
"modified_by": "Administrator",
"module": "Non Profit",
"name": "grant-application",