summaryrefslogtreecommitdiff
path: root/addons/payment_adyen
diff options
context:
space:
mode:
authorqdp-odoo <qdp@odoo.com>2018-05-23 15:44:55 +0200
committerqdp-odoo <qdp@odoo.com>2018-05-23 15:44:55 +0200
commit01216345e28374b554bfe95df82d607c591271cf (patch)
treebf0472c263d72c13aa8a9c79c380c9a8930beea6 /addons/payment_adyen
parent7a31a92afa9a2ad280a6ec110fc9547e48b89466 (diff)
[REF] account,payment(_*),sale*: downgrade transactions into debug items
It was very confusing for the user to distinct account.payment and payment.transaction. From now on, the transactions are technical objects and, in the backend, we only refer to it in log messages (Front end will be adapted in the same fashion later on). They are hidden in debug mode in accounting\configuration\payments as their purpose is now purely technical/log This commit also aims to reduce the gap between the accounting app and the transactions: account.payment objects are created/validated upon completion of transaction. To ease the capture/voiding of pending transactions, the related buttons are now displayed directly on the SO/invoice instead of the transactions. Was task: https://www.odoo.com/web#id=35857&view_type=form&model=project.task&action=333&active_id=967&menu_id=4720 Was PR #24043 [FIX] add domain based on journal to payment tokens Was opw: https://www.odoo.com/web?debug#id=1828206&view_type=form&model=project.task&menu_id=5200
Diffstat (limited to 'addons/payment_adyen')
-rw-r--r--addons/payment_adyen/__init__.py1
-rw-r--r--addons/payment_adyen/__manifest__.py1
-rw-r--r--addons/payment_adyen/models/payment.py20
-rw-r--r--addons/payment_adyen/tests/test_adyen.py2
4 files changed, 10 insertions, 14 deletions
diff --git a/addons/payment_adyen/__init__.py b/addons/payment_adyen/__init__.py
index 8c67f893b37..f2ff55f0433 100644
--- a/addons/payment_adyen/__init__.py
+++ b/addons/payment_adyen/__init__.py
@@ -3,3 +3,4 @@
from . import models
from . import controllers
+from odoo.addons.payment.models.payment_acquirer import create_missing_journal_for_acquirers
diff --git a/addons/payment_adyen/__manifest__.py b/addons/payment_adyen/__manifest__.py
index 1e26a8808ca..8b04a9834e2 100644
--- a/addons/payment_adyen/__manifest__.py
+++ b/addons/payment_adyen/__manifest__.py
@@ -13,4 +13,5 @@
'data/payment_acquirer_data.xml',
],
'installable': True,
+ 'post_init_hook': 'create_missing_journal_for_acquirers',
}
diff --git a/addons/payment_adyen/models/payment.py b/addons/payment_adyen/models/payment.py
index 3b15e51d44f..e67d773d81d 100644
--- a/addons/payment_adyen/models/payment.py
+++ b/addons/payment_adyen/models/payment.py
@@ -217,24 +217,16 @@ class TxAdyen(models.Model):
def _adyen_form_validate(self, data):
status = data.get('authResult', 'PENDING')
if status == 'AUTHORISED':
- self.write({
- 'state': 'done',
- 'acquirer_reference': data.get('pspReference'),
- # 'date_validate': data.get('payment_date', fields.datetime.now()),
- # 'paypal_txn_type': data.get('express_checkout')
- })
+ self.write({'acquirer_reference': data.get('pspReference')})
+ self._set_transaction_done()
return True
elif status == 'PENDING':
- self.write({
- 'state': 'pending',
- 'acquirer_reference': data.get('pspReference'),
- })
+ self.write({'acquirer_reference': data.get('pspReference')})
+ self._set_transaction_pending()
return True
else:
error = _('Adyen: feedback error')
_logger.info(error)
- self.write({
- 'state': 'error',
- 'state_message': error
- })
+ self.write({'state_message': error})
+ self._set_transaction_cancel()
return False
diff --git a/addons/payment_adyen/tests/test_adyen.py b/addons/payment_adyen/tests/test_adyen.py
index 2e1d3eb53f2..16462b74667 100644
--- a/addons/payment_adyen/tests/test_adyen.py
+++ b/addons/payment_adyen/tests/test_adyen.py
@@ -5,6 +5,7 @@ from lxml import objectify
from odoo.addons.payment.tests.common import PaymentAcquirerCommon
from odoo.addons.payment_adyen.controllers.main import AdyenController
from werkzeug import urls
+import odoo.tests
class AdyenCommon(PaymentAcquirerCommon):
@@ -29,6 +30,7 @@ class AdyenCommon(PaymentAcquirerCommon):
self.mistercash = (('6703444444444449', None, 'user', 'password'))
+@odoo.tests.tagged('post_install', '-at_install', 'external', '-standard')
class AdyenForm(AdyenCommon):
def test_10_adyen_form_render(self):