Changes in the release:
connection parameter adde to the open server method:
open(self, options=None, expanded=None, fields=None, where=None,
order_by=None, open_empty=False, params=None, offset=None, limit=None,
funcs=None, group_by=None, safe=False, connection=None)
If the connection is set to None, the application creates
a connection, executes an SQL SELECT query using it, and then closes it,
otherwise it uses the connection to execute the query.
The on_apply event changed
After the apply_delta method is executed, the delta is updated.
The primary key fields of the inserted records (for which rec_inserted returns True)
are assigned values that can be used for further data modifications.
if you are going to read or modify records of database tables during the execution
of the ``on_apply`` event handler, you must pass its connection parameter to the open
apply methods so that all operations take place in one transaction.
import datetime
def on_apply(item, delta, params, connection):
result = item.apply_delta(delta, params, connection)
for d in delta:
cust = item.task.customers.copy(handlers=False)
cust.set_where(id=d.customer.value)
cust.open(connection=connection)
cust.edit()
cust.last_modified.value = datetime.datetime.now()
cust.last_modified_record_id.value = d.id.value
[cust.post](http://cust.post/)()
cust.apply(connection)
return result