OBPIH-6644 Fix calculating inverse item after reducing ordered quantity#4820
Conversation
| Integer quantity | ||
| if (orderItem.isCompletelyFulfilled() && orderItem.isFullyInvoiced()) { | ||
| // If quantity if fully shipped and fully invoiced set full inverse quantity | ||
| quantity = quantityInverseable | ||
| } else { | ||
| quantity = invoiceItem.quantity >= quantityInverseable ? quantityInverseable : invoiceItem.quantity | ||
| } |
There was a problem hiding this comment.
In the code above, we use returns instead of else, so maybe to keep the code consistent, it would be better to use the same approach here?
+ What do you think about writing some simple unit tests? :sadsmile:
There was a problem hiding this comment.
In the code above we return nulls and we don't want to execute code that is below. Here we want to determine the quantity that is going to be used in the latter part of the code
There was a problem hiding this comment.
- What do you think about writing some simple unit tests? :sadsmile:
When it is QA'ed we can think about bumping up test coverage in entire partial invoice feature
There was a problem hiding this comment.
When it is QA'ed we can think about bumping up test coverage in entire partial invoice feature
good idea, but we can't forget about that as always
05fa3aa
into
feature/OBPIH-6398-partial-invoices-for-prepaid-po
✨ Description of Change
Link to GitHub issue or Jira ticket:
https://pihemr.atlassian.net/browse/OBPIH-6644
Description:
When an order item had quantity reduced after making a prepayment, then it was not fully inversed. There was a need for a fix while calculating inverse quantity to take a look if the ordered item is both fully shipped and fully invoiced, and then add inverse item with quantity available to inverse.
📈 Test Plan
Description of test plan (if applicable):
According to reproduction steps
✅ Quality Checks
[OBS-123]for Jira,[#0000]for GitHub, or[OBS-123, OBPIH-123]if there are multiple), or with[N/A]if not applicable