From b2636c026faaec6c2633255136a9544a23eb6efe Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Fri, 18 Sep 2015 11:42:03 +0200 Subject: [PATCH] [FIX] web: dataset aware of m2m tags color change Use case: create a new tag, change its color and create another new tag. The m2m field was rendered again but the dataset was not aware of the color change on the first new tag. We need to invalidate the cache after changing the color in a tag in edit mode. --- addons/web/static/src/js/views/form_relational_widgets.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js index 428a2fe4758..ba6573ed306 100644 --- a/addons/web/static/src/js/views/form_relational_widgets.js +++ b/addons/web/static/src/js/views/form_relational_widgets.js @@ -1490,7 +1490,9 @@ var FieldMany2ManyTags = AbstractManyField.extend(common.CompletionFieldMixin, c var id = $(ev.currentTarget).data('id'); var self = this; - this.dataset._model.call('write', [id, {'color': color}]).done(function(){ + this.dataset.call('write', [id, {'color': color}]).done(function(){ + self.dataset.cache[id].from_read = {}; + self.dataset.evict_record(id); var tag = self.$el.find("span.badge[data-id='" + id + "']"); var old_color = tag.data('color'); tag.removeClass('o_tag_color_' + old_color);