Fails, in model/db.py
db.define_table('sales', Field('item'), Field('item_total', 'double'), Field('tax_percentage', 'double'), Field('trans_date', 'datetime'), ) class Sales(): def total(self): return self.item_total * self.tax_percentage def tax(self): return self.total() - self.item_total db.sales.virtualfields.append(Sales()) in contrrolers/default.py def sales(): rows = db(db.sales.id>0).select() return dict(rows=rows) when accessing sales Traceback (most recent call last): File "/usr/home/jose/w2p/gluon/restricted.py", line 173, in restricted exec ccode in environment File "/usr/home/jose/w2p/applications/csr/controllers/default.py", line 132, in <module> File "/usr/home/jose/w2p/gluon/globals.py", line 96, in <lambda> self._caller = lambda f: f() File "/usr/home/jose/w2p/applications/csr/controllers/default.py", line 12, in ventas rows = db(db.sales.id>0).select() File "/usr/home/jose/w2p/gluon/sql.py", line 3073, in select return self.parse(db,rows,self.colnames) File "/usr/home/jose/w2p/gluon/sql.py", line 3181, in parse rowsobj = rowsobj.setvirtualfields(**{table:item}) File "/usr/home/jose/w2p/gluon/sql.py", line 3332, in setvirtualfields box[attribute]=method() File "/usr/home/jose/w2p/applications/csr/models/db.py", line 159, in tax return self.total() - self.item_total File "/usr/home/jose/w2p/applications/csr/models/db.py", line 157, in total return self.item_total * self.tax_percentage AttributeError: Sales instance has no attribute 'item_total' -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.