Skip to content

OBPIH-6690 Add option to edit unit price on invoice items made from order adjustments (fix after QA)#4849

Merged
awalkowiak merged 1 commit intorelease/0.9.2-hotfix1from
OBPIH-6690-3
Sep 20, 2024
Merged

OBPIH-6690 Add option to edit unit price on invoice items made from order adjustments (fix after QA)#4849
awalkowiak merged 1 commit intorelease/0.9.2-hotfix1from
OBPIH-6690-3

Conversation

@alannadolny
Copy link
Collaborator

No description provided.

@alannadolny alannadolny self-assigned this Sep 19, 2024
@github-actions github-actions bot added domain: frontend Changes or discussions relating to the frontend UI domain: backend Changes or discussions relating to the backend server labels Sep 19, 2024
inverse: inverse,
isCanceled: orderItem?.canceled ?: orderAdjustment?.canceled,
quantityAvailableToInvoice: quantityAvailableToInvoice,
amountAvailableToInvoice: orderAdjustment?.amountAvailableToInvoice,
Copy link
Member

Choose a reason for hiding this comment

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

do we only need this field for adjustments? It'll be null for regular invoice items. I know these are just for display but intuitively it feels like both fields should work for both cases (with quantity being 1 or 0 for adjustments).

All these fields are starting to feel confusing to me... Shouldn't amountAvailableToInvoice be based on the amount field? Maybe a transient would apply best here (though I think this class is starting to get overloaded with those).

Copy link
Collaborator

Choose a reason for hiding this comment

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

do we only need this field for adjustments? It'll be null for regular invoice items. I know these are just for display but intuitively it feels like both fields should work for both cases (with quantity being 1 or 0 for adjustments).

This is InvoiceItem's toJson. So in reality this handles all cases, not only adjustments

All these fields are starting to feel confusing to me... Shouldn't amountAvailableToInvoice be based on the amount field? Maybe a transient would apply best here (though I think this class is starting to get overloaded with those).

Yeah this might be confusing, the unit price and amount for order adjustments, but I would say those two are the same (potentially only differs with sign). So perhaps it is misleading in some places. Tomorrow I'll take a deeper look at the partial invoicing of adjustments, if there is some potential for some simplification.

Copy link
Member

Choose a reason for hiding this comment

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

This is InvoiceItem's toJson. So in reality this handles all cases, not only adjustments

So we'd need amountAvailableToInvoice to look at the shipment or order item as well then right?

Yeah this might be confusing, the unit price and amount for order adjustments, but I would say those two are the same (potentially only differs with sign). So perhaps it is misleading in some places. Tomorrow I'll take a deeper look at the partial invoicing of adjustments, if there is some potential for some simplification.

Sounds good!

Copy link
Collaborator

Choose a reason for hiding this comment

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

So we'd need amountAvailableToInvoice to look at the shipment or order item as well then right?

We're not allowing direct amount update on non-adjustment related items

const validateUnitPrice = (row) => {
if (row?.unitPrice === 0 || Math.abs(row?.unitPrice) > Math.abs(row?.amount)) {
const amountAvailableToInvoice =
Math.abs(row?.amountAvailableToInvoice) + Math.abs(row?.amount);
Copy link
Member

Choose a reason for hiding this comment

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

why plus?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is a case where we have "amount available outside this invoice item" plus "amount from this item" to determine full available amount

Copy link
Member

Choose a reason for hiding this comment

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

I just thought it'd be amount available to invoice = current amount available to invoice - amount we're invoicing for in this row

@awalkowiak awalkowiak merged commit 7d3b12c into release/0.9.2-hotfix1 Sep 20, 2024
@awalkowiak awalkowiak deleted the OBPIH-6690-3 branch September 20, 2024 08:04
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 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