hey all ,
i have create 2 doctypes inside education module , one called sections and the other one called student section enrollment , and i have create a doctype as table called registered courses , then i have Put that table inside student section enrollment in this table i have these filed : section as link to sections doctype
and course ( i want to fetched from section doctype ) and registration date (it’s should be the time ‘now’)
and credit hours ( i want to fetched from course doctype ‘i have add this fild’ when i do fetch the course name from section doctype ) , my problem is
i have create a new method :
@frappe.whitelist() def get_section(section): courses = frappe.db.sql('''select course from `tabsections` where name=%s''', (section), as_dict=1) return courses
and i have but this method inside api file in education module
and i have create a new custom script :
frappe.ui.form.on(‘registered courses’,‘section’, function(frm, cdt, cdn){
frappe.call({ "type":"POST", "method": "erpnext.education.api.get_section", args: { section : frm.doc.section }, callback: function (data) { frappe.model.set_value(cdt, cdn, "course_name", data.message.course); frappe.model.set_value(cdt, cdn, "credit_hours", data.message.credit_hours); } }) })
but when try to run this custom script , i got this error :
AttributeError: module ‘erpnext.education.api’ has no attribute ‘get_section’
i have do this commands :
bench build
bench migrate
note : i have to sites inside this bench (site.local) and (erp2.site)
and i have create these doctypes in erp2.site
please tell me if you need more explanations