Skip to content
Snippets Groups Projects
Commit d69ded69 authored by Damien Bouvy's avatar Damien Bouvy
Browse files

[FIX] payment_test: allow to disable it


closes odoo/odoo#37621

Signed-off-by: default avatarDamien Bouvy (dbo) <dbo@odoo.com>
parent ad94c1e7
Branches
Tags
No related merge requests found
......@@ -14,13 +14,13 @@ class PaymentAcquirerTest(models.Model):
@api.model
def create(self, values):
if values.get('provider') == 'test' and 'state' in values and values.get('state') != 'test':
raise exceptions.UserError(_('This acquirer should not be used for other purpose than testing.'))
if values.get('provider') == 'test' and 'state' in values and values.get('state') not in ('test', 'disabled'):
raise exceptions.UserError(_('This acquirer should not be used for other purposes than testing.'))
return super(PaymentAcquirerTest, self).create(values)
def write(self, values):
if any(rec.provider == 'test' for rec in self) and 'state' in values and values.get('state') != 'test':
raise exceptions.UserError(_('This acquirer should not be used for other purpose than testing.'))
if any(rec.provider == 'test' for rec in self) and 'state' in values and values.get('state') not in ('test', 'disabled'):
raise exceptions.UserError(_('This acquirer should not be used for other purposes than testing.'))
return super(PaymentAcquirerTest, self).write(values)
@api.model
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment