Merge lp:~openerp-dev/openobject-client-web/6.0-opw-591803-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-591803-msh
Merge into: lp:openobject-client-web
Diff against target: 15 lines (+4/-1)
1 file modified
addons/openerp/static/javascript/form_state.js (+4/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-client-web/6.0-opw-591803-msh
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+163090@code.launchpad.net

Description of the change

Hello,

Fixed the issue of attrs not working on editable listview based on boolean field with browser Chrome.

Demo: To reproduce add two fields in the view char and boolean field not char field will have attrs based on boolean field like attrs="{'readonly': [('yourBooleanField', '=', 0)], 'required': [('yourBooleanField', '=', 1)]}" note this is generated only in editable listview, with form there is no issue, now open Chrome and click on boolean field in editable list this will not make char field editable now click again on boolean field now this time it makes char field editable.

Reason: for Boolean field we have globally bind the click event for Boolean fields which changes the value of boolean to "1" or "0", also we binded change event also for each field, so in chrome before onBooleanClicked called it calls change event so value of boolean field comes wrong and on second it gives the value of last changed.

So for editable listview forcefull called onBooleanClicked first.

Thanks.

To post a comment you must log in.
Revision history for this message
Mohammed Shekha(Open ERP) (msh-openerp) wrote :

Hello,

It seems the global isse for editable list view, it does not seems the issue of change event called first in chrome, so this issue requires better fix from form_state.js

Thanks.

Unmerged revisions

4913. By Mohammed Shekha<email address hidden>

[FIX]Fixed the issue of attrs on editable listview which are not working with boolean field on chrome.

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-05-09 05:50:35 +0000
4@@ -225,7 +225,10 @@
5 }
6 if (row_is_editable) {
7 var $field = jQuery(this).bind('onAttrChange', partial(form_onAttrChange, container, widget, attr, attrs[attr], $this));
8- $field.change(partial(form_onAttrChange, container, widget, attr, attrs[attr], $this));
9+ //call change after timeout to forcefully call onBooleanClicked first.
10+ $field.change(function(){
11+ setTimeout(function(){jQuery(this).trigger('onAttrChange');}, 0);
12+ });
13 }
14 return form_onAttrChange(container, widget, attr, attrs[attr], $this);
15 });