Merge lp:~openerp-dev/openobject-client-web/6.0-opw-594799-msh into lp:openobject-client-web

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-client-web/6.0-opw-594799-msh
Merge into: lp:openobject-client-web
Diff against target: 33 lines (+7/-4)
1 file modified
addons/openerp/static/javascript/form_state.js (+7/-4)
To merge this branch: bzr merge lp:~openerp-dev/openobject-client-web/6.0-opw-594799-msh
Reviewer Review Type Date Requested Status
Xavier ALT Pending
Review via email: mp+175481@code.launchpad.net

Description of the change

Hello,

Fixed the issue of attrs not working in editable listview.

Demo:- Apply any attrs on editable listview field, for reference here added a small module which produces this issue.
Download reference module from below(attrs_bug):

https://drive.google.com/folderview?id=0B035wZ_8-uAISXBfeTNHWVR0ME0&usp=sharing

Install it and play with boolean field and selection field type.

Thanks.

To post a comment you must log in.

Unmerged revisions

4916. By Mohammed Shekha<email address hidden>

[FIX]Fixed the issue of attrs not working in editable listview.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/openerp/static/javascript/form_state.js'
2--- addons/openerp/static/javascript/form_state.js 2012-08-28 09:31:17 +0000
3+++ addons/openerp/static/javascript/form_state.js 2013-07-18 10:12:28 +0000
4@@ -189,13 +189,13 @@
5 }
6
7 function list_hookAttrChange(list_name) {
8- jQuery('table[id='+list_name+'_grid] [attrs]').each(function () {
9+ $items = jQuery('table[id='+list_name+'_grid]').find('[attrs]');
10+ $items.each(function () {
11 var $this = jQuery(this);
12 var attrs = $this.attr('attrs') || '{}';
13- var widget = $this.attr('widget') || '';
14+ var widget = $this.attr('name') || '';
15 var container = this;
16 var prefix = widget.slice(0, widget.lastIndexOf('/')+1) || '';
17-
18 // Convert Python statement into it's equivalent in JavaScript.
19 attrs = attrs.replace(/\(/g, '[');
20 attrs = attrs.replace(/\)/g, ']');
21@@ -223,8 +223,11 @@
22 if (typeof(n) == "number") { // {'invisible': [1]}
23 return form_onAttrChange(container, widget, attr, n, $this);
24 }
25+
26+ var name = prefix + n[0];
27+ var field = openobject.dom.get(name);
28 if (row_is_editable) {
29- var $field = jQuery(this).bind('onAttrChange', partial(form_onAttrChange, container, widget, attr, attrs[attr], $this));
30+ var $field = jQuery(field).bind('onAttrChange', partial(form_onAttrChange, container, widget, attr, attrs[attr], $this));
31 $field.change(partial(form_onAttrChange, container, widget, attr, attrs[attr], $this));
32 }
33 return form_onAttrChange(container, widget, attr, attrs[attr], $this);