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
=== modified file 'addons/web/static/src/css/base.css'
--- addons/web/static/src/css/base.css 2014-04-09 09:34:22 +0000
+++ addons/web/static/src/css/base.css 2014-05-12 05:39:08 +0000
@@ -8,7 +8,6 @@
8 font-weight: normal;8 font-weight: normal;
9 font-style: normal;9 font-style: normal;
10}10}
11
12@font-face {11@font-face {
13 font-family: "EntypoRegular";12 font-family: "EntypoRegular";
14 src: url("/web/static/src/font/entypo-webfont.eot") format("eot");13 src: url("/web/static/src/font/entypo-webfont.eot") format("eot");
@@ -19,7 +18,6 @@
19 font-weight: normal;18 font-weight: normal;
20 font-style: normal;19 font-style: normal;
21}20}
22
23.openerp {21.openerp {
24 padding: 0;22 padding: 0;
25 margin: 0;23 margin: 0;
@@ -1029,7 +1027,7 @@
1029 background-image: -moz-linear-gradient(top, #fc8787, maroon);1027 background-image: -moz-linear-gradient(top, #fc8787, maroon);
1030 background-image: -ms-linear-gradient(top, #fc8787, maroon);1028 background-image: -ms-linear-gradient(top, #fc8787, maroon);
1031 background-image: -o-linear-gradient(top, #fc8787, maroon);1029 background-image: -o-linear-gradient(top, #fc8787, maroon);
1032 background-image: linear-gradient(to bottom, #fc8787, #800000);1030 background-image: linear-gradient(to bottom, #fc8787, maroon);
1033}1031}
1034.openerp .oe_topbar .oe_topbar_anonymous_login a {1032.openerp .oe_topbar .oe_topbar_anonymous_login a {
1035 display: block;1033 display: block;
@@ -1275,7 +1273,7 @@
1275 color: white;1273 color: white;
1276 padding: 2px 4px;1274 padding: 2px 4px;
1277 margin: 1px 6px 0 0;1275 margin: 1px 6px 0 0;
1278 border: 1px solid lightGray;1276 border: 1px solid lightgray;
1279 text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);1277 text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
1280 -moz-border-radius: 4px;1278 -moz-border-radius: 4px;
1281 -webkit-border-radius: 4px;1279 -webkit-border-radius: 4px;
@@ -1307,7 +1305,7 @@
1307 transform: scale(1.1);1305 transform: scale(1.1);
1308}1306}
1309.openerp .oe_secondary_submenu .oe_active {1307.openerp .oe_secondary_submenu .oe_active {
1310 border-top: 1px solid lightGray;1308 border-top: 1px solid lightgray;
1311 border-bottom: 1px solid #dedede;1309 border-bottom: 1px solid #dedede;
1312 text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);1310 text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
1313 -moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 -1px 3px rgba(40, 40, 40, 0.2);1311 -moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 -1px 3px rgba(40, 40, 40, 0.2);
@@ -2289,7 +2287,7 @@
2289}2287}
2290.openerp .oe_form .oe_form_label_help[for] span, .openerp .oe_form .oe_form_label[for] span {2288.openerp .oe_form .oe_form_label_help[for] span, .openerp .oe_form .oe_form_label[for] span {
2291 font-size: 80%;2289 font-size: 80%;
2292 color: darkGreen;2290 color: darkgreen;
2293 vertical-align: top;2291 vertical-align: top;
2294 position: relative;2292 position: relative;
2295 top: -4px;2293 top: -4px;
@@ -2815,11 +2813,11 @@
2815.openerp .oe_list_editable .oe_list_content td.oe_list_field_cell {2813.openerp .oe_list_editable .oe_list_content td.oe_list_field_cell {
2816 padding: 4px 6px 3px;2814 padding: 4px 6px 3px;
2817}2815}
2818.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) {2816.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell {
2819 color: transparent;2817 color: transparent;
2820 text-shadow: none;2818 text-shadow: none;
2821}2819}
2822.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) * {2820.openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell * {
2823 visibility: hidden;2821 visibility: hidden;
2824}2822}
2825.openerp .oe_list.oe_list_editable.oe_editing .oe_m2o_drop_down_button {2823.openerp .oe_list.oe_list_editable.oe_editing .oe_m2o_drop_down_button {
@@ -2835,6 +2833,25 @@
2835 min-width: 0;2833 min-width: 0;
2836 max-width: none;2834 max-width: none;
2837}2835}
2836.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_list_field_handle {
2837 font-size: 1px;
2838 letter-spacing: -1px;
2839 color: transparent;
2840 text-shadow: none;
2841 font-weight: normal;
2842 letter-spacing: normal !important;
2843 color: transparent;
2844 margin-right: 7px;
2845}
2846.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_list_field_handle:before {
2847 font: 18px "entypoRegular";
2848 content: "}";
2849 color: #e0e0e0;
2850}
2851.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_readonly {
2852 padding: 4px 6px 3px;
2853 text-align: left;
2854}
2838.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field textarea {2855.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field textarea {
2839 height: 27px;2856 height: 27px;
2840 -moz-border-radius: 0;2857 -moz-border-radius: 0;
@@ -2846,6 +2863,10 @@
2846.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 {2863.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 {
2847 min-width: 0;2864 min-width: 0;
2848}2865}
2866.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 {
2867 padding: 4px 6px 3px 0px;
2868 text-align: right !important;
2869}
2849.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 {2870.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 {
2850 text-align: right;2871 text-align: right;
2851 width: 100% !important;2872 width: 100% !important;
28522873
=== modified file 'addons/web/static/src/css/base.sass'
--- addons/web/static/src/css/base.sass 2014-04-09 09:34:22 +0000
+++ addons/web/static/src/css/base.sass 2014-05-12 05:39:08 +0000
@@ -2218,7 +2218,7 @@
2218 .oe_list_editable .oe_list_content td.oe_list_field_cell2218 .oe_list_editable .oe_list_content td.oe_list_field_cell
2219 padding: 4px 6px 3px2219 padding: 4px 6px 3px
2220 .oe_list.oe_list_editable.oe_editing2220 .oe_list.oe_list_editable.oe_editing
2221 .oe_edition .oe_list_field_cell:not(.oe_readonly)2221 .oe_edition .oe_list_field_cell
2222 *2222 *
2223 visibility: hidden2223 visibility: hidden
2224 color: transparent2224 color: transparent
@@ -2230,6 +2230,14 @@
2230 .oe_input_icon2230 .oe_input_icon
2231 margin-top: 5px2231 margin-top: 5px
2232 .oe_form_field2232 .oe_form_field
2233 &.oe_list_field_handle
2234 @include text-to-entypo-icon("}",#E0E0E0,18px)
2235 letter-spacing: normal !important
2236 color: transparent
2237 margin-right: 7px
2238 &.oe_readonly
2239 padding: 4px 6px 3px
2240 text-align: left
2233 min-width: 02241 min-width: 0
2234 max-width: none2242 max-width: none
2235 input, textarea2243 input, textarea
@@ -2240,6 +2248,9 @@
2240 input, textarea, select2248 input, textarea, select
2241 min-width: 02249 min-width: 0
2242 &.oe_form_field_float,&.oe_form_view_integer2250 &.oe_form_field_float,&.oe_form_view_integer
2251 &.oe_readonly
2252 padding: 4px 6px 3px 0px
2253 text-align: right !important
2243 input2254 input
2244 text-align: right2255 text-align: right
2245 width: 100% !important2256 width: 100% !important
22462257
=== modified file 'addons/web/static/src/js/view_form.js'
--- addons/web/static/src/js/view_form.js 2014-04-18 09:20:33 +0000
+++ addons/web/static/src/js/view_form.js 2014-05-12 05:39:08 +0000
@@ -2599,7 +2599,8 @@
2599 },2599 },
2600 set_dimensions: function (height, width) {2600 set_dimensions: function (height, width) {
2601 this._super(height, width);2601 this._super(height, width);
2602 this.datewidget.$input.css('height', height);2602 if (!this.get("effective_readonly") && this.datewidget.$input)
2603 this.datewidget.$input.css('height', height);
2603 }2604 }
2604});2605});
26052606
@@ -3394,7 +3395,8 @@
3394 },3395 },
3395 set_dimensions: function (height, width) {3396 set_dimensions: function (height, width) {
3396 this._super(height, width);3397 this._super(height, width);
3397 this.$input.css('height', height);3398 if (!this.get("effective_readonly") && this.$input)
3399 this.$input.css('height', height);
3398 }3400 }
3399});3401});
34003402
34013403
=== modified file 'addons/web/static/src/js/view_list_editable.js'
--- addons/web/static/src/js/view_list_editable.js 2014-04-08 12:01:41 +0000
+++ addons/web/static/src/js/view_list_editable.js 2014-05-12 05:39:08 +0000
@@ -283,9 +283,7 @@
283 if (!this.editor.is_editing()) { return; }283 if (!this.editor.is_editing()) { return; }
284 for(var i=0, len=this.fields_for_resize.length; i<len; ++i) {284 for(var i=0, len=this.fields_for_resize.length; i<len; ++i) {
285 var item = this.fields_for_resize[i];285 var item = this.fields_for_resize[i];
286 if (!item.field.get('effective_invisible')) {286 this.resize_field(item.field, item.cell);
287 this.resize_field(item.field, item.cell);
288 }
289 }287 }
290 },288 },
291 /**289 /**
@@ -304,6 +302,11 @@
304 at: 'left top',302 at: 'left top',
305 of: $cell303 of: $cell
306 });304 });
305 if (field.get('effective_readonly')) {
306 field.$el.addClass('oe_readonly');
307 }
308 if(field.widget == "handle")
309 field.$el.addClass('oe_list_field_handle');
307 },310 },
308 /**311 /**
309 * @return {jQuery.Deferred}312 * @return {jQuery.Deferred}
@@ -449,13 +452,10 @@
449 setup_events: function () {452 setup_events: function () {
450 var self = this;453 var self = this;
451 _.each(this.editor.form.fields, function(field, field_name) {454 _.each(this.editor.form.fields, function(field, field_name) {
452 var set_invisible = function() {455 var set_readonly = function() {
453 field.set({'force_invisible': field.get('effective_readonly')});456 field.set({'readonly': field.get('effective_readonly')});
454 };457 };
455 field.on("change:effective_readonly", self, set_invisible);458 field.on("change:effective_readonly", self, function(){
456 set_invisible();
457 field.on('change:effective_invisible', self, function () {
458 if (field.get('effective_invisible')) { return; }
459 var item = _(self.fields_for_resize).find(function (item) {459 var item = _(self.fields_for_resize).find(function (item) {
460 return item.field === field;460 return item.field === field;
461 });461 });
@@ -464,8 +464,8 @@
464 self.resize_field(item.field, item.cell);464 self.resize_field(item.field, item.cell);
465 }, 0);465 }, 0);
466 }466 }
467
468 });467 });
468 set_readonly();
469 });469 });
470470
471 this.editor.$el.on('keyup keypress keydown', function (e) {471 this.editor.$el.on('keyup keypress keydown', function (e) {