Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] models.py: Raise user friendly error message on sql constraints #36458

Closed
wants to merge 12 commits into from

Commits on Sep 11, 2019

  1. Copy the full SHA
    ab89b8e View commit details
    Browse the repository at this point in the history
  2. [FIX] hr_holidays: fix the layout

    RomainLibert authored and tivisse committed Sep 11, 2019
    Copy the full SHA
    69732ca View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    abfc7f8 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    2274a2c View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    4cf11d2 View commit details
    Browse the repository at this point in the history
  6. [FIX] web: Display event name on calendar popup instead of undefined

    Purpose
    =======
    
    When you edit a Time Off Request from the dashboard. The title in the header
    is undefined
    
    https://drive.google.com/open?id=1vBg9AlVCN7rc5D6DUel8hx2uY-oOfwRs
    RomainLibert authored and tivisse committed Sep 11, 2019
    Copy the full SHA
    2f76c5e View commit details
    Browse the repository at this point in the history
  7. [FIX] hr_holidays: Uniformize allocation validation for responsibles

    Purpose
    =======
    
    Have the same mechanism for time off responsibles between leaves and allocations.
    RomainLibert authored and tivisse committed Sep 11, 2019
    Copy the full SHA
    d347018 View commit details
    Browse the repository at this point in the history
  8. [FIX] hr_holidays: write on date_from change request_date_from

    When writing on date_from or date_to, request_date_from and
    request_date_to should also change
    RomainLibert authored and tivisse committed Sep 11, 2019
    Copy the full SHA
    0caa9f8 View commit details
    Browse the repository at this point in the history
  9. [FIX] hr_holidays: allow copy of leaves and allocations

    In the case of allocations, it should simply be possible to copy them
    
    In the case of leave requests, we want to have a "beautiful" message for
    the user in case he cannot duplicate the leave request (overlapping
    leave requests)
    But it makes no sense to not allow at copying it in case the date_from
    and date_to are actually provided
    RomainLibert authored and tivisse committed Sep 11, 2019
    Copy the full SHA
    8c908e3 View commit details
    Browse the repository at this point in the history
  10. [FIX] models.py: Raise user friendly error message on sql constraints

    Purpose
    =======
    
    On a record creation, a valid and user friendly error message is raised
    when a sql constraint is violated. (Eg: 'The start date must be anterior
    to the end date').
    
    On a record modification, this is not always the case anymore, since the
    latest ORM modifications.
    
    Eg: Write on a leave with a date_from > date_to, you got the postgreSQL
    error, which is not understable by a classic human.
    
    This is due to the fact that the error is correctly catched and logged,
    but the result is set into the cache, triggering the execution of computation
    methods, and calling _validate_fields. It is highly probable that a flush
    is done in the constraint method (search, read, ...). In that case the
    postgreSQL error is converted into a ValidationError, with a stringified
    version of the IntegrityError, and thus is not catched by the check wrapper.
    tivisse committed Sep 11, 2019
    Copy the full SHA
    ced793a View commit details
    Browse the repository at this point in the history
  11. Copy the full SHA
    e572165 View commit details
    Browse the repository at this point in the history
  12. [FIX] models.py: Don't commit after fetching a translation

    Purpose
    =======
    
    When trying the translate a sql_contraint message after an integrity error
    we use the current cursor in a 'with', just to make a SELECT query.
    
    That way, the cursor is commited at the end of the with statement, trying
    to commit the inconsitent state of the cursor that was the reason of the
    integrity error.
    
    Just close the cursor, as we only fetch translations from the database.
    tivisse committed Sep 11, 2019
    Copy the full SHA
    a904fe1 View commit details
    Browse the repository at this point in the history