(self)
Finalize the post-processing of recently done transactions not handled by the client.

        :return: None
Finalize the post-processing of recently done transactions not handled by the client.
Finalize the post - processing of recently done transactions not handled by the client .
def _cron_finalize_post_processing(self):
        """ Finalize the post-processing of recently done transactions not handled by the client.

        :return: None
        """
        txs_to_post_process = self
        if not txs_to_post_process:
            # Let the client post-process transactions so that they remain available in the portal
            client_handling_limit_date = datetime.now() - relativedelta.relativedelta(minutes=10)
            # Don't try forever to post-process a transaction that doesn't go through
            retry_limit_date = datetime.now() - relativedelta.relativedelta(days=2)
            # Retrieve all transactions matching the criteria for post-processing
            txs_to_post_process = self.search([
                ('state', '=', 'done'),
                ('is_post_processed', '=', False),
                '|', ('last_state_change', '<=', client_handling_limit_date),
                     ('operation', '=', 'refund'),
                ('last_state_change', '>=', retry_limit_date),
            ])
        for tx in txs_to_post_process:
            try:
                tx._finalize_post_processing()
                self.env.cr.commit()
            except psycopg2.OperationalError:  # A collision of accounting sequences occurred
                self.env.cr.rollback()  # Rollback and try later
            except Exception as e:
                _logger.exception(
                    "encountered an error while post-processing transaction with id %s:\n%s",
                    tx.id, e
                )
                self.env.cr.rollback()
def _cron_finalize_post_processing ( self ) : txs_to_post_process = self if not txs_to_post_process : # Let the client post-process transactions so that they remain available in the portal client_handling_limit_date = datetime . now ( ) - relativedelta . relativedelta ( minutes = 10 ) # Don't try forever to post-process a transaction that doesn't go through retry_limit_date = datetime . now ( ) - relativedelta . relativedelta ( days = 2 ) # Retrieve all transactions matching the criteria for post-processing txs_to_post_process = self . search ( [ ( 'state' , '=' , 'done' ) , ( 'is_post_processed' , '=' , False ) , '|' , ( 'last_state_change' , '<=' , client_handling_limit_date ) , ( 'operation' , '=' , 'refund' ) , ( 'last_state_change' , '>=' , retry_limit_date ) , ] ) for tx in txs_to_post_process : try : tx . _finalize_post_processing ( ) self . env . cr . commit ( ) except psycopg2 . OperationalError : # A collision of accounting sequences occurred self . env . cr . rollback ( ) # Rollback and try later except Exception as e : _logger . exception ( "encountered an error while post-processing transaction with id %s:\n%s" , tx . id , e ) self . env . cr . rollback ( )