diff options
| author | Lucas Perais (lpe) <lpe@odoo.com> | 2017-10-23 11:53:29 +0200 |
|---|---|---|
| committer | Lucas Perais (lpe) <lpe@odoo.com> | 2017-10-25 16:39:52 +0200 |
| commit | f45edfbe6d03b15977392dda9561cd7a3e16ce34 (patch) | |
| tree | a55c431e5f5084c67cb45e5d4ae3bc9699e62abc /addons/web/static/src/js/services/data_manager.js | |
| parent | 6fc0793c30705301190eb67558dab93da9d9424a (diff) | |
[FIX] web: image widget is dependent on its record's last_update
As a way to optimize loading, images are not necessarily fetched in db.
They have, in their url a "unique" parameter, which is the last_update date on **the record** and controls on the python-side whether it should get the image from a cache or from the db.
Before this commit, this __last_update field wasn't present in the view, so it wasn't fetched, and writes on a model's image worked but did not refresh.
The image displayed was the old one.
After this commit, when the image field widget is present, we force the loading of the __last_update field of the record.
Upon update, the image displayed is the new one.
OPW 777552
closes #20457
Diffstat (limited to 'addons/web/static/src/js/services/data_manager.js')
| -rw-r--r-- | addons/web/static/src/js/services/data_manager.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/web/static/src/js/services/data_manager.js b/addons/web/static/src/js/services/data_manager.js index 4bf1748fbab..7e938770ba3 100644 --- a/addons/web/static/src/js/services/data_manager.js +++ b/addons/web/static/src/js/services/data_manager.js @@ -377,6 +377,11 @@ return core.Class.extend({ } } } + + if (attrs.Widget.prototype.fieldDependencies) { + attrs.fieldDependencies = attrs.Widget.prototype.fieldDependencies; + } + return attrs; }, /** @@ -397,6 +402,15 @@ return core.Class.extend({ if (node.tag === 'field') { fieldsInfo[node.attrs.name] = self._processField(viewType, fields[node.attrs.name], node.attrs ? _.clone(node.attrs) : {}); + + if (fieldsInfo[node.attrs.name].fieldDependencies) { + var deps = fieldsInfo[node.attrs.name].fieldDependencies; + for (var dependency_name in deps) { + if (!(dependency_name in fieldsInfo)) { + fieldsInfo[dependency_name] = {'name': dependency_name, 'type': deps[dependency_name].type}; + } + } + } return false; } return node.tag !== 'arch'; |
