Merge lp:~jfb-tempo-consulting/unifield-web/US-7088 into lp:unifield-web
- US-7088
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 4996 |
Proposed branch: | lp:~jfb-tempo-consulting/unifield-web/US-7088 |
Merge into: | lp:unifield-web |
Diff against target: |
319 lines (+190/-8) 7 files modified
addons/openerp/controllers/root.py (+24/-7) addons/openerp/controllers/templates/index.mako (+82/-1) addons/openerp/po/messages/fr.po (+20/-0) addons/openerp/static/css/menu.css (+49/-0) addons/openerp/widgets/listgrid.py (+11/-0) addons/openerp/widgets/templates/listgrid/url.mako (+3/-0) openobject/static/css/jquery.fancybox-1.3.1.css (+1/-0) |
To merge this branch: | bzr merge lp:~jfb-tempo-consulting/unifield-web/US-7088 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Dev Team | Pending | ||
Review via email: mp+388059@code.launchpad.net |
Commit message
Description of the change
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/root.py' | |||
2 | --- addons/openerp/controllers/root.py 2018-04-25 09:45:33 +0000 | |||
3 | +++ addons/openerp/controllers/root.py 2020-08-06 16:14:57 +0000 | |||
4 | @@ -26,7 +26,7 @@ | |||
5 | 26 | 26 | ||
6 | 27 | from openobject.tools import url, expose, redirect | 27 | from openobject.tools import url, expose, redirect |
7 | 28 | from openobject.tools.ast import literal_eval | 28 | from openobject.tools.ast import literal_eval |
9 | 29 | 29 | import json | |
10 | 30 | _MAXIMUM_NUMBER_WELCOME_MESSAGES = 3 | 30 | _MAXIMUM_NUMBER_WELCOME_MESSAGES = 3 |
11 | 31 | 31 | ||
12 | 32 | def _cp_on_error(): | 32 | def _cp_on_error(): |
13 | @@ -53,7 +53,13 @@ | |||
14 | 53 | if read_result['action_id']: | 53 | if read_result['action_id']: |
15 | 54 | next = '/openerp/home' | 54 | next = '/openerp/home' |
16 | 55 | 55 | ||
18 | 56 | return self.menu(next=next) | 56 | if rpc.session.has_logged: |
19 | 57 | rpc.session.has_logged = False | ||
20 | 58 | from_login = True | ||
21 | 59 | else: | ||
22 | 60 | from_login = False | ||
23 | 61 | |||
24 | 62 | return self.menu(next=next, from_login=from_login) | ||
25 | 57 | 63 | ||
26 | 58 | @expose() | 64 | @expose() |
27 | 59 | def home(self): | 65 | def home(self): |
28 | @@ -93,7 +99,7 @@ | |||
29 | 93 | """ % (url("/openerp/static/images/loading.gif")) | 99 | """ % (url("/openerp/static/images/loading.gif")) |
30 | 94 | 100 | ||
31 | 95 | @expose(template="/openerp/controllers/templates/index.mako") | 101 | @expose(template="/openerp/controllers/templates/index.mako") |
33 | 96 | def menu(self, active=None, next=None): | 102 | def menu(self, active=None, next=None, from_login=False): |
34 | 97 | from openerp.widgets import tree_view | 103 | from openerp.widgets import tree_view |
35 | 98 | if next == '/openerp/pref/update_password': | 104 | if next == '/openerp/pref/update_password': |
36 | 99 | # in case the password must be changed, do not do others operations | 105 | # in case the password must be changed, do not do others operations |
37 | @@ -168,10 +174,17 @@ | |||
38 | 168 | widgets=None | 174 | widgets=None |
39 | 169 | display_shortcut = False | 175 | display_shortcut = False |
40 | 170 | 176 | ||
43 | 171 | 177 | main_survey = False | |
44 | 172 | 178 | other_surveys = [] | |
45 | 179 | if from_login: | ||
46 | 180 | surveys = rpc.RPCProxy('sync_client.survey').get_surveys() | ||
47 | 181 | if surveys: | ||
48 | 182 | main_survey = surveys[0] | ||
49 | 183 | if len(surveys) > 1: | ||
50 | 184 | other_surveys = surveys[1:] | ||
51 | 173 | return dict(parents=parents, tools=tools, load_content=(next and next or ''), | 185 | return dict(parents=parents, tools=tools, load_content=(next and next or ''), |
53 | 174 | welcome_messages=rpc.RPCProxy('publisher_warranty.contract').get_last_user_messages(_MAXIMUM_NUMBER_WELCOME_MESSAGES), | 186 | survey=main_survey, |
54 | 187 | other_surveys=json.dumps(other_surveys), | ||
55 | 175 | show_close_btn=rpc.session.uid == 1, | 188 | show_close_btn=rpc.session.uid == 1, |
56 | 176 | widgets=widgets, | 189 | widgets=widgets, |
57 | 177 | display_shortcut=display_shortcut) | 190 | display_shortcut=display_shortcut) |
58 | @@ -181,6 +194,7 @@ | |||
59 | 181 | target = kw.get('target') or '/' | 194 | target = kw.get('target') or '/' |
60 | 182 | if target.startswith('/openerp/do_login'): | 195 | if target.startswith('/openerp/do_login'): |
61 | 183 | target = '/' | 196 | target = '/' |
62 | 197 | rpc.session.has_logged = True | ||
63 | 184 | raise redirect(target) | 198 | raise redirect(target) |
64 | 185 | 199 | ||
65 | 186 | @expose(allow_json=True) | 200 | @expose(allow_json=True) |
66 | @@ -257,5 +271,8 @@ | |||
67 | 257 | error = e | 271 | error = e |
68 | 258 | return dict(error=error) | 272 | return dict(error=error) |
69 | 259 | 273 | ||
71 | 260 | 274 | @expose(allow_json=True) | |
72 | 275 | def survey_answer(self, answer, survey_id, stat_id): | ||
73 | 276 | rpc.RPCProxy('sync_client.survey.user').save_answer(answer, survey_id, stat_id) | ||
74 | 277 | return True | ||
75 | 261 | # vim: ts=4 sts=4 sw=4 si et | 278 | # vim: ts=4 sts=4 sw=4 si et |
76 | 262 | 279 | ||
77 | === modified file 'addons/openerp/controllers/templates/index.mako' | |||
78 | --- addons/openerp/controllers/templates/index.mako 2017-09-20 15:17:48 +0000 | |||
79 | +++ addons/openerp/controllers/templates/index.mako 2020-08-06 16:14:57 +0000 | |||
80 | @@ -170,12 +170,13 @@ | |||
81 | 170 | </td> | 170 | </td> |
82 | 171 | </tr> | 171 | </tr> |
83 | 172 | % endif | 172 | % endif |
84 | 173 | <% user_locale = cp.locale().language %> | ||
85 | 173 | <tr> | 174 | <tr> |
86 | 174 | <td id="footer_section" colspan="4"> | 175 | <td id="footer_section" colspan="4"> |
87 | 175 | <div class="footer-a"> | 176 | <div class="footer-a"> |
88 | 176 | <p class="one"> | 177 | <p class="one"> |
89 | 177 | <span>${rpc.session.protocol}://${_("%(user)s", user=rpc.session.loginname)}@${rpc.session.host}:${rpc.session.port}</span> | 178 | <span>${rpc.session.protocol}://${_("%(user)s", user=rpc.session.loginname)}@${rpc.session.host}:${rpc.session.port}</span> |
91 | 178 | <span>${cp.locale()}</span> | 179 | <span>${user_locale}</span> |
92 | 179 | </p> | 180 | </p> |
93 | 180 | <p class="powered">${_("Powered by %(openerp)s ", | 181 | <p class="powered">${_("Powered by %(openerp)s ", |
94 | 181 | openerp="""<a target="_blank" href="http://www.openerp.com/">openerp.com</a>""")|n}</p> | 182 | openerp="""<a target="_blank" href="http://www.openerp.com/">openerp.com</a>""")|n}</p> |
95 | @@ -184,5 +185,85 @@ | |||
96 | 184 | </tr> | 185 | </tr> |
97 | 185 | </table> | 186 | </table> |
98 | 186 | </div> | 187 | </div> |
99 | 188 | |||
100 | 189 | |||
101 | 190 | % if survey: | ||
102 | 191 | <div id="survey"> | ||
103 | 192 | <div id="survey_title">${_('We welcome your feedback.')}</div> | ||
104 | 193 | <div>${_('Help us improve your experience by taking our short survey.')}</div> | ||
105 | 194 | <div id="survey_name"> | ||
106 | 195 | % if user_locale == 'fr' and survey.get('name_fr'): | ||
107 | 196 | ${survey.get('name_fr')} | ||
108 | 197 | % else: | ||
109 | 198 | ${survey.get('name')} | ||
110 | 199 | % endif | ||
111 | 200 | </div> | ||
112 | 201 | <div class="row"> | ||
113 | 202 | <div class="column"><div class="survey_button" onclick="click_answer('goto')">${_('Go to survey')}</div></div> | ||
114 | 203 | <div class="column"><div class="survey_button" onclick="click_answer('later')">${_('Answer Later')}</div></div> | ||
115 | 204 | <div class="column" id="button_never" | ||
116 | 205 | % if survey['nb_displayed'] < 3: | ||
117 | 206 | style="display: none" | ||
118 | 207 | % endif | ||
119 | 208 | ><div class="survey_button" onclick="click_answer('never')">${_('Do not ask me again')}</div></div> | ||
120 | 209 | </div> | ||
121 | 210 | </div> | ||
122 | 211 | <script type="text/javascript"> | ||
123 | 212 | % if user_locale == 'fr' and survey.get('url_fr'): | ||
124 | 213 | var survey_url = "${survey.get('url_fr')}"; | ||
125 | 214 | % else: | ||
126 | 215 | var survey_url = "${survey.get('url_en')}"; | ||
127 | 216 | % endif | ||
128 | 217 | var survey_stat_id = ${survey['stat_id']}; | ||
129 | 218 | var survey_id = ${survey['id']}; | ||
130 | 219 | var survey_index = 0; | ||
131 | 220 | |||
132 | 221 | jQuery('#survey').fancybox({'modal': true, 'height': 250, 'width': 700, 'scrolling': 'no', 'autoDimensions': false, 'autoScale': false}); | ||
133 | 222 | |||
134 | 223 | jQuery(document).ready(function() { | ||
135 | 224 | jQuery('#survey').trigger('click'); | ||
136 | 225 | jQuery('#survey').show(); | ||
137 | 226 | jQuery('#survey').unbind('click.fb'); | ||
138 | 227 | }) | ||
139 | 228 | |||
140 | 229 | |||
141 | 230 | function click_answer(answer) { | ||
142 | 231 | if (answer == 'goto') { | ||
143 | 232 | window.open(survey_url,'_blank'); | ||
144 | 233 | } | ||
145 | 234 | jQuery.post('/openerp/survey_answer', {'answer': answer, 'survey_id': survey_id, 'stat_id': survey_stat_id}); | ||
146 | 235 | next_survey = false; | ||
147 | 236 | % if len(other_surveys): | ||
148 | 237 | var other_surveys = ${other_surveys|n}; | ||
149 | 238 | if (other_surveys.length > survey_index) { | ||
150 | 239 | jQuery('#survey').hide(); | ||
151 | 240 | next_survey = other_surveys[survey_index]; | ||
152 | 241 | % if user_locale == 'fr': | ||
153 | 242 | survey_url = next_survey.url_fr||next_survey.url_en; | ||
154 | 243 | survey_name = next_survey.name_fr||next_survey.name; | ||
155 | 244 | % else: | ||
156 | 245 | survey_url = next_survey.url_en; | ||
157 | 246 | survey_name = next_survey.name; | ||
158 | 247 | % endif | ||
159 | 248 | survey_stat_id = next_survey.stat_id; | ||
160 | 249 | survey_id = next_survey.id; | ||
161 | 250 | $('#survey_name').html(survey_name); | ||
162 | 251 | if (next_survey.nb_displayed > 2) { | ||
163 | 252 | $('#button_never').show(); | ||
164 | 253 | } else { | ||
165 | 254 | $('#button_never').hide(); | ||
166 | 255 | } | ||
167 | 256 | survey_index += 1; | ||
168 | 257 | setTimeout(function(){jQuery('#survey').show()}, 450); | ||
169 | 258 | } | ||
170 | 259 | % endif | ||
171 | 260 | |||
172 | 261 | if (!next_survey) { | ||
173 | 262 | jQuery('#survey').hide(); | ||
174 | 263 | jQuery.fancybox.close(); | ||
175 | 264 | } | ||
176 | 265 | } | ||
177 | 266 | </script> | ||
178 | 267 | % endif | ||
179 | 187 | </%def> | 268 | </%def> |
180 | 188 | 269 | ||
181 | 189 | 270 | ||
182 | === modified file 'addons/openerp/po/messages/fr.po' | |||
183 | --- addons/openerp/po/messages/fr.po 2019-10-09 16:15:16 +0000 | |||
184 | +++ addons/openerp/po/messages/fr.po 2020-08-06 16:14:57 +0000 | |||
185 | @@ -1830,3 +1830,23 @@ | |||
186 | 1830 | msgid "In Progress" | 1830 | msgid "In Progress" |
187 | 1831 | msgstr "En cours" | 1831 | msgstr "En cours" |
188 | 1832 | 1832 | ||
189 | 1833 | #: controllers/templates/preferences/index.mako:191 | ||
190 | 1834 | msgid "We welcome your feedback." | ||
191 | 1835 | msgstr "Nous apprécions vos remarques" | ||
192 | 1836 | |||
193 | 1837 | #: controllers/templates/preferences/index.mako:191 | ||
194 | 1838 | msgid "Help us improve your experience by taking our short survey." | ||
195 | 1839 | msgstr "Aidez-nous à améliorer votre expérience en répondant à notre court sondage." | ||
196 | 1840 | |||
197 | 1841 | #: controllers/templates/preferences/index.mako:201 | ||
198 | 1842 | msgid "Go to survey" | ||
199 | 1843 | msgstr "Répondre au sondage" | ||
200 | 1844 | |||
201 | 1845 | #: controllers/templates/preferences/index.mako:202 | ||
202 | 1846 | msgid "Answer Later" | ||
203 | 1847 | msgstr "Plus tard" | ||
204 | 1848 | |||
205 | 1849 | #: controllers/templates/preferences/index.mako:207 | ||
206 | 1850 | msgid "Do not ask me again" | ||
207 | 1851 | msgstr "Ne plus demander" | ||
208 | 1852 | |||
209 | 1833 | 1853 | ||
210 | === modified file 'addons/openerp/static/css/menu.css' | |||
211 | --- addons/openerp/static/css/menu.css 2018-05-28 13:16:01 +0000 | |||
212 | +++ addons/openerp/static/css/menu.css 2020-08-06 16:14:57 +0000 | |||
213 | @@ -138,3 +138,52 @@ | |||
214 | 138 | color: #C0C0C0; | 138 | color: #C0C0C0; |
215 | 139 | } | 139 | } |
216 | 140 | 140 | ||
217 | 141 | #survey { | ||
218 | 142 | background-color: #5c5cff; | ||
219 | 143 | color: #ffffff; | ||
220 | 144 | font-size:20px; | ||
221 | 145 | text-align: center; | ||
222 | 146 | height: 250px; | ||
223 | 147 | display: none; | ||
224 | 148 | } | ||
225 | 149 | |||
226 | 150 | #survey_title { | ||
227 | 151 | font-size:35px; | ||
228 | 152 | padding-top: 10px; | ||
229 | 153 | margin-bottom: 35px; | ||
230 | 154 | } | ||
231 | 155 | |||
232 | 156 | #survey .column { | ||
233 | 157 | display: inline-block; | ||
234 | 158 | width: 32%; | ||
235 | 159 | text-align: center; | ||
236 | 160 | } | ||
237 | 161 | |||
238 | 162 | #survey .survey_button { | ||
239 | 163 | text-align: center; | ||
240 | 164 | background-color: white; | ||
241 | 165 | color: #5c5cff; | ||
242 | 166 | margin: 5px; | ||
243 | 167 | cursor: pointer; | ||
244 | 168 | border-radius: 3px; | ||
245 | 169 | } | ||
246 | 170 | |||
247 | 171 | #survey .survey_button:hover { | ||
248 | 172 | background-color: #00A3FF; | ||
249 | 173 | color: white; | ||
250 | 174 | } | ||
251 | 175 | |||
252 | 176 | #survey .row { | ||
253 | 177 | padding-top:25px; | ||
254 | 178 | } | ||
255 | 179 | /* Clear floats after the columns */ | ||
256 | 180 | #survey .row:after { | ||
257 | 181 | content: ""; | ||
258 | 182 | display: table; | ||
259 | 183 | clear: both; | ||
260 | 184 | } | ||
261 | 185 | |||
262 | 186 | #survey_name { | ||
263 | 187 | font-weight: bold; | ||
264 | 188 | margin-top: 5px; | ||
265 | 189 | } | ||
266 | 141 | 190 | ||
267 | === modified file 'addons/openerp/widgets/listgrid.py' | |||
268 | --- addons/openerp/widgets/listgrid.py 2020-04-01 10:02:24 +0000 | |||
269 | +++ addons/openerp/widgets/listgrid.py 2020-08-06 16:14:57 +0000 | |||
270 | @@ -661,6 +661,14 @@ | |||
271 | 661 | class M2M(Char): | 661 | class M2M(Char): |
272 | 662 | 662 | ||
273 | 663 | def get_text(self): | 663 | def get_text(self): |
274 | 664 | if self.truncate: | ||
275 | 665 | if not self.value: | ||
276 | 666 | return '' | ||
277 | 667 | max_length = int(self.truncate) | ||
278 | 668 | value_string = ', '.join([x[1] for x in rpc.RPCProxy(self.attrs['relation']).name_get(self.value, rpc.session.context)]) | ||
279 | 669 | if len(value_string) > max_length: | ||
280 | 670 | value_string = '%s...' % value_string[:max_length-3] | ||
281 | 671 | return value_string | ||
282 | 664 | return "%d" % len(self.value) | 672 | return "%d" % len(self.value) |
283 | 665 | 673 | ||
284 | 666 | class Selection(Char): | 674 | class Selection(Char): |
285 | @@ -898,6 +906,8 @@ | |||
286 | 898 | def update_params(self, params): | 906 | def update_params(self, params): |
287 | 899 | super(Hidden, self).update_params(params) | 907 | super(Hidden, self).update_params(params) |
288 | 900 | 908 | ||
289 | 909 | class URL(Char): | ||
290 | 910 | template = "openerp/widgets/templates/listgrid/url.mako" | ||
291 | 901 | 911 | ||
292 | 902 | CELLTYPES = { | 912 | CELLTYPES = { |
293 | 903 | 'char':Char, | 913 | 'char':Char, |
294 | @@ -917,4 +927,5 @@ | |||
295 | 917 | 'separator': Separator, | 927 | 'separator': Separator, |
296 | 918 | 'human_size': HumanSize, | 928 | 'human_size': HumanSize, |
297 | 919 | 'html_text': HtmlText, | 929 | 'html_text': HtmlText, |
298 | 930 | 'url': URL, | ||
299 | 920 | } | 931 | } |
300 | 921 | 932 | ||
301 | === added file 'addons/openerp/widgets/templates/listgrid/url.mako' | |||
302 | --- addons/openerp/widgets/templates/listgrid/url.mako 1970-01-01 00:00:00 +0000 | |||
303 | +++ addons/openerp/widgets/templates/listgrid/url.mako 2020-08-06 16:14:57 +0000 | |||
304 | @@ -0,0 +1,3 @@ | |||
305 | 1 | % if text: | ||
306 | 2 | <a href="${text}" target="_blank"><img src="/openerp/static/images/icons/gtk-jump-to-ltr.png" title="${text}" /></a> | ||
307 | 3 | % endif | ||
308 | 0 | 4 | ||
309 | === modified file 'openobject/static/css/jquery.fancybox-1.3.1.css' | |||
310 | --- openobject/static/css/jquery.fancybox-1.3.1.css 2010-08-30 10:24:02 +0000 | |||
311 | +++ openobject/static/css/jquery.fancybox-1.3.1.css 2020-08-06 16:14:57 +0000 | |||
312 | @@ -114,6 +114,7 @@ | |||
313 | 114 | background-position: -40px 0; | 114 | background-position: -40px 0; |
314 | 115 | cursor: pointer; | 115 | cursor: pointer; |
315 | 116 | z-index: 1103; | 116 | z-index: 1103; |
316 | 117 | display: none; | ||
317 | 117 | } | 118 | } |
318 | 118 | 119 | ||
319 | 119 | #fancybox_error { | 120 | #fancybox_error { |