[IMP]base_setup: kanban view with .oe_kanban_list_many2many method
bzr revid: chm@openerp.com-20120911112519-agdudw6g0lk156mc
This commit is contained in:
parent
5ea9342dc5
commit
9ab1f35de5
|
@ -9,9 +9,11 @@
|
||||||
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
|
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//div[@class='oe_kanban_partner_categories']" position="inside">
|
<xpath expr="//div[@class='oe_kanban_partner_categories']" position="inside">
|
||||||
<t t-foreach="record.category_id.raw_value" t-as="category">
|
<span class="oe_kanban_list_many2many" data-model="res.partner.category">
|
||||||
<span class="oe_tag" t-att-data-category_id="category"/>
|
<t t-foreach="record.category_id.raw_value" t-as="category">
|
||||||
</t>
|
<span class="oe_tag" t-att-data-list_id="category"/>
|
||||||
|
</t>
|
||||||
|
</span>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
|
@ -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]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
Loading…
Reference in New Issue