I need to override kanban js files to my app

i need to override kanban js files to my app
i do this but the event is still triggered from frappe views kanban board .js file not from my app views kanban js file
what i must do ?
plz help me

i solve it

Have anyone override the kanban ks files in your custom app.

I want to display information of some more fields in the kanban card.

For example, I have a selectable status field in a custom doctype with the options (Yes/No).
I want to display the documents having status yes under yes column and no status under no column of kanban. Its petty straight forward. However I want to display, customer, date, amount, remarks information for each kanban card. So that more information can be viewed on the kanban card itself without opening document.

Have any one worked on similar requirement? If yes, please suggest the required changes to be made in custom app.

Koshish Koirala

yes i solve it

1 Like

@malmahdi please share what you learned or did - that would inform others in the same boat and would be an aid if you ever need to recall the details too

edit: How to Override js function in erpnext v9 - #10 by yogendrasinh

Can we down-vote people who do this?


@malmahdi how to do that bro

Answer : YES we can But not in the hooks

we have a file in frappe frappe.client.get_js

get_js() is whitelist function you can override that function like this

Note: ss_custom_erpnext = custom_app

override_whitelisted_methods = {

create kanban_board.py (in custom app)

indent preformatted text by 4 spaces

    def get_js(items):

‘’'Load JS code files. Will also append translations
and extend frappe._messages

:param items: JSON list of paths of the js files to be loaded.‘’’

This is the function trigger this file location : site.assets.frappe.js.frappe.view.kanban.kanban_board.js

contentpath = ‘./assets/frappe/js/frappe/views/kanban/kanban_board.js’

overrided path:

indent preformatted text by 4 spaces.

       items = json.loads(items)
    out = []
    for src in items:
    src = src.strip("/").split("/")

	if ".." in src or src[0] != "assets":
		frappe.throw(_("Invalid file path: {0}").format("/".join(src)))

	contentpath = os.path.join(frappe.local.sites_path, *src)

	if not contentpath == './assets/frappe/js/frappe/views/kanban/kanban_board.js':
		with open(contentpath, "r") as srcfile:
			code = frappe.utils.cstr(srcfile.read())
		contentpath = './assets/ss_custom_erpnext/js/kanban_board.js'
		with open(contentpath, "r") as srcfile:
			code = frappe.utils.cstr(srcfile.read())

	if frappe.local.lang != "en":
		messages = frappe.get_lang_dict("jsfile", contentpath)
		messages = json.dumps(messages)
		code += "\n\n$.extend(frappe._messages, {})".format(messages)


this will work corectly

1 Like