| @@ 51-127 (lines=77) @@ | ||
| 48 | """Listing view for instrument maintenance tasks |
|
| 49 | """ |
|
| 50 | ||
| 51 | def __init__(self, context, request): |
|
| 52 | super(InstrumentMaintenanceView, self).__init__(context, request) |
|
| 53 | self.catalog = SETUP_CATALOG |
|
| 54 | self.contentFilter = { |
|
| 55 | "portal_type": "InstrumentMaintenanceTask", |
|
| 56 | "path": { |
|
| 57 | "query": api.get_path(context), |
|
| 58 | "depth": 1 # searching just inside the specified folder |
|
| 59 | }, |
|
| 60 | "sort_on": "created", |
|
| 61 | "sort_order": "descending", |
|
| 62 | } |
|
| 63 | ||
| 64 | self.form_id = "instrumentmaintenance" |
|
| 65 | self.title = self.context.translate(_("Instrument Maintenance")) |
|
| 66 | ||
| 67 | self.icon = "{}/{}".format( |
|
| 68 | self.portal_url, |
|
| 69 | "++resource++bika.lims.images/instrumentmaintenance_big.png" |
|
| 70 | ) |
|
| 71 | self.context_actions = { |
|
| 72 | _("Add"): { |
|
| 73 | "url": "createObject?type_name=InstrumentMaintenanceTask", |
|
| 74 | "icon": "++resource++bika.lims.images/add.png"} |
|
| 75 | } |
|
| 76 | ||
| 77 | self.allow_edit = False |
|
| 78 | self.show_select_column = False |
|
| 79 | self.show_workflow_action_buttons = True |
|
| 80 | self.pagesize = 30 |
|
| 81 | ||
| 82 | self.columns = { |
|
| 83 | 'getCurrentState': {'title': ''}, |
|
| 84 | 'Title': {'title': _('Task'), |
|
| 85 | 'index': 'sortable_title'}, |
|
| 86 | 'getType': {'title': _('Task type', 'Type'), 'sortable': True}, |
|
| 87 | 'getDownFrom': {'title': _('Down from'), 'sortable': True}, |
|
| 88 | 'getDownTo': {'title': _('Down to'), 'sortable': True}, |
|
| 89 | 'getMaintainer': {'title': _('Maintainer'), 'sortable': True}, |
|
| 90 | } |
|
| 91 | ||
| 92 | self.review_states = [ |
|
| 93 | { |
|
| 94 | "id": "default", |
|
| 95 | "title": _("Open"), |
|
| 96 | "contentFilter": {"is_active": True}, |
|
| 97 | "columns": [ |
|
| 98 | "getCurrentState", |
|
| 99 | "Title", |
|
| 100 | "getType", |
|
| 101 | "getDownFrom", |
|
| 102 | "getDownTo", |
|
| 103 | "getMaintainer", |
|
| 104 | ] |
|
| 105 | }, { |
|
| 106 | "id": "cancelled", |
|
| 107 | "title": _("Cancelled"), |
|
| 108 | "contentFilter": {"is_active": False}, |
|
| 109 | "columns": [ |
|
| 110 | "getCurrentState", |
|
| 111 | "Title", |
|
| 112 | "getType", |
|
| 113 | "getDownFrom", |
|
| 114 | "getDownTo", |
|
| 115 | "getMaintainer", |
|
| 116 | ] |
|
| 117 | }, { |
|
| 118 | "id": "all", |
|
| 119 | "title": _("All"), |
|
| 120 | "contentFilter": {}, |
|
| 121 | "columns": [ |
|
| 122 | "getCurrentState", |
|
| 123 | "Title", |
|
| 124 | "getType", |
|
| 125 | "getDownFrom", |
|
| 126 | "getDownTo", |
|
| 127 | "getMaintainer" |
|
| 128 | ] |
|
| 129 | } |
|
| 130 | ] |
|
| @@ 368-442 (lines=75) @@ | ||
| 365 | """Listing view for instrument scheduled tasks |
|
| 366 | """ |
|
| 367 | ||
| 368 | def __init__(self, context, request): |
|
| 369 | super(InstrumentScheduleView, self).__init__(context, request) |
|
| 370 | self.catalog = SETUP_CATALOG |
|
| 371 | self.contentFilter = { |
|
| 372 | "portal_type": "InstrumentScheduledTask", |
|
| 373 | "path": { |
|
| 374 | "query": api.get_path(context), |
|
| 375 | "depth": 1 # searching just inside the specified folder |
|
| 376 | }, |
|
| 377 | "sort_on": "created", |
|
| 378 | "sort_order": "descending", |
|
| 379 | } |
|
| 380 | ||
| 381 | self.form_id = "instrumentschedule" |
|
| 382 | self.title = self.context.translate(_("Instrument Scheduled Tasks")) |
|
| 383 | ||
| 384 | self.icon = "{}/{}".format( |
|
| 385 | self.portal_url, |
|
| 386 | "++resource++bika.lims.images/instrumentschedule_big.png" |
|
| 387 | ) |
|
| 388 | self.context_actions = { |
|
| 389 | _("Add"): { |
|
| 390 | "url": "createObject?type_name=InstrumentScheduledTask", |
|
| 391 | "icon": "++resource++bika.lims.images/add.png"} |
|
| 392 | } |
|
| 393 | ||
| 394 | self.allow_edit = False |
|
| 395 | self.show_select_column = False |
|
| 396 | self.show_workflow_action_buttons = True |
|
| 397 | self.pagesize = 30 |
|
| 398 | ||
| 399 | self.columns = { |
|
| 400 | "Title": {"title": _("Scheduled task"), |
|
| 401 | "index": "sortable_title"}, |
|
| 402 | "getType": {"title": _("Task type", "Type")}, |
|
| 403 | "getCriteria": {"title": _("Criteria")}, |
|
| 404 | "creator": {"title": _("Created by")}, |
|
| 405 | "created": {"title": _("Created")}, |
|
| 406 | } |
|
| 407 | ||
| 408 | self.review_states = [ |
|
| 409 | { |
|
| 410 | "id": "default", |
|
| 411 | "title": _("Active"), |
|
| 412 | "contentFilter": {"is_active": True}, |
|
| 413 | "transitions": [{"id": "deactivate"}, ], |
|
| 414 | "columns": [ |
|
| 415 | "Title", |
|
| 416 | "getType", |
|
| 417 | "getCriteria", |
|
| 418 | "creator", |
|
| 419 | "created", |
|
| 420 | ] |
|
| 421 | }, { |
|
| 422 | "id": "inactive", |
|
| 423 | "title": _("Inactive"), |
|
| 424 | "contentFilter": {'is_active': False}, |
|
| 425 | "transitions": [{"id": "activate"}, ], |
|
| 426 | "columns": [ |
|
| 427 | "Title", |
|
| 428 | "getType", |
|
| 429 | "getCriteria", |
|
| 430 | "creator", |
|
| 431 | "created" |
|
| 432 | ] |
|
| 433 | }, { |
|
| 434 | "id": "all", |
|
| 435 | "title": _("All"), |
|
| 436 | "contentFilter": {}, |
|
| 437 | "columns": [ |
|
| 438 | "Title", |
|
| 439 | "getType", |
|
| 440 | "getCriteria", |
|
| 441 | "creator", |
|
| 442 | "created", |
|
| 443 | ] |
|
| 444 | } |
|
| 445 | ] |
|