[IMP] Added datetime and date picker to custom filters.

bzr revid: nicolas.vanhoren@openerp.com-20110519155302-qfthbnkic2qfzmf1
This commit is contained in:
niv-openerp 2011-05-19 17:53:02 +02:00
parent 604434f322
commit 50434b10bc
2 changed files with 37 additions and 15 deletions

View File

@ -696,11 +696,6 @@ openerp.base.search.ManyToManyField = openerp.base.search.IntegerField.extend({
// TODO: .related_columns (Array), .context, .domain
});
openerp.base.search.custom_filters = new openerp.base.Registry({
'char': 'openerp.base.search.ExtendedSearchProposition.Char',
'datetime': 'openerp.base.search.ExtendedSearchProposition.DateTime'
});
openerp.base.search.ExtendedSearch = openerp.base.BaseWidget.extend({
template: 'SearchView.extended_search',
identifier_prefix: 'extended-search',
@ -873,7 +868,7 @@ openerp.base.search.ExtendedSearchProposition.Char = openerp.base.BaseWidget.ext
}
});
openerp.base.search.ExtendedSearchProposition.DateTime = openerp.base.BaseWidget.extend({
template: 'SearchView.extended_search.proposition.char',
template: 'SearchView.extended_search.proposition.datetime',
identifier_prefix: 'extended-search-proposition-datetime',
operators: [
{value: "=", text: "is equal to"},
@ -884,19 +879,45 @@ openerp.base.search.ExtendedSearchProposition.DateTime = openerp.base.BaseWidget
{value: "<=", text: "less or equal than"}
],
get_value: function() {
var val = this.$element.val();
debugger;
return val;
return this.$element.val();
},
render: function(add) {
this._super(add);
this.$element.find('input').datetimepicker({
start: function() {
this._super();
this.$element.datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: 'hh:mm:ss'
});
}
});
openerp.base.search.ExtendedSearchProposition.Date = openerp.base.BaseWidget.extend({
template: 'SearchView.extended_search.proposition.date',
identifier_prefix: 'extended-search-proposition-date',
operators: [
{value: "=", text: "is equal to"},
{value: "!=", text: "is not equal to"},
{value: ">", text: "greater than"},
{value: "<", text: "less than"},
{value: ">=", text: "greater or equal than"},
{value: "<=", text: "less or equal than"}
],
get_value: function() {
return this.$element.val();
},
start: function() {
this._super();
this.$element.datepicker({
dateFormat: 'yy-mm-dd',
timeFormat: 'hh:mm:ss'
});
}
});
openerp.base.search.custom_filters = new openerp.base.Registry({
'char': 'openerp.base.search.ExtendedSearchProposition.Char',
'datetime': 'openerp.base.search.ExtendedSearchProposition.DateTime',
'date': 'openerp.base.search.ExtendedSearchProposition.Date'
});
};
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:

View File

@ -576,9 +576,10 @@
<input t-att-id="element_id"/>
</t>
<t t-name="SearchView.extended_search.proposition.datetime">
<input type="text"
t-att-id="element_id"
/>
<input t-att-id="element_id" class="field_datetime"/>
</t>
<t t-name="SearchView.extended_search.proposition.date">
<input t-att-id="element_id" class="field_date"/>
</t>
<t t-name="ViewManager.sidebar">
<div t-att-id="element_id" class="sidebar-main-div closed-sidebar">