se adicionan pruebas para CUFE y otros
FossilOrigin-Name: bac70bcbd3ad003d2df2d06b477914343f370982133f272dce05b75cc6f1da44
This commit is contained in:
		| @@ -74,15 +74,16 @@ class DianXMLExtensionCUFE(FachoXMLExtension): | ||||
|         fachoxml.set_element('/fe:Invoice/cbc:ProfileExecutionID', self._tipo_ambiente()) | ||||
|          | ||||
|     def issue_time(self, datetime_): | ||||
|         return datetime_.strftime('%H:%M:%S%z') | ||||
|         return datetime_.strftime('%H:%M:%S-05:00') | ||||
|      | ||||
|     def issue_date(self, datetime_): | ||||
|         return datetime_.strftime('%Y-%m-%d') | ||||
|  | ||||
|     def _generate_cufe(self, invoice, fachoxml): | ||||
|     def formatVars(self, invoice): | ||||
|         NumFac = invoice.invoice_ident | ||||
|         FecFac = self.issue_date(invoice.invoice_issue) | ||||
|         HoraFac = self.issue_time(invoice.invoice_issue) | ||||
|         ValorBruto = invoice.invoice_legal_monetary_total.line_extension_amount | ||||
|         ValorBruto = invoice.invoice_legal_monetary_total.tax_exclusive_amount | ||||
|         ValorTotalPagar = invoice.invoice_legal_monetary_total.payable_amount | ||||
|         ValorImpuestoPara = {} | ||||
|         ValorImpuesto1 = 0.0 | ||||
| @@ -103,7 +104,7 @@ class DianXMLExtensionCUFE(FachoXMLExtension): | ||||
|         TipoAmb = self._tipo_ambiente() | ||||
|         ClTec = str(self.clave_tecnica) | ||||
|          | ||||
|         formatVars = [ | ||||
|         return [ | ||||
|             '%s' % NumFac, | ||||
|             '%s' % FecFac, | ||||
|             '%s' % HoraFac, | ||||
| @@ -120,6 +121,9 @@ class DianXMLExtensionCUFE(FachoXMLExtension): | ||||
|             '%s' % ClTec, | ||||
|             '%d' % TipoAmb, | ||||
|         ] | ||||
|  | ||||
|     def _generate_cufe(self, invoice, fachoxml): | ||||
|         formatVars = self.formatVars(invoice) | ||||
|         cufe = "".join(formatVars) | ||||
|  | ||||
|         # crear hash... | ||||
|   | ||||
| @@ -232,7 +232,7 @@ class Invoice: | ||||
|             self.invoice_legal_monetary_total.line_extension_amount += invline.total_amount | ||||
|             self.invoice_legal_monetary_total.tax_exclusive_amount += invline.total_tax_exclusive_amount | ||||
|             self.invoice_legal_monetary_total.tax_inclusive_amount += invline.total_tax_inclusive_amount | ||||
|             self.invoice_legal_monetary_total.charge_total_amount += invline.total_amount | ||||
|             self.invoice_legal_monetary_total.charge_total_amount += invline.tax_amount | ||||
|         #self.invoice_legal_monetary_total.payable_amount = self.invoice_legal_monetary_total.tax_exclusive_amount \ | ||||
|         #    + self.invoice_legal_monetary_total.line_extension_amount \ | ||||
|         #    + self.invoice_legal_monetary_total.tax_inclusive_amount | ||||
| @@ -268,6 +268,11 @@ class DianResolucion0001Validator: | ||||
|         except KeyError: | ||||
|             self.errors.append(('invoice', 'operation_type', | ||||
|                                 'not found %s' % (invoice.invoice_operation_type))) | ||||
|  | ||||
|         # MACHETE se espera en zona horario colombia | ||||
|         if invoice.invoice_issue.tzname() not in ['UTC-05:00', '-05', None]: | ||||
|             self.errors.append(('invoice', 'invoice_issue', | ||||
|                                 'expected timezone UTC-05:00 or -05 or empty got %s' % (invoice.invoice_issue.tzname()))) | ||||
|              | ||||
|     def validate(self, invoice): | ||||
|         invoice.accept(self) | ||||
| @@ -437,7 +442,6 @@ class DIANInvoiceXML(fe.FeXML): | ||||
|         """adiciona etiquetas a FEXML y retorna FEXML | ||||
|         en caso de fallar validacion retorna None""" | ||||
|  | ||||
|         invoice.calculate() | ||||
|         fexml.placeholder_for('/fe:Invoice/ext:UBLExtensions') | ||||
|         fexml.set_element('/fe:Invoice/cbc:UBLVersionID', 'UBL 2.1') | ||||
|         fexml.set_element('/fe:Invoice/cbc:CustomizationID', invoice.invoice_operation_type) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user