From 783261733dfb6df4488a1204b976addba7adff2f Mon Sep 17 00:00:00 2001 From: "Stefan Rijnhart (Opener)" Date: Wed, 25 Jul 2018 18:02:37 +0200 Subject: [PATCH] [ADD] Allow for multiple SEPA payment methods with different versions (#493) (#497) --- .../models/account_payment_method.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/account_banking_pain_base/models/account_payment_method.py b/account_banking_pain_base/models/account_payment_method.py index 07f9b6f22..e0863a6e8 100644 --- a/account_banking_pain_base/models/account_payment_method.py +++ b/account_banking_pain_base/models/account_payment_method.py @@ -21,3 +21,11 @@ class AccountPaymentMethod(models.Model): self.ensure_one() raise UserError(_( "No XSD file path found for payment method '%s'") % self.name) + + _sql_constraints = [( + # Extending this constraint from account_payment_mode + 'code_payment_type_unique', + 'unique(code, payment_type, pain_version)', + 'A payment method of the same type already exists with this code' + ' and PAIN version' + )]