I wanted to create an Invoice for clients orders, i wanted to be able to do all the calculations of the costs of their services as I enter values into the database. But I kinda found a way around this coz it was giving me a headache, so i decided to calculate the total in the controller like i did on the variable pricing below:
def viewInvoices(): invoice=db.ClientDetails(request.args(0, cast=int)) *pricing=db(db.invoice.customer==invoice.id).select(db.invoice.totalPrice.sum().with_alias('total'))* return locals() This kinda gave me a solution to what i was trying achieve. On Monday, November 12, 2018 at 6:19:54 PM UTC+2, Leonel Câmara wrote: > > You can either use after_insert to put the value in the Total of all rows > or you can use a Virtual field or Method. > > May I ask what you're trying to do? > -- 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.