Fix in open mapped doc. Fixes frappe/erpnext#1575

This commit is contained in:
Anand Doshi 2014-05-04 18:33:54 +05:30
parent c9055ad62f
commit f1ff388563
2 changed files with 4 additions and 4 deletions

View file

@ -9,8 +9,6 @@ from frappe.model import default_fields
def get_mapped_doc(from_doctype, from_docname, table_maps, target_doc=None,
postprocess=None, ignore_permissions=False):
if isinstance(target_doc, basestring):
target_doc = json.loads(target_doc)
source_doc = frappe.get_doc(from_doctype, from_docname)
@ -21,6 +19,8 @@ def get_mapped_doc(from_doctype, from_docname, table_maps, target_doc=None,
# main
if not target_doc:
target_doc = frappe.new_doc(table_maps[from_doctype]["doctype"])
elif isinstance(target_doc, basestring):
target_doc = frappe.get_doc(json.loads(target_doc))
if not target_doc.has_permission("create"):
target_doc.raise_no_permission_to("create")

View file

@ -193,11 +193,11 @@ $.extend(frappe.model, {
method: opts.method,
args: {
"source_name": opts.source_name,
"target_doclist": cur_frm.doc
"target_doc": cur_frm.doc
},
callback: function(r) {
if(!r.exc) {
var doclist = frappe.model.sync(r.message);
var doc = frappe.model.sync(r.message);
cur_frm.refresh();
}
}