I have never used after_insert or before_insert before and the
documentation in the book does not answer enough of my questions.
Having the following models I want to create an invoice and record some of
its particulars in the invoice table and then link the transactions that
were invoiced to the invoice number:
db.define_table('invoice',
Field('invoice_date', 'date',
requires=IS_NOT_EMPTY()),
Field('client', 'reference client',
requires=IS_NOT_EMPTY(),
represent = lambda value, row: A('{}'.format(
row.client.name),
_href=URL('show_client', args=value))),
Field('from_date', 'date'),
Field('to_date', 'date'))
db.define_table('transactions',
Field('client', 'reference client',
represent = lambda value, row: A('{}'.format(
row.client.name),
_href=URL('show_client',
args=value))),
...
Field('invoice', 'reference invoice'))
--
Because experiencing your loyal love is better than life itself,
my lips will praise you. (Psalm 63:3)
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.