Skip to content

Instantly share code, notes, and snippets.

@minostro
Created September 27, 2017 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minostro/e6d3f43ce0112d29f26ab183e6d71d06 to your computer and use it in GitHub Desktop.
Save minostro/e6d3f43ce0112d29f26ab183e6d71d06 to your computer and use it in GitHub Desktop.
Generate Nubox Document
from facturacion.models import DocumentoContable
from utils.nubox import actions as nubox_actions
from settings import FACTURACION_CSV_DIR, FACTURACION_PDF_DIR
from utils.nubox.client import Client
documento_contable = DocumentoContable.objects.get(id=1/0)
documento_map = documento_contable.print_repr()
extended_document = nubox_actions.create_extended_document(documento_map)
csv_filename = "documento_contable_{0}.csv".format(documento_contable.id)
csv_filepath = "{0}/{1}".format(FACTURACION_CSV_DIR, csv_filename)
nubox_actions.create_csv_file(csv_filepath, extended_document)
client = Client()
client.autenticar()
identificador = client.generar_documento(open(csv_filepath))
nubox_actions.create_documento_legal(documento_contable, identificador, csv_filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment