Feat: Attachment, ParentDocumentLine
This commit is contained in:
		| @@ -5,11 +5,12 @@ __all__ = ['AttachedDocument'] | ||||
|  | ||||
| class AttachedDocument(): | ||||
|  | ||||
|     def __init__(self, invoice, id): | ||||
|     def __init__(self, invoice, DIANInvoiceXML, id): | ||||
|         self.schema =\ | ||||
|             'urn:oasis:names:specification:ubl:schema:xsd:AttachedDocument-2' | ||||
|         self.id = id | ||||
|         self.invoice = invoice | ||||
|         self.DIANInvoiceXML = DIANInvoiceXML | ||||
|         self.attached_document_invoice = self.attached_document_invoice() | ||||
|  | ||||
|         # self.fexml.placeholder_for( | ||||
| @@ -43,7 +44,8 @@ class AttachedDocument(): | ||||
|  | ||||
|         # DIAN 1.9.-2023: AE05 | ||||
|         self.fexml.set_element( | ||||
|             './cbc:IssueDate', self.invoice.invoice_issue.strftime('%Y-%m-%d')) | ||||
|             './cbc:IssueDate', | ||||
|             self.invoice.invoice_issue.strftime('%Y-%m-%d')) | ||||
|  | ||||
|         # DIAN 1.9.-2023: AE06 | ||||
|         self.fexml.set_element( | ||||
| @@ -163,11 +165,63 @@ class AttachedDocument(): | ||||
|         # DIAN 1.9.-2023: AE37 | ||||
|         self.fexml.set_element( | ||||
|             './cac:Attachment/cac:ExternalReference/cbc:Description', | ||||
|             ' ') | ||||
|             self._build_attachment(self.DIANInvoiceXML) | ||||
|         ) | ||||
|  | ||||
|     def _build_attachment(self, DIANInvoiceXML): | ||||
|         document = ( | ||||
|             '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' | ||||
|         ) + DIANInvoiceXML.tostring() | ||||
|         attachment = "<![CDATA[{}]]>".format( | ||||
|             document) | ||||
|  | ||||
|         return attachment | ||||
|  | ||||
|     def set_parent_document_line_reference(self): | ||||
|         self.fexml.placeholder_for( | ||||
|             './cac:ParentDocumentLineReference') | ||||
|         self.fexml.set_element( | ||||
|             './cac:ParentDocumentLineReference/cbc:LineID', 1) | ||||
|         self.fexml.placeholder_for( | ||||
|             './cac:ParentDocumentLineReference/cac:DocumentReference') | ||||
|         self.fexml.set_element( | ||||
|             './cac:ParentDocumentLineReference/cac:DocumentReference/cbc:ID', | ||||
|             '1234') | ||||
|         self.fexml.set_element( | ||||
|             './cac:ParentDocumentLineReference/cac:DocumentReference/cbc:UUID', | ||||
|             '1234', | ||||
|             schemeName="CUFE-SHA384") | ||||
|         self.fexml.set_element( | ||||
|             './cac:ParentDocumentLineReference/cac:DocumentReference/cbc:IssueDate', | ||||
|             '2024-11-28') | ||||
|         self.fexml.set_element( | ||||
|             './cac:ParentDocumentLineReference/cac:DocumentReference/cbc:DocumentType', | ||||
|             'ApplicationResponse') | ||||
|         self.fexml.placeholder_for( | ||||
|             './cac:ParentDocumentLineReference/cac:DocumentReference/cac:Attachment') | ||||
|         self.fexml.set_element( | ||||
|             './cac:ParentDocumentLineReference/cac:DocumentReference/cac:Attachment/cac:ExternalReference/cbc:MimeCode', | ||||
|             'text/xml') | ||||
|         self.fexml.set_element( | ||||
|             './cac:ParentDocumentLineReference/cac:DocumentReference/cac:Attachment/cac:ExternalReference/cbc:EncodingCode', | ||||
|             'UTF-8') | ||||
|         self.fexml.set_element( | ||||
|             './cac:ParentDocumentLineReference/cac:DocumentReference/cac:Attachment/cac:ExternalReference/cbc:Description', | ||||
|             ' ') | ||||
|         self.fexml.placeholder_for( | ||||
|             './cac:ParentDocumentLineReference/cac:DocumentReference/cac:ResultOfVerification') | ||||
|         self.fexml.set_element( | ||||
|             './cac:ParentDocumentLineReference/cac:DocumentReference/cac:ResultOfVerification/cbc:ValidatorID', | ||||
|             'Unidad Especial Dirección de Impuestos y Aduanas Nacionales') | ||||
|         self.fexml.set_element( | ||||
|             './cac:ParentDocumentLineReference/cac:DocumentReference/cac:ResultOfVerification/cbc:ValidationResultCode', | ||||
|             '02') | ||||
|         self.fexml.set_element( | ||||
|             './cac:ParentDocumentLineReference/cac:DocumentReference/cac:ResultOfVerification/cbc:ValidationDate', | ||||
|             '2024-11-28') | ||||
|         self.fexml.set_element( | ||||
|             './cac:ParentDocumentLineReference/cac:DocumentReference/cac:ResultOfVerification/cbc:ValidationTime', | ||||
|             '10:35:11-05:00') | ||||
|  | ||||
|     def toFachoXML(self): | ||||
|         return self.fexml | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user