Add some basic support for Catapult integration
can view their data directly in web app, and import to rattail tables
This commit is contained in:
parent
a18852f204
commit
0a4ae38f88
18
setup.py
18
setup.py
|
@ -62,12 +62,29 @@ requires = [
|
|||
#
|
||||
# package # low high
|
||||
|
||||
# TODO: must cap this for now, b/c it breaks Catapult integration?!
|
||||
# (something about "Syntax error near 'ROWS'" with grid queries)
|
||||
'SQLAlchemy<1.3', # 1.2.19
|
||||
|
||||
'psycopg2', # 2.8.5
|
||||
'rattail', # 0.9.130
|
||||
'Tailbone', # 0.8.97
|
||||
]
|
||||
|
||||
|
||||
extras = {
|
||||
|
||||
'catapult': [
|
||||
#
|
||||
# package # low high
|
||||
|
||||
'onager', # 0.2.8
|
||||
'rattail-onager', # 0.2.1
|
||||
'tailbone-onager', # 0.2.3
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
setup(
|
||||
name = "tailbone-theo",
|
||||
version = __version__,
|
||||
|
@ -91,6 +108,7 @@ setup(
|
|||
],
|
||||
|
||||
install_requires = requires,
|
||||
extras_require = extras,
|
||||
packages = find_packages(),
|
||||
include_package_data = True,
|
||||
|
||||
|
|
|
@ -40,3 +40,7 @@ class TheoConfig(ConfigExtension):
|
|||
|
||||
# Theo comes with its own menu for web app
|
||||
config.setdefault('tailbone', 'menus', 'theo.web.menus')
|
||||
|
||||
|
||||
def integrate_catapult(config):
|
||||
return config.getbool('theo', 'integrate_catapult', default=False)
|
||||
|
|
|
@ -26,6 +26,8 @@ Theo web app
|
|||
|
||||
from tailbone import app
|
||||
|
||||
from theo.config import integrate_catapult
|
||||
|
||||
|
||||
def main(global_config, **settings):
|
||||
"""
|
||||
|
@ -42,6 +44,11 @@ def main(global_config, **settings):
|
|||
rattail_config = app.make_rattail_config(settings)
|
||||
pyramid_config = app.make_pyramid_config(settings)
|
||||
|
||||
# maybe add catapult integrations
|
||||
if integrate_catapult(rattail_config):
|
||||
from tailbone_onager.db import CatapultSession
|
||||
CatapultSession.configure(bind=rattail_config.catapult_engine)
|
||||
|
||||
# bring in the rest of Theo
|
||||
pyramid_config.include('theo.web.static')
|
||||
pyramid_config.include('theo.web.subscribers')
|
||||
|
|
|
@ -24,12 +24,16 @@
|
|||
Web Menus
|
||||
"""
|
||||
|
||||
from theo.config import integrate_catapult
|
||||
|
||||
|
||||
def simple_menus(request):
|
||||
url = request.route_url
|
||||
rattail_config = request.rattail_config
|
||||
|
||||
menus = [
|
||||
{
|
||||
include_catapult = integrate_catapult(rattail_config)
|
||||
|
||||
orders_menu = {
|
||||
'title': "Orders",
|
||||
'type': 'menu',
|
||||
'items': [
|
||||
|
@ -54,8 +58,9 @@ def simple_menus(request):
|
|||
# 'perm': 'custorders.configure',
|
||||
# },
|
||||
],
|
||||
},
|
||||
{
|
||||
}
|
||||
|
||||
people_menu = {
|
||||
'title': "People",
|
||||
'type': 'menu',
|
||||
'items': [
|
||||
|
@ -75,8 +80,9 @@ def simple_menus(request):
|
|||
'perm': 'people.list',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
}
|
||||
|
||||
products_menu = {
|
||||
'title': "Products",
|
||||
'type': 'menu',
|
||||
'items': [
|
||||
|
@ -106,8 +112,48 @@ def simple_menus(request):
|
|||
'perm': 'vendors.list',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
if include_catapult:
|
||||
catapult_menu = {
|
||||
'title': "Catapult",
|
||||
'type': 'menu',
|
||||
'items': [
|
||||
{
|
||||
'title': "Departments",
|
||||
'url': url('catapult.departments'),
|
||||
'perm': 'catapult.departments.list',
|
||||
},
|
||||
{
|
||||
'title': "Terminals",
|
||||
'url': url('catapult.terminals'),
|
||||
'perm': 'catapult.terminals.list',
|
||||
},
|
||||
{
|
||||
'title': "Transactions",
|
||||
'url': url('catapult.transactions'),
|
||||
'perm': 'catapult.transactions.list',
|
||||
},
|
||||
{
|
||||
'title': "Worksheets",
|
||||
'url': url('catapult.worksheets'),
|
||||
'perm': 'catapult.worksheets.list',
|
||||
},
|
||||
{'type': 'sep'},
|
||||
{
|
||||
'title': "Security Profiles",
|
||||
'url': url('catapult.security_profiles'),
|
||||
'perm': 'catapult.security_profiles.view',
|
||||
},
|
||||
{
|
||||
'title': "Master Functions",
|
||||
'url': url('catapult.master_functions'),
|
||||
'perm': 'catapult.master_functions.view',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
admin_menu = {
|
||||
'title': "Admin",
|
||||
'type': 'menu',
|
||||
'items': [
|
||||
|
@ -169,7 +215,17 @@ def simple_menus(request):
|
|||
'perm': 'upgrades.list',
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
menus = [
|
||||
orders_menu,
|
||||
people_menu,
|
||||
products_menu,
|
||||
]
|
||||
|
||||
if include_catapult:
|
||||
menus.append(catapult_menu)
|
||||
|
||||
menus.append(admin_menu)
|
||||
|
||||
return menus
|
||||
|
|
|
@ -24,8 +24,11 @@
|
|||
Views
|
||||
"""
|
||||
|
||||
from theo.config import integrate_catapult
|
||||
|
||||
|
||||
def includeme(config):
|
||||
rattail_config = config.registry.settings.get('rattail_config')
|
||||
|
||||
# core views
|
||||
config.include('theo.web.views.common')
|
||||
|
@ -53,3 +56,7 @@ def includeme(config):
|
|||
config.include('tailbone.views.subdepartments')
|
||||
config.include('tailbone.views.users')
|
||||
config.include('tailbone.views.vendors')
|
||||
|
||||
# catapult views
|
||||
if integrate_catapult(rattail_config):
|
||||
config.include('tailbone_onager.views')
|
||||
|
|
Loading…
Reference in a new issue