Expose version history for all supported tables
mostly for sake of products, but various..
This commit is contained in:
parent
5be3671a77
commit
bea28e97e9
|
@ -36,6 +36,8 @@ class BrandsView(MasterView):
|
|||
Master view for the Brand class.
|
||||
"""
|
||||
model_class = model.Brand
|
||||
has_versions = True
|
||||
|
||||
grid_columns = [
|
||||
'name',
|
||||
]
|
||||
|
|
|
@ -38,6 +38,7 @@ class CategoriesView(MasterView):
|
|||
model_class = model.Category
|
||||
model_title_plural = "Categories"
|
||||
route_prefix = 'categories'
|
||||
has_versions = True
|
||||
|
||||
grid_columns = [
|
||||
'code',
|
||||
|
|
|
@ -39,6 +39,7 @@ class DepartmentsView(MasterView):
|
|||
Master view for the Department class.
|
||||
"""
|
||||
model_class = model.Department
|
||||
has_versions = True
|
||||
|
||||
grid_columns = [
|
||||
'number',
|
||||
|
|
|
@ -38,6 +38,7 @@ class DepositLinksView(MasterView):
|
|||
"""
|
||||
model_class = model.DepositLink
|
||||
url_prefix = '/deposit-links'
|
||||
has_versions = True
|
||||
|
||||
grid_columns = [
|
||||
'code',
|
||||
|
|
|
@ -158,6 +158,8 @@ class EmployeesView(MasterView):
|
|||
(model.Person, 'uuid', 'person_uuid'),
|
||||
(model.EmployeePhoneNumber, 'parent_uuid'),
|
||||
(model.EmployeeEmailAddress, 'parent_uuid'),
|
||||
(model.EmployeeStore, 'employee_uuid'),
|
||||
(model.EmployeeDepartment, 'employee_uuid'),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,9 @@ class FamiliesView(MasterView):
|
|||
model_class = model.Family
|
||||
model_title_plural = "Families"
|
||||
route_prefix = 'families'
|
||||
has_versions = True
|
||||
grid_key = 'families'
|
||||
|
||||
grid_columns = [
|
||||
'code',
|
||||
'name',
|
||||
|
|
|
@ -42,6 +42,8 @@ class ProfilesView(MasterView):
|
|||
model_class = model.LabelProfile
|
||||
model_title = "Label Profile"
|
||||
url_prefix = '/labels/profiles'
|
||||
has_versions = True
|
||||
|
||||
grid_columns = [
|
||||
'ordinal',
|
||||
'code',
|
||||
|
|
|
@ -77,6 +77,7 @@ class ProductsView(MasterView):
|
|||
"""
|
||||
model_class = model.Product
|
||||
supports_mobile = True
|
||||
has_versions = True
|
||||
|
||||
grid_columns = [
|
||||
'upc',
|
||||
|
@ -89,12 +90,6 @@ class ProductsView(MasterView):
|
|||
'current_price',
|
||||
]
|
||||
|
||||
# child_version_classes = [
|
||||
# (model.ProductCode, 'product_uuid'),
|
||||
# (model.ProductCost, 'product_uuid'),
|
||||
# (model.ProductPrice, 'product_uuid'),
|
||||
# ]
|
||||
|
||||
# These aliases enable the grid queries to filter products which may be
|
||||
# purchased from *any* vendor, and yet sort by only the "preferred" vendor
|
||||
# (since that's what shows up in the grid column).
|
||||
|
@ -366,6 +361,13 @@ class ProductsView(MasterView):
|
|||
'instance_title': self.get_instance_title(instance),
|
||||
'form': form})
|
||||
|
||||
def get_version_child_classes(self):
|
||||
return [
|
||||
(model.ProductCode, 'product_uuid'),
|
||||
(model.ProductCost, 'product_uuid'),
|
||||
(model.ProductPrice, 'product_uuid'),
|
||||
]
|
||||
|
||||
def image(self):
|
||||
"""
|
||||
View which renders the product's image as a response.
|
||||
|
|
|
@ -37,6 +37,7 @@ class ReportCodesView(MasterView):
|
|||
"""
|
||||
model_class = model.ReportCode
|
||||
model_title = "Report Code"
|
||||
has_versions = True
|
||||
|
||||
grid_columns = [
|
||||
'code',
|
||||
|
|
|
@ -44,6 +44,7 @@ class RolesView(PrincipalMasterView):
|
|||
Master view for the Role model.
|
||||
"""
|
||||
model_class = model.Role
|
||||
has_versions = True
|
||||
|
||||
grid_columns = [
|
||||
'name',
|
||||
|
|
|
@ -106,6 +106,7 @@ class WorkedShiftsView(MasterView):
|
|||
"""
|
||||
model_class = model.WorkedShift
|
||||
url_prefix = '/shifts/worked'
|
||||
has_versions = True
|
||||
|
||||
grid_columns = [
|
||||
'employee',
|
||||
|
|
|
@ -37,6 +37,7 @@ class SubdepartmentsView(MasterView):
|
|||
Master view for the Subdepartment class.
|
||||
"""
|
||||
model_class = model.Subdepartment
|
||||
has_versions = True
|
||||
|
||||
grid_columns = [
|
||||
'number',
|
||||
|
|
|
@ -38,6 +38,7 @@ class TaxesView(MasterView):
|
|||
model_class = model.Tax
|
||||
model_title_plural = "Taxes"
|
||||
route_prefix = 'taxes'
|
||||
has_versions = True
|
||||
|
||||
grid_columns = [
|
||||
'code',
|
||||
|
|
|
@ -128,6 +128,8 @@ class UsersView(PrincipalMasterView):
|
|||
Master view for the User model.
|
||||
"""
|
||||
model_class = model.User
|
||||
has_versions = True
|
||||
|
||||
mergeable = True
|
||||
merge_additive_fields = [
|
||||
'sent_message_count',
|
||||
|
@ -212,6 +214,11 @@ class UsersView(PrincipalMasterView):
|
|||
return user.username != 'chuck'
|
||||
return True
|
||||
|
||||
def get_version_child_classes(self):
|
||||
return [
|
||||
(model.UserRole, 'user_uuid'),
|
||||
]
|
||||
|
||||
def find_principals_with_permission(self, session, permission):
|
||||
# TODO: this should search Permission table instead, and work backward to User?
|
||||
all_users = session.query(model.User)\
|
||||
|
|
Loading…
Reference in a new issue