Files
Cédric Krier 5310b00496 Remove grouped_slice per IN_MAX
The usage of ``grouped_slice`` without size is deprecated since `=
ANY(ARRAY[%s])` is used for PostgreSQL and SQLite is used only for tests.

The ``Database.IN_MAX`` is replaced by ``backend.MAX_QUERY_PARAMS`` which is a
more accurate limit of the backend.
The SQLite limits is indeed SQLITE_MAX_EXPR_DEPTH so we use a empirical value.
2026-03-22 21:05:26 +01:00

46 lines
1.4 KiB
Python

# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool, PoolMeta
class Move(metaclass=PoolMeta):
__name__ = 'account.move'
@classmethod
def _get_origin(cls):
models = super()._get_origin()
return models + ['account.payment']
def _payments_to_update(reconciliations):
pool = Pool()
Payment = pool.get('account.payment')
Reconciliation = pool.get('account.move.reconciliation')
moves = set()
others = set()
for reconciliation in reconciliations:
for line in reconciliation.lines:
moves.add(line.move)
others.update(line.reconciliations_delegated)
payments = set(Payment.search([
('clearing_move', 'in', moves),
], order=[]))
if others:
payments.update(_payments_to_update(Reconciliation.browse(others)))
return payments
class MoveReconciliation(metaclass=PoolMeta):
__name__ = 'account.move.reconciliation'
@classmethod
def on_modification(cls, mode, reconciliations, field_names=None):
pool = Pool()
Payment = pool.get('account.payment')
super().on_modification(mode, reconciliations, field_names=field_names)
Payment.__queue__.update_reconciled(
list(_payments_to_update(reconciliations)))