Cleanup initial app, expose only CORE direct data views for now

This commit is contained in:
Lance Edgar 2020-12-03 15:07:46 -06:00
parent e188096fe7
commit 31056f2c38
6 changed files with 72 additions and 169 deletions

View file

@ -17,4 +17,4 @@ class CorporalConfig(ConfigExtension):
config.setdefault('rattail.mail', 'emails', 'corporal.emails') config.setdefault('rattail.mail', 'emails', 'corporal.emails')
config.setdefault('rattail', 'settings', 'corporal.settings') config.setdefault('rattail', 'settings', 'corporal.settings')
config.setdefault('tailbone', 'menus', 'corporal.web.menus') config.setdefault('tailbone', 'menus', 'corporal.web.menus')
config.setdefault('rattail.config', 'templates', 'corporal:data/config rattail:data/config')

View file

@ -6,6 +6,28 @@
############################################################ ############################################################
##############################
# corepos
##############################
[corepos]
# TODO: set this to your local Fannie URL
office.url = http://corepos-server/fannie/
[corepos.api]
# TODO: if applicable, set this to your local Fannie API URL
url = http://corepos-server/fannie/ws/
[corepos.db.office_op]
# TODO: make sure user credentials and server, database names are correct
default.url = mysql+mysqlconnector://username:password@corepos-server/core_op
default.pool_recycle = 3600
[corepos.db.office_trans]
# TODO: make sure user credentials and server, database names are correct
default.url = mysql+mysqlconnector://username:password@corepos-server/core_trans
default.pool_recycle = 3600
############################## ##############################
# rattail # rattail
@ -46,7 +68,7 @@ default.to = root@localhost
[alembic] [alembic]
script_location = rattail.db:alembic script_location = rattail.db:alembic
version_locations = rattail.db:alembic/versions version_locations = rattail_corepos.db:alembic/versions rattail.db:alembic/versions
############################## ##############################

View file

@ -3,7 +3,12 @@
Corporal web app Corporal web app
""" """
from sqlalchemy.orm import sessionmaker, scoped_session
from zope.sqlalchemy import register
from tailbone import app from tailbone import app
from tailbone_corepos.db import (CoreOfficeSession, CoreTransSession,
ExtraCoreOfficeSessions, ExtraCoreTransSessions)
def main(global_config, **settings): def main(global_config, **settings):
@ -12,13 +17,30 @@ def main(global_config, **settings):
""" """
# prefer Corporal templates over Tailbone # prefer Corporal templates over Tailbone
settings.setdefault('mako.directories', ['corporal.web:templates', settings.setdefault('mako.directories', ['corporal.web:templates',
'tailbone_corepos:templates',
'tailbone:templates']) 'tailbone:templates'])
# make config objects # make config objects
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 configure integration db connections # CORE-POS DB(s)
CoreOfficeSession.configure(bind=rattail_config.corepos_engine)
CoreTransSession.configure(bind=rattail_config.coretrans_engine)
# create session wrappers for each "extra" CORE DB engine
for key, engine in rattail_config.corepos_engines.items():
if key != 'default':
Session = scoped_session(sessionmaker(bind=engine))
register(Session)
ExtraCoreOfficeSessions[key] = Session
# create session wrappers for each "extra" CORE Transaction DB engine
for key, engine in rattail_config.coretrans_engines.items():
if key != 'default':
Session = scoped_session(sessionmaker(bind=engine))
register(Session)
ExtraCoreTransSessions[key] = Session
# bring in the rest of Corporal # bring in the rest of Corporal
pyramid_config.include('corporal.web.static') pyramid_config.include('corporal.web.static')

View file

