compute field not work when using after insert callback too.
e.g.
def __after_insert_delivery_order(f, id):
db(db.customer.id == f.customer).update(last_delivery_order_net = f.gross -
f.tarra) # work
#db(db.customer.id == f.customer).update(last_delivery_order_net = f.net) #
not work
def on_define_delivery_order(table):
table._after_insert.append(__after_insert_delivery_order)
table.net.compute = lambda r: r['gross'] - r['tarra']
db.define_table('delivery_order',
Field('delivery_order_no'),
Field('customer', 'reference customer'),
Field('tarra', 'integer'),
Field('gross', 'integer'),
Field('net', 'integer'),
on_define = on_define_delivery_order,
format = '%(delivery_order_no)s')
not sure is it bug, or normal behaviour.
best regards,
stifan
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.