Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OBPIH-6052 validation for zero items to invoice in invoices workflow (post QA) #4509

Conversation

drodzewicz
Copy link
Collaborator

There were missing places where the same validation modal had to appear on invoice creation workflow like:

  • When clicking the previous button
  • when saving
  • when saving & exiting

- added zero items validation dialog on save
- refetch items after save
- added zero items validation on save & exit
- removed items save on Open invoice item cadidates
@drodzewicz drodzewicz self-assigned this Feb 16, 2024
<InvoiceItemsModal
btnOpenText="react.default.button.addLines.label"
btnOpenDefaultText="Add lines"
onOpen={() => saveInvoiceItems(values)}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This onOpen callback would fire a saveItems post request after we opened the dialog for invoice item candidates.
I was looking through PR's and tickets to find the reason behind this logic implementation and was not able to find anything.
It was implemented as part of OBPIH-3614.
To me this looks like a side effect that users might not expect especially with the new logic where we remove rows with 0 quantity.

If I have to leave this callback it would result in following behavior:

  • user ads items
  • user updates some items quantity to 0
  • user opens dialog
  • save items request is sent
  • rows with 0 items disappear
    result: user is confused about what just happened because he did;t click save or anything of sorts.

This looks like a weird side effect that should not happen when opening a dialog and I was not able to figure out any use cases for its existence.
So correct me if I am worng

Copy link
Collaborator

Choose a reason for hiding this comment

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

The case behind this was that when the user had partial invoice quantity, and then revised the quantity to a non-zero value, and then entered back the add items modal. This save prevented wrong invoice item candidate's quantities while coming back to add items and having some revisions in progress. IMHO this still needs to work this way. If you want to avoid confusion, you can show a message, that zeroed items will be removed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok I can bring it back but in my opinion this will be not a pleasant experience for a user.
This looks like a side effect that user might not want to happen.
I will mention this case in the ticket and will want to hear an opinion after UAT.
I would suggest revisitng this case and coming up with some other mechanism or cases, but as part of a different ticket.

<InvoiceItemsModal
btnOpenText="react.default.button.addLines.label"
btnOpenDefaultText="Add lines"
onOpen={() => saveInvoiceItems(values)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The case behind this was that when the user had partial invoice quantity, and then revised the quantity to a non-zero value, and then entered back the add items modal. This save prevented wrong invoice item candidate's quantities while coming back to add items and having some revisions in progress. IMHO this still needs to work this way. If you want to avoid confusion, you can show a message, that zeroed items will be removed.

- display validation dialog before opening invoice item candidates
- added renderButton prop in ModalWrapper for custom button renders
@drodzewicz
Copy link
Collaborator Author

@awalkowiak I brought back this behavior of saving current items before displaying candidates.
Additionally I had to implement some logic to wait for user confirmation "that zero items will be deleted" and only then load the modal which is why I implemented new prop for rendering custom button through renderProps.

@awalkowiak awalkowiak merged commit 746726b into feature/upgrade-to-grails-3.3.10 Feb 19, 2024
2 checks passed
@awalkowiak awalkowiak deleted the OBPIH-6052-validation-for-zero-items-to-invoice-in-invoices-workflow branch February 19, 2024 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants