Skip to content

OBPIH-6497 Fix comparing invoice quantities in UoM and in standard Uom#4781

Merged
awalkowiak merged 1 commit intodevelopfrom
OBPIH-6497
Aug 8, 2024
Merged

OBPIH-6497 Fix comparing invoice quantities in UoM and in standard Uom#4781
awalkowiak merged 1 commit intodevelopfrom
OBPIH-6497

Conversation

@awalkowiak
Copy link
Collaborator

@awalkowiak awalkowiak commented Aug 8, 2024

✨ Description of Change

Link to GitHub issue or Jira ticket:
https://pihemr.atlassian.net/browse/OBPIH-6497

Description:
This is a fix to issues found during QA. Turned out that we had a few places that were mixing up quantities in UoM and quantities in standard UoM.


📈 Test Plan

We require that all code changes come paired with a method of testing them. Please select which of the following testing approaches you've included with this change:

  • 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):


✅ Quality Checks

Please confirm and check each of the following to ensure that your change conforms to the coding standards of the project:

  • 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 Aug 8, 2024
@github-actions github-actions bot added the domain: frontend Changes or discussions relating to the frontend UI label Aug 8, 2024
@ewaterman
Copy link
Member

@awalkowiak can you explain the difference between standard UOM vs. non-standard and when we want to use each? I'm not clear which is supposed to be used in any given scenario

return hasPrepaymentInvoice
}

return true
Copy link
Member

Choose a reason for hiding this comment

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

can be simplified to return !canceled || hasPrepaymentInvoice if you want

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, when I was doing the improvements to fix some edge cases, I wanted to keep it as clear as possible, to avoid any further confusion. I want to add a separate subtask for adding more tests (and improving currently existing ones) that will be done after the solution is working properly, then this could be changed to a one-liner there, if this is preferable.

return hasPrepaymentInvoice
}

return true
Copy link
Member

@ewaterman ewaterman Aug 8, 2024

Choose a reason for hiding this comment

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

same here. Can be simplified to return !canceled || hasPrepaymentInvoice if you want

@awalkowiak
Copy link
Collaborator Author

@ewaterman sure:
Order items have quantity, unit of measure, and quantity per unit of measure that is not always equal to one. Things are ordered and invoiced in "unit of measure" quantity (which is equal to quantity), but shipments and receipts are done in standard uom quantity (which is equal to quantity from order * quantity per uom), so if we are comparing invoiced quantity with the shipped quantity we have to be sure we are comparing correct values (in this case either both compared quantities have to be quantity in standard uom or both to be in uom quantity).

I know that there are some plans for the upcoming release(s) to make this less confusing.


Boolean hasInvoiceableOrderItem() {
return orderItems.any { it.invoiceable }
return orderItems.any { it.canBeOnRegularInvoice() && it.invoiceable }
Copy link
Member

@ewaterman ewaterman Aug 8, 2024

Choose a reason for hiding this comment

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

Can we not move the canBeOnRegularInvoice methods to within the invoiceable methods? Do we ever need to know if an item/adjustment is invoiceable outside of the context of generating a regular invoice for it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It has to be separate for checking if the order isFullyInvoiceble. The canBeOnRegularInvoice still could be part of invoiceable for this case that you pointed out, but since I needed it separately for another place, I decided not to combine these together (at least for now).

@awalkowiak awalkowiak changed the title OBPIH-6497 Fix invoice quantities in UoM and in standard Uom OBPIH-6497 Fix comparing invoice quantities in UoM and in standard Uom Aug 8, 2024
@awalkowiak awalkowiak merged commit 591e9b4 into develop Aug 8, 2024
@awalkowiak awalkowiak deleted the OBPIH-6497 branch August 8, 2024 18:56
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 domain: frontend Changes or discussions relating to the frontend UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants