From 8d7fa04db2877d48b9416934e25028bb74991b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 8 Jul 2019 21:18:18 +0200 Subject: [PATCH] Use clear cache after a commit issue8449 review251651002 --- payment.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/payment.py b/payment.py index a0ed1ee530..4e169cafa3 100644 --- a/payment.py +++ b/payment.py @@ -368,6 +368,8 @@ class Payment(metaclass=PoolMeta): ('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 @@ class Payment(metaclass=PoolMeta): ('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 @@ class Customer(DeactivableMixin, ModelSQL, ModelView): ], ]) 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 @@ class Customer(DeactivableMixin, ModelSQL, ModelView): ('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: