agdar/finance/migrations/0002_alter_invoice_options_and_more.py
2025-11-02 14:35:35 +03:00

313 lines
11 KiB
Python

# Generated by Django 5.2.7 on 2025-10-27 13:14
import datetime
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("appointments", "0002_initial"),
("core", "0001_initial"),
("finance", "0001_initial"),
]
operations = [
migrations.AlterModelOptions(
name="invoice",
options={
"ordering": ["-issue_date", "-invoice_counter"],
"verbose_name": "Invoice",
"verbose_name_plural": "Invoices",
},
),
migrations.AddField(
model_name="historicalinvoice",
name="billing_reference_id",
field=models.CharField(
blank=True,
help_text="Reference to original invoice for credit/debit notes",
max_length=50,
verbose_name="Billing Reference ID",
),
),
migrations.AddField(
model_name="historicalinvoice",
name="billing_reference_issue_date",
field=models.DateField(
blank=True, null=True, verbose_name="Billing Reference Issue Date"
),
),
migrations.AddField(
model_name="historicalinvoice",
name="cryptographic_stamp",
field=models.TextField(
blank=True,
help_text="ECDSA signature for simplified invoices",
verbose_name="Cryptographic Stamp",
),
),
migrations.AddField(
model_name="historicalinvoice",
name="invoice_counter",
field=models.PositiveIntegerField(
db_index=True,
default=1,
editable=False,
help_text="Sequential counter per EGS unit, cannot be reset",
verbose_name="Invoice Counter",
),
),
migrations.AddField(
model_name="historicalinvoice",
name="invoice_hash",
field=models.CharField(
blank=True,
editable=False,
help_text="SHA-256 hash of this invoice",
max_length=64,
verbose_name="Invoice Hash",
),
),
migrations.AddField(
model_name="historicalinvoice",
name="invoice_type",
field=models.CharField(
choices=[
("STANDARD", "Standard Tax Invoice (B2B)"),
("SIMPLIFIED", "Simplified Tax Invoice (B2C)"),
("STANDARD_DEBIT", "Standard Debit Note"),
("STANDARD_CREDIT", "Standard Credit Note"),
("SIMPLIFIED_DEBIT", "Simplified Debit Note"),
("SIMPLIFIED_CREDIT", "Simplified Credit Note"),
],
default="SIMPLIFIED",
help_text="Standard (B2B) requires clearance, Simplified (B2C) requires reporting",
max_length=20,
verbose_name="Invoice Type",
),
),
migrations.AddField(
model_name="historicalinvoice",
name="issue_time",
field=models.TimeField(
blank=True,
default=datetime.datetime(
2025, 10, 27, 13, 14, 1, 482781, tzinfo=datetime.timezone.utc
),
editable=False,
help_text="Time when invoice was generated",
verbose_name="Issue Time",
),
preserve_default=False,
),
migrations.AddField(
model_name="historicalinvoice",
name="previous_invoice_hash",
field=models.CharField(
blank=True,
help_text="SHA-256 hash of previous invoice (PIH)",
max_length=64,
verbose_name="Previous Invoice Hash",
),
),
migrations.AddField(
model_name="historicalinvoice",
name="qr_code",
field=models.TextField(
blank=True, help_text="Base64 encoded TLV QR code", verbose_name="QR Code"
),
),
migrations.AddField(
model_name="historicalinvoice",
name="xml_content",
field=models.TextField(
blank=True, help_text="UBL 2.1 XML invoice content", verbose_name="XML Content"
),
),
migrations.AddField(
model_name="historicalinvoice",
name="zatca_response",
field=models.JSONField(
blank=True,
help_text="Response from ZATCA clearance/reporting API",
null=True,
verbose_name="ZATCA Response",
),
),
migrations.AddField(
model_name="historicalinvoice",
name="zatca_status",
field=models.CharField(
blank=True,
help_text="Clearance/Reporting status from ZATCA",
max_length=20,
verbose_name="ZATCA Status",
),
),
migrations.AddField(
model_name="historicalinvoice",
name="zatca_submission_date",
field=models.DateTimeField(blank=True, null=True, verbose_name="ZATCA Submission Date"),
),
migrations.AddField(
model_name="invoice",
name="billing_reference_id",
field=models.CharField(
blank=True,
help_text="Reference to original invoice for credit/debit notes",
max_length=50,
verbose_name="Billing Reference ID",
),
),
migrations.AddField(
model_name="invoice",
name="billing_reference_issue_date",
field=models.DateField(
blank=True, null=True, verbose_name="Billing Reference Issue Date"
),
),
migrations.AddField(
model_name="invoice",
name="cryptographic_stamp",
field=models.TextField(
blank=True,
help_text="ECDSA signature for simplified invoices",
verbose_name="Cryptographic Stamp",
),
),
migrations.AddField(
model_name="invoice",
name="invoice_counter",
field=models.PositiveIntegerField(
db_index=True,
default=1,
editable=False,
help_text="Sequential counter per EGS unit, cannot be reset",
verbose_name="Invoice Counter",
),
),
migrations.AddField(
model_name="invoice",
name="invoice_hash",
field=models.CharField(
blank=True,
editable=False,
help_text="SHA-256 hash of this invoice",
max_length=64,
verbose_name="Invoice Hash",
),
),
migrations.AddField(
model_name="invoice",
name="invoice_type",
field=models.CharField(
choices=[
("STANDARD", "Standard Tax Invoice (B2B)"),
("SIMPLIFIED", "Simplified Tax Invoice (B2C)"),
("STANDARD_DEBIT", "Standard Debit Note"),
("STANDARD_CREDIT", "Standard Credit Note"),
("SIMPLIFIED_DEBIT", "Simplified Debit Note"),
("SIMPLIFIED_CREDIT", "Simplified Credit Note"),
],
default="SIMPLIFIED",
help_text="Standard (B2B) requires clearance, Simplified (B2C) requires reporting",
max_length=20,
verbose_name="Invoice Type",
),
),
migrations.AddField(
model_name="invoice",
name="issue_time",
field=models.TimeField(
auto_now_add=True,
default=django.utils.timezone.now,
help_text="Time when invoice was generated",
verbose_name="Issue Time",
),
preserve_default=False,
),
migrations.AddField(
model_name="invoice",
name="previous_invoice_hash",
field=models.CharField(
blank=True,
help_text="SHA-256 hash of previous invoice (PIH)",
max_length=64,
verbose_name="Previous Invoice Hash",
),
),
migrations.AddField(
model_name="invoice",
name="qr_code",
field=models.TextField(
blank=True, help_text="Base64 encoded TLV QR code", verbose_name="QR Code"
),
),
migrations.AddField(
model_name="invoice",
name="xml_content",
field=models.TextField(
blank=True, help_text="UBL 2.1 XML invoice content", verbose_name="XML Content"
),
),
migrations.AddField(
model_name="invoice",
name="zatca_response",
field=models.JSONField(
blank=True,
help_text="Response from ZATCA clearance/reporting API",
null=True,
verbose_name="ZATCA Response",
),
),
migrations.AddField(
model_name="invoice",
name="zatca_status",
field=models.CharField(
blank=True,
help_text="Clearance/Reporting status from ZATCA",
max_length=20,
verbose_name="ZATCA Status",
),
),
migrations.AddField(
model_name="invoice",
name="zatca_submission_date",
field=models.DateTimeField(blank=True, null=True, verbose_name="ZATCA Submission Date"),
),
migrations.AlterField(
model_name="historicalinvoice",
name="invoice_number",
field=models.CharField(
db_index=True,
editable=False,
help_text="Unique invoice reference number (IRN)",
max_length=20,
verbose_name="Invoice Number",
),
),
migrations.AlterField(
model_name="invoice",
name="invoice_number",
field=models.CharField(
editable=False,
help_text="Unique invoice reference number (IRN)",
max_length=20,
unique=True,
verbose_name="Invoice Number",
),
),
migrations.AddIndex(
model_name="invoice",
index=models.Index(fields=["invoice_counter"], name="finance_inv_invoice_18bebe_idx"),
),
migrations.AddIndex(
model_name="invoice",
index=models.Index(
fields=["invoice_type", "status"], name="finance_inv_invoice_1f4dd3_idx"
),
),
]