Skip to content

Error en el formulario de TaxPayer en referencia a certificate #173

Open
@gusarg81

Description

No estoy seguro si yo estoy cometiendo un error acá, pero como en cualquier formulario donde exista FILES, no tengo este tipo de errores al guardar (haya o no modificado el formulario).

Sin embargo en el formulario de TaxPayer que utilizo (nada custom, directo con ModelForm), al aplicar save() en el view (por más que no haya cambios en dicho formulario), me arroja:

Traceback (most recent call last):
File "/home/gustavo/Desarrollo/Web/eBiller/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/home/gustavo/Desarrollo/Web/eBiller/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/gustavo/Desarrollo/Web/eBiller/ebiller/apps/management/views_settings.py", line 130, in settings_taxpayer_admin
taxpayer = taxpayer_form.save()
File "/home/gustavo/Desarrollo/Web/eBiller/venv/lib/python3.10/site-packages/django/forms/models.py", line 548, in save
self.instance.save()
File "/home/gustavo/Desarrollo/Web/eBiller/venv/lib/python3.10/site-packages/django/db/models/base.py", line 812, in save
self.save_base(
File "/home/gustavo/Desarrollo/Web/eBiller/venv/lib/python3.10/site-packages/django/db/models/base.py", line 847, in save_base
pre_save.send(
File "/home/gustavo/Desarrollo/Web/eBiller/venv/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 176, in send
return [
File "/home/gustavo/Desarrollo/Web/eBiller/venv/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 177, in
(receiver, receiver(signal=self, sender=sender, **named))
File "/home/gustavo/Desarrollo/Web/eBiller/venv/lib/python3.10/site-packages/django_afip/signals.py", line 11, in update_certificate_expiration
instance.certificate_expiration = instance.get_certificate_expiration()
File "/home/gustavo/Desarrollo/Web/eBiller/venv/lib/python3.10/site-packages/django_afip/models.py", line 423, in get_certificate_expiration
cert = self.certificate_object
File "/home/gustavo/Desarrollo/Web/eBiller/venv/lib/python3.10/site-packages/django_afip/models.py", line 412, in certificate_object
self.certificate.seek(0)
File "/home/gustavo/Desarrollo/Web/eBiller/venv/lib/python3.10/site-packages/django/core/files/utils.py", line 46, in
seek = property(lambda self: self.file.seek)
File "/home/gustavo/Desarrollo/Web/eBiller/venv/lib/python3.10/site-packages/django/db/models/fields/files.py", line 47, in _get_file
self._file = self.storage.open(self.name, "rb")
File "/home/gustavo/Desarrollo/Web/eBiller/venv/lib/python3.10/site-packages/django/core/files/storage.py", line 40, in open
return self._open(name, mode)
File "/home/gustavo/Desarrollo/Web/eBiller/venv/lib/python3.10/site-packages/django/core/files/storage.py", line 276, in _open
return File(open(self.path(name), mode))
FileNotFoundError: [Errno 2] No such file or directory: '/home/gustavo/Desarrollo/Web/eBiller/ebiller/media/eBiller.crt'

El tema acá, más allá de que no estoy seguro por qué el error, es que la ruta del certificado es incorrecto acorde a lo que arroja la excepción FileNotFoundError (cuando en realidad es "/home/gustavo/Desarrollo/Web/eBiller/ebiller/media/afip/taxpayers/certs/eBiller.crt").

¿Qué estoy haciendo mal? ¿Mejor detectar los cambios de este formulario al guardar?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions