@@ -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
|
||||
|
||||
Reference in New Issue
Block a user