[IMP] kanban view:- implement functionality of button type.
bzr revid: ysa@tinyerp.com-20110810110943-c1190qk7gbe5bbtq
This commit is contained in:
parent
0fa64ff6ed
commit
fcacc05042
|
@ -57,7 +57,6 @@ openerp.base.ActionManager = openerp.base.Widget.extend({
|
|||
}
|
||||
},
|
||||
do_action: function(action, on_closed) {
|
||||
console.log("action",action);
|
||||
var type = action.type.replace(/\./g,'_');
|
||||
var popup = action.target === 'new';
|
||||
action.flags = _.extend({
|
||||
|
@ -232,7 +231,7 @@ openerp.base.ViewManager = openerp.base.Widget.extend({
|
|||
},
|
||||
/**
|
||||
* Event launched when a controller has been inited.
|
||||
*
|
||||
*
|
||||
* @param {String} view_type type of view
|
||||
* @param {String} view the inited controller
|
||||
*/
|
||||
|
@ -506,13 +505,13 @@ openerp.base.View = openerp.base.Widget.extend({
|
|||
return this.rpc('/base/action/load', { action_id: parseInt(action_data.name, 10), context: context }, handler);
|
||||
} else {
|
||||
return dataset.exec_workflow(record_id, action_data.name, handler);
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Directly set a view to use instead of calling fields_view_get. This method must
|
||||
* be called before start(). When an embedded view is set, underlying implementations
|
||||
* of openerp.base.View must use the provided view instead of any other one.
|
||||
*
|
||||
*
|
||||
* @param embedded_view A view.
|
||||
*/
|
||||
set_embedded_view: function(embedded_view) {
|
||||
|
|
|
@ -50,22 +50,6 @@ openerp.base_kanban.KanbanView = openerp.base.View.extend({
|
|||
},
|
||||
stop: self.on_recieve_record,
|
||||
});
|
||||
this.$element.find('button').click(function(){
|
||||
var record_id = $(this).closest(".record").attr("id");
|
||||
if(record_id) {
|
||||
record_id = parseInt(record_id.split("_")[1])
|
||||
if(record_id) {
|
||||
if($(this).data("type") == "delete") {
|
||||
self.do_delete(record_id);
|
||||
}
|
||||
else{
|
||||
var button_attrs = $(this).data()
|
||||
self.on_button_click(button_attrs, record_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.$element.find(".record").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
|
||||
.find(".record-header")
|
||||
.addClass("ui-widget-header ui-corner-all")
|
||||
|
@ -143,11 +127,14 @@ openerp.base_kanban.KanbanView = openerp.base.View.extend({
|
|||
this.execute_action(
|
||||
button_attrs, this.dataset, this.session.action_manager,
|
||||
record_id, function () {
|
||||
self.do_change_data();
|
||||
});
|
||||
},
|
||||
|
||||
do_change_data: function() {
|
||||
_.each(self.all_display_data, function(data, index) {
|
||||
self.dataset.read_ids( data.ids, [], function(records){
|
||||
self.all_display_data[index].records = records;
|
||||
self.on_reload_kanban();
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
on_close_action: function(e) {
|
||||
|
@ -230,7 +217,7 @@ openerp.base_kanban.KanbanView = openerp.base.View.extend({
|
|||
}
|
||||
}
|
||||
if(self.flag) {
|
||||
self.on_reload_kanban(this.all_display_data);
|
||||
self.on_reload_kanban();
|
||||
}
|
||||
this.source_index = {};
|
||||
},
|
||||
|
@ -254,6 +241,21 @@ openerp.base_kanban.KanbanView = openerp.base.View.extend({
|
|||
}
|
||||
});
|
||||
this.$element.find( ".oe_table_column " ).css("width", 99 / self.all_display_data.length +"%");
|
||||
this.$element.find('button').click(function(){
|
||||
var record_id = $(this).closest(".record").attr("id");
|
||||
if(record_id) {
|
||||
record_id = parseInt(record_id.split("_")[1])
|
||||
if(record_id) {
|
||||
if($(this).data("type") == "delete") {
|
||||
self.do_delete(record_id);
|
||||
}
|
||||
else{
|
||||
var button_attrs = $(this).data()
|
||||
self.on_button_click(button_attrs, record_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
do_search: function (domains, contexts, group_by) {
|
||||
|
|
Loading…
Reference in New Issue