- Add external_id field to CatalogSale model for tracking synced sales - Create migration 0047 for external_id field - Add TrytonCatalogSale and TrytonCatalogSaleLine classes for Tryton RPC format - Add send_catalog_sales_to_tryton() method to SaleTrytonService - Create CatalogSalesToTrytonView API endpoint (POST) - Register endpoint at /don_confiao/api/enviar_catalog_sales_a_tryton - Add test for external_id field functionality - Catalog sales sync to same Tryton model as Sale (model.sale.sale.create) - Differentiated by reference 'don_confiao_catalog X' and description 'Venta de catálogo' - Filters only catalog sales without external_id to avoid duplicates
92 lines
2.4 KiB
Python
92 lines
2.4 KiB
Python
from django.urls import path, include
|
|
from rest_framework.routers import DefaultRouter
|
|
|
|
from . import views
|
|
from .api import (
|
|
# Products
|
|
ProductView,
|
|
ProductsFromTrytonView,
|
|
# Customers
|
|
CustomerView,
|
|
CustomersFromTrytonView,
|
|
# Sales
|
|
SaleView,
|
|
CatalogSaleView,
|
|
SaleSummary,
|
|
CatalogSaleSummary,
|
|
SalesForTrytonView,
|
|
SalesToTrytonView,
|
|
CatalogSalesToTrytonView,
|
|
# Payments
|
|
ReconciliateJarView,
|
|
ReconciliateJarModelView,
|
|
PaymentMethodView,
|
|
SalesForReconciliationView,
|
|
# Admin
|
|
AdminCodeValidateView,
|
|
)
|
|
|
|
app_name = "don_confiao"
|
|
|
|
router = DefaultRouter()
|
|
router.register(r"sales", SaleView, basename="sale")
|
|
router.register(r"catalog_sales", CatalogSaleView, basename="catalog_sale")
|
|
router.register(r"customers", CustomerView, basename="customer")
|
|
router.register(r"products", ProductView, basename="product")
|
|
router.register(
|
|
r"reconciliate_jar",
|
|
ReconciliateJarModelView,
|
|
basename="reconciliate_jar",
|
|
)
|
|
|
|
urlpatterns = [
|
|
path("productos", views.products, name="products"),
|
|
path(
|
|
"resumen_compra_json/<int:id>",
|
|
SaleSummary.as_view(),
|
|
name="purchase_json_summary",
|
|
),
|
|
path(
|
|
"resumen_compra_catalogo_json/<int:id>",
|
|
CatalogSaleSummary.as_view(),
|
|
name="catalog_purchase_json_summary",
|
|
),
|
|
path(
|
|
"payment_methods/all/select_format",
|
|
PaymentMethodView.as_view(),
|
|
name="payment_methods_to_select",
|
|
),
|
|
path(
|
|
"purchases/for_reconciliation",
|
|
SalesForReconciliationView.as_view(),
|
|
name="sales_for_reconciliation",
|
|
),
|
|
path("reconciliate_jar", ReconciliateJarView.as_view()),
|
|
path("api/", include(router.urls)),
|
|
path(
|
|
"api/importar_productos_de_tryton",
|
|
ProductsFromTrytonView.as_view(),
|
|
name="products_from_tryton",
|
|
),
|
|
path(
|
|
"api/importar_clientes_de_tryton",
|
|
CustomersFromTrytonView.as_view(),
|
|
name="customers_from_tryton",
|
|
),
|
|
path(
|
|
"api/enviar_ventas_a_tryton",
|
|
SalesToTrytonView.as_view(),
|
|
name="send_tryton",
|
|
),
|
|
path(
|
|
"api/enviar_catalog_sales_a_tryton",
|
|
CatalogSalesToTrytonView.as_view(),
|
|
name="send_catalog_sales_tryton",
|
|
),
|
|
path(
|
|
"api/admin_code/validate/<code>",
|
|
AdminCodeValidateView.as_view(),
|
|
),
|
|
path("api/sales/for_tryton", SalesForTrytonView.as_view()),
|
|
]
|