Merge pull request #5098 from nabinhait/multi_fix6

Multi fixes
This commit is contained in:
Rushabh Mehta 2016-03-31 12:25:20 +05:30
commit 8497784c4c
2 changed files with 4 additions and 5 deletions

View File

@ -189,9 +189,6 @@ class Account(Document):
def validate_trash(self):
"""checks gl entries and if child exists"""
if not self.parent_account:
throw(_("Root account can not be deleted"))
if self.check_gle_exists():
throw(_("Account with existing transaction can not be deleted"))
if self.check_if_child_exists():

View File

@ -13,12 +13,14 @@ class NewsletterList(Document):
def onload(self):
singles = [d.name for d in frappe.db.get_all("DocType", "name", {"issingle": 1})]
self.get("__onload").import_types = [{"value": d.parent, "label": "{0} ({1})".format(d.parent, d.label)} \
for d in frappe.db.get_all("DocField", ("parent", "label"), {"options": "Email"}) if d.parent not in singles]
for d in frappe.db.get_all("DocField", ("parent", "label"), {"options": "Email"})
if d.parent not in singles]
def import_from(self, doctype):
"""Extract email ids from given doctype and add them to the current list"""
meta = frappe.get_meta(doctype)
email_field = [d.fieldname for d in meta.fields if d.fieldtype in ("Data", "Small Text") and d.options=="Email"][0]
email_field = [d.fieldname for d in meta.fields
if d.fieldtype in ("Data", "Small Text", "Text", "Code") and d.options=="Email"][0]
unsubscribed_field = "unsubscribed" if meta.get_field("unsubscribed") else None
added = 0