-
-
Notifications
You must be signed in to change notification settings - Fork 392
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
OBPIH-5806 Update with PENDING_APPROVAL status on approval submit and REQUESTED on reagular outbound #4317
OBPIH-5806 Update with PENDING_APPROVAL status on approval submit and REQUESTED on reagular outbound #4317
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
answering your question - it was probably missed because we forgot that those methods are also used for outbounds, and we focused on conditions (if a location does/does not support approvals).
It is probably my fault that I have caused this regression, so I'm sorry that you had to fix that 🙈
} else { | ||
transitionRequisitionStatus(requisition, RequisitionStatus.VERIFYING, EventCode.SUBMITTED, currentUser) | ||
requisition.approvalRequired = false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why have you got rid of those lines?
If you changed on frontend to send PENDING_APPROVAL
no matter of location supported activities, if a location doesn't support the approvals it would set the status for PENDING_APPROVAL
not for VERIFYING
, wouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, good point., this is what I wanted to hear, because I had a feeling I was missing something.
I'll bring back those lines and leave the VERYFING case too.
@@ -1229,7 +1229,7 @@ class AddItemsPage extends Component { | |||
submitRequest(lineItems) { | |||
const nonEmptyLineItems = _.filter(lineItems, val => !_.isEmpty(val) && val.product); | |||
this.saveRequisitionItems(nonEmptyLineItems) | |||
.then(() => this.transitionToNextStep('REQUESTED')); | |||
.then(() => this.transitionToNextStep('PENDING_APPROVAL')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see the comment above - either you bring back those lines in the PENDING_APPROVAL
case, or we should should check (or actually we might do it in both places) here, if a location supports approval workflow - if it does, send PENDING_APPROVAL
, otherwise after your refactor, I guess we should send VERIFYING
directly, instead of REQUESTED
.
} else { | ||
transitionRequisitionStatus(requisition, RequisitionStatus.VERIFYING, EventCode.SUBMITTED, currentUser) | ||
requisition.approvalRequired = false | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now - don't we want to send an event at all if we set it for VERIFYING
? (when we send a request when origin doesn't support approvals)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean?
the break
is inside of an if()
and if requisition.origin.approvalRequired
is false
it will go to next case which is case RequisitionStatus.VERIFYING:
.
I wanted to avoid duplicate code with this approach but if you feel it is too confusing then let me know, I'll either add a comment or duplicate it for the sake of clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it will go there, but from the frontend you still always send PENDING_APPROVAL
and if a location doesn't support the approvals, it won't run the transitionRequisitionStatus
method at all. Or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will run triggerRequisitionStatusTransition
and set the status to VERIFYING
.
Anyways, these state transitions are getting a bit too confusing, I think I need to rethink my approach to which status to send and how to react to it.
.then(() => this.transitionToNextStep('REQUESTED')); | ||
.then(() => { | ||
if (supports(this.state.values.origin?.supportedActivities, ActivityCode.APPROVE_REQUEST)) { | ||
this.transitionToNextStep('PENDING_APPROVAL'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use the enum values defines in the requisitonStatus.js
if (supports(this.state.values.origin?.supportedActivities, ActivityCode.APPROVE_REQUEST)) { | ||
this.transitionToNextStep('PENDING_APPROVAL'); | ||
} else { | ||
this.transitionToNextStep('REQUESTED'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
… REQUESTED on reagular outbound
…ported activity on submit request
1d0607d
to
0512892
Compare
… REQUESTED on reagular outbound (#4317) * OBPIH-5806 Update with PENDING_APPROVAL status on approval submit and REQUESTED on reagular outbound * OBPIH-5806 check if origin requires approval on PENDING_APPROVAL status * OBPIH-5806 Send propper status update based on fulfiling location supported activity on submit request * OBPIH-5806 Use constant status values for RequisitionStatus
lets discuss...
The issue came up when trying to create an outbound with a location which has the supported activity for request approval.
The expected behaviour would be that on Edit step an outbound should have status
VERIFYING
but instead it wasWAITING FOR APPROVAL
.The reason for that was that in both cases (Request and Outbound) we update status with
{ status: 'REQUESTED' }
which is mapped toPENDING_APPROVAL
(change which was introduced in here)Was there a particular reason why we didn't separate VERIFYING and PEWNDING_APPROVAL as individual cases?