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

Proposed by Mohammed Shekha(Open ERP)
Status: Merged
Merge reported by: Mohammed Shekha(Open ERP)
Merged at revision: not available
Proposed branch: lp:~openerp-dev/openerp-web/7.0-opw-602858ReadonlyFieldsInEditableListview-msh
Merge into: lp:openerp-web/7.0
Diff against target: 222 lines (+55/-21)
4 files modified
addons/web/static/src/css/base.css (+29/-8)
addons/web/static/src/css/base.sass (+12/-1)
addons/web/static/src/js/view_form.js (+4/-2)
addons/web/static/src/js/view_list_editable.js (+10/-10)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-opw-602858ReadonlyFieldsInEditableListview-msh
Reviewer Review Type Date Requested Status
Mohammed Shekha(Open ERP) (community) Needs Resubmitting
Martin Trigaux (OpenERP) (community) Needs Fixing
Naresh(OpenERP) Pending
Xavier (Open ERP) Pending
Review via email: mp+212353@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.

We have this issues due to two layer, for readonly field we do not displays form fields from form layer instead we just show simple td with span.

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.

Removed this complication of two layersm instead displayed all form fields, even if it is readonly and cahnged css accordingly, also changd css for float, integer and handle widget as a specical case.

Thanks.

To post a comment you must log in.
4163. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4164. By Denis Ledoux (OpenERP)

[FIX] web: on record reload (form & list view), use search_read instead of read, to check if the user can still read the record (security rules)

4165. By Denis Ledoux (OpenERP)

[REVERT] 4164 revid:<email address hidden>: this fix actually works in saas-3, but not in 7.0, as search_read method is not part of the orm

4166. By Martin Trigaux (OpenERP)

[IMP] cookies: when retrieving session cookie, catch eventual parsing errors and remove cookie if incorrect (opw 605648)

In case of unparsable cookie (modified, corrupted,...), openerp would not load and crash with white screen until expiration.
With the fix goes back to login screen.

4167. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4168. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4169. By Martin Trigaux (OpenERP)

[MERGE] [FIX] upload widget: avoid overflow making impossible to click on other buttons than the first one (opw 603125)

4170. By Denis Ledoux (OpenERP)

[IMP] web: select input on add record in list editable

4171. By Denis Ledoux (OpenERP)

[FIX] web: impossible to click on attach button, for many2many_binary

This fix is related to revision 4169 revid:<email address hidden>

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

Hello,

Sorry but this still does not work. For instance go to "customer payment" view, add a line (where we have some readonly fields), you will get "Uncaught TypeError: Cannot read property '$input' of undefined".

Regards

review: Needs Fixing
4172. By Martin Trigaux (OpenERP)

[MERGE] [FIX] FormView: avoid multiple creations of the same line in o2m fields when the save action fails (e.g. forgot one required field)

This is done by removing the added action 'prepend_on_create' that can be present as many time as we pressed the save button

4173. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4174. By Denis Ledoux (OpenERP)

[FIX] web_kanban: show more button of kanban view behind the kanban cards on (ie9)

4175. By Denis Ledoux (OpenERP)

[FIX] web: double click on save button was trying to save the data two times if there is some latency

4176. By Denis Ledoux (OpenERP)

[FIX] web: double click on save button was trying to save the data two times if there is some latency, event target should be used instead of delegate target

4177. By Denis Ledoux (OpenERP)

[REVERT] web: 4174 revid:<email address hidden>, break the kanban drag and drop, which is far more important than the show more button wrongly displayed in ie.

4178. By Martin Trigaux (OpenERP)

[FIX] FieldMany2One: avoid error when saving changes in popup from a related fields (opw 606601)

4179. By Denis Ledoux (OpenERP)

[FIX] web: abitility to do exact id matching with child_of operator for searchs on many2one fields

4180. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4181. By Martin Trigaux (OpenERP)

[FIX] view: avoid propagation of context while executing an action

As the action could lead to unrelated model, keeping the defaults, groupby and ref do not make sense.
Backport of saas-2 revision 3872, 3891, 3892, 3893 and 3905

4182. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4183. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4184. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4185. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4186. By Mohammed Shekha(Open ERP)

