def METHOD_NAME(self):
    company2 = self.env["res.company"].create(
        {
            "name": "Company 2",
            "street": "Street 2",
            "city": "City 2",
            "country_id": self.env.ref("base.ro").id,
            "l10n_ro_accounting": False,
        }
    )
    self.env["res.partner.bank"].create(
        {
            "acc_number": "NL46ABNA0499998749",
            "partner_id": self.partner1.id,
            "company_id": company2.id,
            "bank_id": self.bank_test.id,
            "acc_type": "iban",
        }
    )
    with self.assertRaises(psycopg2.errors.UniqueViolation):
        self.env["res.partner.bank"].create(
            {
                "acc_number": "NL46ABNA0499998749",
                "partner_id": self.partner1.id,
                "company_id": company2.id,
                "bank_id": self.bank_test.id,
                "acc_type": "iban",
            }
        )