Mudanza de repo

This commit is contained in:
2025-09-22 18:43:29 -06:00
parent 26fe36ca52
commit d11d543bdc
193 changed files with 10998 additions and 0 deletions

View File

@@ -0,0 +1,224 @@
# Generated by Django 5.2.3 on 2025-07-14 16:14
import django.db.models.deletion
import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('organization', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Aduana',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('seccion', models.CharField(max_length=10)),
('descripcion', models.CharField(max_length=200)),
],
options={
'verbose_name': 'Aduana',
'verbose_name_plural': 'Aduanas',
'db_table': 'aduana',
'ordering': ['seccion'],
},
),
migrations.CreateModel(
name='ClavePedimento',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('clave', models.CharField(max_length=10)),
('descripcion', models.CharField(max_length=200)),
],
options={
'verbose_name': 'Clave de Pedimento',
'verbose_name_plural': 'Claves de Pedimento',
'db_table': 'clave_pedimento',
'ordering': ['clave'],
},
),
migrations.CreateModel(
name='EstadoDeProcesamiento',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('estado', models.CharField(max_length=50)),
],
options={
'verbose_name': 'Estado de Procesamiento',
'verbose_name_plural': 'Estados de Procesamiento',
'db_table': 'estado_de_procesamiento',
'ordering': ['estado'],
},
),
migrations.CreateModel(
name='Patente',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('numero', models.CharField(max_length=20)),
('descripcion', models.CharField(max_length=200)),
],
options={
'verbose_name': 'Patente',
'verbose_name_plural': 'Patentes',
'db_table': 'patente',
'ordering': ['numero'],
},
),
migrations.CreateModel(
name='Regimen',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('clave', models.CharField(max_length=10)),
('descripcion', models.CharField(max_length=200)),
],
options={
'verbose_name': 'Regimen',
'verbose_name_plural': 'Regimenes',
'db_table': 'regimen',
'ordering': ['clave'],
},
),
migrations.CreateModel(
name='Servicio',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('endpoint', models.CharField(max_length=100)),
('descripcion', models.TextField(blank=True, null=True)),
('hora_inicio', models.TimeField(blank=True, max_length=50, null=True)),
('hora_fin', models.TimeField(blank=True, max_length=50, null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'verbose_name': 'Servicio',
'verbose_name_plural': 'Servicios',
'db_table': 'servicio',
'ordering': ['endpoint'],
},
),
migrations.CreateModel(
name='TipoDeProcesamiento',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('tipo', models.CharField(max_length=50)),
],
options={
'verbose_name': 'Tipo de Procesamiento',
'verbose_name_plural': 'Tipos de Procesamiento',
'db_table': 'tipo_de_procesamiento',
'ordering': ['tipo'],
},
),
migrations.CreateModel(
name='TipoOperacion',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('tipo', models.CharField(max_length=100)),
('descripcion', models.CharField(max_length=200)),
],
options={
'verbose_name': 'Tipo de Operacion',
'verbose_name_plural': 'Tipos de Operacion',
'db_table': 'tipo_operacion',
'ordering': ['tipo'],
},
),
migrations.CreateModel(
name='AgenteAduanal',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nombre', models.CharField(max_length=100)),
('rfc', models.CharField(blank=True, max_length=13, null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('id_aduana', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='agentes_aduanales', to='customs.aduana')),
('id_patente', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='agentes_aduanales', to='customs.patente')),
],
options={
'verbose_name': 'Agente Aduanal',
'verbose_name_plural': 'Agentes Aduanales',
'db_table': 'agente_aduanal',
'ordering': ['nombre'],
},
),
migrations.CreateModel(
name='Pedimento',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('pedimento', models.CharField(help_text='Número de pedimento aduanal', max_length=20, unique=True)),
('patente', models.CharField(blank=True, help_text='Número de patente aduanal', max_length=20, null=True)),
('aduana', models.CharField(blank=True, help_text='Clave de la aduana según la clasificación aduanera', max_length=10, null=True)),
('regimen', models.CharField(blank=True, help_text='Clave del régimen aduanero según la clasificación aduanera', max_length=10, null=True)),
('clave_pedimento', models.CharField(blank=True, help_text='Clave del pedimento según la clasificación aduanera', max_length=10, null=True)),
('fecha_inicio', models.DateField(blank=True, help_text='Fecha de inicio del pedimento', null=True)),
('fecha_fin', models.DateField(blank=True, help_text='Fecha de fin del pedimento', null=True)),
('fecha_pago', models.DateField(blank=True, help_text='Fecha de pago del pedimento', null=True)),
('alerta', models.BooleanField(default=False, help_text='Indica si el pedimento tiene una alerta asociada')),
('contribuyente', models.CharField(blank=True, help_text='Nombre del contribuyente/importador asociado al pedimento', max_length=100, null=True)),
('agente_aduanal', models.CharField(blank=True, help_text='RFC del agente aduanal', max_length=100, null=True)),
('curp_apoderado', models.CharField(blank=True, help_text='CURP del apoderado aduanal', max_length=18, null=True)),
('importe_total', models.DecimalField(blank=True, decimal_places=2, help_text='Importe total del pedimento', max_digits=10, null=True)),
('saldo_disponible', models.DecimalField(blank=True, decimal_places=2, help_text='Saldo disponible del pedimento', max_digits=10, null=True)),
('importe_pedimento', models.DecimalField(blank=True, decimal_places=2, help_text='Importe del pedimento', max_digits=10, null=True)),
('existe_expediente', models.BooleanField(default=False)),
('remesas', models.BooleanField(default=False, help_text='Indica si el pedimento tiene remesas asociadas')),
('numero_partidas', models.PositiveIntegerField(blank=True, default=0, help_text='Número de partidas asociadas al pedimento', null=True)),
('numero_operacion', models.CharField(blank=True, help_text='Número de operación del pedimento', max_length=20, null=True)),
('created_at', models.DateTimeField(auto_now_add=True, help_text='Fecha de creación del registro')),
('updated_at', models.DateTimeField(auto_now=True, help_text='Fecha de última actualización del registro')),
('organizacion', models.ForeignKey(help_text='Organización a la que pertenece el pedimento', on_delete=django.db.models.deletion.CASCADE, related_name='pedimentos', to='organization.organizacion')),
('tipo_operacion', models.ForeignKey(blank=True, help_text='Tipo de operación del pedimento', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='pedimentos', to='customs.tipooperacion')),
],
options={
'verbose_name': 'Pedimento',
'verbose_name_plural': 'Pedimentos',
'db_table': 'pedimento',
'ordering': ['pedimento'],
},
),
migrations.CreateModel(
name='EDocument',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('numero_edocument', models.CharField(help_text='Número único del e-documento', max_length=20, unique=True)),
('clave', models.CharField(blank=True, help_text='Clave del e-documento según la clasificación aduanera', max_length=10, null=True)),
('cadena_original', models.TextField(blank=True, help_text='Cadena original del e-documento', null=True)),
('sello_digital', models.TextField(blank=True, help_text='Firma digital del e-documento', null=True)),
('descripcion', models.CharField(blank=True, help_text='Descripción del documento', max_length=200, null=True)),
('created_at', models.DateTimeField(auto_now_add=True, help_text='Fecha de creación del documento')),
('updated_at', models.DateTimeField(auto_now=True, help_text='Fecha de última actualización del documento')),
('organizacion', models.ForeignKey(help_text='Organización a la que pertenece el EDocument', on_delete=django.db.models.deletion.CASCADE, related_name='edocuments', to='organization.organizacion')),
('pedimento', models.ForeignKey(help_text='Pedimento asociado al documento', on_delete=django.db.models.deletion.CASCADE, related_name='documentos', to='customs.pedimento')),
],
options={
'verbose_name': 'EDocument',
'verbose_name_plural': 'EDocuments',
'db_table': 'edocs',
'ordering': ['created_at'],
},
),
migrations.CreateModel(
name='ProcesamientoPedimento',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('estado', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='procesamientos', to='customs.estadodeprocesamiento')),
('organizacion', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='procesamientos', to='organization.organizacion')),
('pedimento', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='procesamientos', to='customs.pedimento')),
('servicio', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='procesamientos', to='customs.servicio')),
('tipo_procesamiento', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='procesamientos', to='customs.tipodeprocesamiento')),
],
options={
'verbose_name': 'Procesamiento de Pedimento',
'verbose_name_plural': 'Procesamientos de Pedimento',
'db_table': 'procesamiento_pedimento',
'ordering': ['created_at'],
},
),
]

