Skip to content

OBPIH-6644 Fix calculating inverse item after reducing ordered quantity#4820

Merged
awalkowiak merged 1 commit intofeature/OBPIH-6398-partial-invoices-for-prepaid-pofrom
OBPIH-6644
Sep 3, 2024
Merged

OBPIH-6644 Fix calculating inverse item after reducing ordered quantity#4820
awalkowiak merged 1 commit intofeature/OBPIH-6398-partial-invoices-for-prepaid-pofrom
OBPIH-6644

Conversation

@awalkowiak
Copy link
Collaborator

✨ 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

  • Frontend automation tests (unit)
  • Backend automation tests (unit, API, smoke)
  • End-to-end tests (Playwright)
  • Manual tests (please describe below)
  • Not Applicable

Description of test plan (if applicable):
According to reproduction steps


✅ Quality Checks

  • The pull request title is prefixed with the issue/ticket number (Ex: [OBS-123] for Jira, [#0000] for GitHub, or [OBS-123, OBPIH-123] if there are multiple), or with [N/A] if not applicable
  • The pull request description has enough information for someone without context to be able to understand the change and why it is needed
  • The change has tests that prove the issue is fixed / the feature works as intended

@github-actions github-actions bot added the domain: backend Changes or discussions relating to the backend server label Sep 3, 2024
Comment on lines +185 to +191
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
}
Copy link
Collaborator

@alannadolny alannadolny Sep 3, 2024

Choose a reason for hiding this comment

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

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:

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • 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

Copy link
Collaborator

Choose a reason for hiding this comment

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

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

@awalkowiak awalkowiak merged commit 05fa3aa into feature/OBPIH-6398-partial-invoices-for-prepaid-po Sep 3, 2024
@awalkowiak awalkowiak deleted the OBPIH-6644 branch September 3, 2024 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: backend Changes or discussions relating to the backend server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants