Skip to content

Commit

Permalink
[IMP] api: Code improvements and restructuring
Browse files Browse the repository at this point in the history
- Moved the logic of retrieving shipping information from the controller to the sale.order model to improve code maintainability.

- Added the method get_shipping_info in the sale_order.py model to handle the retrieval of detailed shipping information,
including address and picking data. Updated the controller to call the new model method, ensuring a cleaner and more modular
design.

- Added a route to retrieve states by country, which enhances the flexibility of the application in handling different
countries dynamically. Implemented the get_inventory and get_inventory_by_sku methods in the controller to provide
comprehensive inventory data based on SKUs.

- Ensured that __init__.py and __manifest__ files include EOF.

- Get the sales order through the sales order model.

- Combined get_inventory and get_inventory_by_sku endpoints into a single endpoint in the controller. This unified approach
simplifies the API and improves code maintainability. Implemented logic to handle both GET (all products with SKUs) and
POST (specific product by SKU) requests in the same method.

- Refactored the endpoint for scheduling activities related to invoices to use the invoice.activity_schedule method.

These changes improve the modularity, readability, and maintainability of the codebase, making it easier to manage and
extend in the future.

Closes #25
  • Loading branch information
JAntonioSalas committed May 21, 2024
1 parent 3c2e61e commit 107c3ae
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 221 deletions.
3 changes: 2 additions & 1 deletion hantec_api_ecommerce/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

from . import controllers
from . import models
from . import controllers
2 changes: 1 addition & 1 deletion hantec_api_ecommerce/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"installable": True,
"development_status": "Production/Stable",
"maintainers": ["C&O PROJECTS AND SOLUTIONS"],
}
}
2 changes: 1 addition & 1 deletion hantec_api_ecommerce/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

from . import main
from . import main
Loading

0 comments on commit 107c3ae

Please sign in to comment.