Add some basic support for CORE-POS integration
This commit is contained in:
parent
0a4ae38f88
commit
dd4226fcd6
13
setup.py
13
setup.py
|
@ -82,6 +82,19 @@ extras = {
|
||||||
'rattail-onager', # 0.2.1
|
'rattail-onager', # 0.2.1
|
||||||
'tailbone-onager', # 0.2.3
|
'tailbone-onager', # 0.2.3
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'corepos': [
|
||||||
|
#
|
||||||
|
# package # low high
|
||||||
|
|
||||||
|
# TODO: must cap this for now, b/c it breaks CORE-POS integration?!
|
||||||
|
# (sometimes there are segfaults with basic grid queries)
|
||||||
|
'mysql-connector-python==8.0.17',
|
||||||
|
|
||||||
|
'pyCOREPOS', # 0.1.0
|
||||||
|
'rattail-corepos', # 0.1.0
|
||||||
|
'tailbone-corepos', # 0.1.1
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,19 @@ class TheoConfig(ConfigExtension):
|
||||||
# call the app "Theo" by default
|
# call the app "Theo" by default
|
||||||
config.setdefault('rattail', 'app_title', "Theo")
|
config.setdefault('rattail', 'app_title', "Theo")
|
||||||
|
|
||||||
|
# Theo may define a custom data model
|
||||||
|
if integrate_corepos(config):
|
||||||
|
config.setdefault('rattail', 'model', 'theo.db.model_corepos')
|
||||||
|
|
||||||
# Theo comes with its own menu for web app
|
# Theo comes with its own menu for web app
|
||||||
config.setdefault('tailbone', 'menus', 'theo.web.menus')
|
config.setdefault('tailbone', 'menus', 'theo.web.menus')
|
||||||
|
|
||||||
|
|
||||||
def integrate_catapult(config):
|
def integrate_catapult(config):
|
||||||
return config.getbool('theo', 'integrate_catapult', default=False)
|
return config.getbool('theo', 'integrate_catapult', default=False,
|
||||||
|
usedb=False)
|
||||||
|
|
||||||
|
|
||||||
|
def integrate_corepos(config):
|
||||||
|
return config.getbool('theo', 'integrate_corepos', default=False,
|
||||||
|
usedb=False)
|
||||||
|
|
0
theo/db/__init__.py
Normal file
0
theo/db/__init__.py
Normal file
31
theo/db/model_corepos.py
Normal file
31
theo/db/model_corepos.py
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
# -*- coding: utf-8; -*-
|
||||||
|
################################################################################
|
||||||
|
#
|
||||||
|
# Rattail -- Retail Software Framework
|
||||||
|
# Copyright © 2010-2020 Lance Edgar
|
||||||
|
#
|
||||||
|
# This file is part of Rattail.
|
||||||
|
#
|
||||||
|
# Rattail is free software: you can redistribute it and/or modify it under the
|
||||||
|
# terms of the GNU General Public License as published by the Free Software
|
||||||
|
# Foundation, either version 3 of the License, or (at your option) any later
|
||||||
|
# version.
|
||||||
|
#
|
||||||
|
# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
# details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along with
|
||||||
|
# Rattail. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
"""
|
||||||
|
Theo data model w/ CORE-POS integration
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bring in all the normal stuff from Rattail
|
||||||
|
from rattail.db.model import *
|
||||||
|
|
||||||
|
# also bring in CORE integration models
|
||||||
|
from rattail_corepos.db.model import *
|
|
@ -26,7 +26,7 @@ Theo web app
|
||||||
|
|
||||||
from tailbone import app
|
from tailbone import app
|
||||||
|
|
||||||
from theo.config import integrate_catapult
|
from theo.config import integrate_catapult, integrate_corepos
|
||||||
|
|
||||||
|
|
||||||
def main(global_config, **settings):
|
def main(global_config, **settings):
|
||||||
|
@ -44,10 +44,13 @@ def main(global_config, **settings):
|
||||||
rattail_config = app.make_rattail_config(settings)
|
rattail_config = app.make_rattail_config(settings)
|
||||||
pyramid_config = app.make_pyramid_config(settings)
|
pyramid_config = app.make_pyramid_config(settings)
|
||||||
|
|
||||||
# maybe add catapult integrations
|
# maybe configure integration db connections
|
||||||
if integrate_catapult(rattail_config):
|
if integrate_catapult(rattail_config):
|
||||||
from tailbone_onager.db import CatapultSession
|
from tailbone_onager.db import CatapultSession
|
||||||
CatapultSession.configure(bind=rattail_config.catapult_engine)
|
CatapultSession.configure(bind=rattail_config.catapult_engine)
|
||||||
|
if integrate_corepos(rattail_config):
|
||||||
|
from tailbone_corepos.db import CoreOfficeSession
|
||||||
|
CoreOfficeSession.configure(bind=rattail_config.corepos_engine)
|
||||||
|
|
||||||
# bring in the rest of Theo
|
# bring in the rest of Theo
|
||||||
pyramid_config.include('theo.web.static')
|
pyramid_config.include('theo.web.static')
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
Web Menus
|
Web Menus
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from theo.config import integrate_catapult
|
from theo.config import integrate_catapult, integrate_corepos
|
||||||
|
|
||||||
|
|
||||||
def simple_menus(request):
|
def simple_menus(request):
|
||||||
|
@ -32,6 +32,7 @@ def simple_menus(request):
|
||||||
rattail_config = request.rattail_config
|
rattail_config = request.rattail_config
|
||||||
|
|
||||||
include_catapult = integrate_catapult(rattail_config)
|
include_catapult = integrate_catapult(rattail_config)
|
||||||
|
include_corepos = integrate_corepos(rattail_config)
|
||||||
|
|
||||||
orders_menu = {
|
orders_menu = {
|
||||||
'title': "Orders",
|
'title': "Orders",
|
||||||
|
@ -153,6 +154,59 @@ def simple_menus(request):
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if include_corepos:
|
||||||
|
corepos_menu = {
|
||||||
|
'title': "CORE-POS",
|
||||||
|
'type': 'menu',
|
||||||
|
'items': [
|
||||||
|
{
|
||||||
|
'title': "Departments",
|
||||||
|
'url': url('corepos.departments'),
|
||||||
|
'perm': 'corepos.departments.list',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': "Subdepartments",
|
||||||
|
'url': url('corepos.subdepartments'),
|
||||||
|
'perm': 'corepos.subdepartments.list',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': "Vendors",
|
||||||
|
'url': url('corepos.vendors'),
|
||||||
|
'perm': 'corepos.vendors.list',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': "Products",
|
||||||
|
'url': url('corepos.products'),
|
||||||
|
'perm': 'corepos.products.list',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': "Customers",
|
||||||
|
'url': url('corepos.customers'),
|
||||||
|
'perm': 'corepos.customers.list',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': "Member Types",
|
||||||
|
'url': url('corepos.member_types'),
|
||||||
|
'perm': 'corepos.member_types.list',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': "Members",
|
||||||
|
'url': url('corepos.members'),
|
||||||
|
'perm': 'corepos.members.list',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': "Employees",
|
||||||
|
'url': url('corepos.employees'),
|
||||||
|
'perm': 'corepos.employees.list',
|
||||||
|
},
|
||||||
|
# {
|
||||||
|
# 'title': "Transaction Details",
|
||||||
|
# 'url': url('corepos.transaction_details'),
|
||||||
|
# 'perm': 'corepos.transaction_details.list',
|
||||||
|
# },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
admin_menu = {
|
admin_menu = {
|
||||||
'title': "Admin",
|
'title': "Admin",
|
||||||
'type': 'menu',
|
'type': 'menu',
|
||||||
|
@ -225,6 +279,8 @@ def simple_menus(request):
|
||||||
|
|
||||||
if include_catapult:
|
if include_catapult:
|
||||||
menus.append(catapult_menu)
|
menus.append(catapult_menu)
|
||||||
|
if include_corepos:
|
||||||
|
menus.append(corepos_menu)
|
||||||
|
|
||||||
menus.append(admin_menu)
|
menus.append(admin_menu)
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
Views
|
Views
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from theo.config import integrate_catapult
|
from theo.config import integrate_catapult, integrate_corepos
|
||||||
|
|
||||||
|
|
||||||
def includeme(config):
|
def includeme(config):
|
||||||
|
@ -60,3 +60,7 @@ def includeme(config):
|
||||||
# catapult views
|
# catapult views
|
||||||
if integrate_catapult(rattail_config):
|
if integrate_catapult(rattail_config):
|
||||||
config.include('tailbone_onager.views')
|
config.include('tailbone_onager.views')
|
||||||
|
|
||||||
|
# corepos views
|
||||||
|
if integrate_corepos(rattail_config):
|
||||||
|
config.include('tailbone_corepos.views')
|
||||||
|
|
Loading…
Reference in a new issue