Model:
db.define_table('order',
Field('employee',db.person),
Field('tablenumber'),
Field('ordernumber'),
Field('orderdate','date'),
Field('totalsale', 'decimal(10,2)'),
Field('tipgranted', 'decimal(10,2)',default=None, update=None,
readable=False),
Field('tipvalue','decimal(10,2)',default='0.15'),)
@auth.requires_login()
def show_orders():
db.order.tipgranted.compute=lambda r:
r['totalsale']*r['tipvalue']
form=crud.create(db.order)
orders=db(db.order.employee==employee.id).select(orderby=db.order.ordernumber)
return dict(employee=employee,orders=orders,form=form)
thanks
On May 8, 10:54 pm, mdipierro <[email protected]> wrote:
> Can you show us the model and the action that triggers this?
>
> On May 8, 9:49 pm, greenpoise <[email protected]> wrote:
>
> > Can someone help me. I am trying to do a simple calculation of fields.
> > Fields are defined as decimal in db.py and here is the calculation:
>
> > db.order.tipgranted.compute=lambda r: r['totalsale']*r['tipvalue']
>
> > error: TypeError: can't multiply sequence by non-int of type 'float'