Improve the frontend modals

This commit is contained in:
Urtzi Alfaro
2025-10-27 16:33:26 +01:00
parent 61376b7a9f
commit 858d985c92
143 changed files with 9289 additions and 2306 deletions

View File

@@ -0,0 +1,43 @@
"""add supplier approval workflow settings to tenant settings
Revision ID: 20251025_supplier_approval
Revises: 20251025_procurement
Create Date: 2025-10-25
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
import json
# revision identifiers, used by Alembic.
revision = '20251025_supplier_approval'
down_revision = '20251025_procurement'
branch_labels = None
depends_on = None
def upgrade():
"""Add supplier approval workflow settings to existing supplier_settings"""
# Use a single SQL statement to update all rows at once
# This avoids cursor lock issues and is more efficient
# Note: Cast to jsonb for merge operator, then back to json
op.execute("""
UPDATE tenant_settings
SET
supplier_settings = (supplier_settings::jsonb ||
'{"require_supplier_approval": true, "auto_approve_for_admin_owner": true, "approval_required_roles": ["member", "viewer"]}'::jsonb)::json,
updated_at = now()
""")
def downgrade():
"""Remove supplier approval workflow settings from supplier_settings"""
# Use a single SQL statement to remove the keys from all rows
# Note: Cast to jsonb for operator, then back to json
op.execute("""
UPDATE tenant_settings
SET
supplier_settings = (supplier_settings::jsonb - 'require_supplier_approval' - 'auto_approve_for_admin_owner' - 'approval_required_roles')::json,
updated_at = now()
""")