From 03c652fb0b7adeee8e9c6a1ee30b02f98a131896 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Fri, 13 Mar 2015 15:34:02 +0100 Subject: [PATCH] [IMP] support changing readonly state --- .../static/src/js/web_widget_x2many_2d_matrix.js | 13 +++++++++++++ .../static/src/xml/web_widget_x2many_2d_matrix.xml | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/web_widget_x2many_2d_matrix/static/src/js/web_widget_x2many_2d_matrix.js b/web_widget_x2many_2d_matrix/static/src/js/web_widget_x2many_2d_matrix.js index df8b4930..058a682e 100644 --- a/web_widget_x2many_2d_matrix/static/src/js/web_widget_x2many_2d_matrix.js +++ b/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() {}, diff --git a/web_widget_x2many_2d_matrix/static/src/xml/web_widget_x2many_2d_matrix.xml b/web_widget_x2many_2d_matrix/static/src/xml/web_widget_x2many_2d_matrix.xml index 2950439c..4f587e3f 100644 --- a/web_widget_x2many_2d_matrix/static/src/xml/web_widget_x2many_2d_matrix.xml +++ b/web_widget_x2many_2d_matrix/static/src/xml/web_widget_x2many_2d_matrix.xml @@ -16,8 +16,8 @@ - - + +