Hi All,
i am trying to fetch the name in my form. but i m not able to fetch the name automatically…i correctly followed the video…but i got the error…
the error is :-
Uncaught TypeError: Cannot read property ‘get_doc’ of undefined
at attendee (eval at setup (form.min.js:258), :12:31)
at form.min.js:255
at form.min.js:255
at Function.map (jquery.min.js:2)
at Class.trigger (form.min.js:255)
at form.min.js:33
at Function. (desk.min.js:561)
at Function.each (jquery.min.js:2)
at run (desk.min.js:561)
at Object.trigger (desk.min.js:561)
attendee @ VM830:12
(anonymous) @ form.min.js:255
(anonymous) @ form.min.js:255
map @ jquery.min.js:2
trigger @ form.min.js:255
(anonymous) @ form.min.js:33
(anonymous) @ desk.min.js:561
each @ jquery.min.js:2
run @ desk.min.js:561
trigger @ desk.min.js:561
(anonymous) @ desk.min.js:560
each @ jquery.min.js:2
set_value @ desk.min.js:559
set_model_value @ desk.min.js:385
set @ desk.min.js:384
callback @ form.min.js:262
callback @ desk.min.js:134
200 @ desk.min.js:136
(anonymous) @ desk.min.js:141
i @ jquery.min.js:2
fireWith @ jquery.min.js:2
z @ jquery.min.js:4
(anonymous) @ jquery.min.js:4
my code is below:
meeting.js --:
// Copyright (c) 2016, Frappe and contributors
// For license information, please see license.txt
frappe.ui.form.on(
“Meeting Attendee”, {attendee:function(frm,cdt,cdn)
{
var attendee=frappe.model.get_doc(cdt,cdn);
if(attendee.attendee)
{
frm.call({
method: "meeting.meeting.doctype.meeting.meeting.get_full_name",
args: {attendee:attendee.attendee
},
callback:function(r)
{
fraape.model.set_value(cdt,cdn,“full_name”,r.messaage);
}
});
}
else
{
frappe.model.set_value(cdt,cdn,“full_name”, null);
}
}
})
meeting.py ; -
-- coding: utf-8 --
Copyright (c) 2015, Frappe and contributors
For license information, please see license.txt
from future import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
class Meeting(Document):
def validate(self):
for attendee in self.attendees:
if not attendee.full_name:
attendee.full_name = get_full_name(attendee.attendee)
@fraape.whitelist()
def get_full_name(attendee):
user = frappe.get_doc(“User”,attendee)
return " ".join(filter(None,[user.first_name, user.middle_name,user.last_name]))