On Friday, June 23, 2017 at 4:01:05 AM UTC-4, kesh wrote: > > hi guys sorry to intrude, i have a problem here >> > db.define_table('stock_status', > Field('Date', 'datetime', default=request.now, writable=False), > Field('SN'), > Field('item_description'), > Field('Quantity','integer'), > Field('UOM'), > Field('stockIN','integer'), > Field('stockOUT', 'integer'), > #Field('stock_at_hand','integer'), > Field('assignment') > ) > class MyVirtualFields(object): > def total_price(self): > return self.stock_status.Quantity + self.stock_status.stockIN - > self.stock_status.stockOUT > db.stock_status.stock_at_hand.virtualfields.append(MyVirtualFields()) >
First, the above is an old-style virtual field -- you should instead use the new style <http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#New-style-virtual-fields>. Second, that is not the correct code even for the old style -- see the documentation: http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Old-style-virtual-fields Anthony -- 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.