Merge lp:~openerp-dev/openobject-client-web/6.0-opw-381794-msh into lp:openobject-client-web
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Xavier ALT | ||||
Approved revision: | 4759 | ||||
Merged at revision: | 4860 | ||||
Proposed branch: | lp:~openerp-dev/openobject-client-web/6.0-opw-381794-msh | ||||
Merge into: | lp:openobject-client-web | ||||
Diff against target: |
49 lines (+6/-1) 1 file modified
addons/openerp/static/javascript/m2o.js (+6/-1) |
||||
To merge this branch: | bzr merge lp:~openerp-dev/openobject-client-web/6.0-opw-381794-msh | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+90074@code.launchpad.net |
Description of the change
Hello,
Fixed the issue of initial onchange trigger from m2o field.
Demo :- HR -> Expenses -> create new expense you will see onchange is not fired from Employee field, employee field have onchange which sets department.
Reason :- Here in m2o.js we have removed attr callback from visible field (there is always one hidden field for each visible field), to avoid calling onChange two times one from hidden field and one from visible field(According to Revision no. 4618) but due to this revision initial_onchange has been stop working because we have called initial_onchange on form ready, when form have been ready at that time m2o.js already removed the callback attr from visible field so when initial_onchange is called it will not call the on_change of employee field, initial_onchange is called only for visible fields not for hidden fields, so due to removal of callback attr from visible employee m2o onChange is not called.
If we remove this revision then initial onchange will be called but when user change that field at that time onchange will be called two times because we have bind all m2o field with on_change method of m2o.js, and one another on_change is called for callback on visible field, so we need to remove callback from visible field but we will remove after form load so when form is loaded at that time one time initial_onchange is called and after that we will remove callback from visible field so now when user change the field at that time only binded field onChange called.
So Changed the code and removed the callback after form is loaded.
Thanks.