Merge lp:~jfb-tempo-consulting/unifield-web/US-5859 into lp:unifield-web
- US-5859
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 4968 |
Proposed branch: | lp:~jfb-tempo-consulting/unifield-web/US-5859 |
Merge into: | lp:unifield-web |
Diff against target: |
1082 lines (+386/-43) 31 files modified
addons/openerp/controllers/actions.py (+11/-0) addons/openerp/controllers/form.py (+14/-1) addons/openerp/controllers/templates/form.mako (+13/-2) addons/openerp/controllers/templates/progress.mako (+138/-0) addons/openerp/controllers/view_log.py (+40/-0) addons/openerp/po/javascript/fr.po (+16/-0) addons/openerp/static/css/style.css (+6/-0) addons/openerp/static/javascript/form.js (+17/-1) addons/openerp/static/javascript/form_state.js (+14/-2) addons/openerp/static/javascript/listgrid.js (+18/-3) addons/openerp/static/javascript/m2o.js (+11/-0) addons/openerp/static/javascript/openerp/openerp.base.js (+4/-4) addons/openerp/widgets/_interface.py (+5/-2) addons/openerp/widgets/_views.py (+2/-1) addons/openerp/widgets/form/_form.py (+6/-4) addons/openerp/widgets/form/_o2m.py (+2/-3) addons/openerp/widgets/form/templates/button.mako (+5/-1) addons/openerp/widgets/form/templates/char.mako (+3/-0) addons/openerp/widgets/form/templates/datetime.mako (+3/-0) addons/openerp/widgets/form/templates/float.mako (+3/-0) addons/openerp/widgets/form/templates/integer.mako (+3/-0) addons/openerp/widgets/form/templates/many2one.mako (+5/-2) addons/openerp/widgets/form/templates/one2many.mako (+1/-1) addons/openerp/widgets/form/templates/selection.mako (+3/-0) addons/openerp/widgets/form_view.py (+2/-1) addons/openerp/widgets/listgrid.py (+12/-2) addons/openerp/widgets/templates/listgrid/button.mako (+1/-1) addons/openerp/widgets/templates/listgrid/listgrid.mako (+15/-4) addons/openerp/widgets/templates/sidebar.mako (+5/-1) openobject/static/javascript/jQuery/jquery.fancybox-1.3.1.js (+8/-6) openobject/widgets/_base.py (+0/-1) |
To merge this branch: | bzr merge lp:~jfb-tempo-consulting/unifield-web/US-5859 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Dev Team | Pending | ||
Review via email: mp+367979@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
- 4985. By jftempo
-
Pick line edition: clic on empty line must not raise but save current line if any
- 4986. By jftempo
-
Button action: {'type': 'ir.actions.
refresh_ o2m', 'o2m_refresh': 'move_lines'}, to refresh o2m field only
exple: Pickint Ticket, tick lines click on "Copy lines", "Clear lines": tick boxes must be kept - 4987. By jftempo
-
PPS: last screen of progress pop should display only 1 button
- 4988. By jftempo
-
FIX: list view, tick top header box (to select all lines), click on delete : the top tickbox just not return any id
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'addons/openerp/controllers/actions.py' |
2 | --- addons/openerp/controllers/actions.py 2018-10-23 12:15:03 +0000 |
3 | +++ addons/openerp/controllers/actions.py 2019-08-02 10:04:03 +0000 |
4 | @@ -270,6 +270,11 @@ |
5 | def act_window_close(action=False, *args, **b): |
6 | return close_popup(o2m_refresh=action.get('o2m_refresh')) |
7 | |
8 | +def refresh_o2m(action=False, *a, **b): |
9 | + cherrypy.response.headers['Content-Type'] = 'text/javascript' |
10 | + import json |
11 | + return json.dumps({'reload': 1, 'list_grid': action.get('o2m_refresh')}) |
12 | + |
13 | def act_window(action, data): |
14 | if not action.get('opened'): |
15 | action.setdefault('target', 'current') |
16 | @@ -403,6 +408,7 @@ |
17 | )) |
18 | |
19 | ACTIONS_BY_TYPE = { |
20 | + 'ir.actions.refresh_o2m': refresh_o2m, |
21 | 'ir.actions.act_window_close': act_window_close, |
22 | 'ir.actions.act_window': act_window, |
23 | 'ir.actions.submenu': act_window, |
24 | @@ -460,6 +466,11 @@ |
25 | cherrypy.response.headers['Location'] = url |
26 | if action and action.get('keep_open'): |
27 | cherrypy.response.headers['keep-open'] = 1 |
28 | + if action and action.get('height'): |
29 | + cherrypy.response.headers['height'] = action.get('height') |
30 | + if action and action.get('width'): |
31 | + cherrypy.response.headers['width'] = action.get('width') |
32 | + |
33 | return """<script type="text/javascript"> |
34 | window.top.openAction('%s', '%s'); |
35 | </script> |
36 | |
37 | === modified file 'addons/openerp/controllers/form.py' |
38 | --- addons/openerp/controllers/form.py 2019-02-10 18:15:40 +0000 |
39 | +++ addons/openerp/controllers/form.py 2019-08-02 10:04:03 +0000 |
40 | @@ -192,6 +192,14 @@ |
41 | def create(self, params, tg_errors=None): |
42 | params.view_type = params.view_type or params.view_mode[0] |
43 | |
44 | + loading_id = False |
45 | + if params.view_type == 'form' and params.id: |
46 | + loading_ids = rpc.RPCProxy('job.in_progress').search([('model', '=', params.model), ('res_id', '=', params.id), ('read', '=', False)]) |
47 | + if loading_ids: |
48 | + loading_id = [loading_ids[-1]] |
49 | + params.editable = False |
50 | + params.readonly = True |
51 | + params.force_readonly = True |
52 | if params.view_type == 'tree': |
53 | params.editable = True |
54 | |
55 | @@ -257,6 +265,11 @@ |
56 | display_name = {} |
57 | if params.view_type == 'form': |
58 | if params.id: |
59 | + title_field = form.screen.view.get('title_field') |
60 | + if form.screen.widget.force_string and form.screen.widget.string: |
61 | + form.screen.string = form.screen.widget.string |
62 | + elif title_field and form.screen.view['fields'].get(title_field, {}).get('value'): |
63 | + form.screen.string = form.screen.view['fields'][title_field]['value'] |
64 | if form.screen.view.get('fields') and form.screen.view['fields'].get('name'): |
65 | display_name = {'field': form.screen.view['fields']['name']['string'], 'value': ustr(form.screen.view['fields']['name']['value'])} |
66 | title= ustr(display_name['field']) + ':' + ustr(display_name['value']) |
67 | @@ -272,7 +285,7 @@ |
68 | |
69 | is_dashboard = form.screen.is_dashboard or False |
70 | |
71 | - return dict(form=form, pager=pager, buttons=buttons, path=self.path, can_shortcut=can_shortcut, shortcut_ids=shortcut_ids, display_name=display_name, title=title, tips=tips, obj_process=obj_process, is_dashboard=is_dashboard, sidebar_closed=params._terp_sidebar_closed, sidebar_open=params.sidebar_open, auto_refresh=params.auto_refresh, tg_errors=tg_errors) |
72 | + return dict(form=form, pager=pager, buttons=buttons, path=self.path, can_shortcut=can_shortcut, shortcut_ids=shortcut_ids, display_name=display_name, title=title, tips=tips, obj_process=obj_process, is_dashboard=is_dashboard, sidebar_closed=params._terp_sidebar_closed, sidebar_open=params.sidebar_open, auto_refresh=params.auto_refresh, tg_errors=tg_errors, loading_id=loading_id) |
73 | |
74 | @expose('json', methods=('POST',)) |
75 | def close_or_disable_tips(self): |
76 | |
77 | === modified file 'addons/openerp/controllers/templates/form.mako' |
78 | --- addons/openerp/controllers/templates/form.mako 2018-02-02 13:13:22 +0000 |
79 | +++ addons/openerp/controllers/templates/form.mako 2019-08-02 10:04:03 +0000 |
80 | @@ -28,6 +28,13 @@ |
81 | setTimeout(function() { |
82 | jQuery('[autofocus="autofocus"]').focus(); |
83 | }, 10); |
84 | + |
85 | + % if form.screen.view_type == 'form': |
86 | + sidebar_to_update = $('#update_me_with_title'); |
87 | + if (sidebar_to_update.length) { |
88 | + sidebar_to_update.html($('#form_title').html()); |
89 | + } |
90 | + % endif |
91 | }); |
92 | </script> |
93 | |
94 | @@ -87,13 +94,13 @@ |
95 | % if can_shortcut: |
96 | <a id="shortcut_add_remove" title="${_('Add / Remove Shortcut...')}" href="javascript: void(0)" class="${shortcut_class}"></a> |
97 | % endif |
98 | - |
99 | + <span id="form_title"> |
100 | % if form.screen.view_type == 'tree': |
101 | ${_('Search: %s') % form.screen.string} |
102 | % else: |
103 | ${form.screen.string} |
104 | % endif |
105 | - |
106 | + </span> |
107 | % if obj_process: |
108 | <a class="help" href="${py.url('/view_diagram/process', res_model=form.screen.model, title=form.screen.string, res_id=form.screen.id)}" |
109 | title="${_('Corporate Intelligence...')}"> |
110 | @@ -170,6 +177,7 @@ |
111 | </div> |
112 | % endif |
113 | <div${ " class='non-editable'" if not form.screen.editable and form.screen.view_type == 'form' else "" | n }>${form.display()}</div> |
114 | + |
115 | </div> |
116 | |
117 | </td> |
118 | @@ -214,6 +222,9 @@ |
119 | % if tg_errors: |
120 | error_display(_("The form contains errors.")); |
121 | % endif |
122 | + % if loading_id: |
123 | + jQuery.fancybox({'href': "/openerp/progressbar?model=${form.screen.model}&id=${form.screen.id}&job_id=${loading_id}", 'modal': false, 'onClickClosed': function() {window.editRecord(${form.screen.id})}}); |
124 | + % endif |
125 | }) |
126 | </script> |
127 | </%def> |
128 | |
129 | === added file 'addons/openerp/controllers/templates/progress.mako' |
130 | --- addons/openerp/controllers/templates/progress.mako 1970-01-01 00:00:00 +0000 |
131 | +++ addons/openerp/controllers/templates/progress.mako 2019-08-02 10:04:03 +0000 |
132 | @@ -0,0 +1,138 @@ |
133 | +<%inherit file="/openerp/controllers/templates/base_dispatch.mako"/> |
134 | + |
135 | +<%def name="header()"> |
136 | + <title>${_("Information")}</title> |
137 | + <link href="/openerp/static/css/style.css" rel="stylesheet" type="text/css"/> |
138 | + <script type="text/javascript"> |
139 | + function set_as_read(target) { |
140 | + var req = openobject.http.postJSON('/openerp/progressbar/setread', {'model': "${model}", 'id': ${id}, "job_id": ${job_id}}); |
141 | + req.addCallback(function(obj) { |
142 | + if (obj.error) { |
143 | + jQuery.fancybox(obj.error, {scrolling: 'no'}); |
144 | + } |
145 | + }); |
146 | + } |
147 | + |
148 | + function open_progress_target(target) { |
149 | + if (target) { |
150 | + window.openAction(target); |
151 | + } else { |
152 | + window.editRecord(${id}); |
153 | + } |
154 | + jQuery.fancybox.close(); |
155 | + } |
156 | + |
157 | + get_progress = function () { |
158 | + var req = openobject.http.postJSON('/openerp/progressbar/get', {'model': "${model}", 'id': ${id}, "job_id": ${job_id}}); |
159 | + req.addCallback(function(obj) { |
160 | + if (obj.error) { |
161 | + jQuery.fancybox(obj.error, {scrolling: 'no'}); |
162 | + } |
163 | + else { |
164 | + $('#indicator').width((obj.progress*250)/100+'px'); |
165 | + $('#percentage').html(obj.progress+'%'); |
166 | + if (obj.state == 'error') { |
167 | + set_as_read(); |
168 | + $('#boxtitle').html(_("Last Processing Error")); |
169 | + $('#open_src').click(open_progress_target); |
170 | + $('#open_src').show(); |
171 | + $('#pwidget').css('overflow', 'scroll'); |
172 | + $('#pwidget').css('white-space', 'pre'); |
173 | + $('#pwidget').html(obj.errormsg); |
174 | + } else if (obj.state != 'done') { |
175 | + setTimeout(get_progress, 1000); |
176 | + } else { |
177 | + set_as_read(); |
178 | + if (obj.job_name) { |
179 | + $('#boxtitle').html(obj.job_name + " " + _("Done")); |
180 | + } else { |
181 | + $('#boxtitle').html(_("Done")); |
182 | + } |
183 | + if (obj.src_name) { |
184 | + $('#open_src').html(_('View ')+obj.src_name) |
185 | + } |
186 | + $('#open_src').click(function() {open_progress_target()}); |
187 | + if (obj.target) { |
188 | + if (obj.target_name) { |
189 | + $('#open_target').html(_('View ')+obj.target_name); |
190 | + } |
191 | + $('#open_target').show(); |
192 | + $('#open_target').click(function() {open_progress_target(obj.target)}); |
193 | + } else { |
194 | + $('#open_src').show(); |
195 | + } |
196 | + } |
197 | + } |
198 | + }); |
199 | + |
200 | + } |
201 | + jQuery(document).ready(function () { |
202 | + get_progress(); |
203 | + }); |
204 | + </script> |
205 | + |
206 | + <style> |
207 | + #progressbar { |
208 | + width: 250px; |
209 | + padding:1px; |
210 | + background-color:white; |
211 | + border:1px solid black; |
212 | + height:28px; |
213 | + line-height: 28px; |
214 | + vertical-align: middle; |
215 | + text-align: center; |
216 | + font-weight: bold; |
217 | + font-size: 120%; |
218 | + } |
219 | + |
220 | + #pwidget { |
221 | + background-color:lightgray; |
222 | + width:254px; |
223 | + margin-top: 20px; |
224 | + margin-left: auto; |
225 | + margin-right: auto; |
226 | + padding:2px; |
227 | + -moz-border-radius:3px; |
228 | + border-radius:3px; |
229 | + text-align:center; |
230 | + border:1px solid gray; |
231 | + } |
232 | + |
233 | + #indicator { |
234 | + width: 0px; |
235 | + background-image: linear-gradient(white, green); |
236 | + height: 28px; |
237 | + margin: 0; |
238 | + } |
239 | + |
240 | + #percentage { |
241 | + position: absolute; |
242 | + } |
243 | + </style> |
244 | +</%def> |
245 | + |
246 | +<%def name="content()"> |
247 | + <table class="view" cellspacing="5" border="0" height="200px" width="400px"> |
248 | + <tr> |
249 | + <td> |
250 | + <h1 id="boxtitle">${_("In Progress")}</h1> |
251 | + </td> |
252 | + </tr> |
253 | + <tr> |
254 | + <td> |
255 | + <div id="pwidget"> |
256 | + <div id="progressbar"> |
257 | + <span id="percentage"></span> |
258 | + <div id="indicator" style="width: 25px"></div> |
259 | + </div> |
260 | + </div> |
261 | + </td> |
262 | + </tr> |
263 | + <tr> |
264 | + <td> |
265 | + <button id="open_src" style="display:none">View Object</button> |
266 | + <button id="open_target" style="display:none">View Target</button> |
267 | + </td> |
268 | + </tr> |
269 | + </table> |
270 | +</%def> |
271 | |
272 | === modified file 'addons/openerp/controllers/view_log.py' |
273 | --- addons/openerp/controllers/view_log.py 2018-12-27 15:47:51 +0000 |
274 | +++ addons/openerp/controllers/view_log.py 2019-08-02 10:04:03 +0000 |
275 | @@ -23,6 +23,46 @@ |
276 | |
277 | from openobject.tools import expose |
278 | |
279 | +import base64 |
280 | +import urllib |
281 | +import zlib |
282 | + |
283 | +class progress_bar(SecuredController): |
284 | + _cp_path = '/openerp/progressbar' |
285 | + |
286 | + @expose('json') |
287 | + def get(self, id, model, job_id): |
288 | + job = rpc.RPCProxy('job.in_progress').read(int(job_id)) |
289 | + if not job or job['state'] == 'done' or job['res_id'] != int(id) or job['model'] != model: |
290 | + url = '' |
291 | + if job['target_link']: |
292 | + payload = str({ |
293 | + 'action': job['target_link'], |
294 | + 'data': {} |
295 | + }) |
296 | + compressed_payload = base64.urlsafe_b64encode(zlib.compress(payload)) |
297 | + url = ('/openerp/execute?' + urllib.urlencode({'payload': compressed_payload})) |
298 | + return {'progress': 100, 'state': 'done', 'target': url, 'target_name': job['target_name'], 'src_name': job['src_name'], 'job_name': job['name']} |
299 | + |
300 | + percent = 100*(job['nb_processed'] or 0)/(job['total'] or 1) |
301 | + if job['state'] == 'error': |
302 | + return {'state': 'error', 'errormsg': job['error'], 'progress': percent} |
303 | + |
304 | + return {'progress': percent, 'state': 'in-progress'} |
305 | + |
306 | + @expose('json') |
307 | + def setread(self, id, model, job_id): |
308 | + job_obj = rpc.RPCProxy('job.in_progress') |
309 | + job_id = job_obj.search([('id', '=', int(job_id)), ('res_id', '=', int(id)), ('model', '=', model)]) |
310 | + if job_id: |
311 | + job_obj.write(job_id, {'read': True}) |
312 | + |
313 | + return {} |
314 | + |
315 | + @expose(template="/openerp/controllers/templates/progress.mako") |
316 | + def index(self, id, model, job_id): |
317 | + return {'id': id, 'model': model, 'job_id': job_id} |
318 | + |
319 | |
320 | class View_Log(SecuredController): |
321 | |
322 | |
323 | === modified file 'addons/openerp/po/javascript/fr.po' |
324 | --- addons/openerp/po/javascript/fr.po 2017-09-20 12:27:53 +0000 |
325 | +++ addons/openerp/po/javascript/fr.po 2019-08-02 10:04:03 +0000 |
326 | @@ -118,3 +118,19 @@ |
327 | #: addons/openerp/controllers/templates/form.mako |
328 | msgid "The form contains errors." |
329 | msgstr "Le formulaire comporte des erreurs." |
330 | + |
331 | +#: addons/openerp/controllers/templates/progress.mako |
332 | +msgid "Last Processing Error" |
333 | +msgstr "Dernière Erreur de Traitement" |
334 | + |
335 | +#: addons/openerp/controllers/templates/progress.mako |
336 | +msgid "Done" |
337 | +msgstr "Fini" |
338 | + |
339 | +#: addons/openerp/controllers/templates/progress.mako |
340 | +msgid "In Progress" |
341 | +msgstr "En cours" |
342 | + |
343 | +#: addons/openerp/controllers/templates/progress.mako |
344 | +msgid "View " |
345 | +msgstr "Voir " |
346 | |
347 | === modified file 'addons/openerp/static/css/style.css' |
348 | --- addons/openerp/static/css/style.css 2018-03-08 16:33:38 +0000 |
349 | +++ addons/openerp/static/css/style.css 2019-08-02 10:04:03 +0000 |
350 | @@ -671,6 +671,12 @@ |
351 | padding-right: 16px; |
352 | white-space: nowrap; |
353 | } |
354 | + |
355 | +.m2o_container_nowrap { |
356 | + white-space: normal; |
357 | + padding-right: 16px; |
358 | + |
359 | +} |
360 | .m2o { |
361 | position: relative; |
362 | } |
363 | |
364 | === added file 'addons/openerp/static/images/escalator-up.png' |
365 | Binary files addons/openerp/static/images/escalator-up.png 1970-01-01 00:00:00 +0000 and addons/openerp/static/images/escalator-up.png 2019-08-02 10:04:03 +0000 differ |
366 | === added file 'addons/openerp/static/images/stairs-up.png' |
367 | Binary files addons/openerp/static/images/stairs-up.png 1970-01-01 00:00:00 +0000 and addons/openerp/static/images/stairs-up.png 2019-08-02 10:04:03 +0000 differ |
368 | === modified file 'addons/openerp/static/javascript/form.js' |
369 | --- addons/openerp/static/javascript/form.js 2019-04-30 15:22:40 +0000 |
370 | +++ addons/openerp/static/javascript/form.js 2019-08-02 10:04:03 +0000 |
371 | @@ -426,6 +426,8 @@ |
372 | s_ids = []; |
373 | if (jQuery('[id="order_line"]').length > 0) { |
374 | s_ids = ListView('order_line').getSelectedRecords(); |
375 | + } else if (jQuery('[id="move_lines"]').length > 0){ |
376 | + s_ids = ListView('move_lines').getSelectedRecords(); |
377 | } |
378 | |
379 | var params = { |
380 | @@ -798,6 +800,7 @@ |
381 | fld.value = value; |
382 | var $current_field = jQuery(fld); |
383 | var kind = $current_field.attr('kind') |
384 | + var type2 = $current_field.attr('type2') |
385 | |
386 | //o2m and m2m |
387 | if ($current_field.hasClass('gridview') && !kind){ |
388 | @@ -926,7 +929,10 @@ |
389 | $('#' + prefix + k).val(value || ''); |
390 | break; |
391 | case 'selection': |
392 | - if (typeof(value)=='object') { |
393 | + if (type2 == 'many2one' && typeof(value)=='object') { |
394 | + fld.value = value[0]; |
395 | + } |
396 | + else if (typeof(value)=='object') { |
397 | var opts = [OPTION({'value': ''})]; |
398 | for (var opt = 0; opt < value.length; opt++) { |
399 | if (value[opt].length > 0) { |
400 | @@ -1008,9 +1014,19 @@ |
401 | } |
402 | $fld.trigger('change'); |
403 | MochiKit.Signal.signal(window.document, 'onfieldchange', fld); |
404 | + |
405 | + var fld_ro = jQuery(idSelector(prefix + k + '_ro')); |
406 | + if (fld_ro) { |
407 | + if (fld.nodeName == 'SELECT') { |
408 | + fld_ro.html($fld.children("option:selected").html()); |
409 | + } else { |
410 | + fld_ro.html($fld.val()); |
411 | + } |
412 | + } |
413 | } |
414 | |
415 | fld.__lock_onchange = false; |
416 | + |
417 | } |
418 | |
419 | if (obj.warning && obj.warning.message) { |
420 | |
421 | === modified file 'addons/openerp/static/javascript/form_state.js' |
422 | --- addons/openerp/static/javascript/form_state.js 2018-03-08 15:10:21 +0000 |
423 | +++ addons/openerp/static/javascript/form_state.js 2019-08-02 10:04:03 +0000 |
424 | @@ -573,22 +573,34 @@ |
425 | return; |
426 | } |
427 | $field.attr({'disabled':readonly, 'readOnly': readonly}); |
428 | - |
429 | + ro_f = jQuery(idSelector(field_id+'_ro')) |
430 | if (readonly) { |
431 | if ((type == 'button')) { |
432 | $field.css("cursor", "default"); |
433 | } else { |
434 | $field.removeAttr('href'); |
435 | } |
436 | - |
437 | $field.toggleClass('readonlyfield', type != 'button'); |
438 | if ($field.attr('translatable') == "1") { |
439 | $('#'+field_id+'_translatable').hide(); |
440 | |
441 | } |
442 | + if (ro_f.length) { |
443 | + $field.hide(); |
444 | + ro_f.show(); |
445 | + if (type == 'select-one') { |
446 | + ro_f.html($field.children("option:selected").html()); |
447 | + } else { |
448 | + ro_f.html($field.val()); |
449 | + } |
450 | + } |
451 | } else { |
452 | $field.removeClass('readonlyfield'); |
453 | $field.css('color', ''); |
454 | + if (ro_f.length) { |
455 | + $field.show(); |
456 | + ro_f.hide(); |
457 | + } |
458 | } |
459 | if (type == 'hidden' && kind == 'many2one') { |
460 | ManyToOne(field_id).setReadonly(readonly); |
461 | |
462 | === modified file 'addons/openerp/static/javascript/listgrid.js' |
463 | --- addons/openerp/static/javascript/listgrid.js 2019-04-01 13:56:30 +0000 |
464 | +++ addons/openerp/static/javascript/listgrid.js 2019-08-02 10:04:03 +0000 |
465 | @@ -116,7 +116,7 @@ |
466 | |
467 | checkAll: function(clear) { |
468 | var self = this |
469 | - jQuery('[id="' + this.name + '"] input.grid-record-selector').each(function(){ |
470 | + jQuery('[id="' + this.name + '"] input.grid-record-selector[id!="'+this.name+'_check_all"]').each(function(){ |
471 | jthis = jQuery(this) |
472 | if (clear && jthis.attr('checked')) { |
473 | self.remove_previously_selected(jthis.val()); |
474 | @@ -191,10 +191,11 @@ |
475 | }, |
476 | |
477 | $getSelectedItems: function () { |
478 | + var ignore_tick = this.name+'_check_all'; |
479 | return jQuery(idSelector(this.name)) |
480 | .find('input.grid-record-selector') |
481 | .filter(function() { |
482 | - return this.id && this.checked; |
483 | + return this.id && this.checked && this.id!=ignore_tick; |
484 | }) |
485 | }, |
486 | |
487 | @@ -210,11 +211,18 @@ |
488 | nosidebar = arguments[2]; |
489 | if (clicked) { |
490 | this.add_previously_selected(id); |
491 | + if (this.name != '_terp_list' && jQuery('[id="' + this.name + '"] input.grid-record-selector[id!="'+this.name+'_check_all"]').length == this.getSelectedRecords().length) { |
492 | + $('#'+this.name+'_check_all').attr('checked', true); |
493 | + } |
494 | } else { |
495 | this.remove_previously_selected(id); |
496 | + if (this.name != '_terp_list') { |
497 | + $('#'+this.name+'_check_all').attr('checked', false); |
498 | + } |
499 | } |
500 | + } else if (this.name != '_terp_list') { |
501 | + nosidebar = true; |
502 | } |
503 | - |
504 | if (!nosidebar) { |
505 | var $sidebar = jQuery('.toggle-sidebar'); |
506 | if ($sidebar.is('.closed')) { |
507 | @@ -914,6 +922,9 @@ |
508 | this.reload(); |
509 | }, |
510 | |
511 | + after_reload: function() { |
512 | + }, |
513 | + |
514 | reload_from_wizard: function() { |
515 | return this.reload(undefined, undefined, undefined, undefined, undefined, true); |
516 | }, |
517 | @@ -1045,6 +1056,10 @@ |
518 | //console.log('Set readonly'); |
519 | new One2Many(self.name).setReadonly(true); |
520 | } |
521 | + __listview.after_reload() |
522 | + jQuery('#view_form .editors (input|select):not([type="hidden"]):[fld_readonly="1"][editable_style="1"], #view_form .editors (input|select):[kind="many2one"]:[fld_readonly="1"][editable_style="1"]').each(function() { |
523 | + form_setReadonly(this, this, true); |
524 | + }); |
525 | } |
526 | |
527 | var selfname = self.name |
528 | |
529 | === modified file 'addons/openerp/static/javascript/m2o.js' |
530 | --- addons/openerp/static/javascript/m2o.js 2017-09-14 12:04:48 +0000 |
531 | +++ addons/openerp/static/javascript/m2o.js 2019-08-02 10:04:03 +0000 |
532 | @@ -38,6 +38,7 @@ |
533 | |
534 | this.field = openobject.dom.get(name); |
535 | this.text = openobject.dom.get(name + '_text'); |
536 | + this.textro = openobject.dom.get(name + '_ro'); |
537 | this.editable = this.field.tagName.toLowerCase() != 'span'; |
538 | //for autocomplete |
539 | this.auto_hidden_id = openobject.dom.get('_hidden_' + name); |
540 | @@ -447,6 +448,16 @@ |
541 | .attr({'readOnly': readonly, |
542 | 'disabled': readonly}) |
543 | .toggleClass('readonly', !!readonly).toggleClass('readonlyfield', !!readonly); |
544 | + if (jQuery(this.field).attr('editable_style') == '1') { |
545 | + if (readonly) { |
546 | + jQuery(this.text).hide(); |
547 | + jQuery(this.textro).show().html(jQuery(this.text).val()); |
548 | + jQuery(this.select_img).hide(); |
549 | + } else { |
550 | + jQuery(this.text).show(); |
551 | + jQuery(this.textro).hide(); |
552 | + } |
553 | + } |
554 | }; |
555 | |
556 | ManyToOne.prototype.clearResults = function() { |
557 | |
558 | === modified file 'addons/openerp/static/javascript/openerp/openerp.base.js' |
559 | --- addons/openerp/static/javascript/openerp/openerp.base.js 2018-10-24 14:22:10 +0000 |
560 | +++ addons/openerp/static/javascript/openerp/openerp.base.js 2019-08-02 10:04:03 +0000 |
561 | @@ -134,7 +134,7 @@ |
562 | } else { |
563 | _openAction = openAction; |
564 | } |
565 | - _openAction(xhr.getResponseHeader('Location'), target, active_id, keep_open); |
566 | + _openAction(xhr.getResponseHeader('Location'), target, active_id, keep_open, xhr.getResponseHeader('height'), xhr.getResponseHeader('width')); |
567 | return; |
568 | } |
569 | if(url) { |
570 | @@ -187,7 +187,7 @@ |
571 | * @param action_url the URL of the action to open |
572 | * @param target the target, if any, defaults to 'current' |
573 | */ |
574 | -function openAction(action_url, target, terp_id, keep_open) { |
575 | +function openAction(action_url, target, terp_id, keep_open, height, width) { |
576 | var $dialogs = jQuery('.action-dialog'); |
577 | switch(target) { |
578 | case 'new': |
579 | @@ -195,8 +195,8 @@ |
580 | src: action_url, |
581 | 'class': 'action-dialog' |
582 | }, null, { |
583 | - width: '90%', |
584 | - height: '95%' |
585 | + width: width?width:'90%', |
586 | + height: height?height:'95%' |
587 | }); |
588 | $frame.focus(); |
589 | if (terp_id && !$dialogs.length) { |
590 | |
591 | === modified file 'addons/openerp/widgets/_interface.py' |
592 | --- addons/openerp/widgets/_interface.py 2019-05-06 13:38:07 +0000 |
593 | +++ addons/openerp/widgets/_interface.py 2019-08-02 10:04:03 +0000 |
594 | @@ -57,7 +57,8 @@ |
595 | 'visible', |
596 | 'valign', |
597 | 'model', |
598 | - 'label' |
599 | + 'label', |
600 | + 'editable_style' |
601 | ] |
602 | |
603 | colspan = 1 |
604 | @@ -81,7 +82,7 @@ |
605 | self.nolabel = _boolean_attr(attrs, 'nolabel') |
606 | |
607 | self.visible = True |
608 | - |
609 | + self.editable_style = attrs.get('editable_style', False) and '1' or False |
610 | try: |
611 | visval = attrs.get('invisible', 'False') |
612 | ctx = attrs.get('context', {}) |
613 | @@ -242,6 +243,8 @@ |
614 | params['attrs']['autofocus'] = 'autofocus' |
615 | if self.readonly: |
616 | params['attrs']['disabled'] = 'disabled' |
617 | + if self.editable_style: |
618 | + params['attrs']['editable_style'] = '1' |
619 | #if self.states: |
620 | # states = self.states |
621 | # # convert into JS |
622 | |
623 | === modified file 'addons/openerp/widgets/_views.py' |
624 | --- addons/openerp/widgets/_views.py 2019-01-28 09:28:56 +0000 |
625 | +++ addons/openerp/widgets/_views.py 2019-08-02 10:04:03 +0000 |
626 | @@ -61,7 +61,8 @@ |
627 | readonly=screen.readonly, |
628 | nodefault=screen.nodefault, |
629 | nolinks=screen.link, |
630 | - get_source=screen.get_source) |
631 | + get_source=screen.get_source, |
632 | + force_readonly=screen.force_readonly) |
633 | |
634 | if not screen.is_wizard and screen.ids is None: |
635 | limit = screen.limit or 50 |
636 | |
637 | === modified file 'addons/openerp/widgets/form/_form.py' |
638 | --- addons/openerp/widgets/form/_form.py 2019-01-28 09:28:56 +0000 |
639 | +++ addons/openerp/widgets/form/_form.py 2019-08-02 10:04:03 +0000 |
640 | @@ -532,7 +532,6 @@ |
641 | |
642 | def __init__(self, **attrs): |
643 | super(Selection, self).__init__(**attrs) |
644 | - |
645 | self.options = attrs.get('selection', []) |
646 | self.type2 = attrs.get('type2') |
647 | self.operator = attrs.get('operator', '=') |
648 | @@ -687,7 +686,6 @@ |
649 | visible = True |
650 | def __init__(self, **attrs): |
651 | super(Button, self).__init__(**attrs) |
652 | - |
653 | # remove mnemonic |
654 | self.string = re.sub('_(?!_)', '', self.string or '') |
655 | |
656 | @@ -801,9 +799,9 @@ |
657 | params = ['id'] |
658 | member_widgets = ['frame', 'concurrency_info'] |
659 | |
660 | - def __init__(self, prefix, model, view, ids=[], domain=[], context=None, editable=True, readonly=False, nodefault=False, nolinks=1, get_source=False): |
661 | + def __init__(self, prefix, model, view, ids=[], domain=[], context=None, editable=True, readonly=False, nodefault=False, nolinks=1, get_source=False, force_readonly=False): |
662 | |
663 | - super(Form, self).__init__(prefix=prefix, model=model, editable=editable, readonly=readonly, nodefault=nodefault) |
664 | + super(Form, self).__init__(prefix=prefix, model=model, editable=editable, readonly=readonly, nodefault=nodefault, force_readonly=force_readonly) |
665 | dom = xml.dom.minidom.parseString(view['arch'].encode('utf-8')) |
666 | root = dom.childNodes[0] |
667 | attrs = node_attributes(root) |
668 | @@ -815,6 +813,7 @@ |
669 | self.hide_button_edit = attrs.get('hide_edit_button', False) |
670 | self.hide_button_save = attrs.get('hide_save_button', False) |
671 | self.hide_button_cancel = attrs.get('hide_cancel_button', False) |
672 | + self.force_string = attrs.get('force_string') |
673 | self.noteditable = False |
674 | self.link = attrs.get('link', nolinks) |
675 | self.model = model |
676 | @@ -973,6 +972,8 @@ |
677 | |
678 | elif node.localName=='button': |
679 | attrs['editable'] = self.editable |
680 | + if self.force_readonly: |
681 | + attrs['force_readonly'] = True |
682 | views.append(Button(model=self.model, id=self.id, **attrs)) |
683 | |
684 | elif node.localName == 'form': |
685 | @@ -1080,6 +1081,7 @@ |
686 | attrs.setdefault('context', self.context) |
687 | attrs.setdefault('model', self.model) |
688 | attrs.setdefault('state', self.state) |
689 | + attrs.setdefault('force_readonly', self.force_readonly) |
690 | |
691 | if attrs.get('widget'): |
692 | if attrs['widget']=='one2many_list': |
693 | |
694 | === modified file 'addons/openerp/widgets/form/_o2m.py' |
695 | --- addons/openerp/widgets/form/_o2m.py 2019-01-28 10:50:46 +0000 |
696 | +++ addons/openerp/widgets/form/_o2m.py 2019-08-02 10:04:03 +0000 |
697 | @@ -82,7 +82,7 @@ |
698 | template = "/openerp/widgets/form/templates/one2many.mako" |
699 | params = ['id', 'parent_id', 'new_attrs', 'pager_info', 'switch_to', |
700 | 'default_get_ctx', 'source', 'view_type', 'default_value', |
701 | - 'edition', 'readonly_before_state'] |
702 | + 'edition', 'readonly_before_state', 'editable_style'] |
703 | member_widgets = ['screen'] |
704 | |
705 | form = None |
706 | @@ -95,6 +95,7 @@ |
707 | |
708 | super(O2M, self).__init__(**attrs) |
709 | |
710 | + |
711 | self.new_attrs = { 'text': _("New"), 'help': _('Create new record.')} |
712 | self.default_get_ctx = attrs.get('default_get', {}) or attrs.get('context', {}) |
713 | |
714 | @@ -124,7 +125,6 @@ |
715 | mode = str(attrs.get('mode', 'tree,form')).split(',') |
716 | view['uom_rounding'] = attrs.get('uom_rounding', {}) |
717 | self.view = view |
718 | - |
719 | view_mode = mode |
720 | view_type = mode[0] |
721 | self.view_type = view_type |
722 | @@ -182,7 +182,6 @@ |
723 | tree_attribute = node_attributes(dom.childNodes[0]) |
724 | if tree_attribute.get('limit'): |
725 | current.limit = tree_attribute.get('limit') |
726 | - |
727 | if current.limit != -1 and not params.sort_key and not current.domain: |
728 | ids = ids[current.offset: current.offset+current.limit] |
729 | |
730 | |
731 | === modified file 'addons/openerp/widgets/form/templates/button.mako' |
732 | --- addons/openerp/widgets/form/templates/button.mako 2017-06-13 15:26:29 +0000 |
733 | +++ addons/openerp/widgets/form/templates/button.mako 2019-08-02 10:04:03 +0000 |
734 | @@ -7,7 +7,11 @@ |
735 | onclick="buttonClicked('${name}', '${btype}', '${model}', '${id}', getNodeAttribute(this, 'confirm'), '${target}', getNodeAttribute(this, 'context'));" |
736 | oncontextmenu="showBtnSdref(event, '${name}', '${model}', '${id}');" |
737 | style="height: 20px;" |
738 | - ${py.attrs(attrs, confirm=confirm, context=ctx)}> |
739 | + ${py.attrs(attrs, confirm=confirm, context=ctx)} |
740 | + % if force_readonly: |
741 | + disabled="disabled" |
742 | + % endif |
743 | + > |
744 | % if string: |
745 | % if icon: |
746 | <img src="${icon}" width="16" height="16" alt=""> <span>${string}</span> |
747 | |
748 | === modified file 'addons/openerp/widgets/form/templates/char.mako' |
749 | --- addons/openerp/widgets/form/templates/char.mako 2018-03-08 16:02:12 +0000 |
750 | +++ addons/openerp/widgets/form/templates/char.mako 2019-08-02 10:04:03 +0000 |
751 | @@ -20,6 +20,9 @@ |
752 | }); |
753 | </script> |
754 | % endif |
755 | + % if editable_style: |
756 | + <span id="${name}_ro" /> |
757 | + % endif |
758 | % if error: |
759 | <span class="fielderror">${error}</span> |
760 | % endif |
761 | |
762 | === modified file 'addons/openerp/widgets/form/templates/datetime.mako' |
763 | --- addons/openerp/widgets/form/templates/datetime.mako 2017-10-27 15:27:11 +0000 |
764 | +++ addons/openerp/widgets/form/templates/datetime.mako 2019-08-02 10:04:03 +0000 |
765 | @@ -7,6 +7,9 @@ |
766 | class="${css_class}" |
767 | ${py.attrs(attrs, kind=kind, value=value, |
768 | fld_readonly=1 if readonly_before_state else 0 )}/> |
769 | + % if editable_style: |
770 | + <span id="${name}_ro" /> |
771 | + % endif |
772 | % if error: |
773 | <span class="fielderror">${error}</span> |
774 | % endif |
775 | |
776 | === modified file 'addons/openerp/widgets/form/templates/float.mako' |
777 | --- addons/openerp/widgets/form/templates/float.mako 2017-10-27 14:21:48 +0000 |
778 | +++ addons/openerp/widgets/form/templates/float.mako 2019-08-02 10:04:03 +0000 |
779 | @@ -8,6 +8,9 @@ |
780 | size="1" |
781 | class="${css_class}" |
782 | ${py.attrs(attrs, fld_readonly=1 if readonly_before_state else 0)} /> |
783 | + % if editable_style: |
784 | + <span id="${name}_ro" /> |
785 | + % endif |
786 | % endif |
787 | |
788 | % if editable and error: |
789 | |
790 | === modified file 'addons/openerp/widgets/form/templates/integer.mako' |
791 | --- addons/openerp/widgets/form/templates/integer.mako 2017-10-20 09:24:34 +0000 |
792 | +++ addons/openerp/widgets/form/templates/integer.mako 2019-08-02 10:04:03 +0000 |
793 | @@ -7,6 +7,9 @@ |
794 | value="${value}" |
795 | class="${css_class}" |
796 | ${py.attrs(attrs, fld_readonly=1 if readonly_before_state else 0)}/> |
797 | + % if editable_style: |
798 | + <span id="${name}_ro" /> |
799 | + % endif |
800 | % endif |
801 | |
802 | % if editable and error: |
803 | |
804 | === modified file 'addons/openerp/widgets/form/templates/many2one.mako' |
805 | --- addons/openerp/widgets/form/templates/many2one.mako 2019-05-06 13:38:07 +0000 |
806 | +++ addons/openerp/widgets/form/templates/many2one.mako 2019-08-02 10:04:03 +0000 |
807 | @@ -1,9 +1,9 @@ |
808 | <%def name="display_open_resource(name)"> |
809 | - <img id="${name}_open" alt="${_('Open')}" title="${_('Open a resource')}" |
810 | +<img id="${name}_open" alt="${_('Open')}" title="${_('Open a resource')}" |
811 | src="/openerp/static/images/iconset-d-drop.gif" class="m2o_open"/> |
812 | </%def> |
813 | <%def name="m2o_container()"> |
814 | - <div class="m2o_container"> |
815 | + <div class="m2o_container${editable_style and readonly_before_state and '_nowrap' or ''}"> |
816 | ${caller.body()} |
817 | </div> |
818 | </%def> |
819 | @@ -14,6 +14,9 @@ |
820 | ${py.attrs(attrs, kind=kind, domain=domain, context=ctx, |
821 | relation=relation, required=required and 1 or 0, |
822 | fld_readonly=1 if readonly_before_state else 0)}/> |
823 | + % if editable_style: |
824 | + <span id="${name}_ro" /> |
825 | + % endif |
826 | <input type="text" id="${name}_text" class="${css_class}" size="1" |
827 | ${py.attrs(attrs, kind=kind, relation=relation, value=text)}/> |
828 | |
829 | |
830 | === modified file 'addons/openerp/widgets/form/templates/one2many.mako' |
831 | --- addons/openerp/widgets/form/templates/one2many.mako 2018-02-28 10:41:20 +0000 |
832 | +++ addons/openerp/widgets/form/templates/one2many.mako 2019-08-02 10:04:03 +0000 |
833 | @@ -60,7 +60,7 @@ |
834 | <input type="hidden" name="${name}/_terp_default_get_ctx" id="${name}/_terp_default_get_ctx" value="${default_get_ctx}"/> |
835 | <input type="hidden" name="${name}/_terp_previously_selected" id="${name}/_terp_previously_selected" /> |
836 | % if default_value: |
837 | - <input type="hidden" name="_terp_default_o2m/${name}" id="_terp_default_o2m/${name}" value="${default_value}"/> |
838 | + <input type="hidden" name="_terp_default_o2m/${name}" id="_terp_default_o2m/${name}" value="${default_value}"/> |
839 | %endif |
840 | ${screen.display()} |
841 | </td> |
842 | |
843 | === modified file 'addons/openerp/widgets/form/templates/selection.mako' |
844 | --- addons/openerp/widgets/form/templates/selection.mako 2018-11-07 11:24:59 +0000 |
845 | +++ addons/openerp/widgets/form/templates/selection.mako 2019-08-02 10:04:03 +0000 |
846 | @@ -17,6 +17,9 @@ |
847 | <option value="${val or ''}" ${py.selector(val==(value or False))}>${label}</option> |
848 | % endfor |
849 | </select> |
850 | + % if editable_style: |
851 | + <span id="${name}_ro" /> |
852 | + % endif |
853 | % if error: |
854 | <span class="fielderror">${error}</span> |
855 | % endif |
856 | |
857 | === modified file 'addons/openerp/widgets/form_view.py' |
858 | --- addons/openerp/widgets/form_view.py 2018-11-12 13:37:43 +0000 |
859 | +++ addons/openerp/widgets/form_view.py 2019-08-02 10:04:03 +0000 |
860 | @@ -94,7 +94,7 @@ |
861 | |
862 | get_source = params.get_source or False |
863 | self.screen = Screen(prefix='', hastoolbar=True, hassubmenu=True, editable=editable, readonly=readonly, |
864 | - selectable=params.selectable or 2, get_source=get_source) |
865 | + selectable=params.selectable or 2, get_source=get_source, force_readonly=params.readonly) |
866 | |
867 | if self.screen.widget and self.screen.view_type in ['form', 'tree']: |
868 | self.logs = Logs() |
869 | @@ -115,6 +115,7 @@ |
870 | self.screen.widget.editable = False |
871 | |
872 | # get the correct view title |
873 | + #if params.context and (params.view_type !='form' or not self.screen.string): |
874 | if params.context: |
875 | self.screen.string = params.context.get('_terp_view_name', self.screen.string) |
876 | self.screen.string = self.screen.string |
877 | |
878 | === modified file 'addons/openerp/widgets/listgrid.py' |
879 | --- addons/openerp/widgets/listgrid.py 2019-04-24 14:56:21 +0000 |
880 | +++ addons/openerp/widgets/listgrid.py 2019-08-02 10:04:03 +0000 |
881 | @@ -38,7 +38,7 @@ |
882 | class List(TinyWidget): |
883 | |
884 | template = "/openerp/widgets/templates/listgrid/listgrid.mako" |
885 | - params = ['name', 'data', 'columns', 'headers', 'model', 'selectable', 'editable', 'noteditable', 'resequencable', |
886 | + params = ['name', 'data', 'columns', 'headers', 'model', 'selectable', 'editable', 'noteditable', 'nopopup', 'resequencable', |
887 | 'pageable', 'selector', 'source', 'offset', 'limit', 'show_links', 'editors', 'view_mode', |
888 | 'hiddens', 'edit_inline', 'field_total', 'field_real_total', |
889 | 'link', 'checkbox_name', 'm2m', 'min_rows', 'string', 'o2m', |
890 | @@ -60,6 +60,7 @@ |
891 | headers = None |
892 | noteditable = None |
893 | notselectable = None |
894 | + nopopup = False |
895 | model = None |
896 | selectable = False |
897 | editable = False |
898 | @@ -76,7 +77,7 @@ |
899 | |
900 | def __init__(self, name, model, view, ids=[], domain=[], context={}, **kw): |
901 | |
902 | - super(List, self).__init__(name=name, model=model, ids=ids) |
903 | + super(List, self).__init__(name=name, model=model, ids=ids, force_readonly=kw.get('force_readonly')) |
904 | self.context = context or {} |
905 | self.domain = domain or [] |
906 | custom_search_domain = getattr(cherrypy.request, 'custom_search_domain', []) |
907 | @@ -93,6 +94,7 @@ |
908 | self.dashboard = 0 |
909 | self.noteditable = [] |
910 | self.notselectable = [] |
911 | + self.nopopup = [] |
912 | self.selectable = kw.get('selectable', 0) |
913 | self.editable = kw.get('editable', False) |
914 | self.pageable = kw.get('pageable', True) |
915 | @@ -296,6 +298,13 @@ |
916 | self.noteditable.append(x['id']) |
917 | except: |
918 | pass |
919 | + if self.editable and attrs.get('nopopup'): |
920 | + for x in self.values: |
921 | + try: |
922 | + if expr_eval(attrs.get('nopopup'), x): |
923 | + self.nopopup.append(x['id']) |
924 | + except: |
925 | + pass |
926 | |
927 | if self.editable and attrs.get('editable') in ('top', 'bottom', 'both'): |
928 | self.bothedit = attrs.get('editable') == 'both' |
929 | @@ -307,6 +316,7 @@ |
930 | self.edit_inline = False |
931 | self.editors = {} |
932 | break |
933 | + fa['editable_style'] = attrs.get('editable_style', False) |
934 | Widget = get_widget(fa.get('type', 'char')) or get_widget('char') |
935 | self.editors[f] = Widget(**fa) |
936 | |
937 | |
938 | === modified file 'addons/openerp/widgets/templates/listgrid/button.mako' |
939 | --- addons/openerp/widgets/templates/listgrid/button.mako 2019-05-03 12:59:31 +0000 |
940 | +++ addons/openerp/widgets/templates/listgrid/button.mako 2019-08-02 10:04:03 +0000 |
941 | @@ -16,7 +16,7 @@ |
942 | onclickAction="new ListView('%s').onButtonClick('%s', '%s', %s, getNodeAttribute(this, 'confirm'), getNodeAttribute(this, 'context'));" % (parent_grid, name, btype, ids) |
943 | oncontextmenuAction="showBtnSdref(event, '%s', '%s', '%s', '%s');" % (name, model, ids, parent_grid) |
944 | %> |
945 | -% if visible: |
946 | +% if visible and not force_readonly: |
947 | % if icon: |
948 | <a class="listImage-container" name="${name}" id="${name}" title="${help}" context="${ctx}" ${attrs_} |
949 | onclick="${onclickAction}" |
950 | |
951 | === modified file 'addons/openerp/widgets/templates/listgrid/listgrid.mako' |
952 | --- addons/openerp/widgets/templates/listgrid/listgrid.mako 2019-04-01 13:56:30 +0000 |
953 | +++ addons/openerp/widgets/templates/listgrid/listgrid.mako 2019-08-02 10:04:03 +0000 |
954 | @@ -97,7 +97,8 @@ |
955 | % if not data['id'] or data['id'] not in notselectable: |
956 | % if not m2m: |
957 | <% |
958 | - selector_click = "new ListView('%s').onBooleanClicked(!this.checked, '%s');" % (name, data['id']) |
959 | + nosidedar = name != '_terp_list' and 'true' or 'false' |
960 | + selector_click = "new ListView('%s').onBooleanClicked(!this.checked, '%s', %s);" % (name, data['id'], nosidedar) |
961 | if selector == "radio": |
962 | selector_click += " do_select();" |
963 | %> |
964 | @@ -132,10 +133,12 @@ |
965 | <img alt="edit record" src="${edit_image}" |
966 | class="listImage" border="0" title="${_('Inline Edit')}" |
967 | onclick="listgridValidation('${name}', ${o2m or 0}, ${data['id']})"/> |
968 | - % if not edit_inline or edit_inline == 'null': |
969 | + % if (not nopopup or not data['id'] or data['id'] not in nopopup) and not edit_inline or edit_inline == 'null': |
970 | <img alt="edit record" src="/openerp/static/images/icons/stock_align_left_24.png" |
971 | class="listImage" border="0" title="${_('Edit')}" |
972 | onclick="listgridValidation('${name}', ${o2m or 0}, ${data['id']}, false)" /> |
973 | + % else: |
974 | + <img src="/openobject/static/images/fancybox/blank.gif" alt="" width="24" class="listImage" border="0" title="" onclick="listgridValidation('${name}', ${o2m or 0}, ${data['id']})"/> |
975 | % endif |
976 | |
977 | % else: |
978 | @@ -303,7 +306,7 @@ |
979 | % if selector: |
980 | <th width="1" class="grid-cell selector"> |
981 | % if selector == 'checkbox' and not m2m: |
982 | - <input type="checkbox" class="checkbox grid-record-selector" onclick="new ListView('${name}').checkAll(!this.checked)"/> |
983 | + <input type="checkbox" class="checkbox grid-record-selector" id="${name}_check_all" onclick="new ListView('${name}').checkAll(!this.checked)"/> |
984 | % endif |
985 | % if selector != 'checkbox' and not m2m: |
986 | <span> </span> |
987 | @@ -460,7 +463,15 @@ |
988 | % if bothedit: |
989 | else { |
990 | jQuery(row).click(function(event) { |
991 | - new One2Many('${name}', false).edit(parseInt(jQuery(row).attr('record'), 10), true); |
992 | + var rec_id = parseInt(jQuery(row).attr('record'), 10); |
993 | + if (rec_id) { |
994 | + new One2Many('${name}', false).edit(rec_id, true); |
995 | + } else { |
996 | + var current_id = jQuery(idSelector('${name}')).attr('current_id'); |
997 | + if (current_id) { |
998 | + new ListView('${name}').save(current_id); |
999 | + } |
1000 | + } |
1001 | }); |
1002 | } |
1003 | % endif |
1004 | |
1005 | === modified file 'addons/openerp/widgets/templates/sidebar.mako' |
1006 | --- addons/openerp/widgets/templates/sidebar.mako 2018-12-27 15:37:05 +0000 |
1007 | +++ addons/openerp/widgets/templates/sidebar.mako 2019-08-02 10:04:03 +0000 |
1008 | @@ -9,7 +9,11 @@ |
1009 | % if icon: |
1010 | <img src="${icon}" alt=""/> |
1011 | % endif |
1012 | - <a href="javascript: void(0)" onclick="return false">${item['name']}</a> |
1013 | + <a href="javascript: void(0)" onclick="return false" |
1014 | + % if item.get('update_title'): |
1015 | + id="update_me_with_title" |
1016 | + % endif |
1017 | + >${item['name']}</a> |
1018 | </li> |
1019 | % else: |
1020 | <li> |
1021 | |
1022 | === modified file 'openobject/static/javascript/jQuery/jquery.fancybox-1.3.1.js' |
1023 | --- openobject/static/javascript/jQuery/jquery.fancybox-1.3.1.js 2010-10-06 09:37:11 +0000 |
1024 | +++ openobject/static/javascript/jQuery/jquery.fancybox-1.3.1.js 2019-08-02 10:04:03 +0000 |
1025 | @@ -261,7 +261,11 @@ |
1026 | if (currentOpts.showCloseButton) { |
1027 | close.show(); |
1028 | } |
1029 | - |
1030 | + close.unbind('click'); |
1031 | + if ($.isFunction(currentOpts.onClickClosed)) { |
1032 | + close.click(currentOpts.onClickClosed); |
1033 | + } |
1034 | + close.click($.fancybox.close); |
1035 | fancybox_set_navigation(); |
1036 | |
1037 | $(window).bind("resize.fb", $.fancybox.center); |
1038 | @@ -533,7 +537,6 @@ |
1039 | if(!close) |
1040 | close = $('#fancybox-close'); |
1041 | fancybox_abort(); |
1042 | - |
1043 | var obj = selectedArray[ selectedIndex ], |
1044 | href, |
1045 | type, |
1046 | @@ -753,8 +756,6 @@ |
1047 | nav_left = $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'), |
1048 | nav_right = $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>') |
1049 | ); |
1050 | - |
1051 | - close.click($.fancybox.close); |
1052 | loading.click($.fancybox.cancel); |
1053 | |
1054 | nav_left.click(function(e) { |
1055 | @@ -1081,11 +1082,12 @@ |
1056 | onCancel : null, |
1057 | onComplete : null, |
1058 | onCleanup : null, |
1059 | - onClosed : null |
1060 | + onClosed : null, |
1061 | + onClickClosed : null, |
1062 | }; |
1063 | |
1064 | $(document).ready(function() { |
1065 | fancybox_init(); |
1066 | }); |
1067 | |
1068 | -})(jQuery); |
1069 | \ No newline at end of file |
1070 | +})(jQuery); |
1071 | |
1072 | === modified file 'openobject/widgets/_base.py' |
1073 | --- openobject/widgets/_base.py 2010-12-20 09:57:11 +0000 |
1074 | +++ openobject/widgets/_base.py 2019-08-02 10:04:03 +0000 |
1075 | @@ -72,7 +72,6 @@ |
1076 | pass |
1077 | |
1078 | self._resources = OrderedSet() |
1079 | - |
1080 | # Set default css class for the widget |
1081 | if not getattr(self, 'css_class', None): |
1082 | self.css_class = self.__class__.__name__.lower() |