Browse Source

[IMP] support changing readonly state

pull/96/head
Holger Brunn 10 years ago
parent
commit
d91b99e6b8
  1. 13
      web_widget_x2many_2d_matrix/static/src/js/web_widget_x2many_2d_matrix.js
  2. 4
      web_widget_x2many_2d_matrix/static/src/xml/web_widget_x2many_2d_matrix.xml

13
web_widget_x2many_2d_matrix/static/src/js/web_widget_x2many_2d_matrix.js

@ -317,9 +317,22 @@ openerp.web_widget_x2many_2d_matrix = function(instance)
});
this.compute_totals();
this.setup_many2one_axes();
this.on("change:effective_readonly",
this, this.proxy(this.effective_readonly_change));
this.effective_readonly_change();
return this._super.apply(this, arguments);
},
effective_readonly_change: function()
{
this.$el
.find('tbody td.oe_list_field_cell span.oe_form_field>input')
.toggle(!this.get('effective_readonly'));
this.$el
.find('tbody td.oe_list_field_cell span.oe_form_field>span')
.toggle(this.get('effective_readonly'));
},
// deactivate view related functions
load_views: function() {},
reload_current_view: function() {},

4
web_widget_x2many_2d_matrix/static/src/xml/web_widget_x2many_2d_matrix.xml

@ -16,8 +16,8 @@
<th><t t-esc="widget.get_y_axis_label(y)" /></th>
<td t-foreach="widget.get_x_axis_values()" t-as="x" t-att-class="'oe_list_field_cell' + (widget.is_numeric ? ' oe_number' : '')">
<span t-att-class="widget.get_xy_value_class()">
<input t-if="!widget.get('effective_readonly')" t-att-data-x="x" t-att-data-y="y" t-att-data-id="widget.get_xy_id(x, y)" t-att-value="widget.format_xy_value(widget.get_xy_value(x, y))" />
<t t-if="widget.get('effective_readonly')" t-esc="widget.format_xy_value(widget.get_xy_value(x, y))" />
<input style="display: none" t-att-data-x="x" t-att-data-y="y" t-att-data-id="widget.get_xy_id(x, y)" t-att-value="widget.format_xy_value(widget.get_xy_value(x, y))" />
<span style="display: none"><t t-esc="widget.format_xy_value(widget.get_xy_value(x, y))" /></span>
</span>
</td>
<td t-if="widget.show_row_totals" class="row_total oe_number" t-att-data-y="y"/>

Loading…
Cancel
Save