changeset 39959256c454 in modules/account_payment_stripe:5.0
details: 
https://hg.tryton.org/modules/account_payment_stripe?cmd=changeset;node=39959256c454
description:
        Ensure payment instance has the right company context

        The call to save restore the context when the record was instantiated.

        issue8780
        review256151003
        (grafted from 7488ccbf97b732696a0f4723a4d566be707c9f62)
diffstat:

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

diffs (35 lines):

diff -r 22c4cbebdb45 -r 39959256c454 payment.py
--- a/payment.py        Thu Aug 01 23:31:42 2019 +0200
+++ b/payment.py        Fri Nov 01 23:01:43 2019 +0100
@@ -592,6 +592,7 @@
         for payment in payments:
             # TODO: remove when https://bugs.tryton.org/issue4080
             with Transaction().set_context(company=payment.company.id):
+                payment = Payment(payment.id)
                 if payment.state == 'succeeded':
                     Payment.fail([payment])
                 payment.stripe_captured = charge['captured']
@@ -627,6 +628,7 @@
         for payment in payments:
             # TODO: remove when https://bugs.tryton.org/issue4080
             with Transaction().set_context(company=payment.company.id):
+                payment = Payment(payment.id)
                 payment.stripe_error_message = charge['failure_message']
                 payment.stripe_error_code = charge['failure_code']
                 payment.stripe_error_param = None
@@ -649,6 +651,7 @@
         for payment in payments:
             # TODO: remove when https://bugs.tryton.org/issue4080
             with Transaction().set_context(company=payment.company.id):
+                payment = Payment(payment.id)
                 payment.stripe_dispute_reason = source['reason']
                 payment.stripe_dispute_status = source['status']
                 payment.save()
@@ -668,6 +671,7 @@
         for payment in payments:
             # TODO: remove when https://bugs.tryton.org/issue4080
             with Transaction().set_context(company=payment.company.id):
+                payment = Payment(payment.id)
                 payment.stripe_dispute_reason = source['reason']
                 payment.stripe_dispute_status = source['status']
                 payment.save()

Reply via email to