From c5ac762b2062ca7626ed85b0321450b87d073e0c Mon Sep 17 00:00:00 2001
From: niv-openerp
Date: Thu, 8 Sep 2011 17:06:45 +0200
Subject: [PATCH] [imp] setup of templates for status widget
bzr revid: nicolas.vanhoren@openerp.com-20110908150645-uqj6f9f5icnsf3jx
---
addons/web/static/src/js/form.js | 50 ++++--------------------------
addons/web/static/src/xml/base.xml | 6 ++++
2 files changed, 12 insertions(+), 44 deletions(-)
diff --git a/addons/web/static/src/js/form.js b/addons/web/static/src/js/form.js
index 232cc7fbb30..3462f8f67ef 100644
--- a/addons/web/static/src/js/form.js
+++ b/addons/web/static/src/js/form.js
@@ -2479,55 +2479,17 @@ openerp.web.form.FieldBinaryImage = openerp.web.form.FieldBinary.extend({
});
openerp.web.form.FieldStatus = openerp.web.form.Field.extend({
- init: function(view, node) {
- var self = this;
- this._super(view, node);
- this.template = "FieldSelection";
- this.values = this.field.selection;
- _.each(this.values, function(v, i) {
- if (v[0] === false && v[1] === '') {
- self.values.splice(i, 1);
- }
- });
- this.values.unshift([false, '']);
- },
+ template: "FieldStatus",
start: function() {
- var ischanging = false;
- this._super.apply(this, arguments);
- this.$element.find('select')
- .change(this.on_ui_change)
- .change(function () { ischanging = true; })
- .click(function () { ischanging = false; })
- .keyup(function (e) {
- if (e.which !== 13 || !ischanging) { return; }
- e.stopPropagation();
- ischanging = false;
- });
+ this._super();
+ this.render_list();
},
set_value: function(value) {
- value = value === null ? false : value;
- value = value instanceof Array ? value[0] : value;
this._super(value);
- var index = 0;
- for (var i = 0, ii = this.values.length; i < ii; i++) {
- if (this.values[i][0] === value) index = i;
- }
- this.$element.find('select')[0].selectedIndex = index;
+ this.render_list();
},
- set_value_from_ui: function() {
- this.value = this.values[this.$element.find('select')[0].selectedIndex][0];
- this._super();
- },
- update_dom: function() {
- this._super.apply(this, arguments);
- this.$element.find('select').attr('disabled', this.readonly);
- },
- validate: function() {
- var value = this.values[this.$element.find('select')[0].selectedIndex];
- this.invalid = !(value && !(this.required && value[0] === false));
- },
- focus: function() {
- this.$element.find('select').focus();
+ render_list: function() {
+ this.$element.html("Youpsla");
}
});
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 7a6610850b3..55fc09c6e47 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -1376,5 +1376,11 @@
Depending on your needs, OpenERP is available through a web or application client.
+
+
+
+
+
+