From b86ef518f0f8092cb089b82fe161d9656e02971c Mon Sep 17 00:00:00 2001 From: Antoine Prieels Date: Mon, 12 Oct 2020 07:50:33 +0000 Subject: [PATCH] [FIX] payment_odoo_by_adyen: Disable test mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No test mode is available for Odoo Payments closes odoo/odoo#59778 X-original-commit: 118e52b748a9e0faec45be0ddf1a9e4a94a3f37c Signed-off-by: pimodoo Signed-off-by: Antoine Prieƫls --- addons/payment_odoo_by_adyen/models/payment.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/payment_odoo_by_adyen/models/payment.py b/addons/payment_odoo_by_adyen/models/payment.py index 9e7a4dc2afa..cf44d248400 100644 --- a/addons/payment_odoo_by_adyen/models/payment.py +++ b/addons/payment_odoo_by_adyen/models/payment.py @@ -23,6 +23,12 @@ class AcquirerOdooByAdyen(models.Model): odoo_adyen_account_id = fields.Many2one('adyen.account', required_if_provider='odoo_adyen', related='company_id.adyen_account_id') odoo_adyen_payout_id = fields.Many2one('adyen.payout', required_if_provider='odoo_adyen', string='Adyen Payout', domain="[('adyen_account_id', '=', odoo_adyen_account_id)]") + @api.constrains('provider', 'state') + def _check_odoo_adyen_test(self): + for payment_acquirer in self: + if payment_acquirer.provider == 'odoo_adyen' and payment_acquirer.state == 'test': + raise ValidationError(_('Odoo Payments by Adyen is not available in test mode.')) + def _get_feature_support(self): res = super(AcquirerOdooByAdyen, self)._get_feature_support() res['tokenize'].append('odoo_adyen')