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
1=== modified file 'addons/openerp/controllers/form.py'
2--- addons/openerp/controllers/form.py 2012-11-05 17:35:08 +0000
3+++ addons/openerp/controllers/form.py 2013-04-03 06:44:23 +0000
4@@ -321,10 +321,11 @@
5 search_data=None, filter_domain=None, o2m_edit=False, **kw):
6
7 notebook_tab = kw.get('notebook_tab') or 0
8+ editable = kw.get('editable', True);
9 params = self._read_form(context, count, domain, filter_domain, id,
10 ids, kw, limit, model, offset, search_data,
11 search_domain, source, view_ids, view_mode,
12- view_type, notebook_tab, o2m_edit=o2m_edit, editable=True)
13+ view_type, notebook_tab, o2m_edit=o2m_edit, editable=editable)
14
15 if not params.ids:
16 params.count = 0
17
18=== modified file 'addons/openerp/static/javascript/form.js'
19--- addons/openerp/static/javascript/form.js 2012-10-15 13:19:24 +0000
20+++ addons/openerp/static/javascript/form.js 2013-04-03 06:44:23 +0000
21@@ -53,6 +53,7 @@
22 'offset': openobject.dom.get(prefix + '_terp_offset').value,
23 'limit': openobject.dom.get(prefix + '_terp_limit').value,
24 'count': openobject.dom.get(prefix + '_terp_count').value,
25+ 'editable': openobject.dom.get(prefix + '_terp_editable').value,
26 'search_domain': jQuery('#_terp_search_domain').val() || null,
27 'search_data': jQuery('#_terp_search_data').val() || null,
28 'filter_domain': jQuery('#_terp_filter_domain').val() || [],
29
30=== modified file 'addons/openerp/static/javascript/m2m.js'
31--- addons/openerp/static/javascript/m2m.js 2012-11-15 12:44:28 +0000
32+++ addons/openerp/static/javascript/m2m.js 2013-04-03 06:44:23 +0000
33@@ -156,6 +156,9 @@
34 $field.add(this.text)
35 .attr('readOnly', readonly)
36 .toggleClass('readonlyfield', readonly);
37+ var bool = readonly ? 'False' : 'True';
38+ jQuery(idSelector(this.name+'/_terp_editable')).val(bool);
39+ ListView(this.name).reload();
40 },
41
42 addRecords: function () {