Odoo 10 js cache - odoo

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

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">

Related

Odoo 12 - New Theme - Arabic - Greys Out Site

I have created a new Theme for Odoo 12 (in EN and AR), the theme works fine on my Environment. But when the theme is copied to live environment, the EN site loads fine, but the AR site goes Grey completely. Can any suggest how to approach this problem. There is no evident error in console.
According to your question, it is possible CSS, qweb and js can't loads.
please add your CSS Js and qweb properly.
I add an example for css or js load
<odoo>
<template id="assets_backend" name="Demo project" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/module_name/static/src/css/custom.css"/>
<script type="text/javascript" src="/module_name/static/src/js/module_name.js"/>
</xpath>
</template>
</odoo>

How can I force client to not cache the svelte/rollup bundle.js?

My svelte rollup.js setup has an index.html file with this head:
<link rel='stylesheet' href='/build/bundle.css'><!-- svelte -->
<link rel="stylesheet" href="/build/index.css" /><!-- tailwind -->
<script defer src='/build/bundle.js'></script>
When I deploy a new version to my web server, some clients don't fetch the new bundle.js but instead use their cached copy. What's a good way of forcing them to fetch the new bundle when I've deployed a new version?
The simplest way I can think of would be to add the version number or git commit hash to the end of src, e.g:
<link rel='stylesheet' href='/build/bundle.css?v0.1.4'><!-- svelte -->
<link rel="stylesheet" href="/build/index.css?v0.1.4" /><!-- tailwind -->
<script defer src='/build/bundle.js?v0.1.4'></script>
But I assume this is a common problem, so I'd rather ask.
There's a section in the docs about using hash's in the bundle names. https://rollupjs.org/guide/en/#outputentryfilenames

Laravel is searching for CSS file in wrong directory when using Elixir

Why is Laravel searching for my CSS file in the wrong directory? I've seen this question posted a few times but it's never actually been answered with Elixir. I am assuming there are possibly some configurations that need to be done which aren't covered in the documentation (at least from what I can tell).
My layout.blade.php file links to the css stylesheet as follows:
<link rel="stylesheet" href="{{ elixir('css/app.css') }}">
My CSS file is loaded in the following path:
localhost/fresh/public/build/css/app-279b78681b.css
However,it is looking for the file here (it is notably missing /Fresh/public/ which I can't determine why?):
localhost/build/css/app-279b78681b.css
I am running an Apache 2.4 webserver for my laravel 5.2 project (not on homestead and not on a VM) and my gulpfile.js file has the following code:
elixir(function(mix) {
mix.sass('app.scss')
.version('/css/app.css');
});
All of that being said, if I were to change my layout.blade.php file to the following:
<link rel="stylesheet" href='css/app.css'>
It will capture my stylesheet that is located in the following directory correctly:
localhost/fresh/public/css/app.css
Sooooo, why can't it capture the css stylesheet when i use Elixir and why is it linking the wrong location?
I have the same problem too.
I used as workaround:
<link rel="stylesheet" href="{{ url(elixir('css/app.css') }}">
or
<link rel="stylesheet" href="{{ asset(elixir('css/app.css')) }}">
It's just that it outputs absolute path then in the generated file. It works but I don't like it so am also still interested how to fix it properly.

How do I set favicon in Odoo / OpenERP?

How do I set a favicon for the web/e-commerce frontend of Odoo 8?
Ideally without changing Odoo core files, i.e. I do not simply want to overwrite addons/web/static/src/img/favicon.ico.
(This is Odoo 8, August 2014. It's likely that it will be easier to change the favicon in future versions.)
You have to override the web module with your own module. You can add a line like
'data': [ 'views/website_templates.xml' ]
in your __openerp__.py.
Put your favicon at static/src/img/favicon.ico and add a template to views/website_templates:
<template id="MYSITE_layout" inherit_id="website.layout" name="MYSITE layout" priority="17">
<xpath expr="//head//link" position="after">
<link rel="shortcut icon" href="/MYSITE_web/static/src/img/favicon.ico" type="image/x-icon"/>
</xpath>
</template>
Favicon is set in <head> html section, that is stored in template, and link there is hardcoded to point to /web/static/src/img/favicon.ico (see here), so if you want to change it you have to change either icon file itself or change proper template to point to icon file you want.

IBM Worklight with Dojo Toolkit | dojo/main.js 404 not found issue

I have recently started exploring IBM Worklight which looks really promising to build hybrid mobile apps, in order to do so, created a Worklight project while choosing Dojo Toolkit as a default framework choice and got to see the missing dojo/main.js issue.
Here is the HTML code:
<!DOCTYPE HTML>
<html>
<head>
<title>TD_Mobile</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<script src="dojo/dojo.js" data-dojo-config="isDebug: false, parseOnLoad: true, async: false"></script>
<link rel="stylesheet" href="css/TD_Mobile.css">
</head>
<body id="content" style="display: none;">
<div data-dojo-type="dojox.mobile.ScrollableView" id="view0"
data-dojo-props="selected:true"></div>
TD_Mobile
<!--application UI goes here-->
<script src="js/initOptions.js"></script>
<script src="js/TD_Mobile.js"></script>
<script src="js/messages.js"></script>
</body>
</html>
When I do build and deploy and run the project from worklight console as a common resource, got to see the main.js not found issue at the following path http://localhost:8080/apps/services/preview/TD_Mobile/common/1.0/default/dojo/main.js
And to my surprise further, I was able to search the reference folder at C:\Users\marif\workspace\WorklightServerHome\TD Mobile New\widget-resources\TD_Mobile-common-e6cd3d9088c88e96df743ed1c9a1b584a90da8c9\preview\default\dojo and don't see main.js and some more JS files there.
Looks like final deployed build somehow not working properly, would appreciate for any quick pointer.
Not all files are included in the dojo build, there is a file called build-dojo.xml in your project.
Add main.js to it.
Under <patternset id="dojo.resources.loose-modules"> add the modules you want to use.
This sounds like a write permissions issue.
Can you please create a new project and see if it happens there as well?
If it does not then the issue is solved, else it might be a plugin issue.
Do you get any error message is the Worklight console in the build process?