Skip to content

OBPIH-6693 fix adjustment invoice statuses#4871

Merged
awalkowiak merged 5 commits intorelease/0.9.2-hotfix1from
feature/OBPIH-6693-fix-adjustment-invoice-statuses
Oct 3, 2024
Merged

OBPIH-6693 fix adjustment invoice statuses#4871
awalkowiak merged 5 commits intorelease/0.9.2-hotfix1from
feature/OBPIH-6693-fix-adjustment-invoice-statuses

Conversation

@drodzewicz
Copy link
Collaborator

@drodzewicz drodzewicz commented Oct 1, 2024

✨ 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: OBPIH-6693

Description:


📷 Screenshots & Recordings (optional)

If this PR contains a UI change, consider adding one or more screenshots here or link to a screen recording to help reviewers visualize the change. Otherwise, you can remove this section.

@drodzewicz drodzewicz self-assigned this Oct 1, 2024
@github-actions github-actions bot added type: feature A new piece of functionality for the app domain: backend Changes or discussions relating to the backend server labels Oct 1, 2024
BigDecimal getInvoicedUnitPrice() {
return invoiceItems?.sum {
if (it.invoice?.isRegularInvoice && !it.inverse) {
if (it.invoice?.datePosted != null && it.invoice?.isRegularInvoice && !it.inverse) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't like it here. This might break the getUnitPriceAvailableToInvoice. I think this should be a separate transient (invoiced unit price on posted invoices)

Copy link
Collaborator

Choose a reason for hiding this comment

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

(as you can see, on the OrderItem there are both quantityInvoiced and postedQuantityInvoiced for the same reason)

@drodzewicz drodzewicz requested a review from awalkowiak October 2, 2024 12:32
return !postedPurchaseInvoiceItems.empty
Boolean getIsFullyInvoiced() {
return Math.abs(unitPriceOnPostedInvoices) >= Math.abs(totalAdjustments)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed the isInvoiced transient because it is not used anywhere anymore and if we will ever need this in the future I think we are going to use the derived status like we use in other domains.

Boolean fullyInvoiced = invoicedUnitPrice == totalAdjustments

if (!isInvoiced) {
if (postedPurchaseInvoiceItems.empty) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add some comments inside this method (especially on the latter ifs checks)? Looking at the ordering of the if checks it overall makes sense and should work now, but I am afraid, that if someone starts adjusting here something, then it might easily get broken.

@drodzewicz drodzewicz requested a review from awalkowiak October 3, 2024 11:28
@awalkowiak awalkowiak merged commit 2630879 into release/0.9.2-hotfix1 Oct 3, 2024
@awalkowiak awalkowiak deleted the feature/OBPIH-6693-fix-adjustment-invoice-statuses branch October 3, 2024 14:42
jwalbers pushed a commit to jwalbers/openboxes that referenced this pull request Oct 29, 2024
jwalbers pushed a commit to jwalbers/openboxes that referenced this pull request Oct 31, 2024
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 type: feature A new piece of functionality for the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants