[IMP] Added datetime and date picker to custom filters.
bzr revid: nicolas.vanhoren@openerp.com-20110519155302-qfthbnkic2qfzmf1
This commit is contained in:
parent
604434f322
commit
50434b10bc
|
@ -696,11 +696,6 @@ openerp.base.search.ManyToManyField = openerp.base.search.IntegerField.extend({
|
||||||
// TODO: .related_columns (Array), .context, .domain
|
// 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({
|
openerp.base.search.ExtendedSearch = openerp.base.BaseWidget.extend({
|
||||||
template: 'SearchView.extended_search',
|
template: 'SearchView.extended_search',
|
||||||
identifier_prefix: '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({
|
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',
|
identifier_prefix: 'extended-search-proposition-datetime',
|
||||||
operators: [
|
operators: [
|
||||||
{value: "=", text: "is equal to"},
|
{value: "=", text: "is equal to"},
|
||||||
|
@ -884,19 +879,45 @@ openerp.base.search.ExtendedSearchProposition.DateTime = openerp.base.BaseWidget
|
||||||
{value: "<=", text: "less or equal than"}
|
{value: "<=", text: "less or equal than"}
|
||||||
],
|
],
|
||||||
get_value: function() {
|
get_value: function() {
|
||||||
var val = this.$element.val();
|
return this.$element.val();
|
||||||
debugger;
|
|
||||||
return val;
|
|
||||||
},
|
},
|
||||||
render: function(add) {
|
start: function() {
|
||||||
this._super(add);
|
this._super();
|
||||||
this.$element.find('input').datetimepicker({
|
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',
|
dateFormat: 'yy-mm-dd',
|
||||||
timeFormat: 'hh:mm:ss'
|
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:
|
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
|
||||||
|
|
|
@ -576,9 +576,10 @@
|
||||||
<input t-att-id="element_id"/>
|
<input t-att-id="element_id"/>
|
||||||
</t>
|
</t>
|
||||||
<t t-name="SearchView.extended_search.proposition.datetime">
|
<t t-name="SearchView.extended_search.proposition.datetime">
|
||||||
<input type="text"
|
<input t-att-id="element_id" class="field_datetime"/>
|
||||||
t-att-id="element_id"
|
</t>
|
||||||
/>
|
<t t-name="SearchView.extended_search.proposition.date">
|
||||||
|
<input t-att-id="element_id" class="field_date"/>
|
||||||
</t>
|
</t>
|
||||||
<t t-name="ViewManager.sidebar">
|
<t t-name="ViewManager.sidebar">
|
||||||
<div t-att-id="element_id" class="sidebar-main-div closed-sidebar">
|
<div t-att-id="element_id" class="sidebar-main-div closed-sidebar">
|
||||||
|
|
Loading…
Reference in New Issue