[FIX] payment: allow to set done a payment.transaction in pending state

- If a payment.transaction is in pending state, it was impossible to set
  it to done.
This commit is contained in:
Toufik Benjaa
2018-09-10 10:41:37 +02:00
parent 5e4d4c305f
commit 29cd2c33eb
+1 -1
View File
@@ -722,7 +722,7 @@ class PaymentTransaction(models.Model):
@api.multi
def _set_transaction_done(self):
'''Move the transaction's payment to the done state(e.g. Paypal).'''
if any(trans.state not in ('draft', 'authorized') for trans in self):
if any(trans.state not in ('draft', 'authorized', 'pending') for trans in self):
raise ValidationError(_('Only draft/authorized transaction can be posted.'))
self.write({'state': 'done', 'date': datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT)})