Skip to content

Releases: jam-py/jam-py

5.4.136: distutils copy_tree replaced with shutil copy_tree for python version…

18 Mar 01:28
Compare
Choose a tag to compare

5.4.130

02 Mar 03:35
Compare
Choose a tag to compare
Report class hide_columns method bugs fixed

5.4.124

21 Aug 18:27
Compare
Choose a tag to compare

Privileges button added to reports

Version 5.4.119

23 Mar 03:13
Compare
Choose a tag to compare

Range of records can be selected in the jam.py tables using ShiftKey

Version 5.4.118

21 Mar 03:52
Compare
Choose a tag to compare

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