[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.
This commit is contained in:
Martin Geubelle
2015-10-01 10:51:26 +02:00
parent a0ea75e5f1
commit b2636c026f
@@ -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);