Thank you. So I need to do it manually...
row_id = db.invoice_rows.insert(invoce_id=my_invoice_id) and after redirect to the edit page... redirect(URL(r=request, f='edit', args=[row_id])) I thought the was a way to pass the invoice_id to the SQLFORM... Something like that: form=SQLFORM(db.invoicesrows, invoice_id=my_invoice_id) Thank you Massimiliano On Fri, Jul 23, 2010 at 4:34 PM, Vidul Petrov <vidul.r...@gmail.com> wrote: > You may want to read this part of the book: > http://web2py.com/book/default/section/6/6?search=joins > > On Jul 23, 4:41 pm, Massimiliano <mbelle...@gmail.com> wrote: > > Hi, > > > > I'm sorry if it is a basic question but I don't find a clean way to do > that. > > > > Imagine I'm showing an Invoice with related rows. > > > > How can I create a row and to assign automaticaly the invoice_id field in > > the row record? > > > > db.define_table( > > 'invoices', > > Field('dateinvoice', 'date', default=now,label='Data') > > ... > > ) > > > > db.define_table( > > 'invoice_rows', > > Field('invoice_id', db.invoices) > > ... > > ) > > > > Thank you > > -- > > Massimiliano >