Browse Source

Merge pull request #4 from guewen/web_translate_dialog-no-readonly

[IMP] do not display readonly translatable fields in the translate dialog
pull/9/merge
Holger Brunn 11 years ago
parent
commit
865d1f340f
  1. 8
      web_translate_dialog/static/src/js/web_translate_dialog.js
  2. 2
      web_translate_dialog/static/src/xml/base.xml

8
web_translate_dialog/static/src/js/web_translate_dialog.js

@ -43,7 +43,10 @@ openerp.web_translate_dialog = function (instance) {
this.view_type = parent.fields_view.type || '';
this.$view_form = null;
this.$sidebar_form = null;
this.translatable_fields_keys = _.map(this.view.translatable_fields || [], function(i) { return i.name;});
this.translatable_fields = _.filter(this.view.translatable_fields || [],
this.filter_translatable_fields);
this.translatable_fields_keys = _.map(this.translatable_fields,
function(i) { return i.name;});
this.languages = null;
this.languages_loaded = $.Deferred();
(new instance.web.DataSetSearch(this,
@ -53,6 +56,9 @@ openerp.web_translate_dialog = function (instance) {
.read_slice(['code', 'name'], { sort: 'id' })
.then(this.on_languages_loaded);
},
filter_translatable_fields: function(field) {
return !field.field.readonly;
},
on_languages_loaded: function(langs) {
this.languages = langs;
this.languages_loaded.resolve();

2
web_translate_dialog/static/src/xml/base.xml

@ -10,7 +10,7 @@
<div class="separator horizontal"><t t-esc="name"/></div>
</th>
</tr>
<tr t-foreach="widget.view.translatable_fields" t-as="field" t-att-data-field="field.name">
<tr t-foreach="widget.translatable_fields" t-as="field" t-att-data-field="field.name">
<td class="oe_form_frame_cell" width="1%" nowrap="nowrap">
<label class="oe_label"><t t-esc="field.string"/>:</label>
</td>

Loading…
Cancel
Save