From d1c6c9f0f1bcd8d2125adbcfcf8c228a024c92b4 Mon Sep 17 00:00:00 2001 From: Maxwell Morais Date: Sat, 14 May 2016 23:14:54 -0300 Subject: [PATCH 1/2] Fix: AttributeError: 'dict' object has no attribute 'parenttype' ```python Traceback (innermost last): File "/usr/frappe5/frappe-bench/apps/frappe/frappe/app.py", line 57, in application response = frappe.handler.handle() File "/usr/frappe5/frappe-bench/apps/frappe/frappe/handler.py", line 19, in handle execute_cmd(cmd) File "/usr/frappe5/frappe-bench/apps/frappe/frappe/handler.py", line 36, in execute_cmd ret = frappe.call(method, **frappe.form_dict) File "/usr/frappe5/frappe-bench/apps/frappe/frappe/__init__.py", line 805, in call return fn(*args, **newargs) File "/usr/frappe5/frappe-bench/apps/frappe/frappe/client.py", line 78, in insert parent = frappe.get_doc(doc.parenttype, doc.parent) AttributeError: 'dict' object has no attribute 'parenttype' ``` --- frappe/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/client.py b/frappe/client.py index 0920e7d5df..f46b641dc9 100644 --- a/frappe/client.py +++ b/frappe/client.py @@ -75,7 +75,7 @@ def insert(doc=None): if doc.get("parent") and doc.get("parenttype"): # inserting a child record - parent = frappe.get_doc(doc.parenttype, doc.parent) + parent = frappe.get_doc(doc.get("parenttype"), doc.get("parent")) parent.append(doc) parent.save() return parent.as_dict() From 3a23409239762947803dd81aea40b56feb949cf9 Mon Sep 17 00:00:00 2001 From: Maxwell Morais Date: Sat, 14 May 2016 23:18:52 -0300 Subject: [PATCH 2/2] Fix: TypeError: unhashable type: 'dict' ```python Traceback (innermost last): File "/usr/frappe5/frappe-bench/apps/frappe/frappe/app.py", line 57, in application response = frappe.handler.handle() File "/usr/frappe5/frappe-bench/apps/frappe/frappe/handler.py", line 19, in handle execute_cmd(cmd) File "/usr/frappe5/frappe-bench/apps/frappe/frappe/handler.py", line 36, in execute_cmd ret = frappe.call(method, **frappe.form_dict) File "/usr/frappe5/frappe-bench/apps/frappe/frappe/__init__.py", line 805, in call return fn(*args, **newargs) File "/usr/frappe5/frappe-bench/apps/frappe/frappe/client.py", line 79, in insert parent.append(doc) File "/usr/frappe5/frappe-bench/apps/frappe/frappe/model/base_document.py", line 130, in append if not self.__dict__.get(key): TypeError: unhashable type: 'dict' ``` --- frappe/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/client.py b/frappe/client.py index f46b641dc9..54dce106bf 100644 --- a/frappe/client.py +++ b/frappe/client.py @@ -76,7 +76,7 @@ def insert(doc=None): if doc.get("parent") and doc.get("parenttype"): # inserting a child record parent = frappe.get_doc(doc.get("parenttype"), doc.get("parent")) - parent.append(doc) + parent.append(doc.get("parentfield"), doc) parent.save() return parent.as_dict() else: