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

Add support for more recent API endpoints #90

Closed
8 of 10 tasks
SchrodingersGat opened this issue May 5, 2022 · 7 comments
Closed
8 of 10 tasks

Add support for more recent API endpoints #90

SchrodingersGat opened this issue May 5, 2022 · 7 comments
Milestone

Comments

@SchrodingersGat
Copy link
Member

SchrodingersGat commented May 5, 2022

Many database actions have now been migrated to the API:

inventree/InvenTree#2253

Some (many) of these could now be supported directly by the Python bindings:

  • Install stock item
  • Uninstall stock item
  • Cancel build order
  • Complete build order
  • Cancel purchase order
  • Complete purchase order
  • Issue purchase order
  • Cancel sales order
  • Complete sales order
  • Ship sales order
@miggland
Copy link
Contributor

miggland commented Jul 25, 2022

I'm working on a PR for these:

  • Cancel build order
  • Complete build order
  • Cancel purchase order
  • Complete purchase order
  • Issue purchase order
  • Cancel sales order
  • Complete sales order
  • Ship sales order

The testing is proving to be a bit finicky, it's hard to know what the status is, especially when running the tests several times consecutively.

Also, the names of the functions/API endpoints is not consistent. I'm not working on the 'complete' API endpoint, as this is for completing outputs, not the total order - which is called finish.

@matmair
Copy link
Member

matmair commented Jul 25, 2022

@miggland if you have suggestions for better names we are very open for that. The easier to understand the better as a German would say ;-)

@SchrodingersGat
Copy link
Member Author

The testing is proving to be a bit finicky, it's hard to know what the status is, especially when running the tests several times consecutively.

Try to ensure that each unit test can run "atomically" - i.e. set the state of the items under test to a known state at the start of the test. This way, other tests won't get in the way.

e.g. here :

# Create some new categories under this one

The unit test ensures that the new categories created are unique, by not hard-coding the names of the categories.

@miggland
Copy link
Contributor

@miggland if you have suggestions for better names we are very open for that. The easier to understand the better as a German would say ;-)

There's only a few which have different names, as below. Changing these would make things more consistent. But, it would also break things..

Action Current API name Suggestion
Cancel build order cancel
Complete build order finish complete
Complete build output complete complete-output
Cancel purchase order cancel
Complete purchase order complete
Issue purchase order issue
Cancel sales order cancel
Complete sales order complete
Ship sales order ship complete

@matmair
Copy link
Member

matmair commented Jul 28, 2022

@miggland great suggestions here. The collisions are hard to solve - would need to be a major release for sure.
@SchrodingersGat would you be interested in a renaming initiative or would you prefer to do other stuff first? I know we are spread thin.

@SchrodingersGat
Copy link
Member Author

@miggland I'd rather not rename any API endpoints, as this will break existing code. We can improve the documentation around the functionality, but I think we are stuck with them.

Note that you can call the python functions something more sensible, and just point to the poorly-named endpoints

@SchrodingersGat SchrodingersGat modified the milestones: 0.8.0, 0.8.1 Jul 29, 2022
@miggland
Copy link
Contributor

Currently, I have added aliases, eg so that 'finish' and 'complete' on a build-order does the same thing. Once I get around to it I'll have another go at the tests (as you suggest, I'll have to make them atomic - just that requires adding an order, parts, assigning, shipping, and then completing the order..

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

No branches or pull requests

3 participants