| 81 | There are some options which can be set before invoking the REST controller: |
| 82 | {{{ |
| 83 | def kit(): |
| 84 | "RESTlike CRUD controller" |
| 85 | s3.pdf = URL(r=request, f='kit_export_pdf') |
| 86 | s3.xls = URL(r=request, f='kit_export_xls') |
| 87 | if len(request.args) == 2: |
| 88 | crud.settings.update_next = URL(r=request, f='kit_item', args=request.args[1]) |
| 89 | return shn_rest_controller(module, 'kit', main='code', onaccept=lambda form: kit_total(form)) |
| 90 | }}} |
| 91 | |
| 92 | The {{{s3.pdf}}} & {{{s3.xls}}} provide the {{{view/formats.html}}} with an alternate URL to provide a customised version of the PDF/XLS output available when clicking on the icon (s3.rss is also available). |
| 93 | |
| 94 | {{{ |
| 95 | def report_overdue(): |
| 96 | "Report on Overdue Invoices - those unpaid 30 days after receipt" |
| 97 | response.title = T('Overdue Invoices') |
| 98 | overdue = datetime.date.today() - timedelta(days=30) |
| 99 | s3.filter = (db.fin_invoice.date_out==None) & (db.fin_invoice.date_in < overdue) |
| 100 | s3.crud_strings.fin_invoice.title_list = response.title |
| 101 | s3.crud_strings.fin_invoice.msg_list_empty = T('No Invoices currently overdue') |
| 102 | return shn_rest_controller(module, 'invoice', deletable=False, listadd=False) |
| 103 | }}} |
| 104 | |
| 105 | The {{{s3.filter}}} provides a filter which is used in the list view to show the desired subset of records (note that the s3.crud_strings can also be customised). When done in the Controller like this, they are good for just this request) |