Repository navigation
Conversation
check_origin_date raised the translated message itself, a plain string, so setting a transfer date without a transfer source failed with "exceptions must derive from BaseException" instead of a validation error. It also compared the transfer date (a Date) with the encounter start (a Datetime), which fails with a TypeError on every encounter that has both, and on encounters without a start. Raise ValidationError, and compare the transfer date with the start date in the user's timezone, skipping the check when the encounter has no start. Reported in the review of the 19.0 migration (nirun-life#155).
Contributor
|
Closing as a duplicate of #166. The If both were merged:
The fix is still wanted: it lands with #166, and its forward-ports follow #166's commits. |
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
ni.encounter.check_origin_datenow raisesValidationError. Before, it raised the translated string itself.origin_date, a Date) is compared with the encounter start date in the user's timezone. Before, it was compared withperiod_start, a UTC Datetime. The check is skipped when the encounter has no start.tests/test_ni_encounter_origin_date.py.ni_patient16.0.0.4.0 → 16.0.0.4.1.Why
Both branches of the constraint fail with a
TypeErrorinstead of a validation error:raise _("...")raises a plain string ("exceptions must derive from BaseException").Date > Datetimeraises on every encounter that has both a transfer date and a start, and on encounters with a transfer date but no start.Reported by piruin in the review of the 19.0 migration (#155), who asked for the fix on 16.0 and a forward-port. Part of P0-4 (#135), epic #131.
How tested
-i ni_patient --test-tags /ni_patienton a fresh 16.0 DB: 29 tests, 0 failed.pre-commitclean on the changed files.Notes for reviewer
oca-portonce this is merged and the migration PRs ([17.0][MIG] ni_patient: Migration to 17.0 #153–[19.0][MIG] ni_patient: Migration to 19.0 #155) are in.