Se eliminaron scripts de ayuda

This commit is contained in:
2026-02-11 11:01:10 -06:00
parent 7182e73396
commit dcf92a05ba

View File

@@ -1,35 +0,0 @@
from core.database import CoreSessionLocal
from api.v1.modules.public.reference_data.invoice_types.models import InvoiceType
from api.v1.modules.public.reference_data.invoice_types.seed import seed
def sync_invoice_types():
db = CoreSessionLocal()
try:
for s in seed:
key, description, note, type_, operation = s
obj = db.query(InvoiceType).filter(InvoiceType.key == key).first()
if obj:
print(f"Updating {key}...")
obj.description = description
obj.note = note
obj.type = type_
obj.operation = operation
else:
print(f"Creating {key}...")
obj = InvoiceType(
key=key,
description=description,
note=note,
type=type_,
operation=operation
)
db.add(obj)
db.commit()
except Exception as e:
print(f"Error: {e}")
db.rollback()
finally:
db.close()
if __name__ == "__main__":
sync_invoice_types()