diff --git a/tailbone/views/brands.py b/tailbone/views/brands.py index 4726a77f..cb24279c 100644 --- a/tailbone/views/brands.py +++ b/tailbone/views/brands.py @@ -36,6 +36,8 @@ class BrandsView(MasterView): Master view for the Brand class. """ model_class = model.Brand + has_versions = True + grid_columns = [ 'name', ] diff --git a/tailbone/views/categories.py b/tailbone/views/categories.py index a79c7549..5376776b 100644 --- a/tailbone/views/categories.py +++ b/tailbone/views/categories.py @@ -38,6 +38,7 @@ class CategoriesView(MasterView): model_class = model.Category model_title_plural = "Categories" route_prefix = 'categories' + has_versions = True grid_columns = [ 'code', diff --git a/tailbone/views/departments.py b/tailbone/views/departments.py index d990cd46..8f2a2760 100644 --- a/tailbone/views/departments.py +++ b/tailbone/views/departments.py @@ -39,6 +39,7 @@ class DepartmentsView(MasterView): Master view for the Department class. """ model_class = model.Department + has_versions = True grid_columns = [ 'number', diff --git a/tailbone/views/depositlinks.py b/tailbone/views/depositlinks.py index 8633ec94..b59bcef2 100644 --- a/tailbone/views/depositlinks.py +++ b/tailbone/views/depositlinks.py @@ -38,6 +38,7 @@ class DepositLinksView(MasterView): """ model_class = model.DepositLink url_prefix = '/deposit-links' + has_versions = True grid_columns = [ 'code', diff --git a/tailbone/views/employees.py b/tailbone/views/employees.py index 1657a257..92119537 100644 --- a/tailbone/views/employees.py +++ b/tailbone/views/employees.py @@ -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'), ] diff --git a/tailbone/views/families.py b/tailbone/views/families.py index c1b66b85..97ce44bc 100644 --- a/tailbone/views/families.py +++ b/tailbone/views/families.py @@ -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', diff --git a/tailbone/views/labels/profiles.py b/tailbone/views/labels/profiles.py index 9f61aac5..73fd7cb8 100644 --- a/tailbone/views/labels/profiles.py +++ b/tailbone/views/labels/profiles.py @@ -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', diff --git a/tailbone/views/products.py b/tailbone/views/products.py index 8f21c7d2..5f5b36a7 100644 --- a/tailbone/views/products.py +++ b/tailbone/views/products.py @@ -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. diff --git a/tailbone/views/reportcodes.py b/tailbone/views/reportcodes.py index b3613117..7aa04751 100644 --- a/tailbone/views/reportcodes.py +++ b/tailbone/views/reportcodes.py @@ -37,6 +37,7 @@ class ReportCodesView(MasterView): """ model_class = model.ReportCode model_title = "Report Code" + has_versions = True grid_columns = [ 'code', diff --git a/tailbone/views/roles.py b/tailbone/views/roles.py index 7d514e1b..7432cfa7 100644 --- a/tailbone/views/roles.py +++ b/tailbone/views/roles.py @@ -44,6 +44,7 @@ class RolesView(PrincipalMasterView): Master view for the Role model. """ model_class = model.Role + has_versions = True grid_columns = [ 'name', diff --git a/tailbone/views/shifts/core.py b/tailbone/views/shifts/core.py index 2ad055af..ce9f4350 100644 --- a/tailbone/views/shifts/core.py +++ b/tailbone/views/shifts/core.py @@ -106,6 +106,7 @@ class WorkedShiftsView(MasterView): """ model_class = model.WorkedShift url_prefix = '/shifts/worked' + has_versions = True grid_columns = [ 'employee', diff --git a/tailbone/views/subdepartments.py b/tailbone/views/subdepartments.py index 9d1c070c..214c33f6 100644 --- a/tailbone/views/subdepartments.py +++ b/tailbone/views/subdepartments.py @@ -37,6 +37,7 @@ class SubdepartmentsView(MasterView): Master view for the Subdepartment class. """ model_class = model.Subdepartment + has_versions = True grid_columns = [ 'number', diff --git a/tailbone/views/taxes.py b/tailbone/views/taxes.py index 7d89a8de..2cfbbbff 100644 --- a/tailbone/views/taxes.py +++ b/tailbone/views/taxes.py @@ -38,6 +38,7 @@ class TaxesView(MasterView): model_class = model.Tax model_title_plural = "Taxes" route_prefix = 'taxes' + has_versions = True grid_columns = [ 'code', diff --git a/tailbone/views/users.py b/tailbone/views/users.py index 4b1e465b..ece76bf8 100644 --- a/tailbone/views/users.py +++ b/tailbone/views/users.py @@ -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)\