[IMP] Add new button in kanban view for create new record. fix some problem on action.

bzr revid: ysa@tinyerp.com-20110816072039-vfru2b235ry2nji8
This commit is contained in:
Yogesh (OpenERP) 2011-08-16 12:50:39 +05:30
parent d56065d787
commit b0e182e7a5
3 changed files with 14 additions and 0 deletions

View File

@ -578,6 +578,7 @@ openerp.base.form.Widget = openerp.base.Widget.extend({
this.$element = $('#' + this.element_id); this.$element = $('#' + this.element_id);
}, },
stop: function() { stop: function() {
this.$element = $('#' + this.element_id);
this.$element.remove(); this.$element.remove();
}, },
process_modifiers: function() { process_modifiers: function() {

View File

@ -21,6 +21,7 @@ openerp.base_kanban.KanbanView = openerp.base.View.extend({
this.rpc("/base_kanban/kanbanview/load", this.rpc("/base_kanban/kanbanview/load",
{"model": this.model, "view_id": this.view_id}, this.on_loaded); {"model": this.model, "view_id": this.view_id}, this.on_loaded);
}, },
on_loaded: function(data) { on_loaded: function(data) {
var self = this; var self = this;
this.template_xml = ''; this.template_xml = '';
@ -67,6 +68,7 @@ openerp.base_kanban.KanbanView = openerp.base.View.extend({
}); });
this.$element.find('.record .ui-icon-closethick').click(this.on_close_action); this.$element.find('.record .ui-icon-closethick').click(this.on_close_action);
this.$element.find(".oe_column").disableSelection(); this.$element.find(".oe_column").disableSelection();
this.$element.find('button.oe_kanban_button_new').click(this.do_add_record);
}, },
on_button_click: function(button_attrs, record_id){ on_button_click: function(button_attrs, record_id){
@ -102,6 +104,10 @@ openerp.base_kanban.KanbanView = openerp.base.View.extend({
} }
}, },
do_add_record: function () {
this.do_edit_record(this.dataset, null);
},
do_edit_record: function (dataset, index) { do_edit_record: function (dataset, index) {
var self = this; var self = this;
_.extend(this.dataset, { _.extend(this.dataset, {

View File

@ -1,6 +1,13 @@
<template> <template>
<t t-name="KanbanBiew"> <t t-name="KanbanBiew">
<table style="width:100%;" id="kanbanview"> <table style="width:100%;" id="kanbanview">
<tr>
<td>
<div class="oe_form_header">
<button type="button" class="oe_kanban_button_new">New</button>
</div>
</td>
</tr>
<tr> <tr>
<t t-foreach="datas" t-as="columns"> <t t-foreach="datas" t-as="columns">
<td class="oe_table_column oe_column_heading" t-att-id="'column_' + columns.value"> <td class="oe_table_column oe_column_heading" t-att-id="'column_' + columns.value">