[FIX]Web: Re-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,also fixed the issues of form view which sets dimension even in readonly.

Revision history for this message
Mohammed Shekha(Open ERP) (msh-openerp) wrote :

Hello Martin,

Thanks for your review.

I have re-fixed this issue described in comment 1.

Thanks.

review: Needs Resubmitting

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-04-09 09:34:22 +0000
3+++ addons/web/static/src/css/base.css 2014-05-12 05:39:08 +0000
4@@ -8,7 +8,6 @@
5 font-weight: normal;
6 font-style: normal;
7 }
8-
9 @font-face {
10 font-family: "EntypoRegular";
11 src: url("/web/static/src/font/entypo-webfont.eot") format("eot");
12@@ -19,7 +18,6 @@
13 font-weight: normal;
14 font-style: normal;
15 }
16-
17 .openerp {
18 padding: 0;
19 margin: 0;
20@@ -1029,7 +1027,7 @@
21 background-image: -moz-linear-gradient(top, #fc8787, maroon);
22 background-image: -ms-linear-gradient(top, #fc8787, maroon);
23 background-image: -o-linear-gradient(top, #fc8787, maroon);
24- background-image: linear-gradient(to bottom, #fc8787, #800000);
25+ background-image: linear-gradient(to bottom, #fc8787, maroon);
26 }
27 .openerp .oe_topbar .oe_topbar_anonymous_login a {
28 display: block;
29@@ -1275,7 +1273,7 @@
30 color: white;
31 padding: 2px 4px;
32 margin: 1px 6px 0 0;
33- border: 1px solid lightGray;
34+ border: 1px solid lightgray;
35 text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
36 -moz-border-radius: 4px;
37 -webkit-border-radius: 4px;
38@@ -1307,7 +1305,7 @@
39 transform: scale(1.1);
40 }
41 .openerp .oe_secondary_submenu .oe_active {
42- border-top: 1px solid lightGray;
43+ border-top: 1px solid lightgray;
44 border-bottom: 1px solid #dedede;
45 text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
46 -moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 -1px 3px rgba(40, 40, 40, 0.2);
47@@ -2289,7 +2287,7 @@
48 }
49 .openerp .oe_form .oe_form_label_help[for] span, .openerp .oe_form .oe_form_label[for] span {
50 font-size: 80%;
51- color: darkGreen;
52+ color: darkgreen;
53 vertical-align: top;
54 position: relative;
55 top: -4px;
56@@ -2815,11 +2813,11 @@
57 .openerp .oe_list_editable .oe_list_content td.oe_list_field_cell {
58 padding: 4px 6px 3px;
59 }
60-.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) {
61+.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell {
62 color: transparent;
63 text-shadow: none;
64 }
65-.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) * {
66+.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell * {
67 visibility: hidden;
68 }
69 .openerp .oe_list.oe_list_editable.oe_editing .oe_m2o_drop_down_button {
70@@ -2835,6 +2833,25 @@
71 min-width: 0;
72 max-width: none;
73 }
74+.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_list_field_handle {
75+ font-size: 1px;
76+ letter-spacing: -1px;
77+ color: transparent;
78+ text-shadow: none;
79+ font-weight: normal;
80+ letter-spacing: normal !important;
81+ color: transparent;
82+ margin-right: 7px;
83+}
84+.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_list_field_handle:before {
85+ font: 18px "entypoRegular";
86+ content: "}";
87+ color: #e0e0e0;
88+}
89+.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_readonly {
90+ padding: 4px 6px 3px;
91+ text-align: left;
92+}
93 .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field textarea {
94 height: 27px;
95 -moz-border-radius: 0;
96@@ -2846,6 +2863,10 @@
97 .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field textarea, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field select {
98 min-width: 0;
99 }
100+.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_float.oe_readonly, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_view_integer.oe_readonly {
101+ padding: 4px 6px 3px 0px;
102+ text-align: right !important;
103+}
104 .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_float input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_view_integer input {
105 text-align: right;
106 width: 100% !important;
107
108=== modified file 'addons/web/static/src/css/base.sass'
109--- addons/web/static/src/css/base.sass 2014-04-09 09:34:22 +0000
110+++ addons/web/static/src/css/base.sass 2014-05-12 05:39:08 +0000
111@@ -2218,7 +2218,7 @@
112 .oe_list_editable .oe_list_content td.oe_list_field_cell
113 padding: 4px 6px 3px
114 .oe_list.oe_list_editable.oe_editing
115- .oe_edition .oe_list_field_cell:not(.oe_readonly)
116+ .oe_edition .oe_list_field_cell
117 *
118 visibility: hidden
119 color: transparent
120@@ -2230,6 +2230,14 @@
121 .oe_input_icon
122 margin-top: 5px
123 .oe_form_field
124+ &.oe_list_field_handle
125+ @include text-to-entypo-icon("}",#E0E0E0,18px)
126+ letter-spacing: normal !important
127+ color: transparent
128+ margin-right: 7px
129+ &.oe_readonly
130+ padding: 4px 6px 3px
131+ text-align: left
132 min-width: 0
133 max-width: none
134 input, textarea
135@@ -2240,6 +2248,9 @@
136 input, textarea, select
137 min-width: 0
138 &.oe_form_field_float,&.oe_form_view_integer
139+ &.oe_readonly
140+ padding: 4px 6px 3px 0px
141+ text-align: right !important
142 input
143 text-align: right
144 width: 100% !important
145
146=== modified file 'addons/web/static/src/js/view_form.js'
147--- addons/web/static/src/js/view_form.js 2014-04-18 09:20:33 +0000
148+++ addons/web/static/src/js/view_form.js 2014-05-12 05:39:08 +0000
149@@ -2599,7 +2599,8 @@
150 },
151 set_dimensions: function (height, width) {
152 this._super(height, width);
153- this.datewidget.$input.css('height', height);
154+ if (!this.get("effective_readonly") && this.datewidget.$input)
155+ this.datewidget.$input.css('height', height);
156 }
157 });
158
159@@ -3394,7 +3395,8 @@
160 },
161 set_dimensions: function (height, width) {
162 this._super(height, width);
163- this.$input.css('height', height);
164+ if (!this.get("effective_readonly") && this.$input)
165+ this.$input.css('height', height);
166 }
167 });
168
169
170=== modified file 'addons/web/static/src/js/view_list_editable.js'
171--- addons/web/static/src/js/view_list_editable.js 2014-04-08 12:01:41 +0000
172+++ addons/web/static/src/js/view_list_editable.js 2014-05-12 05:39:08 +0000
173@@ -283,9 +283,7 @@
174 if (!this.editor.is_editing()) { return; }
175 for(var i=0, len=this.fields_for_resize.length; i<len; ++i) {
176 var item = this.fields_for_resize[i];
177- if (!item.field.get('effective_invisible')) {
178- this.resize_field(item.field, item.cell);
179- }
180+ this.resize_field(item.field, item.cell);
181 }
182 },
183 /**
184@@ -304,6 +302,11 @@
185 at: 'left top',
186 of: $cell
187 });
188+ if (field.get('effective_readonly')) {
189+ field.$el.addClass('oe_readonly');
190+ }
191+ if(field.widget == "handle")
192+ field.$el.addClass('oe_list_field_handle');
193 },
194 /**
195 * @return {jQuery.Deferred}
196@@ -449,13 +452,10 @@
197 setup_events: function () {
198 var self = this;
199 _.each(this.editor.form.fields, function(field, field_name) {
200- var set_invisible = function() {
201- field.set({'force_invisible': field.get('effective_readonly')});
202+ var set_readonly = function() {
203+ field.set({'readonly': field.get('effective_readonly')});
204 };
205- field.on("change:effective_readonly", self, set_invisible);
206- set_invisible();
207- field.on('change:effective_invisible', self, function () {
208- if (field.get('effective_invisible')) { return; }
209+ field.on("change:effective_readonly", self, function(){
210 var item = _(self.fields_for_resize).find(function (item) {
211 return item.field === field;
212 });
213@@ -464,8 +464,8 @@
214 self.resize_field(item.field, item.cell);
215 }, 0);
216 }
217-
218 });
219+ set_readonly();
220 });
221
222 this.editor.$el.on('keyup keypress keydown', function (e) {