View File

@@ -0,0 +1,36 @@
# Generated by Django 5.2.3 on 2025-07-15 14:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('customs', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='agenteaduanal',
name='id_aduana',
),
migrations.RemoveField(
model_name='agenteaduanal',
name='id_patente',
),
migrations.DeleteModel(
name='ClavePedimento',
),
migrations.DeleteModel(
name='Regimen',
),
migrations.DeleteModel(
name='Aduana',
),
migrations.DeleteModel(
name='AgenteAduanal',
),
migrations.DeleteModel(
name='Patente',
),
]

View File

@@ -0,0 +1,32 @@
# Generated by Django 5.2.3 on 2025-07-23 22:12
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('customs', '0002_remove_agenteaduanal_id_aduana_and_more'),
('organization', '0002_remove_organizacion_membretado_and_more'),
]
operations = [
migrations.CreateModel(
name='Cove',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('numero_cove', models.CharField(help_text='Número único de la cove', max_length=20, unique=True)),
('created_at', models.DateTimeField(auto_now_add=True, help_text='Fecha de creación de la cove')),
('updated_at', models.DateTimeField(auto_now=True, help_text='Fecha de última actualización de la cove')),
('organizacion', models.ForeignKey(help_text='Organización a la que pertenece la cove', on_delete=django.db.models.deletion.CASCADE, related_name='coves', to='organization.organizacion')),
('pedimento', models.ForeignKey(help_text='Pedimento asociado a la cove', on_delete=django.db.models.deletion.CASCADE, related_name='coves', to='customs.pedimento')),
],
options={
'verbose_name': 'Cove',
'verbose_name_plural': 'Coves',
'db_table': 'coves',
'ordering': ['created_at'],
},
),
]

