Peter,
Thank you, that could work for reading invoice. I guess it might require a
bit more for accepting / creating new invoice... or do I get this wrong.
Regards,
Ramesh.
On Wednesday, July 12, 2017 at 7:37:56 AM UTC+5:30, Peter wrote:
>
> Hi Ramesh,
>
> I return a crud.read() for the invoice header and a separate query output
> for the invoice lines.
>
> My approach is to store all Invoice Header info in a separate table on
> Invoice creation. (This is to ensure that an exact copy invoice
> can be reproduced at any later date and is not affected if company name,
> phone number, email or anything that could change
> down road does change. I also ensure that anything material to invoice
> lines is locked down once invoiced so user cannot change
> affect the invoice line details)
>
> I'm not saying this is best practice but it works for me.
>
> so, the simplified versions of my controller and view would be something
> like...
>
> def view_invoice():
> invoice_id = request.args(0)
>
> invoice_header = crud.read(db.invoice[invoice_id])
>
> query = db(query to filter the required invoice lines)
> invoice_lines = query.select(tables & fields to represent the invoice
> lines)))
>
> return dict(invoice_header=invoice_header, invoice_lines=invoice_lines)
>
>
> and the view...
>
> {{extend 'layout.html'}}
>
> {{=invoice_header}}
>
> {{=invoice_lines}}
>
>
> Hope this helps!
>
> Peter
>
>
> On Monday, 10 July 2017 20:56:58 UTC+1, Ramesh Meda wrote:
>>
>> What would be the best approach to develop Parent-Child forms in Web2Py
>> please...
>>
>> Case in point... lets say, simple invoice application (over simplified
>> for the sake of discussion)
>> Invoice Header (Parent), with invoice information and
>> Invoice Items (Chid), with multiple line items (grid)
>>
>> Thanks in advance...
>>
>
--
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/d/optout.