Browse Source

Do not display readonly translatable fields in the translate dialog

pull/4/head
Guewen Baconnier 11 years ago
parent
commit
c2174496cd
  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_type = parent.fields_view.type || '';
this.$view_form = null; this.$view_form = null;
this.$sidebar_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 = null;
this.languages_loaded = $.Deferred(); this.languages_loaded = $.Deferred();
(new instance.web.DataSetSearch(this, (new instance.web.DataSetSearch(this,
@ -53,6 +56,9 @@ openerp.web_translate_dialog = function (instance) {
.read_slice(['code', 'name'], { sort: 'id' }) .read_slice(['code', 'name'], { sort: 'id' })
.then(this.on_languages_loaded); .then(this.on_languages_loaded);
}, },
filter_translatable_fields: function(field) {
return !field.field.readonly;
},
on_languages_loaded: function(langs) { on_languages_loaded: function(langs) {
this.languages = langs; this.languages = langs;
this.languages_loaded.resolve(); 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> <div class="separator horizontal"><t t-esc="name"/></div>
</th> </th>
</tr> </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"> <td class="oe_form_frame_cell" width="1%" nowrap="nowrap">
<label class="oe_label"><t t-esc="field.string"/>:</label> <label class="oe_label"><t t-esc="field.string"/>:</label>
</td> </td>

Loading…
Cancel
Save