Watermark to every page?

I was wondering, if it is possible to easily add a watermark or some other visual cue to every page.

I have made a copy of our production system for tests and development. I would like to have a big watermark “Test” or maybe a light red background colour or something similar in the test system. So users would easily realize that they are in the test system (or not).

The easiest way would probably be with CSS. This does require a custom app, but it’d be a relatively quick fix.


That sounds reasonable, but somehow it doesn’t work.

I went into ~/frappe-bench/apps/erpnext/erpnext/hooks.py and added a line with a new css file

app_include_css = "/assets/css/dev.css"

The dev.css file has the following in it:

body {background: #ffbaba; }

I tried a bench restart but that didn’t trigger it. What else do I need to make to get this working?

At minimum, you probably need to run bench build to recompile the static assets like css. I don’t know what visibility a body color style will have in the desk page, but the build command will at least get the style applied.

In the long run, you might not want to edit erpnext directly, as any changes you make will get wiped out on migrate, but this is fine for now.

Hmm, that somehow didn’t work either. The bench build ran fine, but the dev.css file didn’t show up. I tried to add the body {background…} directly to erpnext.css, but after another bench build, that line was gone.

In a production system, there are a lot of different places that caching could be happening. You’ll have to troubleshoot by looking at the compiled css to see if your hooked code is being included. If it is, you should reboot supervisor, nginx, etc.