I am trying to replicate the appraisal feature. I have created a template called appraisal ecc. I have added the code below to the appraisal_ecc.js
cur_frm.cscript.kra_template = function(doc, dt, dn) {
doc.goals = [];
erpnext.utils.map_current_doc({
method: “erpnext.hr.doctype.appraisal_ecc.appraisal_ecc.fetch_appraisal_template”,
source_name: cur_frm.doc.kra_template,
frm: cur_frm
});
}
I have added the code below to my appraisal_ecc.py
-- coding: utf-8 --
Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
For license information, please see license.txt
from future import unicode_literals
import frappe
from frappe.utils import flt, getdate
from frappe import _
from frappe.model.mapper import get_mapped_doc
from frappe.model.document import Document
from erpnext.hr.utils import set_employee_name
class AppraisalECC(Document):
pass
def validate(self):
if not self.status:
self.status = “Draft”
@frappe.whitelist()
def fetch_appraisal_template(source_name, target_doc=None):
target_doc = get_mapped_doc(“Appraisal Sections”, source_name, {
“Appraisal Sections”: {
“doctype”: “Appraisal ECC”,
},
“Appraisal Section Goals”: {
“doctype”: “Appraisal ECC Goal”,
}
}, target_doc)
return target_doc
I keep on getting the error below when i select a template
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 61, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1030, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/mapper.py”, line 36, in map_docs
method = frappe.get_attr(method)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1021, in get_attr
return getattr(get_module(modulename), methodname)
AttributeError: ‘module’ object has no attribute ‘fetch_appraisal_template’
Can someone help me please