[IMP] web: m2m_tags support _rec_name != 'name'

Currently, the m2m tags widget would only display the name present in
the "name" field. This prevent them from being used with custom
fields/models and other niceties.

opw-658490
This commit is contained in:
Nicolas Lempereur
2015-12-16 12:03:43 +01:00
parent cb9d7982c1
commit b9520e22e9
2 changed files with 2 additions and 2 deletions
@@ -1430,7 +1430,7 @@ var FieldMany2ManyTags = AbstractManyField.extend(common.CompletionFieldMixin, c
get_render_data: function(ids){
var self = this;
return this.mutex.exec(function(){
var fields = self.fields.color ? ['name', 'color'] : ['name'];
var fields = self.fields.color ? ['display_name', 'name', 'color'] : ['display_name', 'name']; // TODO master: remove useless 'name'
return self.dataset.read_ids(ids, fields);
});
},
+1 -1
View File
@@ -826,7 +826,7 @@
<t t-set="i" t-value="0"/>
<t t-foreach="elements" t-as="el">
<span t-attf-class="badge dropdown #{'o_tag_color_' + (el['color'] || 0)}" t-att-data-color="(el['color'] || 0)" t-att-data-index="i" t-att-data-id="el['id']">
<t t-esc="el['name']"/>
<t t-esc="el['display_name']"/>
<span t-if="!readonly" class="fa fa-times o_delete"/>
</span>
<t t-set="i" t-value="i + 1"/>