minor changes in validate RFC view
This commit is contained in:
@@ -11,8 +11,6 @@ def Custom_is_staff_function(user):
|
|||||||
if user.is_staff:
|
if user.is_staff:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def is_staff_access(view_to_return="index"):
|
def is_staff_access(view_to_return="index"):
|
||||||
def decorator(view):
|
def decorator(view):
|
||||||
@wraps(view)
|
@wraps(view)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ from .forms import ClienteForm,EmailForm
|
|||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.permissions import IsAuthenticated
|
from rest_framework.permissions import IsAuthenticated
|
||||||
|
from rest_framework import status
|
||||||
|
|
||||||
#EXCEL
|
#EXCEL
|
||||||
from openpyxl import Workbook
|
from openpyxl import Workbook
|
||||||
@@ -387,7 +388,7 @@ def PACS_Retrive_RFCS(request):
|
|||||||
|
|
||||||
#-----------------------------------API VIEWS
|
#-----------------------------------API VIEWS
|
||||||
#--------------------------------------------
|
#--------------------------------------------
|
||||||
from rest_framework import status
|
|
||||||
class check_RFC(APIView):
|
class check_RFC(APIView):
|
||||||
permission_classes = (IsAuthenticated,)
|
permission_classes = (IsAuthenticated,)
|
||||||
def get(self,request):
|
def get(self,request):
|
||||||
@@ -395,11 +396,14 @@ class check_RFC(APIView):
|
|||||||
try:
|
try:
|
||||||
cliente, created = Clientes.objects.get_or_create(RFC=rfc)
|
cliente, created = Clientes.objects.get_or_create(RFC=rfc)
|
||||||
serializer = ClienteSerializer(cliente)
|
serializer = ClienteSerializer(cliente)
|
||||||
if not serializer.is_valid:
|
|
||||||
return Response(serializer.errors,status=400)
|
|
||||||
if created:
|
if created:
|
||||||
cliente.Activo=True
|
cliente.Activo=True
|
||||||
cliente.save()
|
cliente.save()
|
||||||
|
|
||||||
|
if not serializer.is_valid:
|
||||||
|
return Response(serializer.errors,status=400)
|
||||||
|
|
||||||
return Response(serializer.data)
|
return Response(serializer.data)
|
||||||
except Exception as E:
|
except Exception as E:
|
||||||
return Response({'Error':f'check_RFC:{E} RFC:{rfc}','isError':True})
|
return Response({'Error':f'check_RFC:{E} RFC:{rfc}','isError':True})
|
||||||
@@ -415,15 +419,8 @@ class add_timbre2(APIView):
|
|||||||
tipo=request.GET.get('tipo', None)
|
tipo=request.GET.get('tipo', None)
|
||||||
rfcp=request.GET.get('rfcp', None)
|
rfcp=request.GET.get('rfcp', None)
|
||||||
modo=request.GET.get('modo', None)
|
modo=request.GET.get('modo', None)
|
||||||
obj={
|
obj={'uuid':uuid,'rfcc':rfcc,'fecha':fecha,'folio':folio,
|
||||||
'uuid':uuid,
|
'serie':serie,'tipo':tipo,'rfcp':rfcp,'modo':modo
|
||||||
'rfcc':rfcc,
|
|
||||||
'fecha':fecha,
|
|
||||||
'folio':folio,
|
|
||||||
'serie':serie,
|
|
||||||
'tipo':tipo,
|
|
||||||
'rfcp':rfcp,
|
|
||||||
'modo':modo
|
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
obj = Timbres.objects.create(**obj)
|
obj = Timbres.objects.create(**obj)
|
||||||
|
|||||||
@@ -23,9 +23,13 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
|||||||
<a data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
|
<a data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
|
||||||
Total x mes
|
Total x mes
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<small>
|
||||||
<strong>
|
<strong>
|
||||||
<small>Filtrado: Mes:{{mes}}, Año:{{year}}, PAC:<label id="lbl_pac"></label></small>
|
Filtrado: Mes:{{mes}}, Año:{{year}}, PAC:<label id="lbl_pac"></label>
|
||||||
</strong>
|
</strong>
|
||||||
|
</small>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div style="display:none;" id="spinner_id" class="spinner-border ml-auto spinner-border-sm" role="status" aria-hidden="true"></div>
|
<div style="display:none;" id="spinner_id" class="spinner-border ml-auto spinner-border-sm" role="status" aria-hidden="true"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -40,7 +44,6 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
|||||||
<select style="display:inline" id="table_select_anio" class="form-control form-control-sm">
|
<select style="display:inline" id="table_select_anio" class="form-control form-control-sm">
|
||||||
<!--option value="0"></option-->
|
<!--option value="0"></option-->
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--MESES-->
|
<!--MESES-->
|
||||||
<select id="table_select" class="form-control form-control-sm">
|
<select id="table_select" class="form-control form-control-sm">
|
||||||
<option value="01">Enero</option>
|
<option value="01">Enero</option>
|
||||||
@@ -158,10 +161,8 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id='id_filters' style="display: none;">{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}</div>
|
<div id='id_filters' style="display: none;">{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}</div>
|
||||||
|
<!-- Modal EMAIL-->
|
||||||
|
<div class="modal fade" data-backdrop="static" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||||
<!-- Modal EMAIL-->
|
|
||||||
<div class="modal fade" data-backdrop="static" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
|
||||||
<form enctype="multipart/form-data" id="id_form" action="{% url 'send_timbres_Email' %}?mes={{mes}}{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}" method="post">
|
<form enctype="multipart/form-data" id="id_form" action="{% url 'send_timbres_Email' %}?mes={{mes}}{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
@@ -221,10 +222,10 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Modal LISTA EMAILS-->
|
<!-- Modal LISTA EMAILS-->
|
||||||
<div class="modal fade bd-example-modal-lg" id="exampleModalCenter2" tabindex="-1" role="contentinfo" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
<div class="modal fade bd-example-modal-lg" id="exampleModalCenter2" tabindex="-1" role="contentinfo" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||||
<div class="modal-dialog modal-lg" role="document">
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@@ -253,7 +254,7 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
@@ -472,5 +473,4 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
|||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% endblock scripts %}
|
{% endblock scripts %}
|
||||||
Reference in New Issue
Block a user