[IMP] handling of config items: display all manual, cross those marked as done

bzr revid: xmo@openerp.com-20110729144227-l5nz6jqdxfy7jsic
This commit is contained in:
Xavier Morel 2011-07-29 16:42:27 +02:00
parent 483689d769
commit 3b00af2cde
3 changed files with 15 additions and 13 deletions

View File

@ -171,7 +171,9 @@
}
.openerp .oe-dashboard-config-overview li.oe-done {
cursor: default;
color: #999999;
text-decoration: line-through;
}
.openerp .oe-dashboard-layout_2-1 .index_0 .oe-dashboard-config-overview ul,

View File

@ -287,14 +287,12 @@ openerp.base_dashboard.ConfigOverview = openerp.base.View.extend({
this._super(parent, element_id);
this.dataset = new openerp.base.DataSetSearch(
this, 'ir.actions.todo');
this.dataset.domain = ['|', '&', ['type', '=', 'recurring'],
['state', '!=', 'hidden'],
'&', ['type', '!=', 'special'],
['state', '=', 'open']];
this.dataset.domain = [['type', '=', 'manual']];
},
start: function () {
$.when(this.dataset.read_slice(['state', 'action_id', 'category_id']),
this.dataset.call('progress')).then(this.on_records_loaded);
this.dataset.call('progress'))
.then(this.on_records_loaded);
},
on_records_loaded: function (read_response, progress_response) {
var records = read_response[0].records,
@ -321,15 +319,16 @@ openerp.base_dashboard.ConfigOverview = openerp.base.View.extend({
var self = this;
this.$element.find('div.oe-dashboard-config-overview ul')
.delegate('span.ui-icon', 'click', function (e) {
// cancel todo
.delegate('input', 'click', function (e) {
// switch todo status
e.stopImmediatePropagation();
var todo_id = $(this).parent().data('id');
self.dataset.write(todo_id, {state: 'hidden'}, function () {
var new_state = this.checked ? 'done' : 'open',
todo_id = parseInt($(this).val(), 10);
self.dataset.write(todo_id, {state: new_state}, function () {
self.start();
});
})
.delegate('li', 'click', function () {
.delegate('li:not(.oe-done)', 'click', function () {
self.execute_action({
type: 'object',
name: 'action_launch'

View File

@ -78,10 +78,11 @@
<li t-foreach="category_value" t-as="todo"
t-att-class="todo.done ? 'oe-done' : undefined"
t-att-data-id="todo.id"
t-att-title="'Execute action \'' + todo.name + '\''">
t-att-title="!todo.done ? 'Execute task \'' + todo.name + '\'' : undefined">
<input type="checkbox" t-att-value="todo.id"
t-att-title="!todo.done ? 'Mark this task as done' : undefined"
t-att-checked="todo.done ? 'checked' : undefined"/>
<t t-esc="todo.name"/>
<span class="ui-icon ui-icon-closethick"
title="Cancel task, remove it from list"/>
</li>
</ul></dd>
</t>