sturo82
sturo82

Reputation: 3

Odoo 10 js cache

I everyone, i have a problem developing a custom module on odoo 10. When i modify a js or a css, imported into the view.xml in this way

    <template id="makeit.assets_common" name="makeit assets common" inherit_id="web.assets_common">
          <xpath expr="." position="inside">
            <!-- All links to CSS and JS files should be added in here. -->
            <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/flick/jquery-ui.css"/>
            <link href="/makeit/static/src/css/jquery.tagit.css" rel="stylesheet" type="text/css"/> 
            <script src="https://sdk.amazonaws.com/js/aws-sdk-2.171.0.min.js"></script>
            <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.js"></script>
            <script src="//cdn.jsdelivr.net/bluebird/3.5.0/bluebird.min.js"></script>
            <t t-call-assets="web.assets_backend" t-css="false"/>
            <link rel="stylesheet" href="/makeit/static/src/css/makeit.css"/>


<script type="text/javascript" src="/makeit/static/src/js/custom_js_v93.js"></script>


          </xpath>
        </template>

as you can see i have to change the name of the custom_js_v93 every time to make it work. I've tried reloading db, odoo service, module ecc. any idea? thank you

Upvotes: 0

Views: 4235

Answers (1)

Vinh VO
Vinh VO

Reputation: 703

If your changes are in *.py files, restart the odoo service.

service odoo restart

If your changes are in existing *.xml files, re-install (upgrade) the module.

Apps > Your module > Upgrade

If your changes are in both, the do the both: restart the service then upgrade the module.

I don't think clearing browser cache is necessary, since Odoo automatically generates new *.js files (and removes the old ones) every service start:

http://odoo.example.com/web/content/6045-b6fe286/web.assets_backend.js
                                         ^
                                  This is generated

So in your case, just reinstall the module.


Updated:

Try changing to inheritance of inherit_id="web.assets_backend" if it fixes your issue:

<template id="makeit.assets_common" name="makeit assets common" inherit_id="web.assets_common">

to

<template id="makeit.assets_backend" name="makeit assets backend" inherit_id="web.assets_backend">

Upvotes: 1

Related Questions