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

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp://staging/~openerp-dev/openobject-client-web/6.0-opw-576891-msh
Merge into: lp://staging/openobject-client-web
Diff against target: 157 lines (+14/-12)
11 files modified
addons/openerp/static/javascript/form_state.js (+1/-1)
addons/openerp/widgets/_interface.py (+2/-1)
addons/openerp/widgets/form/_form.py (+2/-1)
addons/openerp/widgets/form/templates/boolean.mako (+2/-2)
addons/openerp/widgets/form/templates/char.mako (+1/-1)
addons/openerp/widgets/form/templates/email.mako (+1/-1)
addons/openerp/widgets/form/templates/float.mako (+1/-1)
addons/openerp/widgets/form/templates/many2one.mako (+1/-1)
addons/openerp/widgets/form/templates/selection.mako (+1/-1)
addons/openerp/widgets/form/templates/text.mako (+1/-1)
addons/openerp/widgets/form/templates/url.mako (+1/-1)
To merge this branch: bzr merge lp://staging/~openerp-dev/openobject-client-web/6.0-opw-576891-msh
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+116808@code.staging.launchpad.net

Description of the change

Hello,

Fixed the issue of readonly attrs, here there was a regression due to revision no. 4835, but if we remove this revision then we will have the following issue.

If the user has only "read" access for any object and the field has attrs set on it. In that case when you login with the user and select the object view the field is in the editable mode.

1. create a user "Test". Assign the group "partner manager","employee" give the access rights as "read" on the object "product.product" in both the group.
2. login with the User "Test" and open the product form.
3. you will see that the "Cost Price" field and the other field those have attrs set are in the editable mode.

Reason :- The reason is first attrs of py are applied and then the attrs of xml are applied to field, so if attrs of py is making the field readonly and then there is a attrs in xml which has condition that becomes false e.g. attrs="{readonly: [(Somefield = value)]}" which will make the field as editable by calling set_readonly method of form_state.js.

Here what should be the behaviour, attrs of py are applied first, then attrs of xml which is working, but when we only have the access of read to particular object then the form should be opened in readonly mode.
For if you son't have access to any object then server will set readonly attrs when fields_get is called, but the issue with web-client is that we are not able to distinguish that whether readonly attrs in fields is set by the server due to access rule or it is already in column definition.

Hence web will apply py attrs and then xml attrs so field will be in editable mode even though user only have read access.

So the patch will fix both the issue.

Thanks.

To post a comment you must log in.

Unmerged revisions

4865. By Mohammed Shekha(Open ERP)

[FIX]Fixed the issue of readonly attrs for the field when the field is restricted by the access rule, here the attrs of py and xml are combined we are not able to distinguish whether readonly=True is set from access rule or it is from column definition in py, so here py attrs are applied first and then view attrs which makes field editable even though field is restricted by access rule, hence added force_readony when field is restricted by access rule.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.