Files
backend/api/customs/migrations/0001_initial.py
2025-09-22 18:43:29 -06:00

225 lines
13 KiB
Python

# 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'],
},
),
]