From 1be539f68019435b2d09b1a46e4786a09e59edf2 Mon Sep 17 00:00:00 2001 From: "Stefan Rijnhart (Opener)" Date: Wed, 25 Jul 2018 18:02:08 +0200 Subject: [PATCH] [ADD] Allow for multiple SEPA payment methods with different versions (#493) (#496) --- .../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 f7623a5d6..9da1b3c66 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' + )]