[web2py] Re: _before_delete callback function to update the other table

2015-04-12 Thread 黄祥
in case, somebody want to use before delete callback with auth.signature and record versioning, please see this thread : https://groups.google.com/forum/#!topic/web2py/sp4fpYz36HI best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: _before_delete callback function to update the other table

2013-09-16 Thread Niphlod
please. we can't continue to feed you the exact bugfix for your own application. start with a small model, print what is passed back and adjust accordingly. Then extend to the more complex model and see what is the addition breaking. There are no limitations whatsoever Il giorno lunedì 16

[web2py] Re: _before_delete callback function to update the other table

2013-09-16 Thread 黄祥
i found the root cause, it related with auth.signature imho, the limitation for using before and after callback, it's not work when using auth.signature. e.g. 1 in models/db.py *not work* from gluon.tools import Auth, Crud, Service, PluginManager, prettydate auth = Auth(db) crud, service, plugins

[web2py] Re: _before_delete callback function to update the other table

2013-09-15 Thread Niphlod
sorry, my bad. The Set is indeed not a Query ... def __ondelete_receipt_order(s): receipt_order = s.select().first() db(db.purchase_order_header.id==receipt_order.purchase_order_no).update(status='Purchase Order Authorized')

[web2py] Re: _before_delete callback function to update the other table

2013-09-15 Thread 黄祥
i've followed your hints, but still not worked (no error occured). def __ondelete_receipt(s): purchase_order_no=s.select().first().purchase_order_no # for test # purchase_order_no=s.select()[0].purchase_order_no db(db.purchase_order_header.id==purchase_order_no).update(status='Purchase Order

[web2py] Re: _before_delete callback function to update the other table

2013-09-15 Thread Niphlod
my solution works, I tested it :D On Sunday, September 15, 2013 2:30:06 PM UTC+2, 黄祥 wrote: i've followed your hints, but still not worked (no error occured). def __ondelete_receipt(s): purchase_order_no=s.select().first().purchase_order_no # for test #

[web2py] Re: _before_delete callback function to update the other table

2013-09-15 Thread 黄祥
yeah, you are right, your solution is work, i've tested it with the new app, with the simple tables (only 2) and it work well, thank you so much, but in my application that more complex it doesn't work. i've already commenting my code that maybe affect the table in the model (something like,

[web2py] Re: _before_delete callback function to update the other table

2013-09-14 Thread Niphlod
the ondelete doesn't receive a single record: it receives the set that is going to be deleted (remember, one can drop a whole bunch of rows with a single delete()) i.e. when you fire db(cond).delete(), cond is passed. If I understand what you're trying to do, you need to fetch the

[web2py] Re: _before_delete callback function to update the other table

2013-09-14 Thread 黄祥
yeah, my goal is when i delete receipt order it will update the purchase order status. i've followed your suggestion, but still not update the status of purchase order when i delete the receipt order (no error occured, just not update the purchase order). def __ondelete_receipt_order(s):