(self)
Do not allow two users with the same login without website
Do not allow two users with the same login without website
Do not allow two users with the same login without website
def _check_login(self):
        """ Do not allow two users with the same login without website """
        self.flush(['login', 'website_id'])
        self.env.cr.execute(
            """SELECT login
                 FROM res_users
                WHERE login IN (SELECT login FROM res_users WHERE id IN %s AND website_id IS NULL)
                  AND website_id IS NULL
             GROUP BY login
               HAVING COUNT(*) > 1
            """,
            (tuple(self.ids),)
        )
        if self.env.cr.rowcount:
            raise ValidationError(_('You can not have two users with the same login!'))
def _check_login ( self ) : self . flush ( [ 'login' , 'website_id' ] ) self . env . cr . execute ( """SELECT login
                 FROM res_users
                WHERE login IN (SELECT login FROM res_users WHERE id IN %s AND website_id IS NULL)
                  AND website_id IS NULL
             GROUP BY login
               HAVING COUNT(*) > 1
            """ , ( tuple ( self . ids ) , ) ) if self . env . cr . rowcount : raise ValidationError ( _ ( 'You can not have two users with the same login!' ) )