summaryrefslogtreecommitdiff
path: root/addons/base/static/src/js/form.js
diff options
context:
space:
mode:
authorFabien Meghazi <fme@openerp.com>2011-08-24 17:13:57 +0200
committerFabien Meghazi <fme@openerp.com>2011-08-24 17:13:57 +0200
commitffeff63fb69e64ecdb62810c5c1d7d4fc9d80239 (patch)
tree29836ab9fc85a542a52e844d99875e6b7ded800d /addons/base/static/src/js/form.js
parent88200c8bbfe252b5ec8ce8f41e137eb8a289c244 (diff)
[ADD] Translate dialog (WIP)
bzr revid: fme@openerp.com-20110824151357-nln9mnkw13uyng32
Diffstat (limited to 'addons/base/static/src/js/form.js')
-rw-r--r--addons/base/static/src/js/form.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/addons/base/static/src/js/form.js b/addons/base/static/src/js/form.js
index 5da048a17b9..7a4d3c92d89 100644
--- a/addons/base/static/src/js/form.js
+++ b/addons/base/static/src/js/form.js
@@ -38,6 +38,7 @@ openerp.base.FormView = openerp.base.View.extend( /** @lends openerp.base.FormVi
this.registry = openerp.base.form.widgets;
this.has_been_loaded = $.Deferred();
this.$form_header = null;
+ this.translatable_fields = [];
_.defaults(this.options, {"always_show_new_button": true});
},
start: function() {
@@ -461,7 +462,7 @@ openerp.base.form.SidebarAttachments = openerp.base.Widget.extend({
['res_model', '=', this.view.dataset.model],
['res_id', '=', this.view.datarecord.id],
['type', 'in', ['binary', 'url']]
- ])).read_slice(['name', 'url', 'type'], this.on_attachments_loaded);
+ ])).read_slice(['name', 'url', 'type'], {}, this.on_attachments_loaded);
}
},
on_attachments_loaded: function(attachments) {
@@ -839,6 +840,13 @@ openerp.base.form.Field = openerp.base.form.Widget.extend({
this.invalid = false;
this.dirty = false;
},
+ start: function() {
+ this._super.apply(this, arguments);
+ if (this.field.translate) {
+ this.view.translatable_fields.push(this);
+ this.$element.find('.oe_field_translate').click(this.on_translate);
+ }
+ },
set_value: function(value) {
this.value = value;
this.invalid = false;
@@ -850,6 +858,9 @@ openerp.base.form.Field = openerp.base.form.Widget.extend({
},
on_value_changed: function() {
},
+ on_translate: function() {
+ this.view.open_translate_dialog(this);
+ },
get_value: function() {
return this.value;
},