Skip to content
Snippets Groups Projects
  • Lucas Lefèvre's avatar
    d133df58
    [FIX] website: Display duplicate login error message · d133df58
    Lucas Lefèvre authored
    
    When you try to create two users with the same login, the shown error message is
    the Postgresql integrity error instead of a nice (translated) validation error.
    This happens since bf88f3e3 which changed the way error messages are translated.
    
    The reason is the manually created unique index `res_users_login_key_unique_website_index`.
    The error handling and translation mechanisms don't know it exists.
    The index was created for performance reasons in commit b5a12b4a where the
    original python constraint was replaced with this custom SQL index.
    
    In this commit, the python constraint is re-introduced to remove the index hack,
    but the implementation now uses a single SQL query, which should be quite fast.
    
    closes odoo/odoo#38737
    
    X-original-commit: 817a811e
    Signed-off-by: default avatarChristophe Simonis <chs@odoo.com>
    d133df58
    History
    [FIX] website: Display duplicate login error message
    Lucas Lefèvre authored
    
    When you try to create two users with the same login, the shown error message is
    the Postgresql integrity error instead of a nice (translated) validation error.
    This happens since bf88f3e3 which changed the way error messages are translated.
    
    The reason is the manually created unique index `res_users_login_key_unique_website_index`.
    The error handling and translation mechanisms don't know it exists.
    The index was created for performance reasons in commit b5a12b4a where the
    original python constraint was replaced with this custom SQL index.
    
    In this commit, the python constraint is re-introduced to remove the index hack,
    but the implementation now uses a single SQL query, which should be quite fast.
    
    closes odoo/odoo#38737
    
    X-original-commit: 817a811e
    Signed-off-by: default avatarChristophe Simonis <chs@odoo.com>