case 'button':
case 'a':
var type = node.attrs.type || '';
- if (_.indexOf('action,object,edit,open,delete'.split(','), type) !== -1) {
+ if (_.indexOf('action,object,edit,open,delete,url'.split(','), type) !== -1) {
_.each(node.attrs, function(v, k) {
if (_.indexOf('icon,type,name,args,string,context,states,kanban_states'.split(','), k) != -1) {
node.attrs['data-' + k] = v;
}
}];
}
- if (node.tag == 'a') {
+ if (node.tag == 'a' && node.attrs['data-type'] != "url") {
node.attrs.href = '#';
} else {
node.attrs.type = 'button';
self.nb_records += records.length;
self.dataset.ids.push.apply(self.dataset.ids, dataset.ids);
groups_array[index] = new instance.web_kanban.KanbanGroup(self, records, group, dataset);
- if (!remaining--) {
+ if (self.dataset.index >= records.length){
self.dataset.index = self.dataset.size() ? 0 : null;
+ }
+ if (!remaining--) {
return self.do_add_groups(groups_array);
}
});
if(!self.nb_records) {
self.no_result();
}
+ self.trigger('kanban_groups_processed');
});
});
},
self.do_clear_groups();
self.dataset.read_slice(self.fields_keys.concat(['__last_update']), { 'limit': self.limit }).done(function(records) {
var kgroup = new instance.web_kanban.KanbanGroup(self, records, null, self.dataset);
+ if (!_.isEmpty(self.dataset.ids) && (self.dataset.index === null || self.dataset.index >= self.dataset.ids.length)) {
+ self.dataset.index = 0;
+ } else if (_.isEmpty(self.dataset.ids)){
+ self.dataset.index = null;
+ }
self.do_add_groups([kgroup]).done(function() {
if (_.isEmpty(records)) {
self.no_result();
}
+ self.trigger('kanban_dataset_processed');
def.resolve();
});
}).done(null, function() {
stop: function(event, ui) {
var stop_index = ui.item.index();
if (start_index !== stop_index) {
- var $start_column = $('.oe_kanban_groups_records .oe_kanban_column').eq(start_index);
- var $stop_column = $('.oe_kanban_groups_records .oe_kanban_column').eq(stop_index);
+ var $start_column = self.$('.oe_kanban_groups_records .oe_kanban_column').eq(start_index);
+ var $stop_column = self.$('.oe_kanban_groups_records .oe_kanban_column').eq(stop_index);
var method = (start_index > stop_index) ? 'insertBefore' : 'insertAfter';
$start_column[method]($stop_column);
var tmp_group = self.groups.splice(start_index, 1)[0];
* open on form/edit view : oe_kanban_global_click_edit
*/
on_card_clicked: function(ev) {
- if(this.$el.find('.oe_kanban_global_click_edit').size()>0)
+ if (this.$el.find('.oe_kanban_global_click').size() > 0 && this.$el.find('.oe_kanban_global_click').data('routing')) {
+ instance.web.redirect(this.$el.find('.oe_kanban_global_click').data('routing') + "/" + this.id);
+ }
+ else if (this.$el.find('.oe_kanban_global_click_edit').size()>0)
this.do_action_edit();
else
this.do_action_open();
var button_attrs = $action.data();
this.view.do_execute_action(button_attrs, this.view.dataset, this.id, this.do_reload);
},
+ do_action_url: function($action) {
+ return instance.web.redirect($action.attr("href"));
+ },
do_reload: function() {
var self = this;
this.view.dataset.read_ids([this.id], this.view.fields_keys.concat(['__last_update'])).done(function(records) {
*/
instance.web_kanban.QuickCreate = instance.web.Widget.extend({
template: 'KanbanView.quick_create',
-
+
/**
* close_btn: If true, the widget will display a "Close" button able to trigger
* a "close" event.