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

POLIO-1758 Earmarked stock #1938

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open

POLIO-1758 Earmarked stock #1938

wants to merge 38 commits into from

Conversation

mathvdh
Copy link
Collaborator

@mathvdh mathvdh commented Jan 22, 2025

Add the possibility to Earmark Stocks, Use the earmarks or put them back to main stock.

Add the models and APIs for it.

Related JIRA tickets : POLIO-1758

Self proofreading checklist

  • Did I use eslint and black formatters
  • Is my code clear enough and well documented
  • My migrations file are included
  • Are there enough tests

Changes

Add EarmarkedStock model in polio models.
Add new urls
Add new EarmarkedStockViewSet and EarmarkedStockSerializer in stock_management APIs.
Modifications of the calculations in stock_management API to take it into consideration.
Modified the OutgoingStockMovementViewSet to add a create method that tries to see if there is a Earmarked Stock and use it when creating a new Form A.
I had some name clash in OrgUnitNestedSerializer in iaso/api/storage, I had to rename it to StorageOrgUnitNestedSerializer

How to test

Without the frontend the only way is either using django admin or via the APIs to create (see tests)

Notes

The frontend will be added in another PR

Follow the Conventional Commits specification

The merge message of a pull request must follow the Conventional Commits specification.

This convention helps to automatically generate release notes.

Use lowercase for consistency.

Example:

fix: empty instance pop up

Refs: IA-3665

Note that the Jira reference is preceded by a line break.

Both the line break and the Jira reference are entered in the Add an optional extended description… field.

@mathvdh mathvdh marked this pull request as ready for review January 22, 2025 15:26
Copy link
Member

@quang-le quang-le left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comments. I also get a 500 when trying to edit an existing earmarked stock

Screenshot 2025-01-23 at 18 17 54

Almost there!

iaso/test.py Outdated Show resolved Hide resolved
plugins/polio/api/vaccines/stock_management.py Outdated Show resolved Hide resolved
plugins/polio/api/vaccines/stock_management.py Outdated Show resolved Hide resolved
Copy link
Member

@quang-le quang-le left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used earmarked stock appears twice in unusable table: once for earmarked, once for form A

Screenshot 2025-02-03 at 16 46 01

@beygorghor beygorghor added the release Should be released in production at next deploy label Feb 6, 2025
@beygorghor beygorghor requested a review from kemar February 7, 2025 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release Should be released in production at next deploy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants