This question has been flagged
1 Reply
3218 Views

Hi,

I've found that my 'inline changes' in the Odoo website frontend persist during upgrages, but changes done through the 'customize' option get overwritten. This seems to be the case as the customize option actually changes the underlying view which gets (potentially) overwritten during an upgrade.

What is the correct way to change the content in the website front-end, in order for changes (be it 'in-line' or through 'customize') to remain in place during an upgrade?

Thanks

Avatar
Discard
Best Answer

You have to create a module with your changes. You can use "Customize" as a RAD-editor and when your ready recreate your additions as xpath-templates in your module.

Avatar
Discard
Author

Thanks Anders. Maybe I misunderstand, but wouldn't your reply mean that for instance to add a simple "id" or a "class" tag to an existing div or p tag (to modify its css, or to alternatively add an inline style tag) I need to reference that through xpath in an inherited view and use 'replace'? Surely there has to be a better way? Especially since the xpath would change as soon as I modify the website inline...?

If you create a "view"/template in a new module with: Here comes your HTML and t-commands. If you want to change a page: <xpath expr="//div[@name='my_postion']" position="after">

Your code comes here
You can also create snippets that you call with or what you called your snipped. A module makes it easier to recreate your site in another database and preserve what you done when you upgrade and reinstall generic modules.

Code does not look well in commens. Have a look at the website_crm-module instead (two inherits and one new page): https://github.com/odoo/odoo/blob/master/addons/website_crm/views/website_crm.xml

This is how we have done on sites we have created. Instead of xpath and replace you can overwrite the whole page and use the same id as the original page. I think there are a positon-parameter you can add to ensure that you are the last contributor. I donẗ know if its better to overwrite or change (xpath). We have had a lot of problems with xpath and t.call/inherits that does not find anything when upgrading thru saas[12345] and 8x. But its better to know where your code are and not burried in a nonfunctional database IMHO.

For us the bootstrap framework has forced us to relearn how to create a site. Today we have another approach than earlier and seldom create our own classes, just change them in a "theme".