Merge lp:~jfb-tempo-consulting/unifield-web/US-4786 into lp:~jfb-tempo-consulting/unifield-web/jfb-int

Proposed by jftempo on 2018-08-10
Status: Merged
Merged at revision: 4927
Proposed branch: lp:~jfb-tempo-consulting/unifield-web/US-4786
Merge into: lp:~jfb-tempo-consulting/unifield-web/jfb-int
Diff against target: 36 lines (+11/-1)
2 files modified
addons/openerp/static/javascript/o2m.js (+9/-1)
addons/openerp/widgets/form/_form.py (+2/-0)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-web/US-4786
Reviewer Review Type Date Requested Status
jftempo Pending
Review via email: mp+352875@code.launchpad.net
To post a comment you must log in.
4924. By jftempo on 2018-08-10

US-4786 [FIX] o2m in form mode fix readonly switch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/openerp/static/javascript/o2m.js'
2--- addons/openerp/static/javascript/o2m.js 2018-01-29 16:36:51 +0000
3+++ addons/openerp/static/javascript/o2m.js 2018-08-10 10:10:33 +0000
4@@ -198,10 +198,18 @@
5 if (readonly) {
6 jQuery('table.one2many[id$="'+this.name+'"]').addClass('m2o_readonly');
7 if(btn){btn.style.display='none';}
8-
9+
10 MochiKit.Base.map(function (el) {el.style.visibility='hidden';},MochiKit.Selector.findChildElements(grid,['.selector']));
11 edit.value= 0;
12
13+ if (!grid) {
14+ var grid=MochiKit.DOM.getElement('_o2m_'+this.name);
15+ if (grid) {
16+ MochiKit.Base.map(function (el) {form_setReadonly('', el, readonly)}, MochiKit.Selector.findChildElements(grid,['input[kind]']));
17+ MochiKit.Base.map(function (el) {form_setReadonly('', el, readonly)}, MochiKit.Selector.findChildElements(grid,['select[kind]']));
18+ MochiKit.Base.map(function (el) {el.style.visibility='hidden';},MochiKit.Selector.findChildElements(grid,['a.button-a']));
19+ }
20+ }
21 // Not disabling clicks on line dynamically (in browser) to be
22 // consistent with previous behaviors. In many cases (e.g. FO, SI,
23 // ...) we want o2m to be readonly (no New button) but the lines
24
25=== modified file 'addons/openerp/widgets/form/_form.py'
26--- addons/openerp/widgets/form/_form.py 2018-05-15 07:28:21 +0000
27+++ addons/openerp/widgets/form/_form.py 2018-08-10 10:10:33 +0000
28@@ -196,6 +196,8 @@
29 attrs['attrs'] = str(widget.attributes)
30 attrs['widget'] = widget.name
31
32+ if widget.__class__.__name__ == 'O2M' and widget.view_type == 'form':
33+ attrs['id'] = widget.name
34 if not isinstance(widget, (Char, Frame, Float, DateTime, Integer, Selection, Notebook, Separator, NewLine, Label)):
35 from openerp.widgets.search import Filter
36 if self.is_search \

Subscribers

People subscribed via source and target branches

to all changes: