Skip to content

OBPIH-6499 Do not create inverse items for order item and adjustment …#4795

Merged
awalkowiak merged 1 commit intofeature/OBPIH-6398-partial-invoices-for-prepaid-pofrom
OBPIH-6499-fix-NPE
Aug 21, 2024
Merged

OBPIH-6499 Do not create inverse items for order item and adjustment …#4795
awalkowiak merged 1 commit intofeature/OBPIH-6398-partial-invoices-for-prepaid-pofrom
OBPIH-6499-fix-NPE

Conversation

@awalkowiak
Copy link
Collaborator

@awalkowiak awalkowiak commented Aug 20, 2024

…if there is no prepayment

✨ Description of Change

A concise summary of what is being changed. Please provide enough context for reviewers to be able to understand the change and why it is necessary. If the issue/ticket already provides enough information, you can put "See ticket" as the description.

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

Description:
Improvement in generating inverse items (I already skipped generating inverse items for shipment items if there is not prepayment, but I forgot about order items and adjustment)


📈 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 20, 2024
OrderItem orderItem = shipmentItem.orderItems?.find { it }
BigDecimal prepaymentPercent = (orderItem.order.paymentTerm?.prepaymentPercent ?: Constants.DEFAULT_PAYMENT_PERCENT) / 100
InvoiceItem prepaymentItem = orderItem.invoiceItems.find { it.isPrepaymentInvoice }
if (!prepaymentItem) {
Copy link
Member

Choose a reason for hiding this comment

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

is it even possible to get to this point and there not be a prepaymentItem? Anyways, even if it's impossible, there's nothing wrong with having this additional check.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, the case is when you cancel item or adjustment before generating prepayment invoice and the uncanel them. This item is then available to invoice on final invoice but it was not prepaid so we can try to create an inverse

@awalkowiak awalkowiak merged commit 28345aa into feature/OBPIH-6398-partial-invoices-for-prepaid-po Aug 21, 2024
@awalkowiak awalkowiak deleted the OBPIH-6499-fix-NPE branch August 21, 2024 07:52
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.

2 participants