se adiciona requeridos por Trabajador
FossilOrigin-Name: 89012ae06fd60e69b9432618c9338094c0c2020651cb315ad151013ba00567af
This commit is contained in:
		
							
								
								
									
										44
									
								
								facho/fe/data/dian/codelist/SubTipoTrabajador-2.1.gc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								facho/fe/data/dian/codelist/SubTipoTrabajador-2.1.gc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,44 @@ | |||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <!-- | ||||||
|  |      creado por facho, la dian tiene oficial? | ||||||
|  |      poblar usando anexo tecnico 5.5.4 | ||||||
|  | --> | ||||||
|  | <gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/"> | ||||||
|  | 	<Identification> | ||||||
|  | 		<ShortName>SubTipoTrabajador</ShortName> | ||||||
|  | 		<LongName xml:lang="es">Sub tipos de trabajador</LongName> | ||||||
|  | 		<Version>1</Version> | ||||||
|  | 	</Identification> | ||||||
|  | 	<ColumnSet> | ||||||
|  | 		<Column Id="code" Use="required"> | ||||||
|  | 			<ShortName>Code</ShortName> | ||||||
|  | 			<Data Type="normalizedString"/> | ||||||
|  | 		</Column> | ||||||
|  | 		<Column Id="name" Use="required"> | ||||||
|  | 			<ShortName>Nombre</ShortName> | ||||||
|  | 			<Data Type="normalizedString"/> | ||||||
|  | 		</Column> | ||||||
|  | 		<Key Id="codeKey"> | ||||||
|  | 			<ShortName>CodeKey</ShortName> | ||||||
|  | 			<ColumnRef Ref="code"/> | ||||||
|  | 		</Key> | ||||||
|  | 	</ColumnSet> | ||||||
|  | 	<SimpleCodeList> | ||||||
|  | 		<Row> | ||||||
|  | 			<Value ColumnRef="code"> | ||||||
|  | 				<SimpleValue>00</SimpleValue> | ||||||
|  | 			</Value> | ||||||
|  | 			<Value ColumnRef="name"> | ||||||
|  | 				<SimpleValue>No Aplica</SimpleValue> | ||||||
|  | 			</Value> | ||||||
|  | 		</Row> | ||||||
|  | 		<Row> | ||||||
|  | 			<Value ColumnRef="code"> | ||||||
|  | 				<SimpleValue>01</SimpleValue> | ||||||
|  | 			</Value> | ||||||
|  | 			<Value ColumnRef="name"> | ||||||
|  | 				<SimpleValue>Dependiente pensionado por vejez activo</SimpleValue> | ||||||
|  | 			</Value> | ||||||
|  | 		</Row> | ||||||
|  |         </SimpleCodeList> | ||||||
|  | </gc:CodeList> | ||||||
							
								
								
									
										36
									
								
								facho/fe/data/dian/codelist/TipoContrato-2.1.gc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								facho/fe/data/dian/codelist/TipoContrato-2.1.gc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | |||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <!-- | ||||||
|  |      creado por facho, la dian tiene oficial? | ||||||
|  |      poblar usando anexo tecnico 5.5.2 | ||||||
|  | --> | ||||||
|  | <gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/"> | ||||||
|  | 	<Identification> | ||||||
|  | 		<ShortName>TipoContrato</ShortName> | ||||||
|  | 		<LongName xml:lang="es">Tipos de contratos</LongName> | ||||||
|  | 		<Version>1</Version> | ||||||
|  | 	</Identification> | ||||||
|  | 	<ColumnSet> | ||||||
|  | 		<Column Id="code" Use="required"> | ||||||
|  | 			<ShortName>Code</ShortName> | ||||||
|  | 			<Data Type="normalizedString"/> | ||||||
|  | 		</Column> | ||||||
|  | 		<Column Id="name" Use="required"> | ||||||
|  | 			<ShortName>Nombre</ShortName> | ||||||
|  | 			<Data Type="normalizedString"/> | ||||||
|  | 		</Column> | ||||||
|  | 		<Key Id="codeKey"> | ||||||
|  | 			<ShortName>CodeKey</ShortName> | ||||||
|  | 			<ColumnRef Ref="code"/> | ||||||
|  | 		</Key> | ||||||
|  | 	</ColumnSet> | ||||||
|  | 	<SimpleCodeList> | ||||||
|  | 		<Row> | ||||||
|  | 			<Value ColumnRef="code"> | ||||||
|  | 				<SimpleValue>1</SimpleValue> | ||||||
|  | 			</Value> | ||||||
|  | 			<Value ColumnRef="name"> | ||||||
|  | 				<SimpleValue>Termino Fijo</SimpleValue> | ||||||
|  | 			</Value> | ||||||
|  | 		</Row> | ||||||
|  |         </SimpleCodeList> | ||||||
|  | </gc:CodeList> | ||||||
							
								
								
									
										36
									
								
								facho/fe/data/dian/codelist/TipoTrabajador-2.1.gc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								facho/fe/data/dian/codelist/TipoTrabajador-2.1.gc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | |||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <!-- | ||||||
