I did a bunch of work in py4web yesterday getting this to work. I was getting a similar error - I updated the py4web 'grid' code to fix it. I've never used an Expression like this in web2py before so I can't say for sure that it is supported.
A couple other things I noticed.
1. You don't have a groupby specified on your .grid call. With your code, if you get past your error, will only return 1 row with the total.
2. You're asking for the payments.amount field to be displayed as well as the payments_sum_field. It doesn't make sense to me that you'd want to display the individual amount along with the sum. I think you want something more like this:
def payments():
payments_sum_field = db.payments.amount.sum().with_alias('total')
grid_table=SQLFORM.grid(db.payments, fields=[db.payments.client, db.payments.recorded_on,
payments_sum_field], groupby=[db.payments.client, db.payments.recorded_on])
return locals()
With this you'll get one 1 record for each client for each day with their total payments received.
But, you'll still have to find how to fix your Expression object has no attribute tablename issue.
-Jim