[FIX] calendar: partner filter for search more or created

When adding a partner "filter" to the calendar view, it only works if we
select directly the partner and not when we choose him via "search more"
or create him on the fly.

This commit uses the partner id directly which is available in the field
value in those three possible instances.

opw-702491
This commit is contained in:
Nicolas Lempereur
2017-01-03 16:57:20 +01:00
parent 7cd2969b09
commit bbc4137600
@@ -148,12 +148,12 @@ widgets.SidebarFilter.include({
.filter([["id", "=",this.view.dataset.context.uid]])
.first()
.done(function(result){
$.map(self.ir_model_m2o.display_value, function(element,index) {
if (result.partner_id[0] != index){
self.ds_message = new data.DataSetSearch(self, 'calendar.contacts');
defs.push(self.ds_message.call("create", [{'partner_id': index}]));
}
});
var partner_id = self.ir_model_m2o.get_value();
// don't duplicate [Me] filter for current user
if (result.partner_id[0] != partner_id){
self.ds_message = new data.DataSetSearch(self, 'calendar.contacts');
defs.push(self.ds_message.call("create", [{'partner_id': partner_id}]));
}
}));
return $.when.apply(null, defs).then(function() {
return reload_favorite_list(self);