[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;
|
var id = filter.id;
|
||||||
$filter = this.filters[key] = $('<li></li>')
|
$filter = this.filters[key] = $('<li></li>')
|
||||||
.appendTo(this.$element.find('.oe_searchview_custom_list'))
|
.appendTo(this.$element.find('.oe_searchview_custom_list'))
|
||||||
|
.addClass(filter.user_id ? 'oe_searchview_custom_private'
|
||||||
|
: 'oe_searchview_custom_public')
|
||||||
.text(filter.name);
|
.text(filter.name);
|
||||||
|
|
||||||
$('<button type="button">').appendTo($filter)
|
$('<button type="button">').appendTo($filter)
|
||||||
.text(_t("Delete"))
|
.text(_t("Delete"))
|
||||||
.click(function () {
|
.click(function () {
|
||||||
|
@ -1530,7 +1533,8 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({
|
||||||
},
|
},
|
||||||
save_current: function () {
|
save_current: function () {
|
||||||
var self = this;
|
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();
|
var search = this.view.build_search_data();
|
||||||
this.rpc('/web/session/eval_domain_and_context', {
|
this.rpc('/web/session/eval_domain_and_context', {
|
||||||
|
@ -1543,8 +1547,7 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({
|
||||||
}
|
}
|
||||||
var filter = {
|
var filter = {
|
||||||
name: $name.val(),
|
name: $name.val(),
|
||||||
// FIXME: optional on public/private checkbox
|
user_id: private_filter ? instance.connection.uid : false,
|
||||||
user_id: instance.connection.uid,
|
|
||||||
model_id: self.view.model,
|
model_id: self.view.model,
|
||||||
context: results.context,
|
context: results.context,
|
||||||
domain: results.domain
|
domain: results.domain
|
||||||
|
|
|
@ -1472,9 +1472,12 @@
|
||||||
</div>
|
</div>
|
||||||
<div t-name="SearchView.CustomFilters" class="oe_searchview_custom">
|
<div t-name="SearchView.CustomFilters" class="oe_searchview_custom">
|
||||||
<ul class="oe_searchview_custom_list"/>
|
<ul class="oe_searchview_custom_list"/>
|
||||||
<form>
|
<form class="oe_searchview_custom_closed">
|
||||||
<label for="oe_searchview_custom_input">Save current search:</label>
|
<label for="oe_searchview_custom_input" class="oe_searchview_custom_title">
|
||||||
|
Save current search</label>
|
||||||
<input id="oe_searchview_custom_input"/>
|
<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>
|
<button class="oe_searchview_custom_save">Save</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue