[FIX] corrected some old code about focus
bzr revid: nicolas.vanhoren@openerp.com-20120726154716-1sua5q2teqeba7r0
This commit is contained in:
parent
b4565d0f48
commit
781fbd3a26
|
@ -194,8 +194,9 @@ class WebClient(openerpweb.Controller):
|
||||||
if mods is not None:
|
if mods is not None:
|
||||||
path += '?mods=' + mods
|
path += '?mods=' + mods
|
||||||
return [path]
|
return [path]
|
||||||
sugar = req.httprequest.environ["QUERY_STRING"].count("no_sugar") == 0
|
no_sugar = req.httprequest.environ["QUERY_STRING"].count("no_sugar") >= 1
|
||||||
if sugar:
|
no_sugar = no_sugar or req.httprequest.environ.get('HTTP_REFERER', '').count("no_sugar") >= 1
|
||||||
|
if not no_sugar:
|
||||||
return ['%s?debug=%s' % (wp, os.path.getmtime(fp)) for fp, wp in self.manifest_glob(req, mods, extension)]
|
return ['%s?debug=%s' % (wp, os.path.getmtime(fp)) for fp, wp in self.manifest_glob(req, mods, extension)]
|
||||||
else:
|
else:
|
||||||
return [el[1] for el in self.manifest_glob(req, mods, extension)]
|
return [el[1] for el in self.manifest_glob(req, mods, extension)]
|
||||||
|
|
|
@ -647,11 +647,12 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
||||||
});
|
});
|
||||||
var fields_order = self.fields_order.slice(0);
|
var fields_order = self.fields_order.slice(0);
|
||||||
if (self.default_focus_field) {
|
if (self.default_focus_field) {
|
||||||
fields_order.unshift(self.default_focus_field);
|
fields_order.unshift(self.default_focus_field.name);
|
||||||
}
|
}
|
||||||
for (var i = 0; i < fields_order.length; i += 1) {
|
for (var i = 0; i < fields_order.length; i += 1) {
|
||||||
var field = self.fields[fields_order[i]];
|
var field = self.fields[fields_order[i]];
|
||||||
if (!field.get('effective_invisible') && !field.get('effective_readonly') && field.focus() !== false) {
|
if (!field.get('effective_invisible') && !field.get('effective_readonly')) {
|
||||||
|
field.focus();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -986,7 +987,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
||||||
register_field: function(field, name) {
|
register_field: function(field, name) {
|
||||||
this.fields[name] = field;
|
this.fields[name] = field;
|
||||||
this.fields_order.push(name);
|
this.fields_order.push(name);
|
||||||
if (field.node.attrs.default_focus == '1') {
|
if (JSON.parse(field.node.attrs.default_focus || "0")) {
|
||||||
this.default_focus_field = field;
|
this.default_focus_field = field;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1692,7 +1693,7 @@ instance.web.form.WidgetButton = instance.web.form.FormWidget.extend({
|
||||||
this._super(view, node);
|
this._super(view, node);
|
||||||
this.force_disabled = false;
|
this.force_disabled = false;
|
||||||
this.string = (this.node.attrs.string || '').replace(/_/g, '');
|
this.string = (this.node.attrs.string || '').replace(/_/g, '');
|
||||||
if (this.node.attrs.default_focus == '1') {
|
if (JSON.parse(this.node.attrs.default_focus || "0")) {
|
||||||
// TODO fme: provide enter key binding to widgets
|
// TODO fme: provide enter key binding to widgets
|
||||||
this.view.default_focus_button = this;
|
this.view.default_focus_button = this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue