changeset 9cda10c306b8 in modules/account_payment_stripe:5.2
details: 
https://hg.tryton.org/modules/account_payment_stripe?cmd=changeset;node=9cda10c306b8
description:
        Use clear cache after a commit

        issue8449
        review251651002
        (grafted from 3678b90342290281f4fd42ad78af7b9a5ea17c66)
diffstat:

 payment.py |  8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diffs (39 lines):

diff -r aa50755c976c -r 9cda10c306b8 payment.py
--- a/payment.py        Mon May 06 14:57:34 2019 +0200
+++ b/payment.py        Mon Jul 08 21:18:18 2019 +0200
@@ -368,6 +368,8 @@
                     ('company', '=', Transaction().context.get('company')),
                     ])
         for payment in payments:
+            # Use clear cache after a commit
+            payment = cls(payment.id)
             if (payment.stripe_charge_id
                     or payment.journal.process_method != 'stripe'
                     or payment.state != 'processing'):
@@ -447,6 +449,8 @@
                     ('company', '=', Transaction().context.get('company')),
                     ])
         for payment in payments:
+            # Use clear cache after a commit
+            payment = cls(payment.id)
             if (not payment.stripe_charge_id
                     or payment.journal.process_method != 'stripe'
                     or payment.stripe_captured
@@ -828,6 +832,8 @@
                         ],
                     ])
         for customer in customers:
+            # Use clear cache after a commit
+            customer = cls(customer.id)
             if customer.stripe_customer_id:
                 continue
             customer.lock()
@@ -869,6 +875,8 @@
                     ('stripe_customer_id', '!=', None),
                     ])
         for customer in customers:
+            # Use clear cache after a commit
+            customer = cls(customer.id)
             assert not customer.active
             customer.lock()
             try:

Reply via email to