Error is batch list router fixed

v8.0.2
This commit is contained in:
Amritanshu Agrawal 2020-10-11 16:29:19 +05:30
parent 14930954a2
commit 886b11be23
9 changed files with 253 additions and 77 deletions

View File

@ -1,10 +1,9 @@
import logging
from sqlalchemy import create_engine
from sqlalchemy import pool
from alembic import context
from brewman.core.config import settings
from sqlalchemy import create_engine, pool
logging.basicConfig()
logging.getLogger("sqlalchemy.engine").setLevel(settings.ALEMBIC_LOG_LEVEL)
@ -15,6 +14,7 @@ logging.getLogger("alembic").setLevel(settings.ALEMBIC_LOG_LEVEL)
from brewman.models.auth import User # noqa
target_metadata = User.metadata
# other values from the config, defined by the needs of env.py,
@ -55,10 +55,15 @@ def run_migrations_online():
and associate a connection with the context.
"""
connectable = create_engine(settings.SQLALCHEMY_DATABASE_URI, poolclass=pool.NullPool,)
connectable = create_engine(
settings.SQLALCHEMY_DATABASE_URI,
poolclass=pool.NullPool,
)
with connectable.connect() as connection:
context.configure(connection=connection, target_metadata=target_metadata, compare_type=True)
context.configure(
connection=connection, target_metadata=target_metadata, compare_type=True
)
with context.begin_transaction():
context.run_migrations()

View File

@ -5,10 +5,12 @@ Revises:
Create Date: 2020-05-10 19:02:57.301086
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "0bf3d70ee7de"
down_revision = None
@ -100,7 +102,9 @@ def upgrade():
sa.Column("cost_centre_id", postgresql.UUID(), nullable=False),
sa.Column("is_fixture", sa.Boolean(), nullable=False),
sa.ForeignKeyConstraint(
["cost_centre_id"], ["cost_centres.CostCentreID"], name=op.f("fk_accounts_cost_centre_id_cost_centres"),
["cost_centre_id"],
["cost_centres.CostCentreID"],
name=op.f("fk_accounts_cost_centre_id_cost_centres"),
),
sa.PrimaryKeyConstraint("id", name=op.f("pk_accounts")),
sa.UniqueConstraint("name", name=op.f("uq_accounts_name")),
@ -112,13 +116,19 @@ def upgrade():
sa.Column("client_id", postgresql.UUID(), nullable=False),
sa.Column("date", sa.DateTime(timezone=True), nullable=False),
sa.ForeignKeyConstraint(
["client_id"], ["auth_clients.client_id"], name=op.f("fk_auth_login_history_client_id_auth_clients"),
["client_id"],
["auth_clients.client_id"],
name=op.f("fk_auth_login_history_client_id_auth_clients"),
),
sa.ForeignKeyConstraint(
["user_id"], ["auth_users.UserID"], name=op.f("fk_auth_login_history_user_id_auth_users"),
["user_id"],
["auth_users.UserID"],
name=op.f("fk_auth_login_history_user_id_auth_users"),
),
sa.PrimaryKeyConstraint("login_history_id", name=op.f("pk_auth_login_history")),
sa.UniqueConstraint("user_id", "client_id", "date", name=op.f("uq_auth_login_history_user_id")),
sa.UniqueConstraint(
"user_id", "client_id", "date", name=op.f("uq_auth_login_history_user_id")
),
)
op.create_table(
"auth_rolegroups",
@ -126,9 +136,15 @@ def upgrade():
sa.Column("RoleID", postgresql.UUID(), nullable=True),
sa.Column("GroupID", postgresql.UUID(), nullable=True),
sa.ForeignKeyConstraint(
["GroupID"], ["auth_groups.GroupID"], name=op.f("fk_auth_rolegroups_GroupID_auth_groups"),
["GroupID"],
["auth_groups.GroupID"],
name=op.f("fk_auth_rolegroups_GroupID_auth_groups"),
),
sa.ForeignKeyConstraint(
["RoleID"],
["auth_roles.RoleID"],
name=op.f("fk_auth_rolegroups_RoleID_auth_roles"),
),
sa.ForeignKeyConstraint(["RoleID"], ["auth_roles.RoleID"], name=op.f("fk_auth_rolegroups_RoleID_auth_roles"),),
sa.PrimaryKeyConstraint("RoleGroupID", name=op.f("pk_auth_rolegroups")),
)
op.create_table(
@ -137,9 +153,15 @@ def upgrade():
sa.Column("UserID", postgresql.UUID(), nullable=True),
sa.Column("GroupID", postgresql.UUID(), nullable=True),
sa.ForeignKeyConstraint(
["GroupID"], ["auth_groups.GroupID"], name=op.f("fk_auth_usergroups_GroupID_auth_groups"),
["GroupID"],
["auth_groups.GroupID"],
name=op.f("fk_auth_usergroups_GroupID_auth_groups"),
),
sa.ForeignKeyConstraint(
["UserID"],
["auth_users.UserID"],
name=op.f("fk_auth_usergroups_UserID_auth_users"),
),
sa.ForeignKeyConstraint(["UserID"], ["auth_users.UserID"], name=op.f("fk_auth_usergroups_UserID_auth_users"),),
sa.PrimaryKeyConstraint("UserGroupID", name=op.f("pk_auth_usergroups")),
)
op.create_table(
@ -156,8 +178,16 @@ def upgrade():
sa.Column("user_id", postgresql.UUID(), nullable=False),
sa.Column("is_posted", sa.Boolean(), nullable=False),
sa.Column("poster_id", postgresql.UUID(), nullable=True),
sa.ForeignKeyConstraint(["poster_id"], ["auth_users.UserID"], name=op.f("fk_vouchers_poster_id_auth_users"),),
sa.ForeignKeyConstraint(["user_id"], ["auth_users.UserID"], name=op.f("fk_vouchers_user_id_auth_users"),),
sa.ForeignKeyConstraint(
["poster_id"],
["auth_users.UserID"],
name=op.f("fk_vouchers_poster_id_auth_users"),
),
sa.ForeignKeyConstraint(
["user_id"],
["auth_users.UserID"],
name=op.f("fk_vouchers_user_id_auth_users"),
),
sa.PrimaryKeyConstraint("VoucherID", name=op.f("pk_vouchers")),
)
op.create_index(op.f("ix_vouchers_date"), "vouchers", ["date"], unique=False)
@ -169,7 +199,9 @@ def upgrade():
sa.Column("ServicePoints", sa.Numeric(precision=5, scale=2), nullable=True),
sa.Column("JoiningDate", sa.DateTime(), nullable=True),
sa.Column("LeavingDate", sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(["id"], ["accounts.id"], name=op.f("fk_employees_id_accounts")),
sa.ForeignKeyConstraint(
["id"], ["accounts.id"], name=op.f("fk_employees_id_accounts")
),
sa.PrimaryKeyConstraint("id", name=op.f("pk_employees")),
)
op.create_table(
@ -181,13 +213,25 @@ def upgrade():
sa.Column("account_id", postgresql.UUID(), nullable=False),
sa.Column("CostCentreID", postgresql.UUID(), nullable=False),
sa.ForeignKeyConstraint(
["CostCentreID"], ["cost_centres.CostCentreID"], name=op.f("fk_journals_CostCentreID_cost_centres"),
["CostCentreID"],
["cost_centres.CostCentreID"],
name=op.f("fk_journals_CostCentreID_cost_centres"),
),
sa.ForeignKeyConstraint(
["VoucherID"],
["vouchers.VoucherID"],
name=op.f("fk_journals_VoucherID_vouchers"),
),
sa.ForeignKeyConstraint(
["account_id"],
["accounts.id"],
name=op.f("fk_journals_account_id_accounts"),
),
sa.ForeignKeyConstraint(["VoucherID"], ["vouchers.VoucherID"], name=op.f("fk_journals_VoucherID_vouchers"),),
sa.ForeignKeyConstraint(["account_id"], ["accounts.id"], name=op.f("fk_journals_account_id_accounts"),),
sa.PrimaryKeyConstraint("JournalID", name=op.f("pk_journals")),
)
op.create_index(op.f("ix_journals_VoucherID"), "journals", ["VoucherID"], unique=False)
op.create_index(
op.f("ix_journals_VoucherID"), "journals", ["VoucherID"], unique=False
)
op.create_table(
"products",
sa.Column("ProductID", postgresql.UUID(), nullable=False),
@ -210,7 +254,11 @@ def upgrade():
["product_groups.ProductGroupID"],
name=op.f("fk_products_ProductGroupID_product_groups"),
),
sa.ForeignKeyConstraint(["account_id"], ["accounts.id"], name=op.f("fk_products_account_id_accounts"),),
sa.ForeignKeyConstraint(
["account_id"],
["accounts.id"],
name=op.f("fk_products_account_id_accounts"),
),
sa.PrimaryKeyConstraint("ProductID", name=op.f("pk_products")),
sa.UniqueConstraint("Code", name=op.f("uq_products_Code")),
sa.UniqueConstraint("Name", "Units", name=op.f("uq_products_Name")),
@ -225,8 +273,16 @@ def upgrade():
sa.Column("CreationDate", sa.DateTime(timezone=True), nullable=True),
sa.Column("UserID", postgresql.UUID(), nullable=True),
sa.Column("IsValid", sa.Boolean(), nullable=True),
sa.ForeignKeyConstraint(["EmployeeID"], ["employees.id"], name=op.f("fk_attendances_EmployeeID_employees"),),
sa.ForeignKeyConstraint(["UserID"], ["auth_users.UserID"], name=op.f("fk_attendances_UserID_auth_users"),),
sa.ForeignKeyConstraint(
["EmployeeID"],
["employees.id"],
name=op.f("fk_attendances_EmployeeID_employees"),
),
sa.ForeignKeyConstraint(
["UserID"],
["auth_users.UserID"],
name=op.f("fk_attendances_UserID_auth_users"),
),
sa.PrimaryKeyConstraint("AttendanceID", name=op.f("pk_attendances")),
)
op.create_table(
@ -238,7 +294,11 @@ def upgrade():
sa.Column("Rate", sa.Numeric(), nullable=True),
sa.Column("Tax", sa.Numeric(), nullable=True),
sa.Column("Discount", sa.Numeric(), nullable=True),
sa.ForeignKeyConstraint(["ProductID"], ["products.ProductID"], name=op.f("fk_batches_ProductID_products"),),
sa.ForeignKeyConstraint(
["ProductID"],
["products.ProductID"],
name=op.f("fk_batches_ProductID_products"),
),
sa.PrimaryKeyConstraint("BatchID", name=op.f("pk_batches")),
)
op.create_table(
@ -246,7 +306,11 @@ def upgrade():
sa.Column("FingerprintID", postgresql.UUID(), nullable=False),
sa.Column("EmployeeID", postgresql.UUID(), nullable=True),
sa.Column("Date", sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(["EmployeeID"], ["employees.id"], name=op.f("fk_fingerprints_EmployeeID_employees"),),
sa.ForeignKeyConstraint(
["EmployeeID"],
["employees.id"],
name=op.f("fk_fingerprints_EmployeeID_employees"),
),
sa.PrimaryKeyConstraint("FingerprintID", name=op.f("pk_fingerprints")),
)
op.create_table(
@ -261,7 +325,11 @@ def upgrade():
sa.Column("valid_to", sa.Date(), nullable=False),
sa.Column("effective_from", sa.Date(), nullable=False),
sa.Column("effective_to", sa.Date(), nullable=True),
sa.ForeignKeyConstraint(["product_id"], ["products.ProductID"], name=op.f("fk_recipes_product_id_products"),),
sa.ForeignKeyConstraint(
["product_id"],
["products.ProductID"],
name=op.f("fk_recipes_product_id_products"),
),
sa.PrimaryKeyConstraint("recipe_id", name=op.f("pk_recipes")),
)
op.create_table(
@ -276,10 +344,14 @@ def upgrade():
sa.Column("EsiEmployer", sa.Integer(), nullable=True),
sa.Column("PfEmployer", sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(
["JournalID"], ["journals.JournalID"], name=op.f("fk_salary_deductions_JournalID_journals"),
["JournalID"],
["journals.JournalID"],
name=op.f("fk_salary_deductions_JournalID_journals"),
),
sa.ForeignKeyConstraint(
["VoucherID"], ["vouchers.VoucherID"], name=op.f("fk_salary_deductions_VoucherID_vouchers"),
["VoucherID"],
["vouchers.VoucherID"],
name=op.f("fk_salary_deductions_VoucherID_vouchers"),
),
sa.PrimaryKeyConstraint("SalaryDeductionID", name=op.f("pk_salary_deductions")),
)
@ -291,10 +363,14 @@ def upgrade():
sa.Column("days_worked", sa.Integer(), nullable=False),
sa.Column("points", sa.Numeric(precision=5, scale=2), nullable=False),
sa.ForeignKeyConstraint(
["journal_id"], ["journals.JournalID"], name=op.f("fk_service_charges_journal_id_journals"),
["journal_id"],
["journals.JournalID"],
name=op.f("fk_service_charges_journal_id_journals"),
),
sa.ForeignKeyConstraint(
["voucher_id"], ["vouchers.VoucherID"], name=op.f("fk_service_charges_voucher_id_vouchers"),
["voucher_id"],
["vouchers.VoucherID"],
name=op.f("fk_service_charges_voucher_id_vouchers"),
),
sa.PrimaryKeyConstraint("id", name=op.f("pk_service_charges")),
)
@ -308,13 +384,29 @@ def upgrade():
sa.Column("Rate", sa.Numeric(), nullable=True),
sa.Column("Tax", sa.Numeric(), nullable=True),
sa.Column("Discount", sa.Numeric(), nullable=True),
sa.ForeignKeyConstraint(["BatchID"], ["batches.BatchID"], name=op.f("fk_inventories_BatchID_batches"),),
sa.ForeignKeyConstraint(["ProductID"], ["products.ProductID"], name=op.f("fk_inventories_ProductID_products"),),
sa.ForeignKeyConstraint(["VoucherID"], ["vouchers.VoucherID"], name=op.f("fk_inventories_VoucherID_vouchers"),),
sa.ForeignKeyConstraint(
["BatchID"],
["batches.BatchID"],
name=op.f("fk_inventories_BatchID_batches"),
),
sa.ForeignKeyConstraint(
["ProductID"],
["products.ProductID"],
name=op.f("fk_inventories_ProductID_products"),
),
sa.ForeignKeyConstraint(
["VoucherID"],
["vouchers.VoucherID"],
name=op.f("fk_inventories_VoucherID_vouchers"),
),
sa.PrimaryKeyConstraint("InventoryID", name=op.f("pk_inventories")),
sa.UniqueConstraint("VoucherID", "BatchID", name=op.f("uq_inventories_VoucherID")),
sa.UniqueConstraint(
"VoucherID", "BatchID", name=op.f("uq_inventories_VoucherID")
),
)
op.create_index(
op.f("ix_inventories_VoucherID"), "inventories", ["VoucherID"], unique=False
)
op.create_index(op.f("ix_inventories_VoucherID"), "inventories", ["VoucherID"], unique=False)
op.create_table(
"recipe_items",
sa.Column("recipe_item_id", postgresql.UUID(), nullable=False),
@ -323,11 +415,19 @@ def upgrade():
sa.Column("quantity", sa.Integer(), nullable=False),
sa.Column("price", sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(
["product_id"], ["products.ProductID"], name=op.f("fk_recipe_items_product_id_products"),
["product_id"],
["products.ProductID"],
name=op.f("fk_recipe_items_product_id_products"),
),
sa.ForeignKeyConstraint(
["recipe_id"],
["recipes.recipe_id"],
name=op.f("fk_recipe_items_recipe_id_recipes"),
),
sa.ForeignKeyConstraint(["recipe_id"], ["recipes.recipe_id"], name=op.f("fk_recipe_items_recipe_id_recipes"),),
sa.PrimaryKeyConstraint("recipe_item_id", name=op.f("pk_recipe_items")),
sa.UniqueConstraint("recipe_id", "product_id", name=op.f("uq_recipe_items_recipe_id")),
sa.UniqueConstraint(
"recipe_id", "product_id", name=op.f("uq_recipe_items_recipe_id")
),
)
# ### end Alembic commands ###

View File

@ -5,11 +5,13 @@ Revises: 0bf3d70ee7de
Create Date: 2020-05-10 19:52:58.163810
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy import table, column, select
from alembic import op
from sqlalchemy import column, select, table
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "eed0b382c287"
down_revision = "0bf3d70ee7de"
@ -52,7 +54,9 @@ def upgrade():
batch_op.alter_column("UserID", new_column_name="user_id")
batch_op.alter_column("AttendanceType", new_column_name="attendance_type")
batch_op.alter_column("CreationDate", new_column_name="creation_date")
batch_op.alter_column("Date", new_column_name="date", type_=sa.Date(), nullable=False)
batch_op.alter_column(
"Date", new_column_name="date", type_=sa.Date(), nullable=False
)
batch_op.alter_column("EmployeeID", new_column_name="employee_id")
batch_op.alter_column("AttendanceID", new_column_name="id")
batch_op.alter_column("IsValid", new_column_name="is_valid")
@ -66,7 +70,9 @@ def upgrade():
with op.batch_alter_table("batches") as batch_op:
batch_op.alter_column("BatchID", new_column_name="id")
batch_op.alter_column("Discount", new_column_name="discount")
batch_op.alter_column("Name", new_column_name="name", type_=sa.Date(), nullable=False)
batch_op.alter_column(
"Name", new_column_name="name", type_=sa.Date(), nullable=False
)
batch_op.alter_column("ProductID", new_column_name="product_id")
batch_op.alter_column("QuantityRemaining", new_column_name="quantity_remaining")
batch_op.alter_column("Rate", new_column_name="rate")
@ -139,14 +145,22 @@ def upgrade():
op.rename_table("service_charges", "incentives")
with op.batch_alter_table("employees") as batch_op:
batch_op.alter_column("Designation", new_column_name="designation", nullable=False)
batch_op.alter_column(
"Designation", new_column_name="designation", nullable=False
)
batch_op.alter_column("Salary", new_column_name="salary", nullable=False)
batch_op.alter_column("ServicePoints", new_column_name="points", nullable=False)
batch_op.alter_column(
"JoiningDate", new_column_name="joining_date", type_=sa.Date(), nullable=False,
"JoiningDate",
new_column_name="joining_date",
type_=sa.Date(),
nullable=False,
)
batch_op.alter_column(
"LeavingDate", new_column_name="leaving_date", type_=sa.Date(), nullable=True,
"LeavingDate",
new_column_name="leaving_date",
type_=sa.Date(),
nullable=True,
)
with op.batch_alter_table("settings") as batch_op:
@ -161,56 +175,104 @@ def upgrade():
op.drop_constraint("auth_clients_Code_key", "auth_clients", type_="unique")
op.drop_constraint("auth_clients_Name_key", "auth_clients", type_="unique")
op.create_unique_constraint(
op.f("uq_auth_login_history_user_id"), "auth_login_history", ["user_id", "client_id", "date"],
op.f("uq_auth_login_history_user_id"),
"auth_login_history",
["user_id", "client_id", "date"],
)
op.drop_constraint(
"auth_login_history_user_id_client_id_date_key", "auth_login_history", type_="unique",
"auth_login_history_user_id_client_id_date_key",
"auth_login_history",
type_="unique",
)
op.create_unique_constraint(
op.f("uq_auth_permissions_name"), "auth_permissions", ["name"]
)
op.create_unique_constraint(op.f("uq_auth_permissions_name"), "auth_permissions", ["name"])
op.drop_constraint("auth_roles_Name_key", "auth_permissions", type_="unique")
op.create_unique_constraint(op.f("uq_auth_roles_name"), "auth_roles", ["name"])
op.drop_constraint("auth_groups_Name_key", "auth_roles", type_="unique")
op.create_unique_constraint(op.f("uq_auth_users_username"), "auth_users", ["username"])
op.create_unique_constraint(
op.f("uq_auth_users_username"), "auth_users", ["username"]
)
op.drop_constraint("auth_users_Name_key", "auth_users", type_="unique")
op.create_unique_constraint(op.f("uq_cost_centres_name"), "cost_centres", ["name"])
op.drop_constraint("entities_costcenters_Name_key", "cost_centres", type_="unique")
op.drop_constraint("uq_employee_id_date", "fingerprints", type_="unique")
op.create_index(op.f("ix_inventories_voucher_id"), "inventories", ["voucher_id"], unique=False)
op.create_unique_constraint(op.f("uq_inventories_voucher_id"), "inventories", ["voucher_id", "batch_id"])
op.create_index(
op.f("ix_inventories_voucher_id"), "inventories", ["voucher_id"], unique=False
)
op.create_unique_constraint(
op.f("uq_inventories_voucher_id"), "inventories", ["voucher_id", "batch_id"]
)
op.drop_index("ix_inventories_VoucherID", table_name="inventories")
op.create_index(op.f("ix_journals_voucher_id"), "journals", ["voucher_id"], unique=False)
op.create_index(
op.f("ix_journals_voucher_id"), "journals", ["voucher_id"], unique=False
)
op.drop_index("ix_journals_VoucherID", table_name="journals")
op.create_unique_constraint(op.f("uq_product_groups_name"), "product_groups", ["name"])
op.drop_constraint("entities_productgroups_Name_key", "product_groups", type_="unique")
op.create_unique_constraint(
op.f("uq_product_groups_name"), "product_groups", ["name"]
)
op.drop_constraint(
"entities_productgroups_Name_key", "product_groups", type_="unique"
)
op.create_unique_constraint(op.f("uq_products_code"), "products", ["code"])
op.create_unique_constraint(op.f("uq_products_name"), "products", ["name", "units"])
op.drop_constraint("products_Code_key", "products", type_="unique")
op.drop_constraint("products_Name_Units_key", "products", type_="unique")
op.create_unique_constraint(op.f("uq_recipe_items_recipe_id"), "recipe_items", ["recipe_id", "product_id"])
op.drop_constraint("recipe_items_recipe_id_product_id_key", "recipe_items", type_="unique")
op.create_unique_constraint(
op.f("uq_recipe_items_recipe_id"), "recipe_items", ["recipe_id", "product_id"]
)
op.drop_constraint(
"recipe_items_recipe_id_product_id_key", "recipe_items", type_="unique"
)
op.create_unique_constraint(op.f("uq_settings_name"), "settings", ["name"])
op.drop_constraint("settings_Name_key", "settings", type_="unique")
op.create_index(op.f("ix_vouchers_date"), "vouchers", ["date"], unique=False)
op.create_foreign_key(
"fk_incentives_journal_id_journals", "incentives", "journals", ["journal_id"], ["id"],
"fk_incentives_journal_id_journals",
"incentives",
"journals",
["journal_id"],
["id"],
)
op.create_foreign_key(
"fk_incentives_voucher_id_vouchers", "incentives", "vouchers", ["voucher_id"], ["id"],
)
op.drop_constraint("service_charges_journal_id_fkey", "incentives", type_="foreignkey")
op.drop_constraint("service_charges_voucher_id_fkey", "incentives", type_="foreignkey")
op.create_foreign_key(
"fk_employee_benefit_journal_id_journals", "employee_benefit", "journals", ["journal_id"], ["id"],
)
op.create_foreign_key(
"fk_employee_benefit_voucher_id_vouchers", "employee_benefit", "vouchers", ["voucher_id"], ["id"],
"fk_incentives_voucher_id_vouchers",
"incentives",
"vouchers",
["voucher_id"],
["id"],
)
op.drop_constraint(
"entities_salarydeductions_JournalID_fkey", "employee_benefit", type_="foreignkey",
"service_charges_journal_id_fkey", "incentives", type_="foreignkey"
)
op.drop_constraint(
"service_charges_voucher_id_fkey", "incentives", type_="foreignkey"
)
op.create_foreign_key(
"fk_employee_benefit_journal_id_journals",
"employee_benefit",
"journals",
["journal_id"],
["id"],
)
op.create_foreign_key(
"fk_employee_benefit_voucher_id_vouchers",
"employee_benefit",
"vouchers",
["voucher_id"],
["id"],
)
op.drop_constraint(
"entities_salarydeductions_JournalID_fkey",
"employee_benefit",
type_="foreignkey",
)
op.drop_constraint(
"salary_deductions_VoucherID_fkey", "employee_benefit", type_="foreignkey"
)
op.drop_constraint("salary_deductions_VoucherID_fkey", "employee_benefit", type_="foreignkey")
permission = table("auth_permissions", column("id", postgresql.UUID()), column("name", sa.String))
permission = table(
"auth_permissions", column("id", postgresql.UUID()), column("name", sa.String)
)
op.execute(
permission.update()
.where(permission.c.name == op.inline_literal("Service Charge"))
@ -228,9 +290,13 @@ def upgrade():
.values({"name": op.inline_literal("Incentives")})
)
# Remove unneeded Payment and Receipt permissions
permission = table("auth_permissions", column("id", postgresql.UUID()), column("name", sa.String))
permission = table(
"auth_permissions", column("id", postgresql.UUID()), column("name", sa.String)
)
role_permission = table(
"role_permissions", column("permission_id", postgresql.UUID()), column("role_id", postgresql.UUID()),
"role_permissions",
column("permission_id", postgresql.UUID()),
column("role_id", postgresql.UUID()),
)
op.execute(
role_permission.delete().where(

View File

@ -1 +1 @@
__version__ = "8.0.1"
__version__ = "8.0.2"

View File

@ -399,7 +399,7 @@ class Batch(Base):
query = query.filter(cls.name <= date)
if q is not None:
for item in q.split():
query = query.filter(cls.name.ilike(f"%{item}%"))
query = query.filter(Product.name.ilike(f"%{item}%"))
return query.order_by(Product.name).order_by(cls.name).all()
@classmethod

View File

@ -140,6 +140,11 @@ def show_id(
user: UserToken = Security(get_user, scopes=["users"]),
):
item: Role = db.query(Role).filter(Role.id == id_).first()
if item is None:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail="Role not found",
)
return role_info(item, db)

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "brewman"
version = "8.0.1"
version = "8.0.2"
description = "Accounting plus inventory management for a restaurant."
authors = ["tanshu <git@tanshu.com>"]

View File

@ -1,6 +1,6 @@
{
"name": "overlord",
"version": "8.0.1",
"version": "8.0.2",
"scripts": {
"ng": "ng",
"start": "ng serve",

View File

@ -1,5 +1,5 @@
export const environment = {
production: true,
ACCESS_TOKEN_REFRESH_MINUTES: 10, // refresh token 10 minutes before expiry
version: '8.0.1',
version: '8.0.2',
};