|  |      creado por facho, la dian tiene oficial? | ||||||
|  |      poblar usando anexo tecnico 5.5.3 | ||||||
|  | --> | ||||||
|  | <gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/"> | ||||||
|  | 	<Identification> | ||||||
|  | 		<ShortName>TipoTrabajador</ShortName> | ||||||
|  | 		<LongName xml:lang="es">Tipos de trabajadores</LongName> | ||||||
|  | 		<Version>1</Version> | ||||||
|  | 	</Identification> | ||||||
|  | 	<ColumnSet> | ||||||
|  | 		<Column Id="code" Use="required"> | ||||||
|  | 			<ShortName>Code</ShortName> | ||||||
|  | 			<Data Type="normalizedString"/> | ||||||
|  | 		</Column> | ||||||
|  | 		<Column Id="name" Use="required"> | ||||||
|  | 			<ShortName>Nombre</ShortName> | ||||||
|  | 			<Data Type="normalizedString"/> | ||||||
|  | 		</Column> | ||||||
|  | 		<Key Id="codeKey"> | ||||||
|  | 			<ShortName>CodeKey</ShortName> | ||||||
|  | 			<ColumnRef Ref="code"/> | ||||||
|  | 		</Key> | ||||||
|  | 	</ColumnSet> | ||||||
|  | 	<SimpleCodeList> | ||||||
|  | 		<Row> | ||||||
|  | 			<Value ColumnRef="code"> | ||||||
|  | 				<SimpleValue>01</SimpleValue> | ||||||
|  | 			</Value> | ||||||
|  | 			<Value ColumnRef="name"> | ||||||
|  | 				<SimpleValue>Dependiente</SimpleValue> | ||||||
|  | 			</Value> | ||||||
|  | 		</Row> | ||||||
|  |         </SimpleCodeList> | ||||||
|  | </gc:CodeList> | ||||||
| @@ -12,9 +12,6 @@ class CodeList: | |||||||
|         self.short_name = '' |         self.short_name = '' | ||||||
|         self.long_name = '' |         self.long_name = '' | ||||||
|         self.version = 1 |         self.version = 1 | ||||||
|         self.canonical_uri = '' |  | ||||||
|         self.canonical_version_uri = '' |  | ||||||
|         self.location_uri = '' |  | ||||||
|  |  | ||||||
|         self.name_column = name_column |         self.name_column = name_column | ||||||
|         self.rows = {} |         self.rows = {} | ||||||
| @@ -27,9 +24,6 @@ class CodeList: | |||||||
|         self.short_name = tree.find('./Identification/ShortName').text |         self.short_name = tree.find('./Identification/ShortName').text | ||||||
|         self.long_name = tree.find('./Identification/LongName').text |         self.long_name = tree.find('./Identification/LongName').text | ||||||
|         self.version = tree.find('./Identification/Version').text |         self.version = tree.find('./Identification/Version').text | ||||||
|         self.canonical_uri = tree.find('./Identification/CanonicalUri').text |  | ||||||
|         self.canonical_version_uri = tree.find('./Identification/CanonicalVersionUri').text |  | ||||||
|         self.location_uri = tree.find('./Identification/LocationUri').text |  | ||||||
|  |  | ||||||
|         #obtener registros... |         #obtener registros... | ||||||
|         for row in tree.findall('./SimpleCodeList/Row'): |         for row in tree.findall('./SimpleCodeList/Row'): | ||||||
| @@ -101,3 +95,6 @@ Paises = CodeList(path_for_codelist('Paises-2.1.gc'), 'code', 'name') | |||||||
| TipoIdFiscal = CodeList(path_for_codelist('TipoIdFiscal-2.1.gc'), 'code', 'name') | TipoIdFiscal = CodeList(path_for_codelist('TipoIdFiscal-2.1.gc'), 'code', 'name') | ||||||
| CodigoDescuento = CodeList(path_for_codelist('CodigoDescuento-2.1.gc'), 'code', 'name') | CodigoDescuento = CodeList(path_for_codelist('CodigoDescuento-2.1.gc'), 'code', 'name') | ||||||
| UnidadesMedida = CodeList(path_for_codelist('UnidadesMedida-2.1.gc'), 'code', 'name') | UnidadesMedida = CodeList(path_for_codelist('UnidadesMedida-2.1.gc'), 'code', 'name') | ||||||
|  | TipoTrabajador = CodeList(path_for_codelist('TipoTrabajador-2.1.gc'), 'code', 'name') | ||||||
|  | SubTipoTrabajador = CodeList(path_for_codelist('SubTipoTrabajador-2.1.gc'), 'code', 'name') | ||||||
|  | TipoContrato = CodeList(path_for_codelist('TipoContrato-2.1.gc'), 'code', 'name') | ||||||
|   | |||||||
| @@ -10,6 +10,7 @@ import hashlib | |||||||
|  |  | ||||||
| from .. import fe | from .. import fe | ||||||
| from .. import form | from .. import form | ||||||
|  | from ..data.dian import codelist | ||||||
|  |  | ||||||
| from .devengado import * | from .devengado import * | ||||||
| from .deduccion import * | from .deduccion import * | ||||||
| @@ -129,13 +130,115 @@ class Empleador: | |||||||
|                                 Direccion = self.direccion |                                 Direccion = self.direccion | ||||||
|                                 ) |                                 ) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | @dataclass | ||||||
|  | class TipoTrabajador: | ||||||
|  |     code: str | ||||||
|  |     name: str = '' | ||||||
|  |  | ||||||
|  |     def __post_init__(self): | ||||||
|  |         if self.code not in codelist.TipoTrabajador: | ||||||
|  |             raise ValueError("code [%s] not found" % (self.code)) | ||||||
|  |         self.name = codelist.TipoTrabajador[self.code]['name'] | ||||||
|  |  | ||||||
|  | @dataclass | ||||||
|  | class SubTipoTrabajador: | ||||||
|  |     code: str | ||||||
|  |     name: str = '' | ||||||
|  |  | ||||||
|  |     def __post_init__(self): | ||||||
|  |         if self.code not in codelist.SubTipoTrabajador: | ||||||
|  |             raise ValueError("code [%s] not found" % (self.code)) | ||||||
|  |         self.name = codelist.SubTipoTrabajador[self.code]['name'] | ||||||
|  |  | ||||||
|  | @dataclass | ||||||
|  | class TipoDocumento: | ||||||
|  |     code: str | ||||||
|  |     name: str = '' | ||||||
|  |  | ||||||
|  |     def __post_init__(self): | ||||||
|  |         if self.code not in codelist.TipoIdFiscal: | ||||||
|  |             raise ValueError("code [%s] not found" % (self.code)) | ||||||
|  |         self.name = codelist.TipoIdFiscal[self.code]['name'] | ||||||
|  |  | ||||||
|  | @dataclass | ||||||
|  | class TipoContrato: | ||||||
|  |     code: str | ||||||
|  |     name: str = '' | ||||||
|  |  | ||||||
|  |     def __post_init__(self): | ||||||
|  |         if self.code not in codelist.TipoContrato: | ||||||
|  |             raise ValueError("code [%s] not found" % (self.code)) | ||||||
|  |         self.name = codelist.TipoContrato[self.code]['name'] | ||||||
|  |  | ||||||
|  | @dataclass | ||||||
|  | class LugarTrabajo: | ||||||
|  |     pais: Pais | ||||||
|  |     departamento: Departamento | ||||||
|  |     municipio: Municipio | ||||||
|  |     direccion: str | ||||||
|  |  | ||||||
| @dataclass | @dataclass | ||||||
| class Trabajador: | class Trabajador: | ||||||
|  |     tipo_contrato: TipoContrato | ||||||
|  |     tipo_documento: TipoDocumento | ||||||
|     numero_documento: str |     numero_documento: str | ||||||
|  |  | ||||||
|  |     primer_apellido: str | ||||||
|  |     segundo_apellido: str | ||||||
|  |     primer_nombre: str | ||||||
|  |  | ||||||
|  |     lugar_trabajo: LugarTrabajo | ||||||
|  |     alto_riesgo: bool | ||||||
|  |     salario_integral: bool | ||||||
|  |     sueldo: Amount | ||||||
|  |  | ||||||
|  |     tipo: TipoTrabajador | ||||||
|  |  | ||||||
|  |     codigo_trabajador: str = None | ||||||
|  |     otros_nombres: str = None | ||||||
|  |     sub_tipo: SubTipoTrabajador = SubTipoTrabajador(code='00') | ||||||
|  |  | ||||||
|     def apply(self, fragment): |     def apply(self, fragment): | ||||||
|         fragment.set_attributes('./Trabajador', |         fragment.set_attributes('./Trabajador', | ||||||
|                                 NumeroDocumento = self.numero_documento) |                                 # NIE041 | ||||||
|  |                                 TipoTrabajador = self.tipo.code, | ||||||
|  |                                 # NIE042 | ||||||
|  |                                 SubTipoTrabajador = self.sub_tipo.code, | ||||||
|  |                                 # NIE043 | ||||||
|  |                                 AltoRiesgoPension = str(self.alto_riesgo).lower(), | ||||||
|  |                                 # NIE044 | ||||||
|  |                                 TipoDocumento = self.tipo_documento.code, | ||||||
|  |                                 # NIE045 | ||||||
|  |                                 NumeroDocumento = self.numero_documento, | ||||||
|  |                                 # NIE046 | ||||||
|  |                                 PrimerApellido = self.primer_apellido, | ||||||
|  |                                 # NIE047 | ||||||
|  |                                 SegundoApellido = self.segundo_apellido, | ||||||
|  |                                 # NIE048 | ||||||
|  |                                 PrimerNombre = self.primer_nombre, | ||||||
|  |                                 # NIE049 | ||||||
|  |                                 OtrosNombres = self.otros_nombres, | ||||||
|  |                                 # NIE050 | ||||||
|  |                                 LugarTrabajoPais = self.lugar_trabajo.pais.code, | ||||||
|  |  | ||||||
|  |                                 # NIE051 | ||||||
|  |                                 LugarTrabajoDepartamentoEstadoEstado = self.lugar_trabajo.departamento.code, | ||||||
|  |  | ||||||
|  |                                 # NIE052 | ||||||
|  |                                 LugarTrabajoMunicipioCiudad = self.lugar_trabajo.municipio.code, | ||||||
|  |  | ||||||
|  |                                 # NIE053 | ||||||
|  |                                 LugarTrabajoDireccion = self.lugar_trabajo.direccion, | ||||||
|  |                                 # NIE056 | ||||||
|  |                                 SalarioIntegral = str(self.salario_integral).lower(), | ||||||
|  |                                 # NIE061 | ||||||
|  |                                 TipoContrato = self.tipo_contrato.code, | ||||||
|  |                                 # NIE062 | ||||||
|  |                                 Sueldo = str(self.sueldo), | ||||||
|  |                                 # NIE063 | ||||||
|  |                                 CodigoTrabajador = self.codigo_trabajador | ||||||
|  |                                 ) | ||||||
|  |  | ||||||
| class DIANNominaXML: | class DIANNominaXML: | ||||||
|     def __init__(self, tag_document): |     def __init__(self, tag_document): | ||||||
|   | |||||||
| @@ -139,7 +139,28 @@ def test_nomina_cune(): | |||||||
|     )) |     )) | ||||||
|  |  | ||||||
|     nomina.asignar_trabajador(fe.nomina.Trabajador( |     nomina.asignar_trabajador(fe.nomina.Trabajador( | ||||||
|         numero_documento = '800199436' |         tipo_contrato = fe.nomina.TipoContrato( | ||||||
|  |             code = '1' | ||||||
|  |         ), | ||||||
|  |         alto_riesgo = False, | ||||||
|  |         tipo_documento = fe.nomina.TipoDocumento( | ||||||
|  |             code = '11' | ||||||
|  |         ), | ||||||
|  |         primer_apellido = 'gnu', | ||||||
|  |         segundo_apellido = 'emacs', | ||||||
|  |         primer_nombre = 'facho', | ||||||
|  |         lugar_trabajo = fe.nomina.LugarTrabajo( | ||||||
|  |             pais = fe.nomina.Pais(code='CO'), | ||||||
|  |             departamento = fe.nomina.Departamento(code='05'), | ||||||
|  |             municipio = fe.nomina.Municipio(code='05001'), | ||||||
|  |             direccion = 'calle facho' | ||||||
|  |         ), | ||||||
|  |         numero_documento = '800199436', | ||||||
|  |         tipo = fe.nomina.TipoTrabajador( | ||||||
|  |             code = '01' | ||||||
|  |         ), | ||||||
|  |         salario_integral = True, | ||||||
|  |         sueldo = fe.nomina.Amount(1_500_000) | ||||||
|     )) |     )) | ||||||
|  |  | ||||||
|     nomina.adicionar_devengado(fe.nomina.DevengadoBasico( |     nomina.adicionar_devengado(fe.nomina.DevengadoBasico( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user