bzr revid: nicolas.vanhoren@openerp.com-20110630123204-nhccni0tvm1bk4bb
This commit is contained in:
niv-openerp 2011-06-30 14:32:04 +02:00
commit eceae3def4
5 changed files with 35 additions and 12 deletions

View File

@ -773,13 +773,14 @@ background: linear-gradient(top, #ffffff 0%,#d8d8d8 11%,#afafaf 86%,#333333 91%,
position: relative;
vertical-align: top;
}
.openerp input.field_date, .openerp input.field_datetime {
background: #fff url('../img/ui/field_calendar.png') no-repeat right center;
background-origin: content-box;
-moz-background-origin: content;
-moz-background-origin: content-box;
-webkit-background-origin: content-box;
.openerp img.ui-datepicker-trigger, .openerp img.ui-datepicker-trigger {
margin-left: -20px;
vertical-align: middle;
cursor: pointer;
position: relative;
top: -1px;
}
/* http://www.quirksmode.org/dom/inputfile.html
* http://stackoverflow.com/questions/2855589/replace-input-type-file-by-an-image
*/

View File

@ -879,12 +879,17 @@ openerp.base.form.FieldDatetime = openerp.base.form.Field.extend({
this._super(view, node);
this.template = "FieldDate";
this.jqueryui_object = 'datetimepicker';
this.validation_regex = /^\d+-\d+-\d+( \d+:\d+(:\d+)?)?$/;
},
start: function() {
this._super.apply(this, arguments);
this.$element.find('input').change(this.on_ui_change)[this.jqueryui_object]({
dateFormat: 'yy-mm-dd',
timeFormat: 'hh:mm:ss'
timeFormat: 'hh:mm:ss',
showOn: 'button',
buttonImage: '/base/static/src/img/ui/field_calendar.png',
buttonImageOnly: true,
constrainInput: false
});
},
set_value: function(value) {
@ -904,8 +909,20 @@ openerp.base.form.FieldDatetime = openerp.base.form.Field.extend({
this.value = this.format(this.value);
}
},
update_dom: function() {
this._super.apply(this, arguments);
this.$element.find('input').attr('disabled', this.readonly);
},
validate: function() {
this.invalid = this.required && !this.$element.find('input')[this.jqueryui_object]('getDate');
this.invalid = false;
var value = this.$element.find('input').val();
if (value === "") {
this.invalid = this.required;
} else if (this.validation_regex) {
this.invalid = !this.validation_regex.test(value);
} else {
this.invalid = !this.$element.find('input')[this.jqueryui_object]('getDate');
}
},
focus: function() {
this.$element.find('input').focus();
@ -918,6 +935,7 @@ openerp.base.form.FieldDate = openerp.base.form.FieldDatetime.extend({
init: function(view, node) {
this._super(view, node);
this.jqueryui_object = 'datepicker';
this.validation_regex = /^\d+-\d+-\d+$/;
},
parse: openerp.base.parse_date,
format: openerp.base.format_date

View File

@ -427,6 +427,7 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
if (_.isEmpty(records)) {
records = this.groups.get_records();
if (records.constructor != Array) debugger
}
var count = 0, sums = {};
@ -934,6 +935,7 @@ openerp.base.ListView.Groups = Class.extend( /** @lends openerp.base.ListView.Gr
},
get_records: function () {
if (_(this.children).isEmpty()) {
alert("HERE")
return {
count: this.datagroup.length,
values: this.datagroup.aggregates

View File

@ -225,10 +225,10 @@ openerp.base.form.DashBoard = openerp.base.form.Widget.extend({
views_switcher : false,
action_buttons : false,
pager: false
}
var element_id = this.view.element_id + '_action_' + action.id;
var view = new openerp.base.ViewManagerAction(this.session, element_id, action);
view.start();
};
new openerp.base.ActionManager(
this.session, this.view.element_id + '_action_' + action.id)
.do_action(action);
},
render: function() {
// We should start with three columns available

View File

@ -7,6 +7,8 @@ can't be sent there themselves).
import binascii
import hashlib
import simplejson.encoder
import time
import datetime
__all__ = ['Domain', 'Context', 'NonLiteralEncoder, non_literal_decoder', 'CompoundDomain', 'CompoundContext']