Merge lp:~openerp-dev/openobject-client-web/6.0-opw-583890-cpa into lp:openobject-client-web

Proposed by Chirag Patel (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-client-web/6.0-opw-583890-cpa
Merge into: lp:openobject-client-web
Diff against target: 42 lines (+6/-1)
3 files modified
addons/openerp/controllers/form.py (+2/-1)
addons/openerp/static/javascript/form.js (+1/-0)
addons/openerp/static/javascript/m2m.js (+3/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-client-web/6.0-opw-583890-cpa
Reviewer Review Type Date Requested Status
Xavier ALT (community) Needs Fixing
Review via email: mp+142447@code.launchpad.net

Description of the change

Hello,

m2m not support readonly attrs.

Steps:
1) Customize the users form view by adding the following attrs on groups_id field: {'readonly':[('name','=','test')]}
2) Create new user.
3) Enter name "test".

Observed: Groups box is slightly greyed out, but add button still not readonly.
Expected: The add button on the groups box should not be clickable.

Thanks

To post a comment you must log in.
Revision history for this message
Xavier ALT (dex-phx) wrote :

Hi,

Commit is fine, but doesn't fix all use-cases:

Case 1:
=======
1a. Do steps 1), 2), 3) => button "Add" is disabled (so this is ok)
2a. Then clic on the column header "Name"

Observed: many2many widget is reloaded - but attrs seems to not be re-applied => widget still grey-out, but button is re-enabled.
Expected: both widget and button should be inactive.

Case 2:
=======
1a. Do steps 1), 2), 3) => button "Add" is disabled (so this is ok)
2a. Then try to remove one of the proposed default group (ex: Employee) from the many2many by clicking the cross "x"

Observed: item is really removed from the many2many
Expected: as readonly, we should not be able to remove item from the list.

Regards,
Xavier

review: Needs Fixing
4900. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4901. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4902. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4903. By Xavier ALT

[FIX] OPW 581748: user password change wizard should not use 'super-admin' terminology from database op.

4904. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4905. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4906. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4907. By Xavier ALT

[FIX] web: fixup api for correct field validators init

4908. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4909. By Xavier ALT

[FIX] OPW 17626: corresponding fix for single-quote in button confirm message of r4705, but for list view

4910. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4911. By Chris Biersbach (OpenERP)

[MERGE] OPW 582169: Changes the timeout for pinting reports from a hardcoded value to the openerp server timeout config value

4912. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4913. By Chirag Patel (OpenERP)

[FIX] Remove edit,add and delete button in readonly m2m.

Unmerged revisions

4913. By Chirag Patel (OpenERP)

[FIX] Remove edit,add and delete button in readonly m2m.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'addons/openerp/controllers/form.py'
--- addons/openerp/controllers/form.py 2012-11-05 17:35:08 +0000
+++ addons/openerp/controllers/form.py 2013-04-03 06:44:23 +0000
@@ -321,10 +321,11 @@
321 search_data=None, filter_domain=None, o2m_edit=False, **kw):321 search_data=None, filter_domain=None, o2m_edit=False, **kw):
322322
323 notebook_tab = kw.get('notebook_tab') or 0323 notebook_tab = kw.get('notebook_tab') or 0
324 editable = kw.get('editable', True);
324 params = self._read_form(context, count, domain, filter_domain, id,325 params = self._read_form(context, count, domain, filter_domain, id,
325 ids, kw, limit, model, offset, search_data,326 ids, kw, limit, model, offset, search_data,
326 search_domain, source, view_ids, view_mode,327 search_domain, source, view_ids, view_mode,
327 view_type, notebook_tab, o2m_edit=o2m_edit, editable=True)328 view_type, notebook_tab, o2m_edit=o2m_edit, editable=editable)
328329
329 if not params.ids:330 if not params.ids:
330 params.count = 0331 params.count = 0
331332
=== modified file 'addons/openerp/static/javascript/form.js'
--- addons/openerp/static/javascript/form.js 2012-10-15 13:19:24 +0000
+++ addons/openerp/static/javascript/form.js 2013-04-03 06:44:23 +0000
@@ -53,6 +53,7 @@
53 'offset': openobject.dom.get(prefix + '_terp_offset').value,53 'offset': openobject.dom.get(prefix + '_terp_offset').value,
54 'limit': openobject.dom.get(prefix + '_terp_limit').value,54 'limit': openobject.dom.get(prefix + '_terp_limit').value,
55 'count': openobject.dom.get(prefix + '_terp_count').value,55 'count': openobject.dom.get(prefix + '_terp_count').value,
56 'editable': openobject.dom.get(prefix + '_terp_editable').value,
56 'search_domain': jQuery('#_terp_search_domain').val() || null,57 'search_domain': jQuery('#_terp_search_domain').val() || null,
57 'search_data': jQuery('#_terp_search_data').val() || null,58 'search_data': jQuery('#_terp_search_data').val() || null,
58 'filter_domain': jQuery('#_terp_filter_domain').val() || [],59 'filter_domain': jQuery('#_terp_filter_domain').val() || [],
5960
=== modified file 'addons/openerp/static/javascript/m2m.js'
--- addons/openerp/static/javascript/m2m.js 2012-11-15 12:44:28 +0000
+++ addons/openerp/static/javascript/m2m.js 2013-04-03 06:44:23 +0000
@@ -156,6 +156,9 @@
156 $field.add(this.text)156 $field.add(this.text)
157 .attr('readOnly', readonly)157 .attr('readOnly', readonly)
158 .toggleClass('readonlyfield', readonly);158 .toggleClass('readonlyfield', readonly);
159 var bool = readonly ? 'False' : 'True';
160 jQuery(idSelector(this.name+'/_terp_editable')).val(bool);
161 ListView(this.name).reload();
159 },162 },
160163
161 addRecords: function () {164 addRecords: function () {