[IMP]base_setup: kanban view with .oe_kanban_list_many2many method

bzr revid: chm@openerp.com-20120911112519-agdudw6g0lk156mc
This commit is contained in:
Christophe Matthieu 2012-09-11 13:25:19 +02:00
parent 5ea9342dc5
commit 9ab1f35de5
2 changed files with 5 additions and 27 deletions

View File

@ -9,9 +9,11 @@
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@class='oe_kanban_partner_categories']" position="inside">
<t t-foreach="record.category_id.raw_value" t-as="category">
<span class="oe_tag" t-att-data-category_id="category"/>
</t>
<span class="oe_kanban_list_many2many" data-model="res.partner.category">
<t t-foreach="record.category_id.raw_value" t-as="category">
<span class="oe_tag" t-att-data-list_id="category"/>
</t>
</span>
</xpath>
</field>
</record>

View File

@ -1,24 +0,0 @@
openerp.base_setup = function(openerp) {
/* extend kanban to include the names of partner categories in the kanban view of partners */
openerp.web_kanban.KanbanView.include({
on_groups_started: function() {
var self = this;
self._super.apply(this, arguments);
if (this.dataset.model === 'res.partner') {
/* Set names for partner categories */
var category_ids = [];
this.$el.find('.oe_kanban_partner_categories span').each(function() {
category_ids.push($(this).data('category_id'));
});
var dataset = new openerp.web.DataSetSearch(this, 'res.partner.category', self.session.context);
dataset.name_get(_.uniq(category_ids)).then(function(result) {
_.each(result, function(value) {
self.$el
.find('.oe_kanban_partner_categories span[data-category_id=' + value[0] + ']')
.html(value[1]);
});
});
}
}
});
};