예제 #1
0
 def Documento(self, vals):
     documentos = []
     for dteDoc in vals:
         for docData in dteDoc.get("documentos", []):
             if not docData.get('sii_xml_request'):
                 docu = Doc(
                             docData,
                             resumen=True
                         )
                 docu.TipoDTE = dteDoc["TipoDTE"]
                 if self.TipoOperacion == 'COMPRA' and \
                 (not docData['Encabezado'].get('Emisor') or \
                  docu._receptor.RUTRecep == self.Emisor.RUTEmisor):
                     new_recep = {
                         'RUTRecep': self.Emisor.RUTEmisor,
                         'RznSocRecep': self.Emisor.RznSoc,
                         'CdgSIISucur': self.Emisor.CdgSIISucur,
                     }
                     new_emis = {
                         'RUTEmisor': docu._receptor.RUTRecep,
                         'RznSoc': docu._receptor.RznSocRecep,
                         'CdgSIISucur': docu._receptor.CdgSIISucur,
                     }
                     docu._dte_emisor = Emisor(new_emis)
                     docu._receptor = Recep(new_recep)
                 documentos.append(docu)
     self._documentos = documentos
예제 #2
0
def procesar_documento(vals):
    firma = Firma(vals["firma_electronica"])
    emisor = Emisor(vals["Emisor"])
    verify = vals.get('verify', True)
    test = vals.get('test', False)
    _documentos = []
    for docs in vals.get('Documento'):
        TipoDTE = docs.get('TipoDTE', 33)
        caf_file = docs.get('caf_file', [])
        for docData in docs["documentos"]:
            docu = Documento(docData, resumen=False)
            docu._dte_emisor = emisor
            docu._firma = firma
            docu.verify = verify
            docu.test = test
            docu.caf_file = caf_file
            docu.TipoDTE = TipoDTE
            _documentos.append(docu)
    return _documentos