Improve the frontend modals
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
"""add smart procurement settings to tenant settings
|
||||
|
||||
Revision ID: 20251025_procurement
|
||||
Revises: 20251022_0000
|
||||
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_procurement'
|
||||
down_revision = '20251022_0000'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
"""Add smart procurement flags to existing procurement_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
|
||||
procurement_settings = (procurement_settings::jsonb ||
|
||||
'{"use_reorder_rules": true, "economic_rounding": true, "respect_storage_limits": true, "use_supplier_minimums": true, "optimize_price_tiers": true}'::jsonb)::json,
|
||||
updated_at = now()
|
||||
""")
|
||||
|
||||
|
||||
def downgrade():
|
||||
"""Remove smart procurement flags from procurement_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
|
||||
procurement_settings = (procurement_settings::jsonb - 'use_reorder_rules' - 'economic_rounding' - 'respect_storage_limits' - 'use_supplier_minimums' - 'optimize_price_tiers')::json,
|
||||
updated_at = now()
|
||||
""")
|
||||
@@ -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()
|
||||
""")
|
||||
Reference in New Issue
Block a user