changeset a753b03fbbab in modules/account_payment_braintree:default
details:
https://hg.tryton.org/modules/account_payment_braintree?cmd=changeset&node=a753b03fbbab
description:
Add batch option to push queue tasks
issue11129
review381661002
diffstat:
party.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diffs (31 lines):
diff -r 1d0423ceb2c2 -r a753b03fbbab party.py
--- a/party.py Tue Feb 15 00:08:47 2022 +0100
+++ b/party.py Wed Mar 09 00:57:17 2022 +0100
@@ -2,6 +2,7 @@
# this repository contains the full copyright notices and license terms.
from trytond.model import fields
from trytond.pool import Pool, PoolMeta
+from trytond.transaction import Transaction
from .common import BraintreeCustomerMethodMixin
@@ -16,6 +17,8 @@
def write(cls, *args):
pool = Pool()
Customer = pool.get('account.payment.braintree.customer')
+ transaction = Transaction()
+ context = transaction.context
parties = sum(args[0:None:2], [])
customers = sum((p.braintree_customers for p in parties), ())
@@ -28,7 +31,9 @@
if customer._customer_parameters() != params:
to_update.append(customer)
if to_update:
- Customer.__queue__.braintree_update(to_update)
+ with Transaction().set_context(
+ queue_batch=context.get('queue_batch', True)):
+ Customer.__queue__.braintree_update(to_update)
class PartyReceptionDirectDebit(