Hi,
I’m quite new to erpNext and seem to be missing something essential.
I’m trying to access server-side attributes in a custom doctype via js but I keep getting this error:
#### Something went wrong
Server Error: Please check your server logs or contact tech support.
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 45, in execute_cmd raise e
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 42, in execute_cmd method = get_attr(cmd)
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 135, in get_attr method = frappe.get_attr(cmd)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1027, in get_attr return getattr(get_module(modulename), methodname)
AttributeError: module 'sntg.sonith_app.doctype.sonith_thing' has no attribute 'some_method' </code>
my js looks like this:
frappe.ui.form.on('Sonith Thing', {
onload: function(frm){do_something(frm)
});
function do_something(frm){
frappe.call({
method: 'sntg.sonith_app.doctype.sonith_thing.some_method',
callback: (r) => {
cur_frm.set_value('description', 'please!')
}
})
}
my py looks like this:
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class SonithThing(Document):
#pass
def __init__(self):
self.some_attribute="this is some attribute"
@frappe.whitelist()
def some_method(self):
return "anything"
further infos
- The files are located at /frappe-bench/apps/sntg/sntg/sonith_app/doctype/sonith_thing/sonith_thing.py (or .js respectively)
- I can get neither the attribute nor the method, I always get the ‘module x has no attribute y error’
- when I put some other method (e.g. ‘frappe.core.doctype.user.user.get_timezones’) I get some data
Any help will be greatly appreciated!