@ -3,151 +3,18 @@
Corporal Web Menus Corporal Web Menus
""" """
from tailbone_corepos.menus import make_corepos_menu
def simple_menus(request): def simple_menus(request):
url = request.route_url url = request.route_url
people_menu = { corepos_menu = make_corepos_menu(request)
'title': "People",
'type': 'menu',
'items': [
{
'title': "Members",
'url': url('members'),
'perm': 'members.list',
},
{
'title': "Customers",
'url': url('customers'),
'perm': 'customers.list',
},
{
'title': "Customer Groups",
'url': url('customergroups'),
'perm': 'customergroups.list',
},
{
'title': "Employees",
'url': url('employees'),
'perm': 'employees.list',
},
{
'title': "All People",
'url': url('people'),
'perm': 'people.list',
},
],
}
products_menu = {
'title': "Products",
'type': 'menu',
'items': [
{
'title': "Products",
'url': url('products'),
'perm': 'products.list',
},
{
'title': "Departments",
'url': url('departments'),
'perm': 'departments.list',
},
{
'title': "Subdepartments",
'url': url('subdepartments'),
'perm': 'subdepartments.list',
},
{
'title': "Brands",
'url': url('brands'),
'perm': 'brands.list',
},
{
'title': "Families",
'url': url('families'),
'perm': 'families.list',
},
{
'title': "Report Codes",
'url': url('reportcodes'),
'perm': 'reportcodes.list',
},
],
}
vendors_menu = {
'title': "Vendors",
'type': 'menu',
'items': [
{
'title': "Vendors",
'url': url('vendors'),
'perm': 'vendors.list',
},
{'type': 'sep'},
{
'title': "Ordering",
'url': url('ordering'),
'perm': 'ordering.list',
},
{
'title': "Receiving",
'url': url('receiving'),
'perm': 'receiving.list',
},
{'type': 'sep'},
{
'title': "Purchases",
'url': url('purchases'),
'perm': 'purchases.list',
},
{
'title': "Credits",
'url': url('purchases.credits'),
'perm': 'purchases.credits.list',
},
# {'type': 'sep'},
# {
# 'title': "Catalogs",
# 'url': url('vendorcatalogs'),
# 'perm': 'vendorcatalogs.list',
# },
# {
# 'title': "Upload New Catalog",
# 'url': url('vendorcatalogs.create'),
# 'perm': 'vendorcatalogs.create',
# },
],
}
batches_menu = {
'title': "Batches",
'type': 'menu',
'items': [
{
'title': "Handheld",
'url': url('batch.handheld'),
'perm': 'batch.handheld.list',
},
# {
# 'title': "Inventory",
# 'url': url('batch.inventory'),
# 'perm': 'batch.inventory.list',
# },
],
}
admin_menu = { admin_menu = {
'title': "Admin", 'title': "Admin",
'type': 'menu', 'type': 'menu',
'items': [ 'items': [
{
'title': "Stores",
'url': url('stores'),
'perm': 'stores.list',
},
{ {
'title': "Users", 'title': "Users",
'url': url('users'), 'url': url('users'),
@ -199,10 +66,7 @@ def simple_menus(request):
} }
menus = [ menus = [
people_menu, corepos_menu,
products_menu,
vendors_menu,
batches_menu,
admin_menu, admin_menu,
] ]

View file

@ -18,29 +18,23 @@ def includeme(config):
config.include('tailbone.views.datasync') config.include('tailbone.views.datasync')
config.include('tailbone.views.email') config.include('tailbone.views.email')
config.include('tailbone.views.families') config.include('tailbone.views.families')
config.include('tailbone.views.members') config.include('tailbone_corepos.views.members')
config.include('tailbone.views.messages') config.include('tailbone.views.messages')
config.include('tailbone.views.people') config.include('tailbone_corepos.views.people')
config.include('tailbone.views.reportcodes') config.include('tailbone.views.reportcodes')
config.include('tailbone.views.roles') config.include('tailbone.views.roles')
config.include('tailbone.views.settings') config.include('tailbone.views.settings')
config.include('tailbone.views.subdepartments') config.include('tailbone_corepos.views.subdepartments')
config.include('tailbone.views.shifts') config.include('tailbone.views.shifts')
config.include('tailbone.views.users') config.include('tailbone.views.users')
config.include('tailbone.views.stores') config.include('tailbone.views.stores')
config.include('tailbone.views.customers') config.include('tailbone_corepos.views.customers')
config.include('tailbone.views.employees') config.include('tailbone.views.employees')
config.include('tailbone.views.taxes') config.include('tailbone.views.taxes')
config.include('tailbone.views.departments') config.include('tailbone_corepos.views.departments')
config.include('tailbone.views.brands') config.include('tailbone.views.brands')
config.include('tailbone.views.vendors') config.include('tailbone_corepos.views.vendors')
config.include('tailbone.views.products') config.include('tailbone_corepos.views.products')
# purchasing / receiving # CORE-POS direct data views
config.include('tailbone.views.purchases') config.include('tailbone_corepos.views.corepos')
config.include('tailbone.views.purchasing')
# batch views
config.include('tailbone.views.handheld')
config.include('tailbone.views.batch.inventory')

View file

@ -41,30 +41,31 @@ requires = [
# #
# package # low high # package # low high
'invoke', # 1.4.1 # TODO: remove cap for mysql-connector once we figure out what's up with that
'rattail[auth,db,bouncer]', # 0.9.141 'mysql-connector-python==8.0.17',
'rattail-fabric2', # 0.2.1
'invoke', # 1.4.1
'psycopg2', # 2.8.4 'psycopg2', # 2.8.4
'rattail[auth,db,bouncer]', # 0.9.141
'rattail-fabric2', # 0.2.1
'Tailbone', # 0.8.72 'Tailbone', # 0.8.72
'pyCOREPOS', # 0.1.1
'rattail-corepos', # 0.1.3
'tailbone-corepos', # 0.1.3
] ]
setup( setup(
name = "Corporal", name = "Corporal",
version = __version__, version = __version__,
author = "Your Name", author = "Lance Edgar",
author_email = "you@example.com", author_email = "lance@edbob.org",
# url = "", url = "https://rattailproject.org",
description = "Custom Rattail project for Lance Edgar", description = "Companion Back-end for CORE-POS",
long_description = README, long_description = README,
classifiers = [ classifiers = [
# TODO: remove this if you intend to publish your project!
# (it's here by default, to prevent accidental publishing)
'Private :: Do Not Upload',
'Development Status :: 3 - Alpha', 'Development Status :: 3 - Alpha',
'Environment :: Console', 'Environment :: Console',
'Environment :: Web Environment', 'Environment :: Web Environment',