[IMP] web: disable cache in debug assets

When altering a view (regular or wizard's) in code/file (rather than via the
client's interface) and restarting the server view caches don't get cleared and
it's necessary to reload the entire client before the changes can be seen.

This is annoying, and sometimes confusing so the cache is now disable in debug
assets.

Task 1911601

closes odoo/odoo#31667

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Martin Geubelle
2019-03-07 15:02:37 +00:00
parent 5dc971b1ae
commit e8c4ecd3d4
@@ -1,6 +1,7 @@
odoo.define('web.DataManager', function (require) {
"use strict";
var config = require('web.config');
var core = require('web.core');
var rpc = require('web.rpc');
var utils = require('web.utils');
@@ -39,7 +40,7 @@ return core.Class.extend({
var self = this;
var key = this._gen_key(action_id, additional_context || {});
if (!this._cache.actions[key]) {
if (config.debug === 'assets' || !this._cache.actions[key]) {
this._cache.actions[key] = rpc.query({
route: "/web/action/load",
params: {
@@ -79,7 +80,7 @@ return core.Class.extend({
var views_descr = params.views_descr;
var key = this._gen_key(model, views_descr, options || {}, context);
if (!this._cache.views[key]) {
if (config.debug === 'assets' || !this._cache.views[key]) {
// Don't load filters if already in cache
var filters_key;
if (options.load_filters) {
@@ -134,7 +135,7 @@ return core.Class.extend({
*/
load_filters: function (params) {
var key = this._gen_key(params.modelName, params.actionId);
if (!this._cache.filters[key]) {
if (config.debug === 'assets' || !this._cache.filters[key]) {
this._cache.filters[key] = rpc.query({
args: [params.modelName, params.actionId],
kwargs: {