Problem with Hooks

I have a custom app which is installed in a site,

Under my app’s hooks.py file I added:

doctype_list_js = {
  "Warranty Claim": [
     "assets/myapp/images/js/warranty_claim_list.js"
  ]
}

I then uploaded the warranty_claim_list.js file in /frappe-bench/apps/myapp/myapp/public/js/which contains:

frappe.listview_settings['Warranty Claim'] = {
	add_fields: ["status", "customer", "item_code"],
	filters:[["customer","=", "Closed"]]
};

I ran sudo supervisorctl reload and refreshed my Warranty Claim list but there are no changes.

To be honest this is my first time using hooks, so I am not sure what I am doing wrong. Is there something else that I need to do?

I’ve even tried some other hooks for testing:

website_context = {
	"splash_image": "assets/myapp/images/splash.png"
}

But none of it works… Changing my app details e.g. app_version etc. does reflect though.

FYI, I do clear the cache every time I retry.

Any help is appreciated.

@bohlian does your site have your app setup?

@rmehta, not sure what you mean by that but I can see the app under App Installed and the Installed button is greyed out.

Anyone has any idea on why it behaves like this?

I have the same problem wit hooks.py in my app. There i tried to set an own website_context with an own splash-screen. But it does not work.

Seems to be the erpnext hooks.py is dominant and overwriting stuff in the hooks.py of the app is not possible. This would be a big problem, because the intention of the hooks.py is to make changes without touching the erpnext system.

1 Like

Hello,

is there a possible solution to the problem with setting the website_context in the hooks.py of my app?

1 Like