get label from doctype's doclist
This commit is contained in:
parent
7075d36532
commit
61c60c5e52
2 changed files with 16 additions and 5 deletions
|
|
@ -111,8 +111,17 @@ class Document:
|
|||
def __str__(self):
|
||||
return str(self.fields)
|
||||
|
||||
def __repr__(self):
|
||||
return repr(self.fields)
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.fields)
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.fields == other.fields
|
||||
if isinstance(other, Document):
|
||||
return self.fields == other.fields
|
||||
else:
|
||||
return False
|
||||
|
||||
def __getstate__(self):
|
||||
return self.fields
|
||||
|
|
|
|||
|
|
@ -72,7 +72,9 @@ def get_table_fields(doctype):
|
|||
|
||||
return child_tables + custom_child_tables
|
||||
|
||||
def has_field(doctype, fieldname):
|
||||
doclist = webnotes.model.doctype.get(doctype)
|
||||
return doclist.get({"parent":doctype, "doctype":"DocField", "fieldname":fieldname})
|
||||
|
||||
def has_field(doctype, fieldname, parent=None, parentfield=None):
|
||||
return get_field(doctype, fieldname, parent=None, parentfield=None) and True or False
|
||||
|
||||
def get_field(doctype, fieldname, parent=None, parentfield=None):
|
||||
doclist = webnotes.get_doctype(doctype)
|
||||
return doclist.get_field(fieldname, parent, parentfield)
|
||||
Loading…
Add table
Reference in a new issue