I am trying to achieve something here, i have two tables and i want the
values of one table to be default values of another table so that i don't
have to re enter the same information over & over again: In the code below
observe where highlited in green, is there a way for me to do something
like below.
*CODE*:
db.define_table('quotationClient',
Field('Client_Surname'),
Field('Client_Name'),
Field('Company'),
Field('Contact_Details'),
Field('Book_In', 'date'),
Field('Book_Out', 'date'),
Field('Days', compute=lambda r: (r['Book_Out']-r['Book_In'
]).days),
Field('Booked_By', 'reference auth_user', default=auth.
user_id, writable=False, label=SPAN('Booked In By', _style="font-weight:
bold;")),
Field('Booking_Date', 'datetime', default=request.now,
writable=False, label=SPAN('Booking Date', _style="font-weight: bold;")),
format="%(Client_Surname)s %(Client_Name)s"
)
db.define_table('quotation',
Field('customer', 'reference quotationClient', writable=
False),
Field('Quotation_For'),
*#HOW CAN I DO THE BELOW IN SUCH A WAY THAT WORKS*
* Field('Book_In', 'date', default='db.quotationClient.Book_In',
writable=False, readable=False), Field('Book_Out', 'date',
default='db.quotationClient.Book_Out', writable=False, readable=False),*
Field('No_of_Pax', 'integer'),
Field('Days', compute=lambda r: (r['Book_Out']-r['Book_In'
]).days),
#Field('No_of_Days', 'integer'),
Field('Unit_Price', 'integer'),
#Field('vat', compute=lambda r:
int(r['Days'])*r['Unit_Price']*r['No_of_Pax']*0.1),
Field('Amount', compute=lambda r: int(r['Days'])*r[
'Unit_Price']* r['No_of_Pax']),
Field('Quoted_By','reference auth_user', default=auth.
user_id, writable=False),
Field('Quoted_On','datetime',default=request.now,writable=
False))
Mostwanted
--
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.