Add Tryton synchronization for CatalogSale
- 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
This commit is contained in:
@@ -7,6 +7,7 @@ from .sales import (
|
||||
CatalogSaleSummary,
|
||||
SalesForTrytonView,
|
||||
SalesToTrytonView,
|
||||
CatalogSalesToTrytonView,
|
||||
)
|
||||
from .payments import (
|
||||
ReconciliateJarView,
|
||||
@@ -31,6 +32,7 @@ __all__ = [
|
||||
"CatalogSaleSummary",
|
||||
"SalesForTrytonView",
|
||||
"SalesToTrytonView",
|
||||
"CatalogSalesToTrytonView",
|
||||
# Payments
|
||||
"ReconciliateJarView",
|
||||
"ReconciliateJarModelView",
|
||||
|
||||
@@ -100,3 +100,13 @@ class SalesToTrytonView(APIView):
|
||||
service = SaleTrytonService(tryton_client)
|
||||
result = service.send_to_tryton()
|
||||
return Response(result, status=200)
|
||||
|
||||
|
||||
class CatalogSalesToTrytonView(APIView):
|
||||
permission_classes = [IsAuthenticated, IsAdministrator]
|
||||
|
||||
def post(self, request):
|
||||
tryton_client = get_tryton_client()
|
||||
service = SaleTrytonService(tryton_client)
|
||||
result = service.send_catalog_sales_to_tryton()
|
||||
return Response(result, status=200)
|
||||
|
||||
Reference in New Issue
Block a user