Deprecate reduce_ids for SQL_OPERATORS['in']

Closes #12989 #13897
This commit is contained in:
Cédric Krier
2025-12-26 10:57:44 +01:00
parent 7b231e74e9
commit 0da67bce21
46 changed files with 191 additions and 234 deletions
+8 -7
View File
@@ -10,7 +10,7 @@ from trytond.cache import Cache, freeze
from trytond.model import ModelSQL, dualmethod, fields
from trytond.pool import Pool, PoolMeta
from trytond.protocols.jsonrpc import JSONDecoder, JSONEncoder
from trytond.tools import grouped_slice, reduce_ids
from trytond.tools import grouped_slice
from trytond.transaction import Transaction
dumps = partial(
@@ -164,20 +164,21 @@ class PriceListCache(ModelSQL):
cursor.execute(*cache.delete())
elif price_lists and products is None:
for sub_price_lists in grouped_slice(price_lists):
cursor.execute(*cache.delete(where=reduce_ids(
cursor.execute(*cache.delete(where=fields.SQL_OPERATORS['in'](
cache.price_list, [
p.id for p in sub_price_lists])))
elif price_lists is None and products:
for sub_products in grouped_slice(products):
cursor.execute(*cache.delete(where=reduce_ids(
cursor.execute(*cache.delete(where=fields.SQL_OPERATORS['in'](
cache.product, [p.id for p in sub_products])))
else:
for sub_products in grouped_slice(products):
for sub_price_lists in grouped_slice(price_lists):
cursor.execute(*cache.delete(where=reduce_ids(
cache.price_list, [
p.id for p in sub_price_lists])
& reduce_ids(
cursor.execute(*cache.delete(
where=fields.SQL_OPERATORS['in'](
cache.price_list, [
p.id for p in sub_price_lists])
& fields.SQL_OPERATORS['in'](
cache.product, [p.id for p in sub_products])))
@classmethod