Merge lp:~openerp-dev/openerp-web/7.0-opw-602858-msh into lp:openerp-web/7.0

Proposed by Mohammed Shekha(Open ERP)
Status: Rejected
Rejected by: Martin Trigaux (OpenERP)
Proposed branch: lp:~openerp-dev/openerp-web/7.0-opw-602858-msh
Merge into: lp:openerp-web/7.0
Diff against target: 60 lines (+5/-9)
4 files modified
addons/web/static/src/css/base.css (+2/-2)
addons/web/static/src/css/base.sass (+1/-1)
addons/web/static/src/js/view_form.js (+2/-1)
addons/web/static/src/js/view_list_editable.js (+0/-5)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-opw-602858-msh
Reviewer Review Type Date Requested Status
Martin Trigaux (OpenERP) (community) Needs Fixing
Vinay Rana (OpenERP) Pending
Naresh(OpenERP) Pending
Review via email: mp+204480@code.launchpad.net

Description of the change

Hello,

Fixed the issue of readonly field not displayed in editable listview which creates issue with onchange result, result of onchange doesn't diplayed untill editable row is saved, the reason is we kept readonly field invisible in edition form and that's why that readonly field widget doesn't positioned as the place edition form and simple cell is displayed, onchange result calls set_value but value is set on hidden element which is not displayed on edition form, also considered some other scenarios like many2one throws after setting field to visible so checked if many2one field is effective_readonly, also span in current row should not be displayed in edition mode.

Demo:- Add one readonly field in any editable one2many listview and get the value of that field from onchange of another field, you will see when you change the value of the field, readonly field is not affected with value returned by onchange, when we save the whole line at that time we get the value of onchange.

Thanks.

To post a comment you must log in.
Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

Hrllo,

Why do you change the css ? It does not seem to have any impact.
With this patch the on_change put the value in the top-left corner, it should be put at the right (or at least in the middle-left side, not top).

review: Needs Fixing
Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

Also this is wrong to just remove the invisibility.
For instance go to a sale order, it will display the sequence number instead of the handle widget. Also this code was made to handle correctly the cases where a field goes from readonly to editable in a tree view (broken with your patch).

Regards

review: Needs Fixing

Unmerged revisions

4113. By Mohammed Shekha(OpenERP)<email address hidden>

[FIX]Web: Fixed the issue of readonly field not displayed which creates issue with onchange result, result of onchange doesn't diplayed untill editable row is saved, the reason is we kept readonly field invisible in edition form and that's why that readonly field widget doesn't positioned as the place edition form and simple cell is displayed, onchange result calls set_value but value is set on hidden element which is not displayed on edition form, also considered some other scenarios like many2one throws after setting field to visible so checked if many2one field is effective_readonly, also span in current row should not be displayed in edition mode.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/static/src/css/base.css'
2--- addons/web/static/src/css/base.css 2014-01-20 16:35:54 +0000
3+++ addons/web/static/src/css/base.css 2014-02-03 13:04:05 +0000
4@@ -2801,11 +2801,11 @@
5 .openerp .oe_list_editable .oe_list_content td.oe_list_field_cell {
6 padding: 4px 6px 3px;
7 }
8-.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) {
9+.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell {
10 color: transparent;
11 text-shadow: none;
12 }
13-.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) * {
14+.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell * {
15 visibility: hidden;
16 }
17 .openerp .oe_list.oe_list_editable.oe_editing .oe_m2o_drop_down_button {
18
19=== modified file 'addons/web/static/src/css/base.sass'
20--- addons/web/static/src/css/base.sass 2014-01-20 16:35:54 +0000
21+++ addons/web/static/src/css/base.sass 2014-02-03 13:04:05 +0000
22@@ -2207,7 +2207,7 @@
23 .oe_list_editable .oe_list_content td.oe_list_field_cell
24 padding: 4px 6px 3px
25 .oe_list.oe_list_editable.oe_editing
26- .oe_edition .oe_list_field_cell:not(.oe_readonly)
27+ .oe_edition .oe_list_field_cell
28 *
29 visibility: hidden
30 color: transparent
31
32=== modified file 'addons/web/static/src/js/view_form.js'
33--- addons/web/static/src/js/view_form.js 2014-01-20 16:01:47 +0000
34+++ addons/web/static/src/js/view_form.js 2014-02-03 13:04:05 +0000
35@@ -3387,7 +3387,8 @@
36 },
37 set_dimensions: function (height, width) {
38 this._super(height, width);
39- this.$input.css('height', height);
40+ if (!this.get("effective_readonly") && this.$input)
41+ this.$input.css('height', height);
42 }
43 });
44
45
46=== modified file 'addons/web/static/src/js/view_list_editable.js'
47--- addons/web/static/src/js/view_list_editable.js 2013-12-18 15:26:26 +0000
48+++ addons/web/static/src/js/view_list_editable.js 2014-02-03 13:04:05 +0000
49@@ -440,11 +440,6 @@
50 setup_events: function () {
51 var self = this;
52 _.each(this.editor.form.fields, function(field, field_name) {
53- var set_invisible = function() {
54- field.set({'force_invisible': field.get('effective_readonly')});
55- };
56- field.on("change:effective_readonly", self, set_invisible);
57- set_invisible();
58 field.on('change:effective_invisible', self, function () {
59 if (field.get('effective_invisible')) { return; }
60 var item = _(self.fields_for_resize).find(function (item) {