[ADD] trivial handling of private/public filters
bzr revid: xmo@openerp.com-20120510190439-o9s20f10pmcukefu
This commit is contained in:
parent
978eae621d
commit
cfdcd92ecc
|
@ -1502,7 +1502,10 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({
|
|||
var id = filter.id;
|
||||
$filter = this.filters[key] = $('<li></li>')
|
||||
.appendTo(this.$element.find('.oe_searchview_custom_list'))
|
||||
.addClass(filter.user_id ? 'oe_searchview_custom_private'
|
||||
: 'oe_searchview_custom_public')
|
||||
.text(filter.name);
|
||||
|
||||
$('<button type="button">').appendTo($filter)
|
||||
.text(_t("Delete"))
|
||||
.click(function () {
|
||||
|
@ -1530,7 +1533,8 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({
|
|||
},
|
||||
save_current: function () {
|
||||
var self = this;
|
||||
var $name = this.$element.find('input');
|
||||
var $name = this.$element.find('input:first');
|
||||
var private_filter = this.$element.find('input:last').prop('checked');
|
||||
|
||||
var search = this.view.build_search_data();
|
||||
this.rpc('/web/session/eval_domain_and_context', {
|
||||
|
@ -1543,8 +1547,7 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({
|
|||
}
|
||||
var filter = {
|
||||
name: $name.val(),
|
||||
// FIXME: optional on public/private checkbox
|
||||
user_id: instance.connection.uid,
|
||||
user_id: private_filter ? instance.connection.uid : false,
|
||||
model_id: self.view.model,
|
||||
context: results.context,
|
||||
domain: results.domain
|
||||
|
|
|
@ -1472,9 +1472,12 @@
|
|||
</div>
|
||||
<div t-name="SearchView.CustomFilters" class="oe_searchview_custom">
|
||||
<ul class="oe_searchview_custom_list"/>
|
||||
<form>
|
||||
<label for="oe_searchview_custom_input">Save current search:</label>
|
||||
<form class="oe_searchview_custom_closed">
|
||||
<label for="oe_searchview_custom_input" class="oe_searchview_custom_title">
|
||||
Save current search</label>
|
||||
<input id="oe_searchview_custom_input"/>
|
||||
<label for="oe_searchview_custom_private">Private: </label>
|
||||
<input id="oe_searchview_custom_private" type="checkbox" checked="checked"/>
|
||||
<button class="oe_searchview_custom_save">Save</button>
|
||||
</form>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue