Newsletter August 2018


(Cédric Krier) #1

This month, progress has been made on the user interface and on increasing the performance.

The Sower by Vincent Van Gogh

Changes for the user

Limit size of titles

The titles of the tabs, wizard or form can be constructed from multiple sources. But the result may be too big to fit correctly on the screen. We ellipsize them when they are larger than 80 chars and we display the full title as tool-tip.

Show number and reference

The record name of the invoice, sale and purchase shows now the document number but also the reference number (between square brackets). This ease the work of accountant when reviewing accounting moves and their origins.

New module product_price_list_parent

The product_price_list_parent module adds a Parent to the price list and the keyword parent_unit_price for the formula which contains the unit price computed by the parent price list.
With the module, it is possible to create cascading price lists.

New header bar

The desktop client uses an header bar to provide global features like the configuration menu, the action entry and the favorites. This gives more vertical spaces for the application.

Grace period after confirmation purchase or sale

We added a configurable grace period to the confirmation of purchase and sale. This period allow to reset to draft the order after it was confirmed but before the automatic processing. This feature works only if Tryton is configured with worker queue.

Counting wizard for inventory

We added a wizard on the inventory to ease the counting of product. The wizard asks for the product then for the quantity to add.
If the rounding of the unit of measure is 1, then the default value for the added quantity is also 1. This is to allow fast encoding when counting units.

New module for production outsourcing

The production outsourcing module allows to outsource production order per routing. When such outsourced production is set to waiting, a purchase order is created and its cost is added to the production.

New module for unit on stock lot

The stock_lot_unit module allows to define a unit and quantity on stock lot.
Lots with unit have the following properties:

  • no shipment may contain a summed quantity for a lot greater than the quantity of the lot.
  • no move related to a lot with a unit may concern a quantity greater than the quantity of the lot.

Changes for the developer

Fill main language in configuration

At the database initialization, the main language defined by the configuration files is stored in the ir.configuration singleton.

Validation of Dictionary field values

We add a domain field to the dictionary schema. It is validated using the dictionary value on the client side only.

PYSON is more flexible with Boolean

The PYSON syntax is strongly typed to detect type error earlier. But for developer, it can be annoying to cast expression into Boolean for If, And and Or operators. We changed their internal to automatically convert the expression into a Boolean when needed.

Reduce new transaction started by Cache

For performance reason, we improved the Cache to not start a new transaction when it is not needed. We also delayed the synchronization of the cache between host to 5 minutes.

Stop idle database connection pool

For the PostgreSQL backend, we use a connection pool which keep by default 1 connection open. But on setup with a lot of database keeping this connection can be too expensive especially if it is almost never used. Now after 30 minutes of unused the pool is closed which free the connections.
The pool for template1 does not keep any connection at all in order to avoid lock when database is created.

Using subrepository

We started an experiment to replace hgnested by subrepository. The main repository is available at tryton-env. If the result is positive, hgnested will be deactivated on hg.tryton.org.

Use of GtkApplication

The desktop client is using GtkApplication to manage the initialization, the application uniqueness, the menus and URL opens.
Now the client asks before starting for the connection parameters which can no more be changed without closing or starting a new application. The custom IPC has been replaced by the GtkApplication command line signal management.

Improve index creation

It is now possible to create index with SQL expression (instead of only columns) and with where clause. This allow to create indexes tailored for some specific queries.
There is only one limitation with the SQLite backend which can not run the creation query if it has parameters. In such case, no index is created and a warning is displayed.

Add accessor for TableHandler

In the same way as we have __table__ method to retrieve the SQL table of the ModelSQL, we added __table_handler__ method to retrieve an instance of TableHandler for the class. This simplify the code to write to make modification on the table schema like creating an index or make a migration.

Transactional queue

The first result of the crowed funding campaign of B2CK landed in Tryton.
Tryton can be configured to use workers to execute tasks asynchronously. Any Model method can be queued by calling it from the Model.__queue__ attribute. The method must be an instance method or a class-method that takes a list of records as first argument. The other arguments must be JSON-ifiable.
The task posting can be configured using the context variable: queue_name, queue_scheduled_at and queue_expected_at. The queue dispatches the tasks evenly to the available workers and each worker uses a configurable pool of processes (by default the number of CPU) to execute them. The workers can be run an a different machine as long as they have access to the database.
If Tryton has no worker configured, the tasks will be run directly at the end of the transaction.

The processing of sales and purchases have already been adapted to use the queue.

Support of Python 3.7

The version 3.7 of Python has been released about 1 month ago. The development version of Tryton has been updated to support it. So this version of Python will be supported on the next release.