View File

@@ -0,0 +1,24 @@
# Generated by Django 5.2.3 on 2025-08-12 19:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('customs', '0003_cove'),
]
operations = [
migrations.AddField(
model_name='pedimento',
name='pedimento_app',
field=models.CharField(default='', help_text='Número de pedimento en la aplicación', max_length=25),
preserve_default=False,
),
migrations.AlterField(
model_name='pedimento',
name='pedimento',
field=models.CharField(help_text='Número de pedimento aduanal', max_length=20),
),
]

View File

@@ -0,0 +1,17 @@
# Generated by Django 5.2.3 on 2025-08-12 19:25
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('customs', '0004_pedimento_pedimento_app_alter_pedimento_pedimento'),
]
operations = [
migrations.RemoveField(
model_name='pedimento',
name='pedimento_app',
),
]

View File

@@ -0,0 +1,19 @@
# Generated by Django 5.2.3 on 2025-08-12 19:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('customs', '0005_remove_pedimento_pedimento_app'),
]
operations = [
migrations.AddField(
model_name='pedimento',
name='pedimento_app',
field=models.CharField(default='', help_text='Número de pedimento en la aplicación', max_length=25),
preserve_default=False,
),
]

View File

@@ -0,0 +1,27 @@
# Generated by Django 5.2.3 on 2025-08-15 18:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('customs', '0006_pedimento_pedimento_app'),
]
operations = [
migrations.CreateModel(
name='Regimen',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('claveped', models.CharField(max_length=4)),
('regimenped', models.CharField(max_length=4)),
('tipo', models.IntegerField()),
],
options={
'verbose_name': 'Regimen',
'verbose_name_plural': 'Regimenes',
'db_table': 'regimen',
},
),
]

View File

