I would do

db.define_table('customer',Field('name'))
db.define_table('product',Field('name'))
db.define_table('invoice',Field('customer','reference customer'))
db.define_table('invoice_item',Field('invoice','reference 
invoice'),Field(product','reference product'),Field('quantity','integer'))

customer = db.customer(name="Pinco Pallino")
for invoice in db(db.invoice.customer == customer.id).select():
      print invoice.id
      items = 
db(db.invoice_item.product==db.product.id)(db.invoice_item.invoice==invoice.id).select()
      print items



On Friday, 4 August 2017 09:45:51 UTC-5, Mumtoz Dalimov wrote:
>
> Hello,
>
> Is it possible to create table with 2 fields for example, list:reference 
> <table>, which are being multiplied pairly.
> How to input this kind of info in one record of table
>
> Customer>Bob
>     Product:Book    Amount:20
>     Product:Pencil  Amount:39
>
> Customer>John
>     Product:Pen    Amount:7
>     Product:Pencil  Amount:39
>     Product:Backpack  Amount:1
>
> I am very new in coding and web2py, so need your help
> Thanks
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to