frappe/frappe#478 erpnext install works

This commit is contained in:
Rushabh Mehta 2014-04-02 18:09:37 +05:30
parent 8bb11e01be
commit 0efb2e4da2
4 changed files with 9 additions and 4 deletions

View file

@ -11,7 +11,6 @@ from frappe.model.document import Document
class OutgoingEmailSettings(Document):
def validate(self):
self.encode()
if self.mail_server:
from frappe.utils import cint
from frappe.utils.email_lib.smtp import SMTPServer

View file

@ -20,7 +20,7 @@ class PropertySetter(Document):
doctype_or_field = %(doctype_or_field)s
and doc_type = %(doc_type)s
and ifnull(field_name,'') = ifnull(%(field_name)s, '')
and property = %(property)s""", self.fields)
and property = %(property)s""", self.get_valid_dict())
# clear cache
frappe.clear_cache(doctype = self.doc_type)

View file

@ -324,9 +324,12 @@ class Document(BaseDocument):
frappe.throw("{}: {}".format(_("Could not find the following documents"), msg),
frappe.LinkValidationError)
def get_all_children(self):
def get_all_children(self, parenttype=None):
ret = []
for df in self.meta.get("fields", {"fieldtype": "Table"}):
if parenttype:
if df.options==parenttype:
return self.get(df.fieldname)
value = self.get(df.fieldname)
if isinstance(value, list):
ret.extend(value)

View file

@ -217,7 +217,10 @@ def get_datetime(datetime_str):
if isinstance(datetime_str, datetime):
return datetime_str.replace(tzinfo=None)
return datetime.strptime(datetime_str, '%Y-%m-%d %H:%M:%S.%f')
try:
return datetime.strptime(datetime_str, '%Y-%m-%d %H:%M:%S.%f')
except ValueError:
return datetime.strptime(datetime_str, '%Y-%m-%d %H:%M:%S')
def get_datetime_str(datetime_obj):
if isinstance(datetime_obj, basestring):