Skip to Content
Menú
This question has been flagged
4 Respostes
5021 Vistes

Hi all,

Can someone please point me to the file where the custom code is stored when using the Website/Customize -> HTML/CSS/JS Editor?

Regards

Avatar
Descartar
Autor

I found an entry for the file in question in the ir.attachment table, administered through the Technical / Database Structure / Attachments menu option.

I removed the entry, which fixed the major problem after the initial edit of the JS content, but now I am getting an error iin the browser inspect console:
Could not get content for /website/static/src/js/user_custom_javascript.custom.web.assets_frontend_lazy.js defined in bundle 'web.assets_frontend_lazy'

How do I get this entry back and pointing to the correct file?

Best Answer

The custom CSS and JS files are located in Technical > Database Structure > Attachments

In my case they are named user_custom_rules.css and user_custom_rules.js 


The XML (HTML) files are located in technical > user interface > views

The editors states the  Template ID: website.homepage

Find the view by the key and edit it online.

Avatar
Descartar
Best Answer

Hi,

I was facing an issue with assets as well.

  1. What happened
    I wanted to install a Google plugin, so I went to "Website/Customize -> HTML/CSS/JS Editor" and entered the custom code there.
    Bang!
    From that moment, couldn't properly load
  2.  website, was getting a syntax error in  /website/static/src/js/user_custom_javascript.custom.web.assets_frontend_lazy.js
  3. How I fixed?
    1. Got in backend "Settings/Technical/Attachments"
    2. Located the corrupt asset
    3. Downloaded the js file and corrected it in text editor.
    4. Uploaded the modified file back on same asset form.

This solved the issue for me.

Hope it helps someone else.

Avatar
Descartar
Best Answer

I'm in the same dead end, been struggling with this all day. Did you find the f*** file!?

Thanks!

Avatar
Descartar
Autor

I found the entry in the ir.attachment table, but I cannot find the file the entry is pointing to.

Autor

I deactivated the asset that directs the default file to the custome file in Technical / Database Structure / Assets.

To do this you have to activate Developer Mode (with Assets)

Autor Best Answer

Ok, previously I thought that I have found the file, but it turns out to be a dead end.


After the above mentioned change, when looking at the web browser's concole, an error occurs due to the inserted code. The file indicated with the faulty content is web.assets_frontend_lazy.js:29388 which turns out to be the bundle which the JS script belongs to.

When hovering over the error the path is indicated as https://www.lesswatts.co.za/web/assets/debug/1/web.assets_frontend_lazy.js

I can't seem to find the file or a url handler for this path. 


Am I missing something?

Avatar
Descartar
Autor

I managed to solve the problem by deactivating the asset which directs ODOO to replace the default web.assets_frontend_lazy.js file with the custom file.