Skip to content

Instantly share code, notes, and snippets.

@ianjosephwilson
Last active December 13, 2015 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianjosephwilson/4963999 to your computer and use it in GitHub Desktop.
Save ianjosephwilson/4963999 to your computer and use it in GitHub Desktop.
Ids in database are not returning the right records.
diff -r 271dd306761f trytond/ir/action.py
--- a/trytond/ir/action.py Tue Feb 12 18:09:17 2013 +0100
+++ b/trytond/ir/action.py Fri Feb 15 14:12:11 2013 -0800
@@ -84,7 +84,18 @@
elif type_ == 'ir.action.act_window':
to_remove = ('domain', 'context', 'search_value')
columns.difference_update(to_remove)
- return Action.read(action_ids, list(columns))
+ res = []
+ for action_id in action_ids:
+ # Hack to fix id problem.
+ try:
+ # Read sub-action with this id.
+ res.extend(Action.read([action_id], list(columns)))
+ except Exception:
+ # Search to sub-action with this parent action id.
+ action_id = Action.search([('action', '=', action_id)])[0].id
+ # Now read sub-action with the new id.
+ res.extend(Action.read([action_id], list(columns)))
+ return res
class ActionKeyword(ModelSQL, ModelView):
psql -Utfs stockmodules-tryton-2.6 -c "SELECT ir_action.id AS ir_action__id, ir_action_act_window.action AS ir_action_act_window__action, ir_action_act_window.id AS ir_action_act_window__id FROM ir_action JOIN ir_action_act_window ON ir_action.id = ir_action_act_window.action WHERE ir_action.id != ir_action_act_window.id;"
ir_action__id | ir_action_act_window__action | ir_action_act_window__id
---------------+------------------------------+--------------------------
152 | 152 | 151
158 | 158 | 157
164 | 164 | 163
172 | 172 | 171
180 | 180 | 179
190 | 190 | 189
200 | 200 | 199
214 | 214 | 213
216 | 216 | 215
220 | 220 | 219
224 | 224 | 223
8 | 8 | 7
10 | 10 | 9
12 | 12 | 11
14 | 14 | 13
16 | 16 | 15
18 | 18 | 17
20 | 20 | 19
24 | 24 | 23
26 | 26 | 25
28 | 28 | 27
30 | 30 | 29
36 | 36 | 35
38 | 38 | 37
40 | 40 | 39
42 | 42 | 41
46 | 46 | 45
48 | 48 | 47
58 | 58 | 57
60 | 60 | 59
62 | 62 | 61
64 | 64 | 63
68 | 68 | 67
76 | 76 | 75
78 | 78 | 77
80 | 80 | 79
82 | 82 | 81
84 | 84 | 83
90 | 90 | 89
92 | 92 | 91
94 | 94 | 93
96 | 96 | 95
98 | 98 | 97
102 | 102 | 101
104 | 104 | 103
110 | 110 | 109
114 | 114 | 113
118 | 118 | 117
120 | 120 | 119
122 | 122 | 121
132 | 132 | 131
138 | 138 | 137
142 | 142 | 141
148 | 148 | 147
156 | 156 | 155
230 | 230 | 229
234 | 234 | 233
236 | 236 | 235
244 | 244 | 243
258 | 258 | 257
262 | 262 | 261
274 | 274 | 273
286 | 286 | 285
288 | 288 | 287
290 | 290 | 289
304 | 304 | 303
320 | 320 | 319
322 | 322 | 321
246 | 246 | 245
326 | 326 | 325
332 | 332 | 331
338 | 338 | 337
342 | 342 | 341
354 | 354 | 353
356 | 356 | 355
358 | 358 | 357
374 | 374 | 373
376 | 376 | 375
378 | 378 | 377
384 | 384 | 383
386 | 386 | 385
388 | 388 | 387
396 | 396 | 395
412 | 412 | 411
414 | 414 | 413
416 | 416 | 415
436 | 436 | 435
438 | 438 | 437
440 | 440 | 439
448 | 448 | 447
450 | 450 | 449
468 | 468 | 467
168 | 168 | 167
182 | 182 | 181
184 | 184 | 183
186 | 186 | 185
194 | 194 | 193
196 | 196 | 195
198 | 198 | 197
218 | 218 | 217
66 | 66 | 65
108 | 108 | 107
126 | 126 | 125
226 | 226 | 225
228 | 228 | 227
278 | 278 | 277
284 | 284 | 283
292 | 292 | 291
294 | 294 | 293
300 | 300 | 299
336 | 336 | 335
344 | 344 | 343
364 | 364 | 363
366 | 366 | 365
368 | 368 | 367
398 | 398 | 397
404 | 404 | 403
406 | 406 | 405
422 | 422 | 421
302 | 302 | 301
328 | 328 | 327
348 | 348 | 347
350 | 350 | 349
360 | 360 | 359
370 | 370 | 369
380 | 380 | 379
408 | 408 | 407
428 | 428 | 427
430 | 430 | 429
446 | 446 | 445
454 | 454 | 453
44 | 44 | 43
432 | 432 | 431
(133 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment