User cannot create requisition if reason is not assigned to particular program and facility
Description
Environment
Attachments
Checklists
Activity
Adam Nawrot
There is a high chance this can be resolved via UI, as written in this comment https://openlmis.atlassian.net/browse/MALAWISUP-4388?focusedCommentId=90104
Artur Lebiedziński
@Adam Nawrot Please let me know what is the remaining estimation to set up the solution proposed by @Aleksandra Hinc
Artur Lebiedziński
I’m ok with that if it fits the problem that we have here.
Aleksandra Hinc
As I’ve spoken with Nikola the solution of resolving this problem is to unassign the reasons from the facility and give the possibility to perform requisition despite the fact that they will not be available to the user. So all the calculations that are now performed on the backend should continue to be performed correctly, despite the unassigning of these reasons. We do not delete them, but only unassigning them from the facility. Nikola also proposed that we can make at least one reason, e.g. when entering physical inventory and if there is none, then info "there are no reasons, to continue physical inventory please contact your system administrator". All of those considerations are mentioned in this ticket: https://openlmis.atlassian.net/browse/MALAWISUP-4388
@Artur Lebiedziński is this enough to start fixing this by the dev side?
cc: @Adam Nawrot
Aleksandra Hinc
@Artur Lebiedziński yes I have an update. I’ve noticed several pages thtat are using the reasons:
Manage Proof of Delivery page
Requisition page (the whole R&R is using the total losses and adjustments)
Physical Inventory page
Requisition Template page
Some of the Superset reports (Adjustments Report)
This seems like a lot of interference into the system… @Adam Nawrot Not sure if we could find proper solution for this?
Details
Assignee
Reporter
Time tracking
Fix versions
Priority
Time Assistant

Enable users to proceed with the requisition process even if the reason is not associated with this facility/program anymore.
Background
Malawi implementation wanted to remove the reasons from the system, they unassigned them from the facility type and program but then when user wanted to create requisition the following error appeared:
(the id was an id of the unassigned reason).
More info here: https://openlmis.atlassian.net/browse/MALAWISUP-4388
Reproduction steps
Go to Administration → Reasons
Click Edit next to Consumed reason
Remove all programs and facility type in the table at the bottom
Click Update Reason button
Go to Requisition → Create/Authorize
Select Family Planning Program
Click Initiate
Expected behavior
User should be able to initiate requisition even if the reasons are not assigned to particular program and facility but these reasons should not be visible in adjustments modal window (after clicking edit icon/pencil in adjustment column).