@@ -0,0 +1,139 @@
from django.db import migrations
def cargar_catalogo_regimen(apps, schema_editor):
from api.customs.models import Regimen
data = [
(1, 'A1', 'EXD', 2),
(2, 'A1', 'IMD', 1),
(3, 'A2', 'ITE', 1),
(4, 'A3', 'IMD', 1),
(5, 'A4', 'DFI', 2),
(6, 'A4', 'DFI', 1),
(7, 'A5', 'DFI', 2),
(8, 'A5', 'DFI', 1),
(9, 'A6', 'ITR', 1),
(10, 'A7', 'ITR', 1),
(11, 'A8', 'ITE', 1),
(12, 'A9', 'ITR', 1),
(13, 'AA', 'ITE', 1),
(14, 'AD', 'ITR', 1),
(15, 'AF', 'ITE', 1),
(16, 'AF', 'ITR', 1),
(17, 'AJ', 'ETR', 2),
(18, 'AJ', 'ITR', 1),
(19, 'BA', 'ETR', 2),
(20, 'BA', 'ITR', 1),
(21, 'BB', 'EXD', 2),
(22, 'BC', 'ITR', 1),
(23, 'BD', 'ITR', 1),
(24, 'BE', 'ITR', 1),
(25, 'BF', 'ETR', 2),
(26, 'BH', 'ITR', 1),
(27, 'BI', 'ITR', 1),
(28, 'BM', 'ETE', 2),
(29, 'BO', 'ETE', 2),
(30, 'BO', 'ITR', 1),
(31, 'BP', 'ITR', 1),
(32, 'BR', 'ETR', 2),
(33, 'C1', 'IMD', 1),
(34, 'C2', 'IMD', 1),
(35, 'C3', 'IMD', 1),
(36, 'CT', 'EXD', 2),
(37, 'D1', 'EXD', 2),
(38, 'D1', 'IMD', 1),
(39, 'E1', 'ITE', 1),
(40, 'E2', 'ITR', 1),
(41, 'E3', 'ITE', 1),
(42, 'E4', 'ITR', 1),
(43, 'F2', 'DFI', 1),
(44, 'F3', 'IMD', 1),
(45, 'F4', 'EXD', 2),
(46, 'F4', 'IMD', 1),
(47, 'F5', 'IMD', 1),
(48, 'F8', 'DFI', 2),
(49, 'F8', 'DFI', 1),
(50, 'F9', 'DFI', 2),
(51, 'F9', 'DFI', 1),
(52, 'G1', 'EXD', 2),
(53, 'G1', 'IMD', 1),
(54, 'G2', 'IMD', 1),
(55, 'G6', 'EXD', 2),
(56, 'G7', 'EXD', 2),
(57, 'G8', 'RFS', 2),
(58, 'G9', 'IMD', 2),
(59, 'GC', 'EXD', 2),
(60, 'GC', 'IMD', 1),
(61, 'H1', 'EXD', 2),
(62, 'H1', 'IMD', 1),
(63, 'H8', 'EXD', 2),
(64, 'H8', 'IMD', 1),
(65, 'I1', 'EXD', 2),
(66, 'I1', 'IMD', 1),
(67, 'IN', 'ITE', 1),
(68, 'J1', 'EXD', 2),
(69, 'J2', 'EXD', 2),
(70, 'J3', 'RFE', 2),
(71, 'J4', 'RFS', 2),
(72, 'K1', 'EXD', 2),
(73, 'K1', 'IMD', 1),
(74, 'K2', 'EXD', 2),
(75, 'K3', 'EXD', 2),
(76, 'L1', 'EXD', 2),
(77, 'L1', 'IMD', 1),
(78, 'M1', 'RFE', 1),
(79, 'M2', 'RFE', 1),
(80, 'M3', 'RFS', 1),
(81, 'M4', 'RFS', 1),
(82, 'M5', 'RFS', 1),
(83, 'P1', 'IMD', 1),
(84, 'R1', 'ETE', 2),
(85, 'R1', 'ETR', 2),
(86, 'R1', 'EXD', 2),
(87, 'R1', 'IMD', 1),
(88, 'R1', 'ITE', 1),
(89, 'R1', 'ITR', 1),
(90, 'RT', 'EXD', 2),
(91, 'S2', 'EXD', 2),
(92, 'S2', 'IMD', 1),
(93, 'T1', 'EXD', 2),
(94, 'T1', 'IMD', 1),
(95, 'T3', 'TRA', 1),
(96, 'T6', 'TRA', 2),
(97, 'T7', 'TRA', 1),
(98, 'T9', 'TRA', 1),
(99, 'V1', 'EXD', 2),
(100, 'V1', 'ITE', 1),
(101, 'V1', 'ITR', 1),
(102, 'V2', 'EXD', 2),
(103, 'V2', 'IMD', 1),
(104, 'V3', 'DFI', 2),
(105, 'V3', 'DFI', 1),
(106, 'V4', 'ETR', 2),
(107, 'V4', 'ITR', 1),
(108, 'V5', 'EXD', 2),
(109, 'V5', 'IMD', 1),
(110, 'V6', 'EXD', 2),
(111, 'V6', 'IMD', 1),
(112, 'V7', 'EXD', 2),
(113, 'V7', 'ITR', 1),
(114, 'V8', 'DFI', 1),
(115, 'V8', 'EXD', 2),
(116, 'V9', 'EXD', 2),
(117, 'V9', 'IMD', 1),
(118, 'VF', 'IMD', 1),
(119, 'VU', 'IMD', 1),
(120, 'H3', 'ITE', 1),
(121, 'H3', 'ITR', 1),
]
for id, claveped, regimenped, tipo in data:
Regimen.objects.create(id=id, claveped=claveped, regimenped=regimenped, tipo=tipo)
class Migration(migrations.Migration):
dependencies = [
('customs', '0007_regimen'),
]
operations = [
migrations.RunPython(cargar_catalogo_regimen),
]

