From 144dea8c8693800ed460ede870f065cc76e0facf Mon Sep 17 00:00:00 2001 From: "Stefan Rijnhart (Opener)" Date: Wed, 25 Jul 2018 14:47:36 +0200 Subject: [PATCH] [ADD] Allow for multiple SEPA payment methods with different versions (#493) --- .../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 9d9499036..6f4ca7ee7 100644 --- a/account_banking_pain_base/models/account_payment_method.py +++ b/account_banking_pain_base/models/account_payment_method.py @@ -22,3 +22,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' + )]