[FIX] pos_adyen: active constraint if the identifier is empty

Disqualify the constraint in the adyen identifier if it is empty because
it is not needed in other payment methods that are configured with other
payment terminal.

closes odoo/odoo#36702

Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
Joseph Caburnay
2019-09-12 05:34:09 +00:00
parent a0c5a3cc4a
commit c7ee7ce8e0
@@ -27,6 +27,8 @@ class PosPaymentMethod(models.Model):
@api.constrains('adyen_terminal_identifier')
def _check_adyen_terminal_identifier(self):
for payment_method in self:
if not payment_method.adyen_terminal_identifier:
continue
existing_payment_method = self.search([('id', '!=', payment_method.id),
('adyen_terminal_identifier', '=', payment_method.adyen_terminal_identifier)],
limit=1)