View File

@@ -0,0 +1,31 @@
# Generated by Django 5.2.3 on 2025-08-16 15:54
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('customs', '0008_regimen_catalogo'),
('organization', '0002_remove_organizacion_membretado_and_more'),
]
operations = [
migrations.CreateModel(
name='Importador',
fields=[
('rfc', models.CharField(help_text='RFC del importador', max_length=13, primary_key=True, serialize=False, unique=True)),
('nombre', models.CharField(help_text='Nombre del importador', max_length=200)),
('created_at', models.DateTimeField(auto_now_add=True, help_text='Fecha de creación del registro')),
('updated_at', models.DateTimeField(auto_now=True, help_text='Fecha de última actualización del registro')),
('organizacion', models.ForeignKey(help_text='Organización a la que pertenece el importador', on_delete=django.db.models.deletion.CASCADE, related_name='importadores', to='organization.organizacion')),
],
options={
'verbose_name': 'Importador',
'verbose_name_plural': 'Importadores',
'db_table': 'importador',
'ordering': ['rfc'],
},
),
]

View File

@@ -0,0 +1,21 @@
from django.db import migrations
def crear_importadores_desde_pedimentos(apps, schema_editor):
Pedimento = apps.get_model('customs', 'Pedimento')
Importador = apps.get_model('customs', 'Importador')
Organizacion = apps.get_model('organization', 'Organizacion')
rfcs_orgs = Pedimento.objects.values_list('contribuyente', 'organizacion_id').distinct()
for rfc, org_id in rfcs_orgs:
if rfc and not Importador.objects.filter(rfc=rfc).exists():
organizacion = Organizacion.objects.get(id=org_id) if org_id else None
Importador.objects.create(rfc=rfc, nombre='', organizacion=organizacion)
class Migration(migrations.Migration):
dependencies = [
('customs', '0009_importador'),
]
operations = [
migrations.RunPython(crear_importadores_desde_pedimentos),
]

View File

@@ -0,0 +1,19 @@
# Generated by Django 5.2.3 on 2025-08-16 16:00
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('customs', '0009b_poblar_importadores'),
]
operations = [
migrations.AlterField(
model_name='pedimento',
name='contribuyente',
field=models.ForeignKey(blank=True, help_text='Contribuyente asociado al pedimento', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='pedimentos', to='customs.importador'),
),
]

View File