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

Proposed by jftempo
Status: Merged
Merged at revision: 4939
Proposed branch: lp:~jfb-tempo-consulting/unifield-web/US-4350
Merge into: lp:unifield-web
Diff against target: 262 lines (+56/-11)
15 files modified
addons/openerp/controllers/attachment.py (+2/-3)
addons/openerp/controllers/form.py (+0/-2)
addons/openerp/controllers/search.py (+4/-0)
addons/openerp/po/messages/fr.po (+4/-0)
addons/openerp/static/javascript/listgrid.js (+12/-1)
addons/openerp/static/javascript/openerp/openerp.base.js (+1/-0)
addons/openerp/static/javascript/search.js (+20/-3)
addons/openerp/utils/rpc.py (+1/-0)
addons/openerp/widgets/_views.py (+1/-0)
addons/openerp/widgets/listgrid.py (+5/-1)
addons/openerp/widgets/screen.py (+1/-1)
addons/openerp/widgets/templates/sidebar.mako (+2/-0)
addons/openerp/widgets/templates/viewform.mako (+1/-0)
doc/openerp-web-win.cfg (+1/-0)
doc/openerp-web.cfg (+1/-0)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-web/US-4350
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+357937@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/openerp/controllers/attachment.py'
2--- addons/openerp/controllers/attachment.py 2017-02-06 11:21:15 +0000
3+++ addons/openerp/controllers/attachment.py 2018-10-29 09:32:00 +0000
4@@ -71,10 +71,9 @@
5 raise Exception('Unknown attachment type %(type)s for attachment name %(name)s' % attachment)
6
7 @expose('json', methods=('POST',))
8- def save(self, datas, **kwargs):
9- params, data = TinyDict.split(cherrypy.session['params'])
10+ def save(self, model, model_id, datas, **kwargs):
11 ctx = dict(rpc.session.context,
12- default_res_model=params.model, default_res_id=params.id,
13+ default_res_model=model, default_res_id=model_id,
14 active_id=False, active_ids=[])
15 ctx['from_web_interface'] = True
16
17
18=== modified file 'addons/openerp/controllers/form.py'
19--- addons/openerp/controllers/form.py 2018-03-16 11:04:11 +0000
20+++ addons/openerp/controllers/form.py 2018-10-29 09:32:00 +0000
21@@ -181,8 +181,6 @@
22 if tg_errors:
23 return cherrypy.request.terp_form
24
25- cherrypy.session['params'] = params
26-
27 params.offset = params.offset or 0
28 params.count = params.count or 0
29 params.approximation = params.approximation or False
30
31=== modified file 'addons/openerp/controllers/search.py'
32--- addons/openerp/controllers/search.py 2018-02-09 14:29:44 +0000
33+++ addons/openerp/controllers/search.py 2018-10-29 09:32:00 +0000
34@@ -502,3 +502,7 @@
35 del context_own[ctx[0]]
36
37 return context_own
38+
39+ @expose()
40+ def kill_search_filter(self, model, unique_id):
41+ rpc.session.execute('object', 'execute', model, 'kill_search_filter', unique_id, rpc.session.context)
42
43=== modified file 'addons/openerp/po/messages/fr.po'
44--- addons/openerp/po/messages/fr.po 2018-09-20 12:56:09 +0000
45+++ addons/openerp/po/messages/fr.po 2018-10-29 09:32:00 +0000
46@@ -1608,6 +1608,10 @@
47 msgid "Clear all."
48 msgstr "Tout effacer."
49
50+#: widgets/templates/viewform.mako:33
51+msgid "Cancel query"
52+msgstr "Annuler la recherche"
53+
54 #: widgets/templates/viewform.mako:35
55 msgid "Clear"
56 msgstr "Effacer"
57
58=== modified file 'addons/openerp/static/javascript/listgrid.js'
59--- addons/openerp/static/javascript/listgrid.js 2018-07-26 15:07:43 +0000
60+++ addons/openerp/static/javascript/listgrid.js 2018-10-29 09:32:00 +0000
61@@ -692,6 +692,7 @@
62 }
63 });
64
65+var current_search;
66 // standard actions
67 MochiKit.Base.update(ListView.prototype, {
68
69@@ -925,6 +926,10 @@
70
71 var prefix = this.name == '_terp_list' ? '' : this.name + '/';
72 args[prefix+'_terp_force_limit'] = 1;
73+
74+ if (this.name == '_terp_list') {
75+ jQuery('#kill_search').show();
76+ }
77 if (this.name == '_terp_list') {
78 jQuery.extend(args, {
79 _terp_search_domain: openobject.dom.get('_terp_search_domain').value,
80@@ -949,18 +954,24 @@
81 args['_terp_clear'] = true;
82 }
83
84+ if (unique_id) {
85+ args['_terp_unique_id'] = unique_id;
86+ }
87 if (ids_to_show) {
88 args['_terp_ids_to_show'] = '['+ids_to_show.join(',')+']';
89 args['_terp_offset'] = 0;
90 }
91 jQuery(idSelector(self.name) + ' .loading-list').show();
92- jQuery.ajax({
93+ current_search = jQuery.ajax({
94 url: '/openerp/listgrid/get',
95 data: args,
96 dataType: 'jsonp',
97 type: 'POST',
98 error: loadingError(),
99 success: function(obj) {
100+ if (self.name == '_terp_list') {
101+ jQuery('#kill_search').hide();
102+ }
103 var _terp_id = openobject.dom.get(self.name + '/_terp_id') || openobject.dom.get('_terp_id');
104 var _terp_ids = openobject.dom.get(self.name + '/_terp_ids') || openobject.dom.get('_terp_ids');
105 var _terp_count = openobject.dom.get(self.name + '/_terp_count') || openobject.dom.get('_terp_count');
106
107=== modified file 'addons/openerp/static/javascript/openerp/openerp.base.js'
108--- addons/openerp/static/javascript/openerp/openerp.base.js 2018-07-27 09:07:36 +0000
109+++ addons/openerp/static/javascript/openerp/openerp.base.js 2018-10-29 09:32:00 +0000
110@@ -432,3 +432,4 @@
111 });
112
113 var global_list_refresh;
114+var unique_id ='';
115
116=== modified file 'addons/openerp/static/javascript/search.js'
117--- addons/openerp/static/javascript/search.js 2017-01-02 14:59:00 +0000
118+++ addons/openerp/static/javascript/search.js 2018-10-29 09:32:00 +0000
119@@ -633,12 +633,29 @@
120 if (group_by == 'False') {
121 group_by = [];
122 }
123-
124+ unique_id = new Date().getTime();
125 if(jQuery('#filter_table').is(':visible') || jQuery('#_terp_filter_domain').val() != '[]') {
126- display_Customfilters(all_domains, group_by);
127+ return display_Customfilters(all_domains, group_by);
128 } else {
129 var custom_domain = jQuery('#_terp_filter_domain').val() || '[]';
130- final_search_domain(custom_domain, all_domains, group_by);
131+ return final_search_domain(custom_domain, all_domains, group_by);
132+ }
133+}
134+
135+function kill_search_filter() {
136+ current_search.abort();
137+ jQuery(idSelector('_terp_list') + ' .loading-list').hide();
138+ jQuery('#kill_search').hide();
139+ $.event.trigger("ajaxStop");
140+ if (unique_id) {
141+ jQuery.ajax({
142+ url:'/openerp/search/kill_search_filter',
143+ data: {
144+ model: jQuery('#_terp_model').val(),
145+ unique_id: unique_id,
146+ },
147+ type: 'POST',
148+ });
149 }
150 }
151
152
153=== modified file 'addons/openerp/utils/rpc.py'
154--- addons/openerp/utils/rpc.py 2018-02-14 10:46:12 +0000
155+++ addons/openerp/utils/rpc.py 2018-10-29 09:32:00 +0000
156@@ -396,6 +396,7 @@
157 def logout(self):
158 try:
159 self.storage.clear()
160+ cherrypy.session.delete()
161 except Exception:
162 pass
163
164
165=== modified file 'addons/openerp/widgets/_views.py'
166--- addons/openerp/widgets/_views.py 2017-10-12 15:54:04 +0000
167+++ addons/openerp/widgets/_views.py 2018-10-29 09:32:00 +0000
168@@ -119,6 +119,7 @@
169 default_data=screen.default_value,
170 force_readonly=screen.force_readonly,
171 approximation=screen.approximation,
172+ unique_id=screen.unique_id,
173 filter_selector=screen.filter_selector)
174
175 screen.ids = widget.ids
176
177=== modified file 'addons/openerp/widgets/listgrid.py'
178--- addons/openerp/widgets/listgrid.py 2018-05-29 16:01:39 +0000
179+++ addons/openerp/widgets/listgrid.py 2018-10-29 09:32:00 +0000
180@@ -184,7 +184,11 @@
181 search_text = terp_params.get('_terp_search_text', False)
182 if not self.source:
183 self.source = terp_params.get('_terp_source', None)
184+
185+
186 if not default_data and not self.o2m and not self.m2m:
187+ if 'unique_id' in kw:
188+ context['unique_id'] = kw['unique_id']
189 if self.limit > 0:
190 if self.sort_key:
191 ids = proxy.search(search_param, self.offset, self.limit, self.sort_key + ' ' +self.sort_order + ',id', context)
192@@ -222,7 +226,7 @@
193 ctx.update(context)
194
195 try:
196- data = proxy.read(ids, fields.keys() + ['__last_update'], ctx)
197+ data = proxy.read_web(ids, fields.keys() + ['__last_update'], ctx)
198 except:
199 pass
200
201
202=== modified file 'addons/openerp/widgets/screen.py'
203--- addons/openerp/widgets/screen.py 2018-04-04 15:01:51 +0000
204+++ addons/openerp/widgets/screen.py 2018-10-29 09:32:00 +0000
205@@ -85,7 +85,7 @@
206 self.count = params.count
207 self.approximation = params.approximation
208 self.target_action_id = params.target_action_id or False
209-
210+ self.unique_id = params.unique_id or False
211 if (self.ids or self.id) and self.count == 0:
212 if self.ids and len(self.ids) < self.limit:
213 self.count = len(self.ids)
214
215=== modified file 'addons/openerp/widgets/templates/sidebar.mako'
216--- addons/openerp/widgets/templates/sidebar.mako 2017-07-27 12:07:44 +0000
217+++ addons/openerp/widgets/templates/sidebar.mako 2018-10-29 09:32:00 +0000
218@@ -72,6 +72,8 @@
219 <form id="attachment-box" action="/openerp/attachment/save" method="post"
220 enctype="multipart/form-data">
221 <label for="sidebar_attachments_datas">${_("File")}:</label>
222+ <input type="hidden" name="model" value="${model}" />
223+ <input type="hidden" name="model_id" value="${id}" />
224 <input type="file" id="sidebar_attachments_datas" class="binary"
225 name="datas" kind="binary" size="5"
226 max-size="${max_attachment_size}"/>
227
228=== modified file 'addons/openerp/widgets/templates/viewform.mako'
229--- addons/openerp/widgets/templates/viewform.mako 2017-06-01 13:48:36 +0000
230+++ addons/openerp/widgets/templates/viewform.mako 2018-10-29 09:32:00 +0000
231@@ -31,6 +31,7 @@
232 else:
233 clear_filters = "reload_graph(true);"
234 %>
235+ <button title="${_('Cancel query')}" onclick="kill_search_filter(''); return false;" class="oe_form_button_search" style="display: none;" id="kill_search">${_('Cancel query')}</button>
236 <button title="${_('Clear all.')}" id="clear_all_filters"
237 class="oe_form_button_clear"
238 onclick="${clear_filters} return false;"
239
240=== modified file 'doc/openerp-web-win.cfg'
241--- doc/openerp-web-win.cfg 2018-04-25 11:58:27 +0000
242+++ doc/openerp-web-win.cfg 2018-10-29 09:32:00 +0000
243@@ -13,6 +13,7 @@
244
245 tools.sessions.on = True
246 tools.sessions.persistent = False
247+tools.sessions.locking = 'explicit'
248
249 # Simple code profiling
250 server.profile_on = False
251
252=== modified file 'doc/openerp-web.cfg'
253--- doc/openerp-web.cfg 2018-04-25 09:45:33 +0000
254+++ doc/openerp-web.cfg 2018-10-29 09:32:00 +0000
255@@ -13,6 +13,7 @@
256
257 tools.sessions.on = True
258 tools.sessions.persistent = False
259+tools.sessions.locking = 'explicit'
260
261 # Simple code profiling
262 server.profile_on = False

Subscribers

People subscribed via source and target branches