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

Adding invoice editing functionality to MyFinances #153

Merged
merged 16 commits into from
Dec 13, 2023

Conversation

HarryHuCodes
Copy link
Contributor

@HarryHuCodes HarryHuCodes commented Dec 13, 2023


title: Adding invoice editing functionality to MyFinances

Checklist

  • Ran the Black Formatter on any new code (checks will fail without)
  • [ x ] Made any changes or additions to the documentation where required
  • Changes generate no new warnings/errors
  • New and existing unit tests pass locally with my changes

What type of PR is this?

  • ✨ Feature

Description

Incentive:

  • Before implementing this feature, the invoice dashboard had 3 working actions for users to manage the invoices that they create. We noticed that a user was not yet able to edit an invoice due to the Edit feature being greyed out and incomplete. We took this opportunity to work on this functionality as we felt that this was an important component to have and a good place to start.

What has been done ✔️ :

  • An edit.html page that allows the user to edit existing invoices with changes to fields like self and client information (such as name, company, addresses, ...etc) as well as issue/due dates. The page layout is consistent with that of the create invoice page and contains sub-html pages: edit_to_destination and edit_from_destination.

  • Updated urls.py, _fetch_body.html which stores the path and urlpatterns to invoice actions. Created edit.py with a decorator, view function, and associated methods for updating invoice attributes.

invoice_edit
update_invoice
We tested this in the backend and saw changes take place in the database which reflects the modifications by the user on updating their invoice information.

  • Once editing is complete, the user will be brought back to the invoice dashboard where changes to the due date of invoices will be re-evaluated and payment status will be updated accordingly.

SCREENSHOT showcase:
demoedit
demoedit2

After changing the fields above and extending the due date of the invoice by a year, we get the following:

demoedit3
demoedit4

IDEAS and things to be done:

  • We initially wanted to pre-populate the fields of the edit invoice page with stored data of the existing invoice that the user wishes to modify. Due to time constraints, this still needs to be done. I have made a method to store the attributes of invoice objects in dicts based on invoice id. This can then be passed within the render template parameters to the front end.
  • The default values of fields in edit_to_destination.html and edit_from_destination.html will need to be replaced with values from the dict or json (whichever works here)
  • We noticed a bug with inputting/modifying fields like company and county where changes sometimes do not appear visually in the boxes after a save. This seems to be an existing issue that happens to the create invoice feature as well
  • A user-friendly suggestion would be to allow all fields of edit invoice to be optional. User is NOT required to change anything and they should be able to "update invoice" from edit invoice page without actually modifying anything.

Added/updated tests?

  • 🙅 no, because they aren't needed

Related PRs, Issues etc

  • N/A

Tianrui-Luo and others added 15 commits December 11, 2023 20:15
…on used in urlpatterns path for redirect to edit.html
… pass it to frontend for populating fields during an edit
@TreyWW TreyWW merged commit dccc610 into TreyWW:main Dec 13, 2023
3 checks passed
@TreyWW
Copy link
Owner

TreyWW commented Dec 13, 2023

Thank you @Tianrui-Luo and @HarryHuCodes for this feature. It's a great feature and will really help the Invoice functionality improve. This is a big step and it's great that you guys managed to do it.

Thanks again!

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.

4 participants