feat(#49): add product provenance (suppliers, organizations, geography)

- Country, Department, Municipality models (municipality unique per department)
- Organization and Supplier models, Supplier links to organization and municipality
- Product.suppliers M2M to link products to one or more suppliers
- Authenticated CRUD APIs for organizations, suppliers, countries, departments and municipalities (write only for administrators)
- product_provenance domain data embedded in sale/catalog summaries (public and authenticated)
- seed_geography endpoint (admin, idempotent) and scripts/seed_geography.py using pycountry + DANE municipalities CSV
- TDD tests for models, API permissions/CRUD and summary provenance data
This commit is contained in:
2026-08-15 16:32:20 -05:00
parent b088794716
commit 29d154e140
18 changed files with 1321 additions and 5 deletions

View File

@@ -29,6 +29,13 @@ from .api import (
AdminCodeValidateView,
# Store Settings
StoreSettingsView,
# Provenance
OrganizationView,
SupplierView,
CountryView,
DepartmentView,
MunicipalityView,
SeedGeographyView,
)
app_name = "don_confiao"
@@ -48,6 +55,11 @@ router.register(
ReconciliateJarModelView,
basename="reconciliate_jar",
)
router.register(r"organizations", OrganizationView, basename="organization")
router.register(r"suppliers", SupplierView, basename="supplier")
router.register(r"countries", CountryView, basename="country")
router.register(r"departments", DepartmentView, basename="department")
router.register(r"municipalities", MunicipalityView, basename="municipality")
urlpatterns = [
path("productos", views.products, name="products"),
@@ -109,4 +121,9 @@ urlpatterns = [
),
path("api/sales/for_tryton", SalesForTrytonView.as_view()),
path("api/store_settings", StoreSettingsView.as_view()),
path(
"api/seed_geography",
SeedGeographyView.as_view(),
name="seed_geography",
),
]