diff --git a/frappe/api.py b/frappe/api.py index 01cec3b335..676a589e49 100644 --- a/frappe/api.py +++ b/frappe/api.py @@ -41,17 +41,17 @@ def handle(): elif call=="resource": if "run_method" in frappe.local.form_dict: - bean = frappe.get_doc(doctype, name) + doc = frappe.get_doc(doctype, name) if frappe.local.request.method=="GET": - if not bean.has_permission("read"): + if not doc.has_permission("read"): frappe.throw("No Permission", frappe.PermissionError) - bean.run_method(frappe.local.form_dict.run_method, **frappe.local.form_dict) + doc.run_method(frappe.local.form_dict.run_method, **frappe.local.form_dict) if frappe.local.request.method=="POST": - if not bean.has_permission("write"): + if not doc.has_permission("write"): frappe.throw("No Permission", frappe.PermissionError) - bean.run_method(frappe.local.form_dict.run_method, **frappe.local.form_dict) + doc.run_method(frappe.local.form_dict.run_method, **frappe.local.form_dict) frappe.db.commit() else: diff --git a/frappe/client.py b/frappe/client.py index 108868f192..f11c55bcfd 100644 --- a/frappe/client.py +++ b/frappe/client.py @@ -32,16 +32,16 @@ def set_value(doctype, name, fieldname, value): doc = frappe.db.get_value(doctype, name, ["parenttype", "parent"], as_dict=True) if doc and doc.parent: - bean = frappe.get_doc(doc.parenttype, doc.parent) - child = bean.getone({"doctype": doctype, "name": name}) + doc = frappe.get_doc(doc.parenttype, doc.parent) + child = doc.getone({"doctype": doctype, "name": name}) child.set(fieldname, value) else: - bean = frappe.get_doc(doctype, name) - bean.set(fieldname, value) + doc = frappe.get_doc(doctype, name) + doc.set(fieldname, value) - bean.save() + doc.save() - return bean.as_dict() + return doc.as_dict() @frappe.whitelist() def insert(doclist): @@ -54,21 +54,21 @@ def insert(doclist): if doclist[0].get("parent") and doclist[0].get("parenttype"): # inserting a child record d = doclist[0] - bean = frappe.get_doc(d["parenttype"], d["parent"]) - bean.append(d) - bean.save() + doc = frappe.get_doc(d["parenttype"], d["parent"]) + doc.append(d) + doc.save() return [d] else: - bean = frappe.get_doc(doclist).insert() - return bean.as_dict() + doc = frappe.get_doc(doclist).insert() + return doc.as_dict() @frappe.whitelist() def save(doclist): if isinstance(doclist, basestring): doclist = json.loads(doclist) - bean = frappe.get_doc(doclist).save() - return bean.as_dict() + doc = frappe.get_doc(doclist).save() + return doc.as_dict() @frappe.whitelist() def rename_doc(doctype, old_name, new_name, merge=False): @@ -104,7 +104,7 @@ def set_default(key, value, parent=None): @frappe.whitelist() def make_width_property_setter(): - doc = json.loads(frappe.form_dict.doc) + doc = json.loads(frappe.form_dict) if doc["doctype"]=="Property Setter" and doc["property"]=="width": frappe.get_doc(doc).insert(ignore_permissions = True) @@ -117,9 +117,9 @@ def bulk_update(docs): ddoc = {key: val for key, val in doc.iteritems() if key not in ['doctype', 'docname']} doctype = doc['doctype'] docname = doc['docname'] - bean = frappe.get_doc(doctype, docname) - bean.update(ddoc) - bean.save() + doc = frappe.get_doc(doctype, docname) + doc.update(ddoc) + doc.save() except: failed_docs.append({ 'doc': doc, diff --git a/frappe/core/doctype/communication/communication.py b/frappe/core/doctype/communication/communication.py index b17780da83..8c77a1f5bf 100644 --- a/frappe/core/doctype/communication/communication.py +++ b/frappe/core/doctype/communication/communication.py @@ -15,12 +15,12 @@ from frappe.utils import scrub_urls from frappe.model.document import Document class Communication(Document): - def get_parent_bean(self): + def get_parent_doc(self): return frappe.get_doc(self.parenttype, self.parent) def update_parent(self): """update status of parent Lead or Contact based on who is replying""" - observer = self.get_parent_bean().get_attr("on_communication") + observer = self.get_parent_doc().get_attr("on_communication") if observer: observer() @@ -58,8 +58,8 @@ def _make(doctype=None, name=None, content=None, subject=None, sent_or_received if isinstance(sender, (tuple, list)) and len(sender)==2: sender = formataddr(sender) - comm = frappe.new_bean('Communication') - d = comm.doc + comm = frappe.new_doc('Communication') + d = comm d.subject = subject d.content = content d.sent_or_received = sent_or_received @@ -81,7 +81,7 @@ def _make(doctype=None, name=None, content=None, subject=None, sent_or_received comm.insert() if send_email: - d = comm.doc + d = comm send_comm_email(d, name, sent_via, print_html, attachments, send_me_a_copy) @frappe.whitelist() diff --git a/frappe/core/doctype/customize_form/customize_form.py b/frappe/core/doctype/customize_form/customize_form.py index b871cab778..1fe5007cd2 100644 --- a/frappe/core/doctype/customize_form/customize_form.py +++ b/frappe/core/doctype/customize_form/customize_form.py @@ -152,7 +152,7 @@ class CustomizeForm(Document): if ref_d.get("__custom_field"): # update custom field if self.has_property_changed(ref_d, new_d, prop): - # using set_value not bean because validations are called + # using set_value not doc because validations are called # in the end anyways frappe.db.set_value("Custom Field", ref_d.name, prop, new_d.get(prop)) else: @@ -294,13 +294,13 @@ class CustomizeForm(Document): frappe.db.sql(""" DELETE FROM `tabProperty Setter` WHERE doc_type = %(doc_type)s - AND property = %(property)s""", d.fields) + AND property = %(property)s""", d.as_dict()) else: frappe.db.sql(""" DELETE FROM `tabProperty Setter` WHERE doc_type = %(doc_type)s AND field_name = %(field_name)s - AND property = %(property)s""", d.fields) + AND property = %(property)s""", d.as_dict()) # Save the property setter doc if not marked for deletion i.e. delete=0 if not d.delete: diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py index 916351a8f2..a1017c0c5d 100644 --- a/frappe/core/doctype/doctype/doctype.py +++ b/frappe/core/doctype/doctype/doctype.py @@ -176,23 +176,24 @@ def validate_fields(fields): def check_illegal_mandatory(d): if d.fieldtype in ('HTML', 'Button', 'Section Break', 'Column Break') and d.reqd: - frappe.msgprint('%(label)s [%(fieldtype)s] cannot be mandatory' % d.fields, + print d.fieldname, d.reqd + frappe.msgprint('%(parent)s, %(label)s [%(fieldtype)s] cannot be mandatory' % d.as_dict(), raise_exception=1) def check_link_table_options(d): if d.fieldtype in ("Link", "Table"): if not d.options: - frappe.msgprint("""#%(idx)s %(label)s: Options must be specified for Link and Table type fields""" % d.fields, + frappe.msgprint("""#%(idx)s %(label)s: Options must be specified for Link and Table type fields""" % d.as_dict(), raise_exception=1) if d.options=="[Select]": return if d.options != d.parent and not frappe.db.exists("DocType", d.options): - frappe.msgprint("""#%(idx)s %(label)s: Options %(options)s must be a valid "DocType" for Link and Table type fields""" % d.fields, + frappe.msgprint("""#%(idx)s %(label)s: Options %(options)s must be a valid "DocType" for Link and Table type fields""" % d.as_dict(), raise_exception=1) def check_hidden_and_mandatory(d): if d.hidden and d.reqd and not d.default: - frappe.msgprint("""#%(idx)s %(label)s: Cannot be hidden and mandatory (reqd) without default""" % d.fields, + frappe.msgprint("""#%(idx)s %(label)s: Cannot be hidden and mandatory (reqd) without default""" % d.as_dict(), raise_exception=True) def check_min_items_in_list(fields): diff --git a/frappe/core/doctype/notification_count/notification_count.py b/frappe/core/doctype/notification_count/notification_count.py index d58f650a59..36c624a5f6 100644 --- a/frappe/core/doctype/notification_count/notification_count.py +++ b/frappe/core/doctype/notification_count/notification_count.py @@ -59,12 +59,12 @@ def delete_notification_count_for(doctype): def delete_event_notification_count(): delete_notification_count_for("Event") -def clear_doctype_notifications(bean, method=None): +def clear_doctype_notifications(doc, method=None): if frappe.flags.in_import: return config = get_notification_config() - doctype = bean.doctype + doctype = doc.doctype if doctype in config.for_doctype: delete_notification_count_for(doctype) diff --git a/frappe/core/doctype/print_format/print_format.py b/frappe/core/doctype/print_format/print_format.py index 52a12536a4..0a8953a1a3 100644 --- a/frappe/core/doctype/print_format/print_format.py +++ b/frappe/core/doctype/print_format/print_format.py @@ -48,16 +48,16 @@ def get_args():
%s""" % repr(frappe.form_dict) } - bean = frappe.get_doc(frappe.form_dict.doctype, frappe.form_dict.name) + doc = frappe.get_doc(frappe.form_dict.doctype, frappe.form_dict.name) for ptype in ("read", "print"): - if not frappe.has_permission(bean.doctype, ptype, bean): + if not frappe.has_permission(doc.doctype, ptype, doc): return { "body": """
No {ptype} permission
""".format(ptype=ptype) } return { - "body": get_html(bean), + "body": get_html(doc), "css": get_print_style(frappe.form_dict.style), "comment": frappe.session.user } diff --git a/frappe/core/page/data_import_tool/importer.py b/frappe/core/page/data_import_tool/importer.py index ba292ee6fa..5e2ed8ff9a 100644 --- a/frappe/core/page/data_import_tool/importer.py +++ b/frappe/core/page/data_import_tool/importer.py @@ -181,7 +181,7 @@ def upload(rows = None, submit_after_import=None, ignore_encoding_errors=False, continue row_idx = i + start_row - bean = None + doc = None doc = get_doc(row_idx) try: @@ -209,8 +209,8 @@ def upload(rows = None, submit_after_import=None, ignore_encoding_errors=False, ret.append('Submitted row (#%d) %s' % (row_idx + 1, getlink(doc.doctype, doc.name))) except Exception, e: error = True - if bean: - frappe.errprint(bean.as_dict()) + if doc: + frappe.errprint(doc.as_dict()) err_msg = frappe.local.message_log and "{{ d.highlight }}
@@ -20,9 +20,9 @@ {% endfor %} {% endif %} - {% if obj.doclist.get({"doctype":"About Us Team Member"}) %} + {% if obj.get({"doctype":"About Us Team Member"}) %}