diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2012-10-04 18:14:33 +0200 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2012-10-04 18:14:33 +0200 |
| commit | 8bc67000e62ac8757b1edd31d5db16e515fa2a72 (patch) | |
| tree | 0fdeedb2ea16cc2688bebb29c242efa071c49515 /addons/web/static/src/js | |
| parent | 18cc6542b63110ec2f63a5c2af14e903c14d5f28 (diff) | |
added default field manager
bzr revid: nicolas.vanhoren@openerp.com-20121004161433-pbtx50nk7hg4ihw0
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index f5e701a5dce..f180311f7a5 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1565,6 +1565,42 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt }, }); +/** + Welcome. + + If you read this documentation, it probably means that you were asked to use a form view widget outside of + a form view. Before going further, you must understand that those fields were never really created for + that usage. Don't think that this class will hold the answer to all your problems, at best it will allow + you to hack the system with more style. +*/ +instance.web.form.DefaultFieldManager = instance.web.CallbackEnabled.extend({ + init: function(parent, eval_context) { + this._super(parent); + this.field_descs = {}; + this.eval_context = eval_context || {}; + }, + get_field_desc: function(field_name) { + if (this.field_descs[field_name] === undefined) { + this.field_descs[field_name] = { + string: "I have no name", + }; + } + return this.field_descs[field_name]; + }, + get_field_value: function(field_name) { + return false; + }, + set_values: function(values) { + // nothing + }, + compute_domain: function(expression) { + return instance.web.form.compute_domain(expression, {}); + }, + build_eval_context: function() { + return new instance.web.CompoundContext(this.eval_context); + }, +}); + instance.web.form.FormDialog = instance.web.Dialog.extend({ init: function(parent, options, view_id, dataset) { this._super(parent, options); |
