Add batch option to push queue tasks
issue11129 review381661002
This commit is contained in:
1 parent
ba595d5dfb
commit
4acdcc7efe
1 file changed
+6
-2
+6
-2
@@ -16,9 +16,11 @@ def process_sale_supply(func):
|
||||
def wrapper(cls, productions):
|
||||
pool = Pool()
|
||||
Sale = pool.get('sale.sale')
|
||||
transaction = Transaction()
|
||||
context = transaction.context
|
||||
|
||||
sales = set()
|
||||
with Transaction().set_context(_check_access=False):
|
||||
with transaction.set_context(_check_access=False):
|
||||
for sub_productions in grouped_slice(productions):
|
||||
ids = [p.id for p in sub_productions]
|
||||
sales.update([s.id for s in Sale.search([
|
||||
@@ -26,7 +28,9 @@ def process_sale_supply(func):
|
||||
])])
|
||||
func(cls, productions)
|
||||
if sales:
|
||||
Sale.__queue__.process(sales)
|
||||
with transaction.set_context(
|
||||
queue_batch=context.get('queue_batch', True)):
|
||||
Sale.__queue__.process(sales)
|
||||
return wrapper
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user