Error – 'NoneType' object has no attribute 'IN_MAX'

Hello,

We are encountering the following error in Tryton, specifically during operations related to sick leave (arrêts de travail) creation:

'NoneType' object has no attribute 'IN_MAX'

This error appears consistently across all processes involving sick leave creation. It seems related to the use of Transaction().database.IN_MAX, which is None in our case.

Has anyone encountered a similar issue or could point us to what might be causing this?
Any guidance or ideas would be appreciated.

Thanks in advance!

You can use Transaction().database only if the Transaction.start has been called before.
Normally the framework should have been started it for you so we will need more information on where this error happens and in which execution context.

Thank you for your reply.

The error occurs during the execution of a batch process that performs automatic processing on claim.ij.subscription records. This batch triggers the evaluation of rules (such as the Daily Allowance rule) programmatically, outside of the standard client UI.

In case of failure, the batch logs the error in the process.log table. For this issue, the message recorded is:
ERROR in tranche_salaire : 'NoneType' object has no attribute 'IN_MAX'

If the batch is launched by the cron, normally a transaction should be started.
How is you batch launched?

The batch is implemented as a class that inherits from batch.BatchRoot, and it’s executed using the Coog command-line tool:

coog batch exec <batch_name> 

This is not a standard Tryton command. The proper way to run task is to define a ir.cron entry.

So probably this command does not start the transaction.