Merge lp:~openerp-dev/openobject-client-web/backport-stable-trunk-bugfixes into lp:~openerp-dev/openobject-client-web/trunk-dev-web
- backport-stable-trunk-bugfixes
- Merge into trunk-dev-web
Status: | Merged |
---|---|
Merged at revision: | 3231 |
Proposed branch: | lp:~openerp-dev/openobject-client-web/backport-stable-trunk-bugfixes |
Merge into: | lp:~openerp-dev/openobject-client-web/trunk-dev-web |
Diff against target: |
2061 lines (+585/-217) (has conflicts) 53 files modified
addons/openerp/controllers/actions.py (+16/-2) addons/openerp/controllers/fieldpref.py (+1/-0) addons/openerp/controllers/form.py (+19/-5) addons/openerp/controllers/impex.py (+69/-44) addons/openerp/controllers/listgrid.py (+4/-3) addons/openerp/controllers/openo2m.py (+0/-4) addons/openerp/controllers/requests.py (+1/-1) addons/openerp/controllers/search.py (+8/-1) addons/openerp/controllers/templates/about.mako (+3/-3) addons/openerp/controllers/templates/error_page.mako (+37/-0) addons/openerp/controllers/templates/exp.mako (+1/-0) addons/openerp/controllers/templates/form.mako (+19/-0) addons/openerp/controllers/templates/search.mako (+4/-4) addons/openerp/controllers/templates/translator.mako (+5/-1) addons/openerp/controllers/translator.py (+11/-5) addons/openerp/controllers/viewed.py (+2/-3) addons/openerp/controllers/wizard.py (+3/-0) addons/openerp/static/calendar/lang/calendar-de.js (+1/-1) addons/openerp/static/calendar/lang/calendar-de_at.js (+1/-1) addons/openerp/static/calendar/lang/calendar-de_de.js (+1/-1) addons/openerp/static/calendar/lang/calendar-en.js (+1/-1) addons/openerp/static/javascript/form.js (+24/-4) addons/openerp/static/javascript/form_state.js (+15/-4) addons/openerp/static/javascript/listgrid.js (+12/-3) addons/openerp/static/javascript/m2o.js (+68/-6) addons/openerp/static/javascript/o2m.js (+23/-0) addons/openerp/utils/tools.py (+12/-4) addons/openerp/utils/utils.py (+11/-2) addons/openerp/validators/validators.py (+6/-2) addons/openerp/widgets/form/_action.py (+1/-1) addons/openerp/widgets/form/_form.py (+11/-6) addons/openerp/widgets/form/_o2m.py (+3/-0) addons/openerp/widgets/form/templates/button.mako (+2/-2) addons/openerp/widgets/form/templates/char.mako (+1/-1) addons/openerp/widgets/form/templates/many2many.mako (+3/-0) addons/openerp/widgets/form/templates/many2one.mako (+3/-11) addons/openerp/widgets/form/templates/one2many.mako (+2/-2) addons/openerp/widgets/form/templates/reference.mako (+5/-1) addons/openerp/widgets/form_view.py (+13/-1) addons/openerp/widgets/listgrid.py (+10/-2) addons/openerp/widgets/sidebar.py (+3/-5) addons/openerp/widgets/templates/listgrid.mako (+55/-46) addons/openerp/widgets/tree_view.py (+1/-1) addons/view_calendar/static/javascript/calendar_month.js (+4/-1) addons/view_calendar/static/javascript/calendar_utils.js (+10/-0) addons/view_calendar/static/javascript/calendar_week.js (+10/-4) addons/view_calendar/widgets/_base.py (+5/-3) addons/view_diagram/controllers/process.py (+5/-0) addons/view_diagram/controllers/templates/process_tip.mako (+26/-0) addons/view_diagram/static/javascript/process.js (+8/-5) addons/view_graph/widgets/_graph.py (+23/-17) addons/view_graph/widgets/templates/graph.mako (+1/-1) addons/widget_wiki/widgets/wiki.py (+2/-2) Text conflict in addons/openerp/controllers/actions.py Text conflict in addons/openerp/controllers/templates/error_page.mako Text conflict in addons/openerp/controllers/templates/form.mako Text conflict in addons/openerp/controllers/templates/translator.mako Text conflict in addons/openerp/static/javascript/form.js Text conflict in addons/openerp/static/javascript/m2o.js Text conflict in addons/openerp/widgets/templates/listgrid.mako Text conflict in addons/view_calendar/static/javascript/calendar_utils.js |
To merge this branch: | bzr merge lp:~openerp-dev/openobject-client-web/backport-stable-trunk-bugfixes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Navrang Oza (community) | Approve | ||
Review via email: mp+26683@code.launchpad.net |
Commit message
Description of the change
- Backporting stable bugs to trunk.
- 3158. By Vaibhav Darji
-
[FIX] applied style using class.
- 3159. By Vaibhav Darji
-
[FIX] Fixed searh_table align.
- 3160. By Vaibhav Darji
-
[FIX] Calendar basic improvements.
- 3161. By Vaibhav Darji
-
[FIX] Calendar resize problem.
- 3162. By Vaibhav Darji
-
[FIX] Changes for calendar resize.
- 3163. By Vaibhav Darji
-
[FIX] alignment of header for calendar.
- 3164. By Vaibhav Darji
-
[IMP] Padding for calendar events.
- 3165. By Vaibhav Darji
-
[FIX] css layout for calendar sidebar.
- 3166. By Vaibhav Darji
-
[IMP] Buttons in cal popup.
- 3167. By Vaibhav Darji
-
[FIX] Fixed search tooltip problem.
- 3168. By Xavier (Open ERP)
-
[MERGE] application iframe removal branch, usage of xhr requests instead
- 3169. By noz <noz@noz>
-
[FIX] Some minor changes.
- 3170. By Sananaz (Open ERP)
-
[IMP] Improvesupport for 'or' in attrs keyword.
Xavier (Open ERP) (xmo-deactivatedaccount) wrote : | # |
- 3171. By Xavier (Open ERP)
-
[IMP] try to simplify form_evalExpr a bit
- 3172. By Xavier (Open ERP)
-
[REM] unused variables in switchView, also not useful intermediate variable
- 3173. By Xavier (Open ERP)
-
[FIX] broken ajax form submission for multipart/
form-data, as well as broken hiding of waitbox on form submit - 3174. By Vaibhav Darji
-
[IMP] Button can change context, should be reapplied to view.
- 3175. By Navrang Oza
-
[FIX] Initial implementation of Server actions logs.
- 3176. By Xavier (Open ERP)
-
[FIX] pager, broken prev/next buttons
- 3177. By Xavier (Open ERP)
-
[FIX] display of current pager range
- 3178. By Navrang Oza
-
[IMP] Implemented background action log display in flash message.
- 3179. By Xavier (Open ERP)
-
[IMP] use actual labels in search view
- 3180. By Xavier (Open ERP)
-
[FIX] pager position broken during merge
- 3181. By Xavier (Open ERP)
-
[FIX] broken popups: switch base template (base.mako or xhr.mako) based on X-Requested-With header. Means either explicit xhr calls *have* to set it, or requirement to go through jquery (which sets it automatically)
- 3182. By Xavier (Open ERP)
-
[FIX] brokened form_evalExpr
- 3183. By Xavier (Open ERP)
-
[REM] redundant CSS properties
- 3184. By Xavier (Open ERP)
-
[FIX] width of .fields tables back to 100%
- 3185. By Xavier (Open ERP)
-
[FIX] re-enable tooltips by re-running the tooltips finder/creator every time the ajax querying completes
- 3186. By Xavier (Open ERP)
-
[FIX] footer width to 100%
- 3187. By Navrang Oza
-
[FIX] Code improvement.
- 3188. By Vaibhav Darji
-
[FIX] Filters Layout.
- 3189. By Navrang Oza
-
[FIX] Some minor changes.
- 3190. By Vaibhav Darji
-
[IMP] Filter widget style.
- 3191. By Vaibhav Darji
-
[FIX] Minor changes for filter style.
- 3192. By Xavier (Open ERP)
-
[IMP] simplify JS CSS properties setting in header file
- 3193. By Xavier (Open ERP)
-
[IMP] add missing alt attributes
- 3194. By Xavier (Open ERP)
-
[IMP] use actual link for openerp logo
- 3195. By Vaibhav Darji
-
[FIX] add view_type calendar for search widget.
- 3196. By Vaibhav Darji
-
[FIX] Minor changes.
- 3197. By Vaibhav Darji
-
[FIX] Fixed filter class.
- 3198. By Vaibhav Darji
-
[FIX] Fixed Attachment issue.
- 3199. By Navrang Oza
-
[FIX] Fixed multiple email entries possible for email widget.
- 3200. By Xavier (Open ERP)
-
[IMP] simplify calendar code a bit
- 3201. By Xavier (Open ERP)
-
[IMP] optimize imports in view_calendar widgets
- 3202. By Xavier (Open ERP)
-
[IMP] fix appends, remove dead code
- 3203. By Xavier (Open ERP)
-
[IMP] remove dead code, use itertools.chain
- 3204. By Xavier (Open ERP)
-
[MERGE] Fix calendar initial loading, and other calendar-related improvements
- 3205. By Xavier (Open ERP)
-
[IMP] use jquery to fetch selected colors instead of doing it manually via mochikit & DOM
- 3206. By Xavier (Open ERP)
-
[FIX] push incorrectly scoped variable back to local
- 3207. By Xavier (Open ERP)
-
[IMP] replace calLoading layer by a WaitBox call after ~300ms if new calendar still not displayed
- 3208. By Xavier (Open ERP)
-
[IMP] try to fix a few selectors
- 3209. By Xavier (Open ERP)
-
[FIX] broken import/export popups
- 3210. By Xavier (Open ERP)
-
[IMP] try to jqueryfy the import/export popup a bit
- 3211. By Vaibhav Darji
-
[FIX] Apply headers styles.
- 3212. By Vaibhav Darji
-
[FIX] Style for reference.
- 3213. By Vaibhav Darji
-
[FIX] Menu align.
- 3214. By Sananaz (Open ERP)
-
[FIX] Fixed m2o autocomplete position.
- 3215. By Sananaz (Open ERP)
-
[Fix] Fixed context problem for self attr.
- 3216. By Vaibhav Darji
-
[FIX] Fixed form display header.
- 3217. By Vaibhav Darji
-
[FIX] Headers styles.
- 3218. By Vaibhav Darji
-
[FIX] Set Home action.
- 3219. By Navrang Oza
-
[FIX] CSS Improvements for labels.
- 3220. By Xavier (Open ERP)
-
[IMP] simplify header code & css
- 3221. By Xavier (Open ERP)
-
[IMP] optimize imports in _form.py
- 3222. By Xavier (Open ERP)
-
[IMP] replace magic method call (__add__) with '+'
- 3223. By Xavier (Open ERP)
-
[IMP] replace += [single item list] by .append
- 3224. By Xavier (Open ERP)
-
[IMP] Try to simplify _form.py a bit
* Remove redundant False argument to dict.get in boolean context
* Replace a==False with not a
* Remove redundancies - 3225. By Navrang Oza
-
[FIX] Removed server action log for tree view.
- 3226. By Xavier (Open ERP)
-
[FIX] I should remember to check for circular imports when moving imports around...
- 3227. By Vaibhav Darji
-
[IMP] Warning when changing page and object not saved.
- 3228. By Vaibhav Darji
-
[FIX] Fixed warning message.
- 3229. By Vaibhav Darji
-
[FIX] fixed group_by style.
- 3230. By Vaibhav Darji
-
[REV]Revert warning message related changes (Need to check).
- 3231. By Navrang Oza
-
[Merge] Backporting - Stable to Trunk (Bug fixes).
Navrang Oza (noz-tiny) wrote : | # |
Approved, required some fixes.
Preview Diff
1 | === modified file 'addons/openerp/controllers/actions.py' |
2 | --- addons/openerp/controllers/actions.py 2010-05-31 12:33:26 +0000 |
3 | +++ addons/openerp/controllers/actions.py 2010-06-10 08:37:38 +0000 |
4 | @@ -71,6 +71,8 @@ |
5 | |
6 | cherrypy.request._terp_view_name = name or None |
7 | cherrypy.request._terp_view_target = target or None |
8 | + if name: |
9 | + params.context['_terp_view_name'] = name |
10 | |
11 | if params.ids and not isinstance(params.ids, list): |
12 | params.ids = [params.ids] |
13 | @@ -271,9 +273,19 @@ |
14 | |
15 | res = rpc.RPCProxy('ir.actions.server').run([action['id']], ctx) |
16 | if res: |
17 | +<<<<<<< TREE |
18 | return execute(res, **data) |
19 | else: |
20 | return '' |
21 | +======= |
22 | + if not isinstance(res, list): |
23 | + res = [res] |
24 | + |
25 | + output = None |
26 | + for r in res: |
27 | + output = execute(r, **data) |
28 | + return output |
29 | +>>>>>>> MERGE-SOURCE |
30 | |
31 | elif action['type']=='ir.actions.wizard': |
32 | if 'window' in data: |
33 | @@ -284,7 +296,7 @@ |
34 | |
35 | ctx1.update(ctx2) |
36 | |
37 | - data['context'] = ctx2 |
38 | + data['context'] = ctx1 |
39 | |
40 | return execute_wizard(action['wiz_name'], **data) |
41 | |
42 | @@ -339,8 +351,10 @@ |
43 | |
44 | if type is None: |
45 | type = get_action_type(act_id) |
46 | + |
47 | + ctx = dict(rpc.session.context, **(data.get('context') or {})) |
48 | |
49 | - res = rpc.session.execute('object', 'execute', type, 'read', act_id, False, rpc.session.context) |
50 | + res = rpc.session.execute('object', 'execute', type, 'read', act_id, False, ctx) |
51 | return execute(res, **data) |
52 | |
53 | def execute_by_keyword(keyword, adds=None, **data): |
54 | |
55 | === modified file 'addons/openerp/controllers/fieldpref.py' |
56 | --- addons/openerp/controllers/fieldpref.py 2010-05-13 09:21:46 +0000 |
57 | +++ addons/openerp/controllers/fieldpref.py 2010-06-10 08:37:38 +0000 |
58 | @@ -87,6 +87,7 @@ |
59 | field = field.split('/')[-1] |
60 | |
61 | proxy = rpc.RPCProxy('ir.values') |
62 | + |
63 | res = proxy.set('default', deps, field, [(model,False)], value, True, False, False, params.you or False, True) |
64 | |
65 | return dict(model=params.model, click_ok=click_ok, field=params.field, deps=params.deps2, should_close=True) |
66 | |
67 | === modified file 'addons/openerp/controllers/form.py' |
68 | --- addons/openerp/controllers/form.py 2010-06-09 12:44:22 +0000 |
69 | +++ addons/openerp/controllers/form.py 2010-06-10 08:37:38 +0000 |
70 | @@ -279,6 +279,9 @@ |
71 | |
72 | params.editable = editable |
73 | params.view_type = 'form' |
74 | + |
75 | + if kw.get('default_date'): |
76 | + params.context.update({'default_date' : kw['default_date']}) |
77 | |
78 | cherrypy.request._terp_view_target = kw.get('target') |
79 | |
80 | @@ -384,7 +387,8 @@ |
81 | proxy = rpc.RPCProxy(params.model) |
82 | |
83 | if not params.id: |
84 | - id = proxy.create(data, params.context) |
85 | + ctx = dict((params.context or {}), **rpc.session.context) |
86 | + id = proxy.create(data, ctx) |
87 | params.ids = (params.ids or []) + [int(id)] |
88 | params.id = int(id) |
89 | params.count += 1 |
90 | @@ -467,6 +471,9 @@ |
91 | |
92 | id = (id or False) and int(id) |
93 | ids = (id or []) and [id] |
94 | + |
95 | + ctx = dict((params.context or {}), **rpc.session.context) |
96 | + ctx.update(button.context or {}) |
97 | |
98 | if btype == 'cancel': |
99 | if name: |
100 | @@ -489,8 +496,7 @@ |
101 | return actions.execute(res, ids=[id]) |
102 | |
103 | elif btype == 'object': |
104 | - ctx = params.context or {} |
105 | - ctx.update(rpc.session.context.copy()) |
106 | + |
107 | res = rpc.session.execute('object', 'execute', model, name, ids, ctx) |
108 | |
109 | if isinstance(res, dict): |
110 | @@ -509,7 +515,7 @@ |
111 | |
112 | res = actions.execute_by_id(action_id, type=action_type, |
113 | model=model, id=id, ids=ids, |
114 | - context=params.context or {}) |
115 | + context=ctx or {}) |
116 | if res: |
117 | return res |
118 | |
119 | @@ -861,7 +867,7 @@ |
120 | model = params.model |
121 | |
122 | id = params.id or False |
123 | - ids = params.ids or [] |
124 | + ids = params.selection or params.ids or [] |
125 | |
126 | if params.view_type == 'form': |
127 | #TODO: save current record |
128 | @@ -993,12 +999,20 @@ |
129 | values2 = {} |
130 | for k, v in values.items(): |
131 | key = ((prefix or '') and prefix + '/') + k |
132 | + |
133 | + kind = data.get(key, {}).get('type', '') |
134 | |
135 | if key in data and key != 'id': |
136 | values2[k] = data[key] |
137 | values2[k]['value'] = v |
138 | else: |
139 | values2[k] = {'value': v} |
140 | + |
141 | + if kind == 'float': |
142 | + field = proxy.fields_get([k], ctx2) |
143 | + digit = field[k].get('digits') |
144 | + if digit: digit = digit[1] |
145 | + values2[k]['digit'] = digit or 2 |
146 | |
147 | values = TinyForm(**values2).from_python().make_plain() |
148 | |
149 | |
150 | === modified file 'addons/openerp/controllers/impex.py' |
151 | --- addons/openerp/controllers/impex.py 2010-05-13 09:21:46 +0000 |
152 | +++ addons/openerp/controllers/impex.py 2010-06-10 08:37:38 +0000 |
153 | @@ -36,12 +36,11 @@ |
154 | from openerp.widgets import treegrid, listgrid |
155 | |
156 | from openobject import tools |
157 | -from openobject.tools import expose, redirect |
158 | +from openobject.tools import expose, redirect, ast |
159 | |
160 | |
161 | def datas_read(ids, model, fields, context=None): |
162 | - ctx = context.copy() |
163 | - ctx.update(rpc.session.context) |
164 | + ctx = dict((context or {}), **rpc.session.context) |
165 | return rpc.RPCProxy(model).export_data(ids, fields, ctx) |
166 | |
167 | def export_csv(fields, result, write_title=False): |
168 | @@ -71,7 +70,9 @@ |
169 | except IOError, (errno, strerror): |
170 | raise common.message(_("Operation failed!\nI/O error")+"(%s)" % (errno,)) |
171 | |
172 | -def _fields_get_all(model, views): |
173 | +def _fields_get_all(model, views, context=None): |
174 | + |
175 | + context = context or {} |
176 | |
177 | def parse(root, fields): |
178 | |
179 | @@ -90,8 +91,8 @@ |
180 | |
181 | proxy = rpc.RPCProxy(model) |
182 | |
183 | - v1 = proxy.fields_view_get(views.get('tree', False), 'tree', rpc.session.context) |
184 | - v2 = proxy.fields_view_get(views.get('form', False), 'form', rpc.session.context) |
185 | + v1 = proxy.fields_view_get(views.get('tree', False), 'tree', context) |
186 | + v2 = proxy.fields_view_get(views.get('form', False), 'form', context) |
187 | |
188 | dom = xml.dom.minidom.parseString(v1['arch'].encode('utf-8')) |
189 | root = dom.childNodes[0] |
190 | @@ -116,6 +117,8 @@ |
191 | @expose(template="templates/exp.mako") |
192 | def exp(self, **kw): |
193 | params, data = TinyDict.split(kw) |
194 | + |
195 | + ctx = dict((params.context or {}), **rpc.session.context) |
196 | |
197 | views = {} |
198 | if params.view_mode and params.view_ids: |
199 | @@ -132,17 +135,18 @@ |
200 | headers=headers, |
201 | url=tools.url('/openerp/impex/get_fields'), |
202 | field_parent='relation', |
203 | + context=ctx, |
204 | views=views) |
205 | |
206 | tree.show_headers = False |
207 | |
208 | - view = proxy.fields_view_get(False, 'tree', rpc.session.context) |
209 | + view = proxy.fields_view_get(False, 'tree', ctx) |
210 | new_list = listgrid.List(name='_terp_list', model='ir.exports', view=view, ids=None, |
211 | domain=[('resource', '=', params.model)], |
212 | - context=rpc.session.context, selectable=1, editable=False, pageable=False) |
213 | - |
214 | - |
215 | - return dict(new_list=new_list, model=params.model, ids=params.ids, |
216 | + context=ctx, selectable=1, editable=False, pageable=False) |
217 | + |
218 | + |
219 | + return dict(new_list=new_list, model=params.model, ids=params.ids, ctx=ctx, |
220 | search_domain=params.search_domain, source=params.source, |
221 | tree=tree) |
222 | |
223 | @@ -175,18 +179,25 @@ |
224 | @expose('json') |
225 | def get_fields(self, model, prefix='', name='', field_parent=None, **kw): |
226 | |
227 | - is_importing = kw.get('is_importing', False) |
228 | + is_importing = kw.get('is_importing', False) |
229 | + |
230 | + try: |
231 | + ctx = ast.literal_eval(kw['context']) |
232 | + except: |
233 | + ctx = {} |
234 | + |
235 | + ctx.update(**rpc.session.context) |
236 | |
237 | ids = kw.get('ids', '').split(',') |
238 | ids = [i for i in ids if i] |
239 | - |
240 | - views = {} |
241 | + |
242 | try: |
243 | - views = eval(kw['views']) |
244 | + views = ast.literal_eval(kw['views']) |
245 | except: |
246 | - pass |
247 | + views = {} |
248 | + |
249 | |
250 | - fields = _fields_get_all(model, views) |
251 | + fields = _fields_get_all(model, views, ctx) |
252 | fields.update({'id': {'string': 'ID'}, 'db_id': {'string': 'Database ID'}}) |
253 | |
254 | fields_order = fields.keys() |
255 | @@ -246,7 +257,7 @@ |
256 | cid = id + '/' + fld |
257 | cid = cid.replace(' ', '_') |
258 | |
259 | - children += [cid] |
260 | + children.append(cid) |
261 | |
262 | record['children'] = children or None |
263 | record['params'] = {'model': ref, 'prefix': id, 'name': nm} |
264 | @@ -259,12 +270,14 @@ |
265 | def get_namelist(self, **kw): |
266 | |
267 | params, data = TinyDict.split(kw) |
268 | - |
269 | + |
270 | + ctx = dict((params.context or {}), **rpc.session.context) |
271 | + |
272 | res = [] |
273 | ids = [] |
274 | id = params.id |
275 | |
276 | - res = self.get_data(params.model) |
277 | + res = self.get_data(params.model, ctx) |
278 | |
279 | ir_export = rpc.RPCProxy('ir.exports') |
280 | ir_export_line = rpc.RPCProxy('ir.exports.line') |
281 | @@ -280,11 +293,10 @@ |
282 | |
283 | return dict(name_list=name_list) |
284 | |
285 | - def get_data(self, model): |
286 | + def get_data(self, model, context=None): |
287 | |
288 | - name = '' |
289 | - prefix = '' |
290 | ids = [] |
291 | + context = context or {} |
292 | |
293 | fields_data = {} |
294 | proxy = rpc.RPCProxy(model) |
295 | @@ -292,8 +304,8 @@ |
296 | |
297 | # XXX: in GTK client, top fields comes from Screen |
298 | if not ids: |
299 | - f1 = proxy.fields_view_get(False, 'tree', rpc.session.context)['fields'] |
300 | - f2 = proxy.fields_view_get(False, 'form', rpc.session.context)['fields'] |
301 | + f1 = proxy.fields_view_get(False, 'tree', context)['fields'] |
302 | + f2 = proxy.fields_view_get(False, 'form', context)['fields'] |
303 | |
304 | fields = {} |
305 | fields.update(f1) |
306 | @@ -332,8 +344,7 @@ |
307 | if isinstance(fields, basestring): |
308 | fields = [fields] |
309 | |
310 | - ctx = {} |
311 | - ctx.update(rpc.session.context.copy()) |
312 | + ctx = dict((params.context or {}), **rpc.session.context) |
313 | ctx['import_comp'] = import_compat |
314 | |
315 | domain = params.seach_domain or [] |
316 | @@ -362,8 +373,8 @@ |
317 | wb = xlwt.Workbook() |
318 | worksheet = wb.add_sheet('Sheet 1') |
319 | |
320 | - for col in range(len(fields)): |
321 | - worksheet.write(0, col, str(fields[col])) |
322 | + for col in range(len(params.fields2)): |
323 | + worksheet.write(0, col, ustr(params.fields2[col])) |
324 | col+1 |
325 | |
326 | heading_xf = ezxf('align: wrap yes') |
327 | @@ -371,7 +382,7 @@ |
328 | for data in range(len(result)): |
329 | for d in range(len(result[data])): |
330 | try: |
331 | - result[data][d] = str(result[data][d]) |
332 | + result[data][d] = ustr(result[data][d]) |
333 | except: |
334 | pass |
335 | result[data][d] = re.sub("\r", " ", result[data][d]) |
336 | @@ -390,7 +401,9 @@ |
337 | @expose(template="templates/imp.mako") |
338 | def imp(self, **kw): |
339 | params, data = TinyDict.split(kw) |
340 | - |
341 | + |
342 | + ctx = dict((params.context or {}), **rpc.session.context) |
343 | + |
344 | views = {} |
345 | if params.view_mode and params.view_ids: |
346 | for i, view in enumerate(params.view_mode): |
347 | @@ -403,6 +416,7 @@ |
348 | url=tools.url('/openerp/impex/get_fields'), |
349 | field_parent='relation', |
350 | views=views, |
351 | + context=ctx, |
352 | is_importing=1) |
353 | |
354 | tree.show_headers = False |
355 | @@ -415,7 +429,9 @@ |
356 | |
357 | _fields = {} |
358 | _fields_invert = {} |
359 | - |
360 | + |
361 | + fields = rpc.RPCProxy(params.model).fields_get(False, rpc.session.context) |
362 | + |
363 | def model_populate(fields, prefix_node='', prefix=None, prefix_value='', level=2): |
364 | def str_comp(x,y): |
365 | if x<y: return 1 |
366 | @@ -425,17 +441,23 @@ |
367 | fields_order = fields.keys() |
368 | fields_order.sort(lambda x,y: str_comp(fields[x].get('string', ''), fields[y].get('string', ''))) |
369 | for field in fields_order: |
370 | - if (fields[field]['type'] not in ('reference',)) and (not fields[field].get('readonly', False)): |
371 | + if (fields[field].get('type','') not in ('reference',))\ |
372 | + and (not fields[field].get('readonly', False)\ |
373 | + or not dict(fields[field].get('states', {}).get( |
374 | + 'draft', [('readonly', True)])).get('readonly',True)): |
375 | + |
376 | st_name = prefix_value+fields[field]['string'] or field |
377 | _fields[prefix_node+field] = st_name |
378 | _fields_invert[st_name] = prefix_node+field |
379 | - if fields[field]['type']=='one2many' and level>0: |
380 | + if fields[field].get('type','')=='one2many' and level>0: |
381 | fields2 = rpc.session.execute('object', 'execute', fields[field]['relation'], 'fields_get', False, rpc.session.context) |
382 | + fields2.update({'id': {'type': 'char', 'string': 'ID'}, 'db_id':{'type': 'char', 'string': 'Database ID'}}) |
383 | model_populate(fields2, prefix_node+field+'/', None, st_name+'/', level-1) |
384 | + if fields[field].get('type','') in ('many2one', 'many2many' ) and level>0: |
385 | + model_populate({'id': {'type': 'char', 'string': 'ID'}, 'db_id': {'type': 'char', 'string': 'Database ID'}}, |
386 | + prefix_node+field+':', None, st_name+'/', level-1) |
387 | |
388 | - proxy = rpc.RPCProxy(params.model) |
389 | - fields = proxy.fields_get(False, rpc.session.context) |
390 | - fields.update({'id': {'string': 'ID'}, 'db_id': {'string': 'Database ID'}}) |
391 | + fields.update({'id': {'type': 'char', 'string': 'ID'}, 'db_id': {'type': 'char', 'string': 'Database ID'}}) |
392 | model_populate(fields) |
393 | |
394 | try: |
395 | @@ -449,10 +471,12 @@ |
396 | for line in data: |
397 | for word in line: |
398 | word = ustr(word.decode(csvcode)) |
399 | - if word in _fields_invert.keys(): |
400 | + if word in _fields: |
401 | + fields += [(word, _fields[word])] |
402 | + elif word in _fields_invert.keys(): |
403 | fields += [(_fields_invert[word], word)] |
404 | else: |
405 | - fields += [(word, _fields[word])] |
406 | + raise common.warning(_("You cannot import this field %s, because we cannot auto-detect it" % (word,))) |
407 | break |
408 | except: |
409 | raise common.warning(_('Error processing your first line of the file.\nField %s is unknown!') % (word,), _('Import Error.')) |
410 | @@ -469,15 +493,16 @@ |
411 | input=StringIO.StringIO(content) |
412 | data = list(csv.reader(input, quotechar=str(csvdel), delimiter=str(csvsep)))[int(csvskip):] |
413 | datas = [] |
414 | - #if csv_data['combo']: |
415 | - ctx = {} |
416 | - ctx.update(rpc.session.context.copy()) |
417 | - |
418 | + ctx = dict(**rpc.session.context) |
419 | + |
420 | if not isinstance(fields, list): |
421 | fields = [fields] |
422 | |
423 | for line in data: |
424 | - datas.append(map(lambda x:x.decode(csvcode).encode('utf-8'), line)) |
425 | + try: |
426 | + datas.append(map(lambda x:x.decode(csvcode).encode('utf-8'), line)) |
427 | + except: |
428 | + datas.append(map(lambda x:x.decode('latin').encode('utf-8'), line)) |
429 | try: |
430 | res = rpc.session.execute('object', 'execute', params.model, 'import_data', fields, datas, 'init', '', False, ctx) |
431 | except Exception, e: |
432 | |
433 | === modified file 'addons/openerp/controllers/listgrid.py' |
434 | --- addons/openerp/controllers/listgrid.py 2010-06-09 12:05:00 +0000 |
435 | +++ addons/openerp/controllers/listgrid.py 2010-06-10 08:37:38 +0000 |
436 | @@ -64,9 +64,10 @@ |
437 | frm = TinyForm(**kw).to_python() |
438 | data = {} |
439 | ctx = context_with_concurrency_info(params.parent.context, params.concurrency_info) |
440 | - |
441 | - if model != params.model: |
442 | - source = params.source |
443 | + |
444 | + source = params.source |
445 | + if source and source != '_terp_list': |
446 | + |
447 | data = frm.chain_get(source) |
448 | |
449 | if '__id' in data: data.pop('__id') |
450 | |
451 | === modified file 'addons/openerp/controllers/openo2m.py' |
452 | --- addons/openerp/controllers/openo2m.py 2010-05-13 09:21:46 +0000 |
453 | +++ addons/openerp/controllers/openo2m.py 2010-06-10 08:37:38 +0000 |
454 | @@ -54,10 +54,6 @@ |
455 | # to get proper view, first generate form using the view_params |
456 | vp = params.view_params |
457 | |
458 | - # this prevents calling default_get, causes unnecessary |
459 | - # auto increment of sequence |
460 | - vp.id = params.parent_id or False |
461 | - |
462 | form = tw.form_view.ViewForm(vp, name="view_form", action="/openerp/openo2m/save") |
463 | cherrypy.request.terp_validators = {} |
464 | wid = form.screen.widget.get_widgets_by_name(params.o2m)[0] |
465 | |
466 | === modified file 'addons/openerp/controllers/requests.py' |
467 | --- addons/openerp/controllers/requests.py 2010-05-24 13:21:09 +0000 |
468 | +++ addons/openerp/controllers/requests.py 2010-06-10 08:37:38 +0000 |
469 | @@ -62,7 +62,7 @@ |
470 | def default(self): |
471 | import actions |
472 | return actions.execute_window(False, 'res.request', res_id=None, |
473 | - domain=[('act_to','=',rpc.session.uid)], view_type='form', mode='tree,form') |
474 | + domain=[], view_type='form', mode='tree,form') |
475 | |
476 | |
477 | # vim: ts=4 sts=4 sw=4 si et |
478 | |
479 | === modified file 'addons/openerp/controllers/search.py' |
480 | --- addons/openerp/controllers/search.py 2010-05-31 06:01:58 +0000 |
481 | +++ addons/openerp/controllers/search.py 2010-06-10 08:37:38 +0000 |
482 | @@ -96,7 +96,7 @@ |
483 | params, data = TinyDict.split(kw) |
484 | |
485 | domain = kw.get('_terp_domain', []) |
486 | - context = kw.get('_terp_context', {}) |
487 | + context = params.context or {} |
488 | |
489 | parent_context = params.parent_context or {} |
490 | parent_context.update(rpc.session.context.copy()) |
491 | @@ -120,6 +120,10 @@ |
492 | if prefix and '/' in prefix: |
493 | prefix = prefix.rsplit('/', 1)[0] |
494 | pctx = pctx.chain_get(prefix) |
495 | + |
496 | + #update active_id in context for links |
497 | + parent_context.update({'active_id': params.active_id or False, |
498 | + 'active_ids': params.active_ids or []}) |
499 | |
500 | ctx['parent'] = pctx |
501 | ctx['context'] = parent_context |
502 | @@ -148,6 +152,9 @@ |
503 | for key, val in context.items(): |
504 | if val==None: |
505 | context[key] = False |
506 | + |
507 | + if isinstance(context, dict): |
508 | + context = expr_eval(context, ctx) |
509 | |
510 | ctx2 = parent_context |
511 | parent_context.update(context) |
512 | |
513 | === modified file 'addons/openerp/controllers/templates/about.mako' |
514 | --- addons/openerp/controllers/templates/about.mako 2010-03-05 13:19:04 +0000 |
515 | +++ addons/openerp/controllers/templates/about.mako 2010-06-10 08:37:38 +0000 |
516 | @@ -92,7 +92,7 @@ |
517 | </td> |
518 | </tr><tr> |
519 | <td> |
520 | - <a target="_blank" href="http://openerp.com/en/downloads.html">${_("Download")}</a> |
521 | + <a target="_blank" href="http://openerp.com/downloads.html">${_("Download")}</a> |
522 | </td> |
523 | </tr><tr> |
524 | <td> |
525 | @@ -116,11 +116,11 @@ |
526 | </td> |
527 | </tr><tr> |
528 | <td> |
529 | - <a target="_blank" href="http://openerp.com/en/buy/trainings.html">${_("Trainings")}</a> |
530 | + <a target="_blank" href="http://openerp.com/buy/trainings.html">${_("Trainings")}</a> |
531 | </td> |
532 | </tr><tr> |
533 | <td> |
534 | - <a target="_blank" href="http://openerp.com/en/buy.html">${_("Services")}</a> |
535 | + <a target="_blank" href="http://openerp.com/buy.html">${_("Services")}</a> |
536 | </td> |
537 | </tr> |
538 | </table> |
539 | |
540 | === modified file 'addons/openerp/controllers/templates/error_page.mako' |
541 | --- addons/openerp/controllers/templates/error_page.mako 2010-06-07 15:21:15 +0000 |
542 | +++ addons/openerp/controllers/templates/error_page.mako 2010-06-10 08:37:38 +0000 |
543 | @@ -86,6 +86,7 @@ |
544 | is displayed on the second tab.""")} |
545 | </pre> |
546 | % elif maintenance['status'] == 'full': |
547 | +<<<<<<< TREE |
548 | <div> |
549 | <table width="100%"> |
550 | <tr> |
551 | @@ -125,6 +126,42 @@ |
552 | </tr> |
553 | </table> |
554 | </div> |
555 | +======= |
556 | + <div> |
557 | + <table width="100%"> |
558 | + <tr> |
559 | + <td colspan="2" align="center"> |
560 | + <strong>${_("Maintenance contract.")}</strong><br/><br/> |
561 | + <em>${_("Your request will be sent to OpenERP and maintenance team will reply you shortly.")}</em> |
562 | + </td> |
563 | + </tr> |
564 | + <tr> |
565 | + <td class="label" width="5%" nowrap="nowrap">${_("Explain what you did:")}</td> |
566 | + <td class="item"> |
567 | + <textarea id="explanation" class="text" rows="10"></textarea> |
568 | + <script type="text/javascript"> |
569 | + new openerp.ui.TextArea('explanation'); |
570 | + </script> |
571 | + </td> |
572 | + </tr> |
573 | + <tr> |
574 | + <td class="label">${_("Other Comments:")}</td> |
575 | + <td class="item"> |
576 | + <textarea id="remarks" class="text" rows="10"></textarea> |
577 | + <script type="text/javascript"> |
578 | + new openerp.ui.TextArea('remarks'); |
579 | + </script> |
580 | + </td> |
581 | + </tr> |
582 | + <tr> |
583 | + <td></td> |
584 | + <td> |
585 | + <a class="button-a" href="javascript: void(0)" onclick="send_maintenance_request()">${_("Send to Maintenance Team")}</a> |
586 | + </td> |
587 | + </tr> |
588 | + </table> |
589 | + </div> |
590 | +>>>>>>> MERGE-SOURCE |
591 | % endif |
592 | </div> |
593 | <div title="${_('Application Error!')}"> |
594 | |
595 | === modified file 'addons/openerp/controllers/templates/exp.mako' |
596 | --- addons/openerp/controllers/templates/exp.mako 2010-06-02 08:18:17 +0000 |
597 | +++ addons/openerp/controllers/templates/exp.mako 2010-06-10 08:37:38 +0000 |
598 | @@ -168,6 +168,7 @@ |
599 | <input type="hidden" id="_terp_ids" name="_terp_ids" value="${ids}"/> |
600 | <input type="hidden" id="_terp_search_domain" name="_terp_search_domain" value="${search_domain}"/> |
601 | <input type="hidden" id="_terp_fields2" name="_terp_fields2" value="[]"/> |
602 | + <input type="hidden" id="_terp_context" name="_terp_context" value="${ctx}"/> |
603 | |
604 | <table class="view" cellspacing="5" border="0" width="100%"> |
605 | <tr> |
606 | |
607 | === modified file 'addons/openerp/controllers/templates/form.mako' |
608 | --- addons/openerp/controllers/templates/form.mako 2010-06-09 12:44:22 +0000 |
609 | +++ addons/openerp/controllers/templates/form.mako 2010-06-10 08:37:38 +0000 |
610 | @@ -5,6 +5,7 @@ |
611 | |
612 | <script type="text/javascript"> |
613 | var form_controller = '${path}'; |
614 | + var USER_ID = '${rpc.session.uid}'; |
615 | </script> |
616 | |
617 | <script type="text/javascript"> |
618 | @@ -122,6 +123,7 @@ |
619 | </td> |
620 | % endif |
621 | % if form.screen.view_type in ('form'): |
622 | +<<<<<<< TREE |
623 | <td align="center" valign="middle" width="16" class="content_header_space"> |
624 | <img |
625 | class="button" width="16" height="16" |
626 | @@ -135,6 +137,23 @@ |
627 | src="/openerp/static/images/stock/stock_log.png" |
628 | onclick="openobject.tools.openWindow('${py.url('/openerp/viewlog', _terp_model=form.screen.model, _terp_id=form.screen.id)}', {width: 500, height: 300})"/> |
629 | </td> |
630 | +======= |
631 | + <td align="center" valign="middle" width="16" style="padding: 0px 5px 0px 0px;"> |
632 | + <img |
633 | + class="button" width="16" height="16" |
634 | + title="${_('Translate this resource.')}" |
635 | + src="/openerp/static/images/stock/stock_translate.png" onclick="openobject.tools.openWindow(openobject.http.getURL('/openerp/translator', {_terp_model: '${form.screen.model}', _terp_id: ${form.screen.id}, _terp_context: $('_terp_context').value}));"/> |
636 | + </td> |
637 | + % endif |
638 | + % if form.screen.view_type in ('form'): |
639 | + <td align="center" valign="middle" width="16" style="padding: 0px 5px 0px 0px;"> |
640 | + <img |
641 | + class="button" width="16" height="16" |
642 | + title="${_('View Log.')}" |
643 | + src="/openerp/static/images/stock/stock_log.png" |
644 | + onclick="openobject.tools.openWindow('${py.url('/openerp/viewlog', _terp_model=form.screen.model, _terp_id=form.screen.id)}', {width: 500, height: 300})"/> |
645 | + </td> |
646 | +>>>>>>> MERGE-SOURCE |
647 | % endif |
648 | </tr> |
649 | </table> |
650 | |
651 | === modified file 'addons/openerp/controllers/templates/search.mako' |
652 | --- addons/openerp/controllers/templates/search.mako 2010-06-07 13:05:27 +0000 |
653 | +++ addons/openerp/controllers/templates/search.mako 2010-06-10 08:37:38 +0000 |
654 | @@ -24,14 +24,14 @@ |
655 | % if params.selectable == 1: |
656 | <script type="text/javascript"> |
657 | |
658 | - function do_select(id){ |
659 | - if (!id) { |
660 | + function do_select(res_id){ |
661 | + if (!res_id) { |
662 | var ids = new ListView('_terp_list').getSelectedRecords(); |
663 | |
664 | if (ids.length<1) |
665 | return; |
666 | |
667 | - id = ids[0]; |
668 | + res_id = ids[0]; |
669 | } |
670 | |
671 | with (window.opener) { |
672 | @@ -39,7 +39,7 @@ |
673 | var value_field = openobject.dom.get('${params.source}'); |
674 | var text_field = openobject.dom.get('${params.source}_text'); |
675 | |
676 | - value_field.value = id; |
677 | + value_field.value = res_id; |
678 | |
679 | if (text_field){ |
680 | text_field.value = ''; |
681 | |
682 | === modified file 'addons/openerp/controllers/templates/translator.mako' |
683 | --- addons/openerp/controllers/templates/translator.mako 2010-06-02 08:18:17 +0000 |
684 | +++ addons/openerp/controllers/templates/translator.mako 2010-06-10 08:37:38 +0000 |
685 | @@ -10,7 +10,7 @@ |
686 | <form action="/openerp/translator/save" method="post" enctype="multipart/form-data"> |
687 | <input type="hidden" id="_terp_model" name="_terp_model" value="${model}"/> |
688 | <input type="hidden" id="_terp_id" name="_terp_id" value="${id}"/> |
689 | - |
690 | + <input type="hidden" id="_terp_context" name="_terp_context" value="${ctx}"/> |
691 | <table class="view" cellspacing="5" border="0" width="100%"> |
692 | <tr> |
693 | <td> |
694 | @@ -31,8 +31,12 @@ |
695 | <tr> |
696 | <td class="label"><label for="translate">${_("Add Translation for:")}</label></td> |
697 | <td> |
698 | +<<<<<<< TREE |
699 | <select name="translate" id="translate" |
700 | onchange="openLink(openobject.http.getURL('/openerp/translator', {_terp_model: '${model}', _terp_id: '${id}', translate: this.value}))"> |
701 | +======= |
702 | + <select name="translate" onchange="window.location.href=openobject.http.getURL('/openerp/translator', {_terp_model: '${model}', _terp_id: '${id}', _terp_context: $('_terp_context').value, translate: this.value})"> |
703 | +>>>>>>> MERGE-SOURCE |
704 | <option value="fields" ${py.selector(translate=='fields')}>${_("Fields")}</option> |
705 | <option value="labels" ${py.selector(translate=='labels')}>${_("Labels")}</option> |
706 | <option value="relates" ${py.selector(translate=='relates')}>${_("Relates")}</option> |
707 | |
708 | === modified file 'addons/openerp/controllers/translator.py' |
709 | --- addons/openerp/controllers/translator.py 2010-05-13 09:21:46 +0000 |
710 | +++ addons/openerp/controllers/translator.py 2010-06-10 08:37:38 +0000 |
711 | @@ -48,6 +48,9 @@ |
712 | @expose(template="templates/translator.mako") |
713 | def index(self, translate='fields', **kw): |
714 | params, data = TinyDict.split(kw) |
715 | + |
716 | + ctx = dict((params.context or {}), **rpc.session.context) |
717 | + params['context'] = ustr(ctx) |
718 | |
719 | proxy = rpc.RPCProxy('res.lang') |
720 | |
721 | @@ -59,7 +62,7 @@ |
722 | data = [] |
723 | view = [] |
724 | |
725 | - view_view = cache.fields_view_get(params.model, False, 'form', rpc.session.context, True) |
726 | + view_view = cache.fields_view_get(params.model, False, 'form', ctx, True) |
727 | |
728 | view_fields = view_view['fields'] |
729 | view_relates = view_view.get('toolbar') |
730 | @@ -73,7 +76,7 @@ |
731 | if attrs.get('translate'): |
732 | value = {} |
733 | for lang in langs: |
734 | - context = copy.copy(rpc.session.context) |
735 | + context = copy.copy(ctx) |
736 | context['lang'] = adapt_context(lang['code']) |
737 | |
738 | val = proxy.read([params.id], [name], context) |
739 | @@ -123,11 +126,14 @@ |
740 | if values: |
741 | view += [(code, values)] |
742 | |
743 | - return dict(translate=translate, langs=langs, data=data, view=view, model=params.model, id=params.id) |
744 | + return dict(translate=translate, langs=langs, data=data, view=view, model=params.model, id=params.id, ctx=params.context) |
745 | |
746 | @expose() |
747 | def save(self, translate='fields', **kw): |
748 | params, data = TinyDict.split(kw) |
749 | + |
750 | + ctx = dict((params.context or {}), **rpc.session.context) |
751 | + params['context'] = ustr(ctx) |
752 | |
753 | if translate == 'fields': |
754 | if not params.id: |
755 | @@ -135,7 +141,7 @@ |
756 | |
757 | for lang, value in data.items(): |
758 | |
759 | - context = copy.copy(rpc.session.context) |
760 | + context = copy.copy(ctx) |
761 | context['lang'] = adapt_context(lang) |
762 | |
763 | for name, val in value.items(): |
764 | @@ -160,6 +166,6 @@ |
765 | for id, val in value.items(): |
766 | rpc.session.execute('object', 'execute', 'ir.translation', 'write', [int(id)], {'value': val}) |
767 | |
768 | - return self.index(translate=translate, _terp_model=params.model, _terp_id=params.id) |
769 | + return self.index(translate=translate, _terp_model=params.model, _terp_id=params.id, ctx=params.context) |
770 | |
771 | # vim: ts=4 sts=4 sw=4 si et |
772 | |
773 | === modified file 'addons/openerp/controllers/viewed.py' |
774 | --- addons/openerp/controllers/viewed.py 2010-05-24 05:03:10 +0000 |
775 | +++ addons/openerp/controllers/viewed.py 2010-06-10 08:37:38 +0000 |
776 | @@ -741,7 +741,7 @@ |
777 | 'image' : ['filename', 'width', 'height', 'groups'], |
778 | 'separator' : ['string', 'colspan', 'groups'], |
779 | 'label': ['string', 'align', 'colspan', 'groups'], |
780 | - 'button': ['name', 'string', 'icon', 'type', 'states', 'readonly', 'special', 'target', 'confirm', 'attrs', 'groups'], |
781 | + 'button': ['name', 'string', 'icon', 'type', 'states', 'readonly', 'special', 'target', 'confirm', 'context', 'attrs', 'groups'], |
782 | 'newline' : [], |
783 | 'hpaned': ['position', 'groups'], |
784 | 'vpaned': ['position', 'groups'], |
785 | @@ -868,8 +868,7 @@ |
786 | class ActionProperty(widgets.form.M2O): |
787 | |
788 | def __init__(self, name, default=None): |
789 | - attrs = dict(name=name, relation='ir.actions.actions') |
790 | - super(ActionProperty, self).__init__(attrs) |
791 | + super(ActionProperty, self).__init__(name=name, relation='ir.actions.actions') |
792 | self.set_value(default or False) |
793 | |
794 | class IconProperty(widgets.SelectField): |
795 | |
796 | === modified file 'addons/openerp/controllers/wizard.py' |
797 | --- addons/openerp/controllers/wizard.py 2010-05-13 09:21:46 +0000 |
798 | +++ addons/openerp/controllers/wizard.py 2010-06-10 08:37:38 +0000 |
799 | @@ -85,6 +85,9 @@ |
800 | for f in fields: |
801 | if 'value' in fields[f]: |
802 | form_values[f] = fields[f]['value'] |
803 | + |
804 | + if f in datas['form'] and fields[f]['type'] == "one2many": |
805 | + datas['form'][f] = [(1, d, {}) for d in datas['form'][f]] |
806 | |
807 | form_values.update(datas['form']) |
808 | |
809 | |
810 | === modified file 'addons/openerp/static/calendar/lang/calendar-de.js' |
811 | --- addons/openerp/static/calendar/lang/calendar-de.js 2009-04-13 14:25:09 +0000 |
812 | +++ addons/openerp/static/calendar/lang/calendar-de.js 2010-06-10 08:37:38 +0000 |
813 | @@ -27,7 +27,7 @@ |
814 | "So"); |
815 | |
816 | // First day of the week. "0" means display Sunday first. |
817 | -Calendar._FD = 0; |
818 | +Calendar._FD = 1; |
819 | |
820 | // full month names |
821 | Calendar._MN = new Array |
822 | |
823 | === modified file 'addons/openerp/static/calendar/lang/calendar-de_at.js' |
824 | --- addons/openerp/static/calendar/lang/calendar-de_at.js 2009-04-13 14:25:09 +0000 |
825 | +++ addons/openerp/static/calendar/lang/calendar-de_at.js 2010-06-10 08:37:38 +0000 |
826 | @@ -27,7 +27,7 @@ |
827 | "So"); |
828 | |
829 | // First day of the week. "0" means display Sunday first. |
830 | -Calendar._FD = 0; |
831 | +Calendar._FD = 1; |
832 | |
833 | // full month names |
834 | Calendar._MN = new Array |
835 | |
836 | === modified file 'addons/openerp/static/calendar/lang/calendar-de_de.js' |
837 | --- addons/openerp/static/calendar/lang/calendar-de_de.js 2009-04-13 14:25:09 +0000 |
838 | +++ addons/openerp/static/calendar/lang/calendar-de_de.js 2010-06-10 08:37:38 +0000 |
839 | @@ -27,7 +27,7 @@ |
840 | "So"); |
841 | |
842 | // First day of the week. "0" means display Sunday first. |
843 | -Calendar._FD = 0; |
844 | +Calendar._FD = 1; |
845 | |
846 | // full month names |
847 | Calendar._MN = new Array |
848 | |
849 | === modified file 'addons/openerp/static/calendar/lang/calendar-en.js' |
850 | --- addons/openerp/static/calendar/lang/calendar-en.js 2009-04-13 14:25:09 +0000 |
851 | +++ addons/openerp/static/calendar/lang/calendar-en.js 2010-06-10 08:37:38 +0000 |
852 | @@ -45,7 +45,7 @@ |
853 | |
854 | // First day of the week. "0" means display Sunday first, "1" means display |
855 | // Monday first, etc. |
856 | -Calendar._FD = 0; |
857 | +Calendar._FD = 1; |
858 | |
859 | // full month names |
860 | Calendar._MN = new Array |
861 | |
862 | === modified file 'addons/openerp/static/javascript/form.js' |
863 | --- addons/openerp/static/javascript/form.js 2010-06-09 12:00:08 +0000 |
864 | +++ addons/openerp/static/javascript/form.js 2010-06-10 08:37:38 +0000 |
865 | @@ -152,6 +152,7 @@ |
866 | |
867 | params['_terp_source'] = src; |
868 | params['_terp_source_view_type'] = view_type; |
869 | + params['_terp_editable'] = $(prefix + '_terp_editable').value |
870 | |
871 | if (openobject.dom.get('_terp_list')) { |
872 | var ids = new ListView('_terp_list').getSelectedRecords(); |
873 | @@ -306,9 +307,19 @@ |
874 | '_terp_button/model': model, |
875 | '_terp_button/id': id |
876 | }; |
877 | + |
878 | + if (!context || context == "{}") { |
879 | + var act = get_form_action(btype == 'cancel' ? 'cancel' : 'save', params); |
880 | + return submit_form(act, null, target); |
881 | + } |
882 | + |
883 | + var req = eval_domain_context_request({source: "", domain: "[]", context: context}); |
884 | + req.addCallback(function(obj) { |
885 | + params['_terp_button/context'] = obj.context || 0; |
886 | |
887 | - var act = get_form_action(btype == 'cancel' ? 'cancel' : 'save', params); |
888 | - submit_form(act, null, target); |
889 | + var act = get_form_action(btype == 'cancel' ? 'cancel' : 'save', params); |
890 | + submit_form(act, null, target); |
891 | + }); |
892 | } |
893 | |
894 | function onBooleanClicked(name) { |
895 | @@ -436,7 +447,9 @@ |
896 | } |
897 | |
898 | if (kind == 'text_html') { |
899 | - attrs['value'] = tinyMCE.get(e.name).getContent(); |
900 | + if(tinyMCE.get(e.name)){ |
901 | + attrs['value'] = tinyMCE.get(e.name).getContent(); |
902 | + } |
903 | } |
904 | |
905 | if (kind == 'reference' && value) { |
906 | @@ -571,7 +584,9 @@ |
907 | openobject.dom.get(prefix + k + '_checkbox_').checked = value || false; |
908 | break; |
909 | case 'text_html': |
910 | - tinyMCE.execInstanceCommand(k, 'mceSetContent', false, value || ''); |
911 | + if(tinyMCE.get(prefix + k)){ |
912 | + tinyMCE.execInstanceCommand(prefix + k, 'mceSetContent', false, value || '') |
913 | + } |
914 | break; |
915 | case 'selection': |
916 | var opts = []; |
917 | @@ -651,8 +666,13 @@ |
918 | params['_terp_prefix'] = prefix; |
919 | params['_terp_active_id'] = prefix ? openobject.dom.get(prefix + '/_terp_id').value : openobject.dom.get('_terp_id').value; |
920 | params['_terp_active_ids'] = prefix ? openobject.dom.get(prefix + '/_terp_ids').value : openobject.dom.get('_terp_ids').value; |
921 | +<<<<<<< TREE |
922 | |
923 | if(options.group_by_ctx && options.group_by_ctx.length > 0) |
924 | +======= |
925 | + |
926 | + if(options.group_by_ctx && options.group_by_ctx.length > 0) |
927 | +>>>>>>> MERGE-SOURCE |
928 | params['_terp_group_by'] = options.group_by_ctx; |
929 | else |
930 | params['_terp_group_by'] = '[]'; |
931 | |
932 | === modified file 'addons/openerp/static/javascript/form_state.js' |
933 | --- addons/openerp/static/javascript/form_state.js 2010-06-09 10:46:38 +0000 |
934 | +++ addons/openerp/static/javascript/form_state.js 2010-06-10 08:37:38 +0000 |
935 | @@ -161,6 +161,7 @@ |
936 | attrs = attrs.replace(/\)/g, ']'); |
937 | attrs = attrs.replace(/True/g, '1'); |
938 | attrs = attrs.replace(/False/g, '0'); |
939 | + attrs = attrs.replace(/uid/g, window.USER_ID); |
940 | |
941 | try { |
942 | attrs = eval('(' + attrs + ')'); |
943 | @@ -287,15 +288,16 @@ |
944 | |
945 | if (!kind && |
946 | openobject.dom.get(field.id + '_id') && |
947 | - openobject.dom.get(field.id + '_text') && |
948 | + MochiKit.DOM.getElement(field.id + '_set') && |
949 | MochiKit.DOM.getNodeAttribute(field.id + '_id', 'kind') == "many2many") { |
950 | return Many2Many(field.id).setReadonly(readonly); |
951 | } |
952 | - |
953 | + |
954 | + var type = MochiKit.DOM.getNodeAttribute(field, 'type'); |
955 | field.readOnly = readonly; |
956 | field.disabled = readonly; |
957 | |
958 | - if (readonly) { |
959 | + if (readonly && (type != 'button')) { |
960 | MochiKit.DOM.addElementClass(field, 'readonlyfield'); |
961 | } else { |
962 | MochiKit.DOM.removeElementClass(field, 'readonlyfield'); |
963 | @@ -306,6 +308,10 @@ |
964 | return ManyToOne(field).setReadonly(readonly); |
965 | } |
966 | |
967 | + if (!kind && MochiKit.DOM.getElement(field.id + '_btn_') || MochiKit.DOM.getElement('_o2m_'+field.id)) { // one2many |
968 | + return new One2Many(field.id).setReadonly(readonly); |
969 | + } |
970 | + |
971 | if (kind == 'date' || kind == 'datetime' || kind == 'time') { |
972 | var img = openobject.dom.get(field.name + '_trigger'); |
973 | if (img) |
974 | @@ -352,7 +358,12 @@ |
975 | try { |
976 | var label = getNodeAttribute(container, 'for'); |
977 | label = MochiKit.Selector.findChildElements(container.parentNode, ['td.label[for="' + label + '"]'])[0]; |
978 | - if (label) label.style.display = visible ? '' : 'none'; |
979 | + if (!label){ |
980 | + container.style.display = visible ? '' : 'none'; |
981 | + } |
982 | + else{ |
983 | + getFirstParentByTagAndClassName(container).style.display = visible ? '' : 'none'; |
984 | + } |
985 | }catch(e){} |
986 | } |
987 | } |
988 | |
989 | === modified file 'addons/openerp/static/javascript/listgrid.js' |
990 | --- addons/openerp/static/javascript/listgrid.js 2010-06-02 08:18:17 +0000 |
991 | +++ addons/openerp/static/javascript/listgrid.js 2010-06-10 08:37:38 +0000 |
992 | @@ -581,7 +581,7 @@ |
993 | } |
994 | |
995 | var parent_field = this.name.split('/'); |
996 | - var data = getFormData(true); |
997 | + var data = getFormData(2); |
998 | var args = getFormParams('_terp_concurrency_info'); |
999 | |
1000 | for (var k in data) { |
1001 | @@ -715,11 +715,14 @@ |
1002 | var self = this; |
1003 | var args = this.makeArgs(); |
1004 | |
1005 | + var current_id = edit_inline ? (parseInt(edit_inline) || 0) : edit_inline; |
1006 | + |
1007 | // add args |
1008 | args['_terp_source'] = this.name; |
1009 | args['_terp_edit_inline'] = edit_inline; |
1010 | args['_terp_source_default_get'] = default_get_ctx; |
1011 | args['_terp_concurrency_info'] = concurrency_info; |
1012 | + args['_terp_editable'] = openobject.dom.get('_terp_editable').value; |
1013 | args['_terp_group_by_ctx'] = openobject.dom.get('_terp_group_by_ctx').value; |
1014 | |
1015 | if (this.name == '_terp_list') { |
1016 | @@ -743,9 +746,13 @@ |
1017 | var _terp_id = openobject.dom.get(self.name + '/_terp_id') || openobject.dom.get('_terp_id'); |
1018 | var _terp_ids = openobject.dom.get(self.name + '/_terp_ids') || openobject.dom.get('_terp_ids'); |
1019 | var _terp_count = openobject.dom.get(self.name + '/_terp_count') || openobject.dom.get('_terp_count'); |
1020 | - |
1021 | + _terp_id.value = current_id > 0 ? current_id : 'False'; |
1022 | + |
1023 | if (obj.ids) { |
1024 | - _terp_id.value = obj.ids.length ? obj.ids[0] : 'False'; |
1025 | + if (typeof(current_id) == "undefined" && obj.ids.length) { |
1026 | + current_id = obj.ids[0]; |
1027 | + } |
1028 | + _terp_id.value = current_id > 0 ? current_id : 'False'; |
1029 | _terp_ids.value = '[' + obj.ids.join(',') + ']'; |
1030 | _terp_count.value = obj.count; |
1031 | } |
1032 | @@ -842,6 +849,7 @@ |
1033 | |
1034 | openobject.tools.openWindow(openobject.http.getURL('/openerp/impex/exp', {_terp_model: this.model, |
1035 | _terp_source: this.name, |
1036 | + _terp_context: $('_terp_context').value, |
1037 | _terp_search_domain: openobject.dom.get('_terp_search_domain').value, |
1038 | _terp_ids: ids, |
1039 | _terp_view_ids : this.view_ids, |
1040 | @@ -850,6 +858,7 @@ |
1041 | |
1042 | importData: function() { |
1043 | openobject.tools.openWindow(openobject.http.getURL('/openerp/impex/imp', {_terp_model: this.model, |
1044 | + _terp_context: $('_terp_context').value, |
1045 | _terp_source: this.name, |
1046 | _terp_view_ids : this.view_ids, |
1047 | _terp_view_mode : this.view_mode})); |
1048 | |
1049 | === modified file 'addons/openerp/static/javascript/m2o.js' |
1050 | --- addons/openerp/static/javascript/m2o.js 2010-06-02 08:18:17 +0000 |
1051 | +++ addons/openerp/static/javascript/m2o.js 2010-06-10 08:37:38 +0000 |
1052 | @@ -49,7 +49,7 @@ |
1053 | |
1054 | this.field = openobject.dom.get(name); |
1055 | this.text = openobject.dom.get(name + '_text'); |
1056 | - |
1057 | + this.editable = getElement('_terp_editable') ? getElement('_terp_editable').value : 'True'; |
1058 | //for autocomplete |
1059 | this.auto_hidden_id = openobject.dom.get('_hidden_' + name); |
1060 | |
1061 | @@ -81,6 +81,7 @@ |
1062 | this.field_class = getNodeAttribute(this.field, 'class'); |
1063 | setNodeAttribute(this.text, 'autocomplete', 'OFF'); |
1064 | |
1065 | +<<<<<<< TREE |
1066 | connect(this.field, 'onchange', this, this.on_change); |
1067 | //connect(this.text, 'onchange', this, this.on_change_text); |
1068 | connect(this.text, 'onkeydown', this, this.on_keydown); |
1069 | @@ -114,6 +115,43 @@ |
1070 | } |
1071 | bindMethods(this); |
1072 | }; |
1073 | +======= |
1074 | + if (this.editable == 'True'){ |
1075 | + connect(this.field, 'onchange', this, this.on_change); |
1076 | + //connect(this.text, 'onchange', this, this.on_change_text); |
1077 | + connect(this.text, 'onkeydown', this, this.on_keydown); |
1078 | + connect(this.text, 'onkeypress', this, this.on_keypress); |
1079 | + connect(this.text, 'onkeyup', this, this.on_keyup); |
1080 | + connect(this.text, 'onfocus', this, this.gotFocus); |
1081 | + connect(this.text, 'onblur', this, this.lostFocus); |
1082 | + |
1083 | + if (this.hiddenField) |
1084 | + this.lastHiddenResult = this.field.value; |
1085 | + this.lastTextResult = this.text.value; |
1086 | + |
1087 | + if (this.select_img) |
1088 | + connect(this.select_img, 'onclick', this, this.select); |
1089 | + if (this.open_img) |
1090 | + connect(this.open_img, 'onclick', this, this.open_record); |
1091 | + |
1092 | + if (this.reference) { |
1093 | + connect(this.reference, 'onchange', this, this.on_reference_changed); |
1094 | + } |
1095 | + |
1096 | + this.is_inline = name.indexOf('_terp_listfields/') == 0; |
1097 | + |
1098 | + this.field._m2o = this; |
1099 | + |
1100 | + this.change_icon(); |
1101 | + |
1102 | + if (this.takeFocus) { |
1103 | + this.text.focus(); |
1104 | + this.gotFocus(); |
1105 | + } |
1106 | + bindMethods(this); |
1107 | + } |
1108 | +} |
1109 | +>>>>>>> MERGE-SOURCE |
1110 | |
1111 | ManyToOne.prototype.gotFocus = function(evt) { |
1112 | this.hasFocus = true; |
1113 | @@ -130,6 +168,7 @@ |
1114 | |
1115 | ManyToOne.prototype.select = function(evt) { |
1116 | |
1117 | +<<<<<<< TREE |
1118 | if (this.field.disabled) { |
1119 | return; |
1120 | } |
1121 | @@ -149,19 +188,42 @@ |
1122 | }; |
1123 | |
1124 | ManyToOne.prototype.open = function(id) { |
1125 | +======= |
1126 | + if (this.field.disabled) { |
1127 | + return; |
1128 | + } |
1129 | + if(this.field_class.indexOf('readonlyfield') == -1) { |
1130 | + this.get_matched(); |
1131 | + } |
1132 | +} |
1133 | + |
1134 | +ManyToOne.prototype.open_record = function(evt){ |
1135 | + this.field.value = this.field.value || getNodeAttribute(this.field, 'value'); |
1136 | + if (this.field.value) { |
1137 | + this.open(this.field.value); |
1138 | + } |
1139 | +} |
1140 | + |
1141 | +ManyToOne.prototype.create = function(evt){ |
1142 | + this.open(); |
1143 | +} |
1144 | + |
1145 | +ManyToOne.prototype.open = function(id){ |
1146 | +>>>>>>> MERGE-SOURCE |
1147 | |
1148 | var domain = getNodeAttribute(this.field, 'domain'); |
1149 | var context = getNodeAttribute(this.field, 'context'); |
1150 | |
1151 | var model = this.relation; |
1152 | var source = this.name; |
1153 | - var editable = 'True'; |
1154 | + var editable = this.editable || 'True'; |
1155 | |
1156 | - // To open popup form in readonly mode. |
1157 | - if (this.field_class.indexOf('readonlyfield') != -1) { |
1158 | - var editable = 'False'; |
1159 | + if (editable == 'True'){ |
1160 | + // To open popup form in readonly mode. |
1161 | + if (this.field_class.indexOf('readonlyfield') != -1) { |
1162 | + var editable = 'False'; |
1163 | + } |
1164 | } |
1165 | - |
1166 | var req = eval_domain_context_request({source: source, domain: domain, context: context}); |
1167 | |
1168 | req.addCallback(function(obj) { |
1169 | |
1170 | === modified file 'addons/openerp/static/javascript/o2m.js' |
1171 | --- addons/openerp/static/javascript/o2m.js 2010-06-02 08:18:17 +0000 |
1172 | +++ addons/openerp/static/javascript/o2m.js 2010-06-10 08:37:38 +0000 |
1173 | @@ -88,8 +88,11 @@ |
1174 | |
1175 | // get the required view params to get proper view |
1176 | params['_terp_view_params/_terp_model'] = openobject.dom.get('_terp_model').value; |
1177 | + params['_terp_view_params/_terp_id'] = $('_terp_id').value; |
1178 | + params['_terp_view_params/_terp_ids'] = $('_terp_ids').value; |
1179 | params['_terp_view_params/_terp_view_ids'] = openobject.dom.get('_terp_view_ids').value; |
1180 | params['_terp_view_params/_terp_view_mode'] = openobject.dom.get('_terp_view_mode').value; |
1181 | + params['_terp_view_params/_terp_context'] = openobject.dom.get('_terp_context').value || {}; |
1182 | params['_terp_view_params/_terp_view_type'] = 'form'; |
1183 | |
1184 | while (names.length) { |
1185 | @@ -98,8 +101,11 @@ |
1186 | var prefix = parents.join('/'); |
1187 | |
1188 | params['_terp_view_params/' + prefix + '/_terp_model'] = openobject.dom.get(prefix + '/_terp_model').value; |
1189 | + params['_terp_view_params/' + prefix + '/_terp_id'] = $(prefix + '/_terp_id').value; |
1190 | + params['_terp_view_params/' + prefix + '/_terp_ids'] = $(prefix + '/_terp_ids').value; |
1191 | params['_terp_view_params/' + prefix + '/_terp_view_ids'] = openobject.dom.get(prefix + '/_terp_view_ids').value; |
1192 | params['_terp_view_params/' + prefix + '/_terp_view_mode'] = openobject.dom.get(prefix + '/_terp_view_mode').value; |
1193 | + params['_terp_view_params/' + prefix + '/_terp_context'] = openobject.dom.get(prefix + '/_terp_context').value || {}; |
1194 | params['_terp_view_params/' + prefix + '/_terp_view_type'] = 'form'; |
1195 | } |
1196 | |
1197 | @@ -136,5 +142,22 @@ |
1198 | openobject.http.delCookie('_terp_parent_context'); |
1199 | } |
1200 | }); |
1201 | + }, |
1202 | + |
1203 | + setReadonly: function(readonly) { |
1204 | + var btn=MochiKit.DOM.getElement(this.name+'_btn_'); |
1205 | + var grid=MochiKit.DOM.getElement(this.name+'_grid'); |
1206 | + var edit=MochiKit.DOM.getElement(this.name + '/_terp_editable'); |
1207 | + |
1208 | + if (readonly) { |
1209 | + if(btn){btn.style.display='none';} |
1210 | + MochiKit.Base.map(function (el) {el.style.display='none'},MochiKit.Selector.findChildElements(grid,['.selector'])); |
1211 | + edit.value= 0; |
1212 | + } |
1213 | + else{ |
1214 | + if(btn){btn.style.display='';} |
1215 | + MochiKit.Base.map(function (el) {el.style.display=''},MochiKit.Selector.findChildElements(grid,['.selector'])); |
1216 | + edit.value = 1; |
1217 | + } |
1218 | } |
1219 | }; |
1220 | |
1221 | === modified file 'addons/openerp/utils/tools.py' |
1222 | --- addons/openerp/utils/tools.py 2010-05-20 06:33:09 +0000 |
1223 | +++ addons/openerp/utils/tools.py 2010-06-10 08:37:38 +0000 |
1224 | @@ -48,6 +48,10 @@ |
1225 | return {} |
1226 | return temp |
1227 | else: |
1228 | + if isinstance(string, dict): |
1229 | + for i,v in string.items(): |
1230 | + if v=='active_id': |
1231 | + string[i] = eval(v,context) |
1232 | return string |
1233 | |
1234 | def node_attributes(node): |
1235 | @@ -157,7 +161,7 @@ |
1236 | if pn and pn.localName and pn.localName != 'view': |
1237 | xp = get_node_xpath(pn) + xp |
1238 | |
1239 | - nodes = xml_locate(root, node.parentNode) |
1240 | + nodes = [n for n in pn.childNodes if n.localName == node.localName] |
1241 | xp += '[%s]' % (nodes.index(node) + 1) |
1242 | |
1243 | return xp |
1244 | @@ -194,11 +198,15 @@ |
1245 | fd, fn = tempfile.mkstemp(suffix=suffix, prefix=prefix, dir=dir, text=text) |
1246 | os.close(fd) |
1247 | return str.__new__(cls, fn) |
1248 | + |
1249 | + def __init__(self, *args, **kwargs): |
1250 | + self.__os_path_exists = os.path.exists |
1251 | + self.__os_unlink = os.unlink |
1252 | + str.__init__(self, *args, **kwargs) |
1253 | |
1254 | def __del__(self): |
1255 | - import os # ensure os module exists |
1256 | - if os.path.exists(str(self)): |
1257 | - os.unlink(str(self)) |
1258 | + if self.__os_path_exists(self): |
1259 | + self.__os_unlink(self) |
1260 | |
1261 | def __copy__(self): |
1262 | return self |
1263 | |
1264 | === modified file 'addons/openerp/utils/utils.py' |
1265 | --- addons/openerp/utils/utils.py 2010-03-08 11:44:48 +0000 |
1266 | +++ addons/openerp/utils/utils.py 2010-06-10 08:37:38 +0000 |
1267 | @@ -157,7 +157,7 @@ |
1268 | |
1269 | def _plain(data, prefix): |
1270 | for k, v in data.items(): |
1271 | - if isinstance(v, dict): |
1272 | + if isinstance(v, dict) and not k.startswith('_terp_'): |
1273 | _plain(v, prefix + k +'/') |
1274 | else: |
1275 | res[prefix + k] = v |
1276 | @@ -189,6 +189,7 @@ |
1277 | 'text': lambda *a: validators.String(), |
1278 | 'text_tag': lambda *a: validators.String(), |
1279 | 'many2many': lambda *a: validators.many2many(), |
1280 | + 'one2many': lambda *a: validators.one2many(), |
1281 | 'many2one': lambda *a: validators.many2one(), |
1282 | 'email' : lambda *a: validators.Email(), |
1283 | 'url' : lambda *a: validators.URL(), |
1284 | @@ -243,12 +244,18 @@ |
1285 | from openerp.utils import rpc |
1286 | proxy = rpc.RPCProxy(attrs['relation']) |
1287 | res = proxy.read(value, [], rpc.session.context) |
1288 | + res1 = proxy.fields_get(False, rpc.session.context) |
1289 | + for values in res: |
1290 | + for key, val in values.items(): |
1291 | + if key in res1.keys(): |
1292 | + if res1[key]['type'] == 'many2many': |
1293 | + values[key] = [(6, 0, val)] |
1294 | value = [] |
1295 | for r in res: |
1296 | id = r.pop('id') |
1297 | value += [(1, id, r)] |
1298 | else: |
1299 | - value = [(0, 0, [])] |
1300 | + value = [] |
1301 | except: |
1302 | pass |
1303 | |
1304 | @@ -256,6 +263,8 @@ |
1305 | kind = 'char' |
1306 | |
1307 | v = _VALIDATORS.get(kind, validators.DefaultValidator)() |
1308 | + if kind == "float" and attrs.get("digit"): |
1309 | + v = validators.Float(digit=attrs.get("digit")) |
1310 | v.not_empty = (required or False) and True |
1311 | |
1312 | try: |
1313 | |
1314 | === modified file 'addons/openerp/validators/validators.py' |
1315 | --- addons/openerp/validators/validators.py 2010-03-08 11:44:48 +0000 |
1316 | +++ addons/openerp/validators/validators.py 2010-06-10 08:37:38 +0000 |
1317 | @@ -78,8 +78,8 @@ |
1318 | try: |
1319 | value = format.parse_decimal(value) |
1320 | except ValueError: |
1321 | - pass |
1322 | - return Number.to_python(value, state) |
1323 | + raise Invalid(_('Invalid literal for float'), value, state) |
1324 | + return value |
1325 | |
1326 | class FloatTime(Float): |
1327 | |
1328 | @@ -227,6 +227,10 @@ |
1329 | value = (len(value) or False) and value[0] |
1330 | |
1331 | return value or '' |
1332 | + |
1333 | +class one2many(FancyValidator): |
1334 | + |
1335 | + if_empty = [] |
1336 | |
1337 | |
1338 | # Let some FormEncode strings goes into message catalog. |
1339 | |
1340 | === modified file 'addons/openerp/widgets/form/_action.py' |
1341 | --- addons/openerp/widgets/form/_action.py 2010-03-23 12:46:22 +0000 |
1342 | +++ addons/openerp/widgets/form/_action.py 2010-06-10 08:37:38 +0000 |
1343 | @@ -58,7 +58,7 @@ |
1344 | super(Action, self).__init__(**attrs) |
1345 | self.nolabel = True |
1346 | |
1347 | - self.act_id = int(attrs['name']) |
1348 | + self.act_id= self.name |
1349 | |
1350 | proxy = rpc.RPCProxy("ir.actions.actions") |
1351 | res = proxy.read([self.act_id], ['type'], rpc.session.context) |
1352 | |
1353 | === modified file 'addons/openerp/widgets/form/_form.py' |
1354 | --- addons/openerp/widgets/form/_form.py 2010-06-04 06:31:13 +0000 |
1355 | +++ addons/openerp/widgets/form/_form.py 2010-06-10 08:37:38 +0000 |
1356 | @@ -286,7 +286,7 @@ |
1357 | |
1358 | self.fake_widget = '_fake' |
1359 | if attrs.get('prefix'): |
1360 | - self.fake_widge = attrs['prefix'] + '/_fake' |
1361 | + self.fake_widget = attrs['prefix'] + '/_fake' |
1362 | |
1363 | register_widget(Notebook, ["notebook"]) |
1364 | |
1365 | @@ -632,7 +632,7 @@ |
1366 | class Button(TinyInputWidget): |
1367 | |
1368 | template = "templates/button.mako" |
1369 | - params = ["btype", "id", "confirm", "icon", "target"] |
1370 | + params = ["btype", "id", "confirm", "icon", "target", "context"] |
1371 | |
1372 | visible = True |
1373 | target = 'current' |
1374 | @@ -645,6 +645,7 @@ |
1375 | self.string = re.sub('_(?!_)', '', self.string or '') |
1376 | |
1377 | self.btype = attrs.get('special', attrs.get('type', 'workflow')) |
1378 | + self.context = attrs.get("context", {}) |
1379 | |
1380 | self.nolabel = True |
1381 | |
1382 | @@ -799,9 +800,11 @@ |
1383 | values[d[0]] = d[2][0] |
1384 | |
1385 | if ids: |
1386 | - values = proxy.read(ids[:1], fields.keys() + ['__last_update'], ctx)[0] |
1387 | - self.id = ids[0] |
1388 | - self._update_concurrency_info(self.model, [values]) |
1389 | + lval = proxy.read(ids[:1], fields.keys() + ['__last_update'], ctx) |
1390 | + if lval: |
1391 | + values = lval[0] |
1392 | + self.id = ids[0] |
1393 | + self._update_concurrency_info(self.model, [values]) |
1394 | |
1395 | elif 'datas' in view: # wizard data |
1396 | |
1397 | @@ -912,6 +915,7 @@ |
1398 | name = attrs['name'] |
1399 | |
1400 | try: |
1401 | + fields[name]['link'] = attrs.get('link', '1') |
1402 | fields[name].update(attrs) |
1403 | except: |
1404 | print "-"*30,"\n malformed tag for:", attrs |
1405 | @@ -975,7 +979,8 @@ |
1406 | def _make_field_widget(self, attrs, value=False): |
1407 | |
1408 | attrs['editable'] = self.editable |
1409 | - attrs['link'] = self.link |
1410 | + if not attrs['type'] == 'many2one': |
1411 | + attrs['link'] = self.link |
1412 | |
1413 | attrs.setdefault('context', self.context) |
1414 | attrs.setdefault('model', self.model) |
1415 | |
1416 | === modified file 'addons/openerp/widgets/form/_o2m.py' |
1417 | --- addons/openerp/widgets/form/_o2m.py 2010-06-03 09:55:52 +0000 |
1418 | +++ addons/openerp/widgets/form/_o2m.py 2010-06-10 08:37:38 +0000 |
1419 | @@ -112,6 +112,9 @@ |
1420 | |
1421 | if ids and isinstance(ids[0], dict): |
1422 | ids = [] |
1423 | + |
1424 | + if ids and isinstance(ids[0], tuple): |
1425 | + ids = [i[1] for i in ids] |
1426 | |
1427 | id = (ids or None) and ids[0] |
1428 | |
1429 | |
1430 | === modified file 'addons/openerp/widgets/form/templates/button.mako' |
1431 | --- addons/openerp/widgets/form/templates/button.mako 2010-05-26 08:41:51 +0000 |
1432 | +++ addons/openerp/widgets/form/templates/button.mako 2010-06-10 08:37:38 +0000 |
1433 | @@ -1,8 +1,8 @@ |
1434 | -<a ${py.attrs(attrs)} |
1435 | +<a ${py.attrs(attrs, context=ctx)} |
1436 | class="button-b" |
1437 | id="${name}" |
1438 | href="javascript: void(0)" |
1439 | - onclick="buttonClicked('${name}', '${btype}', '${model}', '${id}', '${confirm}', '${target}');" style="height: 18px;"> |
1440 | + onclick="buttonClicked('${name}', '${btype}', '${model}', '${id}', '${confirm}', '${target}', getNodeAttribute(this, 'context'));" style="height: 18px;"> |
1441 | % if string: |
1442 | % if icon: |
1443 | <div class="button_wid_string" style="background-image: url(${icon});">${string}</div> |
1444 | |
1445 | === modified file 'addons/openerp/widgets/form/templates/char.mako' |
1446 | --- addons/openerp/widgets/form/templates/char.mako 2010-04-21 14:22:43 +0000 |
1447 | +++ addons/openerp/widgets/form/templates/char.mako 2010-06-10 08:37:38 +0000 |
1448 | @@ -8,7 +8,7 @@ |
1449 | % endif |
1450 | |
1451 | % if not editable and not password: |
1452 | - <span kind="${kind}" id="${name}">${value}</span> |
1453 | + <span kind="${kind}" id="${name}" value="${value}">${value}</span> |
1454 | % endif |
1455 | |
1456 | % if not editable and password and value: |
1457 | |
1458 | === modified file 'addons/openerp/widgets/form/templates/many2many.mako' |
1459 | --- addons/openerp/widgets/form/templates/many2many.mako 2010-05-24 13:21:09 +0000 |
1460 | +++ addons/openerp/widgets/form/templates/many2many.mako 2010-06-10 08:37:38 +0000 |
1461 | @@ -21,6 +21,9 @@ |
1462 | <td id='${name}_container'> |
1463 | ${screen.display()} |
1464 | <!-- IMP: IE problem, openobject.dom.get('some_name') returns field with name="some_id" instead of id="some_id" --> |
1465 | + % if not editable: |
1466 | + <input type="hidden" class="${css_class}" id='${name}_set' kind="${kind}" ${py.attrs(attrs)} style="width: 100%;"/> |
1467 | + % endif |
1468 | <input type="hidden" class="${css_class}" kind="${kind}" id='${name}_id' name="${name}" value="${screen.ids}" ${py.attrs(attrs)} relation="${relation}"/> |
1469 | </td> |
1470 | % endif |
1471 | |
1472 | === modified file 'addons/openerp/widgets/form/templates/many2one.mako' |
1473 | --- addons/openerp/widgets/form/templates/many2one.mako 2010-05-31 06:01:58 +0000 |
1474 | +++ addons/openerp/widgets/form/templates/many2one.mako 2010-06-10 08:37:38 +0000 |
1475 | @@ -36,20 +36,12 @@ |
1476 | |
1477 | % if not editable and link: |
1478 | % if link=='1': |
1479 | - <span id="${name}" ${py.attrs(kind=kind, value=value)}> |
1480 | - <a href="${py.url('/openerp/form/view', model=relation, id=value)}">${text}</a> |
1481 | + <span id="${name}" name="${name}" ${py.attrs(kind=kind, value=value, relation=relation, context=ctx, domain=domain, link=link)}> |
1482 | + <a href="javascript: void(0)" onclick="new ManyToOne('${name}').open_record('${value}')">${text}</a> |
1483 | </span> |
1484 | % endif |
1485 | % if link=='0': |
1486 | - <span id="${name}" ${py.attrs(kind=kind, value=value)}>${text}</span> |
1487 | + <span id="${name}" ${py.attrs(kind=kind, value=value, relation=relation, link=link)}>${text}</span> |
1488 | % endif |
1489 | % endif |
1490 | |
1491 | -% if not editable and not link == '0': |
1492 | - <span> |
1493 | - <span id="${name}" ${py.attrs(kind=kind, value=value, relation=relation)}> |
1494 | - <a href="${py.url('/openerp/form/view', model=relation, id=value)}">${text}</a> |
1495 | - </span> |
1496 | - </span> |
1497 | -% endif |
1498 | - |
1499 | |
1500 | === modified file 'addons/openerp/widgets/form/templates/one2many.mako' |
1501 | --- addons/openerp/widgets/form/templates/one2many.mako 2010-06-03 09:55:52 +0000 |
1502 | +++ addons/openerp/widgets/form/templates/one2many.mako 2010-06-10 08:37:38 +0000 |
1503 | @@ -36,7 +36,7 @@ |
1504 | % if not screen.editable and screen.view_type=='form': |
1505 | <img class="button" title="${_('Translate me.')}" alt="${_('Translate me.')}" |
1506 | src="/openerp/static/images/stock/stock_translate.png" width="16" height="16" |
1507 | - onclick="openobject.tools.openWindow('${py.url('/openerp/translator', _terp_model=screen.model, _terp_id=screen.id)}')"/> |
1508 | + onclick="openobject.tools.openWindow(openobject.http.getURL('/openerp/translator', {_terp_model: '${screen.model}', _terp_id: ${screen.id}, _terp_context: $('_terp_context').value}));"/> |
1509 | % endif |
1510 | </td> |
1511 | </tr> |
1512 | @@ -46,7 +46,7 @@ |
1513 | <tr> |
1514 | % if screen: |
1515 | <td> |
1516 | - <input type="hidden" name="${name}/__id" id="${name}/__id" value="${id}"/> |
1517 | + <input type="hidden" name="${name}/__id" id="${name}/__id" value="${id}" ${py.disabled(screen.view_type!="form")}/> |
1518 | <input type="hidden" name="${name}/_terp_default_get_ctx" id="${name}/_terp_default_get_ctx" value="${default_get_ctx}"/> |
1519 | ${screen.display()} |
1520 | </td> |
1521 | |
1522 | === modified file 'addons/openerp/widgets/form/templates/reference.mako' |
1523 | --- addons/openerp/widgets/form/templates/reference.mako 2010-01-11 09:32:25 +0000 |
1524 | +++ addons/openerp/widgets/form/templates/reference.mako 2010-06-10 08:37:38 +0000 |
1525 | @@ -48,6 +48,10 @@ |
1526 | new ManyToOne('${name}'); |
1527 | </script> |
1528 | % else: |
1529 | - <span>${'(%s) %s' % (dict(options).get(relation), text)}</span> |
1530 | + <span> |
1531 | + <span id="${name}" ${py.attrs(kind=kind, value=value, relation=relation)}> |
1532 | + <a href="${py.url('/form/view', model=relation, id=value)}">${text}</a> |
1533 | + </span> |
1534 | + </span> |
1535 | % endif |
1536 | |
1537 | |
1538 | === modified file 'addons/openerp/widgets/form_view.py' |
1539 | --- addons/openerp/widgets/form_view.py 2010-05-10 12:45:17 +0000 |
1540 | +++ addons/openerp/widgets/form_view.py 2010-06-10 08:37:38 +0000 |
1541 | @@ -103,9 +103,16 @@ |
1542 | |
1543 | if params.view_type == 'tree': |
1544 | self.screen.id = False |
1545 | + |
1546 | + if 'form' not in self.screen.view_mode: |
1547 | + self.screen.widget.link = 0 |
1548 | + self.screen.editable = False |
1549 | + self.screen.widget.editable = False |
1550 | |
1551 | # get the correct view title |
1552 | - self.screen.string = getattr(cherrypy.request, '_terp_view_name', self.screen.string) or self.screen.string |
1553 | + if params.context: |
1554 | + self.screen.string = params.context.get('_terp_view_name', self.screen.string) |
1555 | + self.screen.string = self.screen.string |
1556 | |
1557 | # get the actual pager data |
1558 | self.limit = self.screen.limit |
1559 | @@ -120,6 +127,11 @@ |
1560 | self.hidden_fields = params.hidden_fields |
1561 | |
1562 | #self.fields = cherrypy.request.terp_fields |
1563 | + def update_params(self, d): |
1564 | + super(ViewForm, self).update_params(d) |
1565 | + if self.search: |
1566 | + d.attrs['onsubmit']='submit_search_form()'; |
1567 | + |
1568 | |
1569 | |
1570 | # vim: ts=4 sts=4 sw=4 si et |
1571 | |
1572 | === modified file 'addons/openerp/widgets/listgrid.py' |
1573 | --- addons/openerp/widgets/listgrid.py 2010-05-26 10:13:57 +0000 |
1574 | +++ addons/openerp/widgets/listgrid.py 2010-06-10 08:37:38 +0000 |
1575 | @@ -47,7 +47,7 @@ |
1576 | |
1577 | template = "templates/listgrid.mako" |
1578 | params = ['name', 'data', 'columns', 'headers', 'model', 'selectable', 'editable', |
1579 | - 'pageable', 'selector', 'source', 'offset', 'limit', 'show_links', 'editors', |
1580 | + 'pageable', 'selector', 'source', 'offset', 'limit', 'show_links', 'editors', 'view_mode', |
1581 | 'hiddens', 'edit_inline', 'field_total', 'link', 'checkbox_name', 'm2m', 'min_rows', 'string'] |
1582 | |
1583 | member_widgets = ['pager', 'buttons', 'editors', 'concurrency_info'] |
1584 | @@ -94,7 +94,8 @@ |
1585 | self.selectable = kw.get('selectable', 0) |
1586 | self.editable = kw.get('editable', False) |
1587 | self.pageable = kw.get('pageable', True) |
1588 | - |
1589 | + self.view_mode = kw.get('view_mode', []) |
1590 | + |
1591 | self.offset = kw.get('offset', 0) |
1592 | self.limit = kw.get('limit', 0) |
1593 | self.count = kw.get('count', 0) |
1594 | @@ -444,6 +445,9 @@ |
1595 | |
1596 | def get_text(self): |
1597 | if self.value: |
1598 | + if isinstance(self.value, (tuple, list)): |
1599 | + self.value = self.value[0] |
1600 | + |
1601 | selection = self.attrs['selection'] |
1602 | for k, v in selection: |
1603 | if k == self.value: |
1604 | @@ -468,6 +472,10 @@ |
1605 | def get_text(self): |
1606 | val = self.value or 0.0 |
1607 | t = '%02d:%02d' % (math.floor(abs(val)),round(abs(val)%1+0.01,2) * 60) |
1608 | + |
1609 | + hour, min = t.split(':') |
1610 | + if int(min) == 60: |
1611 | + t = str(int(hour) + 1) + ":00" |
1612 | if val < 0: |
1613 | t = '-' + t |
1614 | |
1615 | |
1616 | === modified file 'addons/openerp/widgets/sidebar.py' |
1617 | --- addons/openerp/widgets/sidebar.py 2010-05-31 06:01:58 +0000 |
1618 | +++ addons/openerp/widgets/sidebar.py 2010-06-10 08:37:38 +0000 |
1619 | @@ -123,18 +123,16 @@ |
1620 | rep['context'] = self.context |
1621 | self.reports.append(rep) |
1622 | |
1623 | - if self.view_type == 'form': |
1624 | + if self.view_type == 'form' and id: |
1625 | |
1626 | proxy = rpc.RPCProxy('ir.attachment') |
1627 | ids = proxy.search([('res_model', '=', model), ('res_id', '=', id)], 0, 0, 0, self.context) |
1628 | |
1629 | if ids: |
1630 | attach = [] |
1631 | - datas = proxy.read(ids, ['datas_fname']) |
1632 | - self.attachments = [(d['id'], d['datas_fname']) for d in datas if d['datas_fname']] |
1633 | + datas = proxy.read(ids, ['datas_fname', 'name']) |
1634 | + self.attachments = [(d['id'], d['datas_fname'] or d['name']) for d in datas if d['datas_fname'] or d['name']] |
1635 | |
1636 | self.sub_menu = submenu |
1637 | - else: |
1638 | - self.relates = [] |
1639 | |
1640 | # vim: ts=4 sts=4 sw=4 si et |
1641 | |
1642 | === modified file 'addons/openerp/widgets/templates/listgrid.mako' |
1643 | --- addons/openerp/widgets/templates/listgrid.mako 2010-05-31 06:01:58 +0000 |
1644 | +++ addons/openerp/widgets/templates/listgrid.mako 2010-06-10 08:37:38 +0000 |
1645 | @@ -108,13 +108,21 @@ |
1646 | } |
1647 | } |
1648 | else if(jQuery('#_o2m_${name}').length>0) { |
1649 | - jQuery('#${name}').find('td.pager-cell:first').after('<td style="width: 10%;" class="pager-cell"><a class="button-a" href="javascript: void(0)" id="${name}_btn_" title="${_('Create new record.')}">new<a/></td>'); |
1650 | + if('${editable}' != 'False') { |
1651 | + jQuery('#${name}').find('td.pager-cell:first').after('<td style="width: 10%;" class="pager-cell"><a class="button-a" href="javascript: void(0)" id="${name}_btn_" title="${_('Create new record.')}">new<a/></td>'); |
1652 | + } |
1653 | jQuery('#${name}_btn_').click(function() { |
1654 | new One2Many('${name}', jQuery('#_o2m_${name}').attr('detail')).create() |
1655 | }); |
1656 | } |
1657 | else { |
1658 | +<<<<<<< TREE |
1659 | jQuery('#${name}').find('td.pager-cell:first').after('<td class="pager-cell-button"><a class="button-a" href="javascript: void(0)" title="${_('Create new record.')}">new</a></td>'); |
1660 | +======= |
1661 | + if('${editable}' != 'False') { |
1662 | + jQuery('#${name}').find('td.pager-cell:first').after('<td style="width: 10%;" class="pager-cell-button"><a class="button-a" href="javascript: void(0)" title="${_('Create new record.')}">new<a/></td>'); |
1663 | + } |
1664 | +>>>>>>> MERGE-SOURCE |
1665 | if("${editors}" == "{}") { |
1666 | jQuery('#${name}').find('td.pager-cell-button:first').find('a:first').click(function() { |
1667 | editRecord(null); |
1668 | @@ -284,51 +292,52 @@ |
1669 | } |
1670 | </script> |
1671 | % endif |
1672 | - |
1673 | - <script type="text/javascript"> |
1674 | - //Make all records Editable by Double-click |
1675 | - var view_type = jQuery('[id*=_terp_view_type]').val(); |
1676 | - var editable = jQuery('[id*=_terp_editable]').val(); |
1677 | - jQuery('table#${name}_grid tr.grid-row').each(function(index, row) { |
1678 | - jQuery(row).dblclick(function(event) { |
1679 | - if (!(event.target.className == 'checkbox grid-record-selector' || event.target.className == 'listImage')) { |
1680 | - if (view_type == 'tree') { |
1681 | - if (editable != 'True') { |
1682 | - do_select(jQuery(row).attr('record')); |
1683 | - } |
1684 | - else { |
1685 | - editRecord(jQuery(row).attr('record')); |
1686 | - } |
1687 | - } |
1688 | - } |
1689 | - }); |
1690 | - }); |
1691 | - |
1692 | - jQuery('table#${name}_grid tr.grid-row').each(function(index, row) { |
1693 | - jQuery(row).click(function(event) { |
1694 | - if (!(event.target.className == 'grid-cell selector' || event.target.className == 'checkbox grid-record-selector' || event.target.className == 'listImage')) { |
1695 | - if (view_type == 'tree') { |
1696 | - do_select(jQuery(row).attr('record')); |
1697 | - } |
1698 | - } |
1699 | - }); |
1700 | - }); |
1701 | - |
1702 | - if (view_type == 'form') { |
1703 | - if (jQuery('#${name}_set').length) { |
1704 | - if (jQuery('input#${name}/_terp_ids').val() != '[]') { |
1705 | - jQuery('table#${name}_grid tr.grid-row td:nth-child(2) span span').each(function(index, span) { |
1706 | - var link_text = jQuery(span).text(); |
1707 | - var record_id = jQuery(span).parents('tr.grid-row').attr('record'); |
1708 | - jQuery(span).empty().append( |
1709 | - jQuery('<a>').attr('href', '#').click(function () { |
1710 | - do_select(record_id, '${name}'); |
1711 | - return false; |
1712 | - }).text(link_text));}); |
1713 | - } |
1714 | - } |
1715 | - } |
1716 | - </script> |
1717 | + % if 'form' in view_mode: |
1718 | + <script type="text/javascript"> |
1719 | + //Make all records Editable by Double-click |
1720 | + var view_type = jQuery('[id*=_terp_view_type]').val(); |
1721 | + var editable = jQuery('[id*=_terp_editable]').val(); |
1722 | + jQuery('table#${name}_grid tr.grid-row').each(function(index, row) { |
1723 | + jQuery(row).dblclick(function(event) { |
1724 | + if (!(event.target.className == 'checkbox grid-record-selector' || event.target.className == 'listImage')) { |
1725 | + if (view_type == 'tree') { |
1726 | + if (editable != 'True') { |
1727 | + do_select(jQuery(row).attr('record')); |
1728 | + } |
1729 | + else { |
1730 | + editRecord(jQuery(row).attr('record')); |
1731 | + } |
1732 | + } |
1733 | + } |
1734 | + }); |
1735 | + }); |
1736 | + |
1737 | + jQuery('table#${name}_grid tr.grid-row').each(function(index, row) { |
1738 | + jQuery(row).click(function(event) { |
1739 | + if (!(event.target.className == 'grid-cell selector' || event.target.className == 'checkbox grid-record-selector' || event.target.className == 'listImage')) { |
1740 | + if (view_type == 'tree') { |
1741 | + do_select(jQuery(row).attr('record')); |
1742 | + } |
1743 | + } |
1744 | + }); |
1745 | + }); |
1746 | + |
1747 | + if (view_type == 'form') { |
1748 | + if (jQuery('#${name}_set').length) { |
1749 | + if (jQuery('input#${name}/_terp_ids').val() != '[]') { |
1750 | + jQuery('table#${name}_grid tr.grid-row td:nth-child(2) span span').each(function(index, span) { |
1751 | + var link_text = jQuery(span).text(); |
1752 | + var record_id = jQuery(span).parents('tr.grid-row').attr('record'); |
1753 | + jQuery(span).empty().append( |
1754 | + jQuery('<a>').attr('href', '#').click(function () { |
1755 | + do_select(record_id, '${name}'); |
1756 | + return false; |
1757 | + }).text(link_text));}); |
1758 | + } |
1759 | + } |
1760 | + } |
1761 | + </script> |
1762 | + % endif |
1763 | </td> |
1764 | </tr> |
1765 | |
1766 | |
1767 | === modified file 'addons/openerp/widgets/tree_view.py' |
1768 | --- addons/openerp/widgets/tree_view.py 2010-06-03 15:30:46 +0000 |
1769 | +++ addons/openerp/widgets/tree_view.py 2010-06-10 08:37:38 +0000 |
1770 | @@ -121,7 +121,7 @@ |
1771 | self.sidebar = Sidebar(self.model, submenu, toolbar, context=self.context) |
1772 | |
1773 | # get the correct view title |
1774 | - self.string = getattr(cherrypy.request, '_terp_view_name', self.string) |
1775 | + self.string = self.context.get('_terp_view_name', self.string) or self.string |
1776 | |
1777 | def parse(self, root, fields=None): |
1778 | |
1779 | |
1780 | === modified file 'addons/view_calendar/static/javascript/calendar_month.js' |
1781 | --- addons/view_calendar/static/javascript/calendar_month.js 2010-05-03 15:13:18 +0000 |
1782 | +++ addons/view_calendar/static/javascript/calendar_month.js 2010-06-10 08:37:38 +0000 |
1783 | @@ -168,7 +168,10 @@ |
1784 | if (!hasElementClass(target, 'calMonthDay')) |
1785 | return; |
1786 | |
1787 | - editCalendarRecord(null); |
1788 | + var elem = getElement('calEventNew'); |
1789 | + var dt = MochiKit.DateTime.isoTimestamp(getNodeAttribute(elem, 'dtStart')); |
1790 | + |
1791 | + editCalendarRecord(null, toISOTimestamp(dt)); |
1792 | }, |
1793 | |
1794 | splitEvent : function(record, params) { |
1795 | |
1796 | === modified file 'addons/view_calendar/static/javascript/calendar_utils.js' |
1797 | --- addons/view_calendar/static/javascript/calendar_utils.js 2010-06-02 08:18:17 +0000 |
1798 | +++ addons/view_calendar/static/javascript/calendar_utils.js 2010-06-10 08:37:38 +0000 |
1799 | @@ -180,7 +180,11 @@ |
1800 | }); |
1801 | }; |
1802 | |
1803 | +<<<<<<< TREE |
1804 | var editCalendarRecord = function(record_id) { |
1805 | +======= |
1806 | +var editCalendarRecord = function(record_id, date){ |
1807 | +>>>>>>> MERGE-SOURCE |
1808 | |
1809 | var params = { |
1810 | 'id': record_id, |
1811 | @@ -188,8 +192,14 @@ |
1812 | 'view_mode': openobject.dom.get('_terp_view_mode').value, |
1813 | 'view_ids': openobject.dom.get('_terp_view_ids').value, |
1814 | 'domain': openobject.dom.get('_terp_domain').value, |
1815 | +<<<<<<< TREE |
1816 | 'context': openobject.dom.get('_terp_context').value |
1817 | }; |
1818 | +======= |
1819 | + 'context': openobject.dom.get('_terp_context').value, |
1820 | + 'default_date': date |
1821 | + } |
1822 | +>>>>>>> MERGE-SOURCE |
1823 | |
1824 | var act = openobject.http.getURL('/view_calendar/calpopup/edit', params); |
1825 | openobject.tools.openWindow(act); |
1826 | |
1827 | === modified file 'addons/view_calendar/static/javascript/calendar_week.js' |
1828 | --- addons/view_calendar/static/javascript/calendar_week.js 2010-05-03 15:13:18 +0000 |
1829 | +++ addons/view_calendar/static/javascript/calendar_week.js 2010-06-10 08:37:38 +0000 |
1830 | @@ -310,8 +310,11 @@ |
1831 | var target = evt.target(); |
1832 | if (!hasElementClass(target, 'calVRule')) |
1833 | return; |
1834 | - |
1835 | - editCalendarRecord(null); |
1836 | + |
1837 | + var elem = getElement('calEventNew'); |
1838 | + var dt = MochiKit.DateTime.isoTimestamp(getNodeAttribute(elem, 'dtStart')); |
1839 | + |
1840 | + editCalendarRecord(null, toISOTimestamp(dt)); |
1841 | }, |
1842 | |
1843 | splitEvent : function(record, params) { |
1844 | @@ -403,7 +406,10 @@ |
1845 | forEach(events, function(e) { |
1846 | var dt = toISODate(e.starts); |
1847 | |
1848 | - if (!(dt in containers)) return; |
1849 | + if (!(dt in containers)){ |
1850 | + e.style.display = 'none'; |
1851 | + return; |
1852 | + } |
1853 | |
1854 | var container = containers[dt]; |
1855 | |
1856 | @@ -725,7 +731,7 @@ |
1857 | |
1858 | setNodeAttribute(elem, 'dtend', toISOTimestamp(e)); |
1859 | |
1860 | - editCalendarRecord(null); |
1861 | + editCalendarRecord(null, toISOTimestamp(dt)); |
1862 | |
1863 | hideElement('calEventNew'); |
1864 | }, |
1865 | |
1866 | === modified file 'addons/view_calendar/widgets/_base.py' |
1867 | --- addons/view_calendar/widgets/_base.py 2010-06-07 09:45:59 +0000 |
1868 | +++ addons/view_calendar/widgets/_base.py 2010-06-10 08:37:38 +0000 |
1869 | @@ -332,7 +332,7 @@ |
1870 | h = ends |
1871 | |
1872 | if ends == self.day_length: |
1873 | - n += 1 |
1874 | + span = 1 |
1875 | |
1876 | elif ends > self.day_length: |
1877 | n = ends / self.day_length |
1878 | @@ -340,9 +340,11 @@ |
1879 | |
1880 | n = int(math.floor(n)) |
1881 | |
1882 | - if h > 0: n += 1 |
1883 | + if h > 0: |
1884 | + span = n + 1 |
1885 | + else: |
1886 | + span = n |
1887 | |
1888 | - span = n |
1889 | ends = time.localtime(time.mktime(starts) + (h * 60 * 60) + (n * 24 * 60 * 60)) |
1890 | |
1891 | if starts and self.date_stop: |
1892 | |
1893 | === modified file 'addons/view_diagram/controllers/process.py' |
1894 | --- addons/view_diagram/controllers/process.py 2010-05-14 05:23:53 +0000 |
1895 | +++ addons/view_diagram/controllers/process.py 2010-06-10 08:37:38 +0000 |
1896 | @@ -105,5 +105,10 @@ |
1897 | node['res']['perm'] = update_perm(node['res']['perm'] or {}) |
1898 | |
1899 | return graph |
1900 | + |
1901 | + @expose(template="templates/process_tip.mako") |
1902 | + def open_tip(self, **kw): |
1903 | + title_tip = kw.get('title_tip') |
1904 | + return dict(id=None, res_model=None, res_id=None, title=None, selection=None, title_tip=title_tip) |
1905 | |
1906 | # vim: ts=4 sts=4 sw=4 si et |
1907 | |
1908 | === added file 'addons/view_diagram/controllers/templates/process_tip.mako' |
1909 | --- addons/view_diagram/controllers/templates/process_tip.mako 1970-01-01 00:00:00 +0000 |
1910 | +++ addons/view_diagram/controllers/templates/process_tip.mako 2010-06-10 08:37:38 +0000 |
1911 | @@ -0,0 +1,26 @@ |
1912 | +<%inherit file="master.mako"/> |
1913 | +<%! show_header_footer = False %> |
1914 | + |
1915 | +<%def name="header()"> |
1916 | + <title>${_("Process")}</title> |
1917 | +</%def> |
1918 | + |
1919 | +<%def name="content()"> |
1920 | +<table class="view" cellspacing="5" border="0" width="100%"> |
1921 | + <tr> |
1922 | + <td> |
1923 | + <div class="box2"> |
1924 | + ${title_tip | n} |
1925 | + </div> |
1926 | + </td> |
1927 | + </tr> |
1928 | + <tr> |
1929 | + <td align="right"> |
1930 | + <div class="box2"> |
1931 | + <button type="button" onclick="window.close()">${_("Close")}</button> |
1932 | + </div> |
1933 | + </td> |
1934 | + </tr> |
1935 | +</table> |
1936 | + |
1937 | +</%def> |
1938 | \ No newline at end of file |
1939 | |
1940 | === modified file 'addons/view_diagram/static/javascript/process.js' |
1941 | --- addons/view_diagram/static/javascript/process.js 2010-06-02 08:18:17 +0000 |
1942 | +++ addons/view_diagram/static/javascript/process.js 2010-06-10 08:37:38 +0000 |
1943 | @@ -260,7 +260,7 @@ |
1944 | var bbar = openobject.dom.select('td.node-buttons', elem)[0]; |
1945 | var menu = openobject.dom.select('td.node-menu', elem)[0]; |
1946 | |
1947 | - title.innerHTML = title.title = this.data.name || ''; |
1948 | + title.innerHTML = this.data.name || ''; |
1949 | text.innerHTML = this.data.notes || ''; |
1950 | |
1951 | if (this.data.subflow && this.data.subflow.length) { |
1952 | @@ -342,7 +342,7 @@ |
1953 | |
1954 | this.setTargetDecorator(new openobject.process.TargetDecorator(color)); |
1955 | this.setColor(color); |
1956 | - this.setLineWidth(2); |
1957 | + this.setLineWidth(3); |
1958 | this.setSelectable(false); |
1959 | |
1960 | this.data = data; |
1961 | @@ -352,7 +352,8 @@ |
1962 | var elem = this.getHTMLElement(); |
1963 | elem.style.cursor = 'pointer'; |
1964 | elem.title = this._makeTipText(); |
1965 | - |
1966 | + MochiKit.Signal.connect(elem, 'ondblclick', this, this._makeTipText); |
1967 | + |
1968 | if (roles.length) { |
1969 | var role_img = new draw2d.ImageFigure('/openerp/static/images/stock/stock_person.png'); |
1970 | role_img.setDimension(32, 32); |
1971 | @@ -389,8 +390,10 @@ |
1972 | if (buttons.length) { |
1973 | title += '<span>Actions:</span>' + _mkList(buttons); |
1974 | } |
1975 | - |
1976 | - return title; |
1977 | + |
1978 | + var params = {'title_tip': MochiKit.DOM.emitHTML(title)} |
1979 | + |
1980 | + openobject.tools.openWindow(openobject.http.getURL("/process/open_tip", params), {width: 450, height: 250}); |
1981 | } |
1982 | }); |
1983 | |
1984 | |
1985 | === modified file 'addons/view_graph/widgets/_graph.py' |
1986 | --- addons/view_graph/widgets/_graph.py 2010-05-13 09:21:46 +0000 |
1987 | +++ addons/view_graph/widgets/_graph.py 2010-06-10 08:37:38 +0000 |
1988 | @@ -159,23 +159,29 @@ |
1989 | for i in fields[x]['selection']: |
1990 | if value[x] in i: |
1991 | res[x] = i[1] |
1992 | - elif fields[x]['type'] == 'date' and value[x]: |
1993 | - date = time.strptime(value[x], DT_FORMAT) |
1994 | - res[x] = time.strftime(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y'), date) |
1995 | - elif fields[x]['type'] == 'datetime' and value[x]: |
1996 | - date = time.strptime(value[x], DHM_FORMAT) |
1997 | - if 'tz' in rpc.session.context: |
1998 | - try: |
1999 | - import pytz |
2000 | - lzone = pytz.timezone(rpc.session.context['tz']) |
2001 | - szone = pytz.timezone(rpc.session.timezone) |
2002 | - dt = DT.datetime(date[0], date[1], date[2], date[3], date[4], date[5], date[6]) |
2003 | - sdt = szone.localize(dt, is_dst=True) |
2004 | - ldt = sdt.astimezone(lzone) |
2005 | - date = ldt.timetuple() |
2006 | - except: |
2007 | - pass |
2008 | - res[x] = time.strftime(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y')+' %H:%M:%S', date) |
2009 | + elif fields[x]['type'] == 'date': |
2010 | + if value[x]: |
2011 | + date = time.strptime(value[x], DT_FORMAT) |
2012 | + res[x] = time.strftime(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y'), date) |
2013 | + else: |
2014 | + res[x] = '' |
2015 | + elif fields[x]['type'] == 'datetime': |
2016 | + if value[x]: |
2017 | + date = time.strptime(value[x], DHM_FORMAT) |
2018 | + if 'tz' in rpc.session.context: |
2019 | + try: |
2020 | + import pytz |
2021 | + lzone = pytz.timezone(rpc.session.context['tz']) |
2022 | + szone = pytz.timezone(rpc.session.timezone) |
2023 | + dt = DT.datetime(date[0], date[1], date[2], date[3], date[4], date[5], date[6]) |
2024 | + sdt = szone.localize(dt, is_dst=True) |
2025 | + ldt = sdt.astimezone(lzone) |
2026 | + date = ldt.timetuple() |
2027 | + except: |
2028 | + pass |
2029 | + res[x] = time.strftime(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y')+' %H:%M:%S', date) |
2030 | + else: |
2031 | + res[x] = '' |
2032 | else: |
2033 | res[x] = float(value[x]) |
2034 | |
2035 | |
2036 | === modified file 'addons/view_graph/widgets/templates/graph.mako' |
2037 | --- addons/view_graph/widgets/templates/graph.mako 2010-05-03 15:13:18 +0000 |
2038 | +++ addons/view_graph/widgets/templates/graph.mako 2010-06-10 08:37:38 +0000 |
2039 | @@ -1,6 +1,6 @@ |
2040 | <div class="graph-block" style="text-align: center; padding: 10px; min-width: $width"> |
2041 | |
2042 | - <div id="${name}"></div> |
2043 | + <div id="${name}_"></div> |
2044 | |
2045 | <script type="text/javascript"> |
2046 | var get_chart_${name} = function(name) { |
2047 | |
2048 | === modified file 'addons/widget_wiki/widgets/wiki.py' |
2049 | --- addons/widget_wiki/widgets/wiki.py 2010-05-14 05:23:53 +0000 |
2050 | +++ addons/widget_wiki/widgets/wiki.py 2010-06-10 08:37:38 +0000 |
2051 | @@ -175,8 +175,8 @@ |
2052 | proxy = rpc.RPCProxy('wiki.wiki') |
2053 | def link(path): |
2054 | link = path.group().replace('[','').replace('[','').replace(']','').replace(']','').split("|") |
2055 | - |
2056 | - mids = proxy.search([('name','ilike',link[0])]) |
2057 | + name_to_search = link[0].strip() |
2058 | + mids = proxy.search([('name','ilike', name_to_search)]) |
2059 | link_str = "" |
2060 | if mids: |
2061 | if len(link) == 2: |
I'll trust you for the bug fixing itself, or maybe you could spend an hour or two with Noz reviewing the bugs and checking that they're fixed?
For the tech review:
addons/ openerp/ controllers/ actions. py:339 rpc.session. context. copy())
There is no need for the copy() in ctx.update(
You could also do all of that in a single statement:
ctx = dict(rpc. session. context, **(data. get('context' ) or {})
addons/ openerp/ controllers/ fieldpref. py:87
Why are you testing for type() and then why are you checking for length?
The test could be replaced by
if not value and isinstance(value, basestring)
but I'd also wonder what types value can have. Is the type testing really necessary?
addons/ openerp/ controllers/ form.py: 274 'default_ date')` be replaced by `kw['default_ date']` since we already checked for presence?
Can't the second `kw.get(
addons/ openerp/ controllers/ form.py: 384
No need for the copy() in the ctx.update() call. Also, it's going not update params.context as well, is that normal?
addons/ openerp/ controllers/ form.py: 467
Too many copy() calls, this could be written
ctx = dict((params. context or {}), **rpc.session. context) update( button. context or {})
ctx.
no?
addons/ openerp/ controllers/ form.py: 993 .get('type' )
Can't
kind = ''
if data.get(key):
kind = data[key]
be rewritten:
kind = data.get(key, {}).get('type', '')
?
addons/ openerp/ controllers/ impex.py: 71
is the setting of context to {} really necessary? Why?
addons/ openerp/ controllers/ impex.py: 116
ctx creation/setting should be a single call, redundant copy() call in ctx.update()
addons/ openerp/ controllers/ impex.py: 176
Use litteral_eval instead of eval, maybe set ctx = {} in the except clause? Can't you restrict the kind of exceptions caught by except?
Also, redundant copy() in ctx.update()
addons/ openerp/ controllers/ impex.py: 259
redundant copy of rpc.session.context in ctx.update()
addons/ openerp/ controllers/ impex.py: 292
is it really necessary to set context to {}?
Also, impex.py seems to have lots of unused variables (name and prefix in get_data for instance)
addons/ openerp/ controllers/ impex.py: :390 context, ctx creation could be performed in a single call
Redundant copy() of rpc.session.
addons/ openerp/ controllers/ impex.py: 415
Is the intermediate `proxy` variable really useful?
Why not RPCProxy( params. model). fields_ get(False, rpc.session. context)
rpc.
addons/ openerp/ controllers/ impex.py: 449
Use append() to add a single item to a list, not += (or extend)
addons/ openerp/ controllers/ search. py:120
You could use update() here to set both keys at once.
addons/ openerp/ controllers/ translator. py:48 openerp/ controllers/ translator. py:123
addons/
no need for the ctx = {} initialization, the next two lines could be a single call, redundant copy()
addons/ openerp/ utils/tools. py:156
line commented instead of removed
addons/ openerp/ utils/tools. py:194
What is the point of aliasing functions from os and os.path?
addons/ openerp/ utils/utils. py:243
if val == []:
values[key] = [(6, 0, [])]
else:
values[key] = [(6, 0, val)]
why not just `values[key] = [(6, 0, val)]
addons/ view_graph/ widgets/ _graph. py:159
Wouldn't it have been simpler to...