Odoo template page not refreshed when xml changes

Just started Odoo for the client and I have a basic template problem.

simple template with a few divs and headers. I also have an entry to display it in the main menu.

Everything works when I first build it. However, if it happens that I want to add or change any html, those changes are not reflected on the site page (even after updating or updating the theme). The website builder allows me to change the text and more, but that's not what I want. I want to change the html structure from XML. But as soon as the page is created the first time ... I am not allowed. Only the first page will be displayed on the page.

Hope this is clear and thanks in advance for any help.

Joe

+3


source to share


4 answers


Version: Odoo nightly 10.0-20170427

TL; DR

Every time you use the site builder (add snippets, change text, ..) and save, the data in the Odoo database changes (obviously - otherwise your changes won't be saved).

This process sets the value of the "noupdate" field in the "ir_model_data" table from false to true to write your template. As long as "noupdate" is true, the entry for this template will not be changed by the update action on your module.

To be able to change this, you will need to set "noupdate" back to false so that the template in the database is overwritten by the modified content of your xml during the update process. Please check the warning at the bottom of my answer!

My similar problem

I faced a similar problem. Like you, I created a simple module / template with a few html tags, added it to main_menu, and installed the module. Everything worked as expected (menu visibility and all my content was shown).

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <!-- === Page template === -->
    <template name="tpl-imprint" id="website.imprint" page="True">
        <t t-call="website.layout">
            <div id="wrap">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12">
                            <h1>some Header</h1>
                            <p>some text</p>
                        </div>
                    </div>
                    <!-- === Snippets' area === -->
                    <div class="row">
                        <div class="oe_structure" />
                    </div>
                </div>
            </div>
        </t>
    </template>
    <!-- === Menu item === -->
    <record id="menu_imprint" model="website.menu">
        <field name="name">Imprint</field>
        <field name="url">/page/imprint</field>
        <field name="parent_id" ref="website.main_menu" />
        <field name="sequence" type="int">100</field>
        <field name="website_id" type="int">1</field>
    </record>
</odoo>

      

After that, I changed my XML file a bit, added text, etc., updated the module and again everything worked as expected. Then I experimented a bit with a website builder on a page that I created myself, added some snippets and saved. Then I realized that I had some typos in my xml, so I went to my editor, fixed them, updated the module and as expected, my view didn't change.

Since I'm pretty new to Odoo, didn't really dive into how Odoo works in the backend and I didn't find anything good on google, I started analyzing what happens to the database during the upgrade process as well as using the web builder -sites. I found out that by simply using an update to download my changes, only the "arch_db" field of the "ir_ui_view" table was changed for the corresponding record. However, using the website builder, not only was the content of the template written to "ir_ui_view", but the "noupdate" field for the related record in the "ir_model_data" table was changed - it was set from false to true (There are probably more changes happens to the database, but the ones mentioned are related to the problem).

How to run the update process again

To fix the update problem, I simply changed the "noupdate" value to true and the update process worked again. (You will have to do this every time you use a website builder with one of your custom templates - at least if you want to make changes to the template again through your xml).



Back up the database before manually modifying it (I tested / used these sql lines with my database but no guarantee;))

Find the template model_data_id of the template in "ir_ui_view"

select
    model_data_id
from
    ir_ui_view
where
    name = '<the name of your template - in my case tpl-imprint>';

      

Use this identifier to find / update the corresponding entry in the "ir_ui_data" table

update
    ir_model_data
set
    noupdate = true
where
    id = <the ID you got with the first query>

      

Done! Try updating the module. Your xml changes should now be stored in the database.


You can also change the value in one step

update
    ir_model_data
set
    noupdate = false
where
    id in(
        select
            model_data_id
        from
            ir_ui_view
        where
            name = '<the name of your template - in my case tpl-imprint>'
    );

      

!!!! WARNING!!!!

Any changes you made when creating the site will be lost during the upgrade process if you set "noupdate" to false. If you want to keep them, you must copy your changes to your template into your xml! To do this, go to "Customize / HTML Editor" on the page you want to get the content from and copy pasting the parts you want to keep in your xml.

+5


source


Remove your template from the frontend, then update your module and test it.



0


source


when changes are made in a view or template in ode, you need to update the module to reflect the changes in the field of view. so try updating your module from apps or updating from terminal

login to your database and run the following command in terminal and reload the page from browser.

For odoo 8.9

python openerp-server -u your_module_name

      

For odoo 10

python odoo-bin -u your_module_name

      

0


source


This is a serious problem that we face now. If I change the template by overriding the original site template My localhost is updated with new content, but on the serial and live server it is not updated. Basically I was making changes to the website.layout template . I also found a solution, but this is not an efficient and practical way. To do this, I followed these steps:

  • Activate developer mode

  • Go to Settings -> User Interface -> Views. Find the template in the view and remove the correct ones and reinstall My Custom Module again.

But I cannot say that this is an efficient method, and sometimes an error occurs in the entry if we try to delete a template with a relation.

0


source







All Articles