Add basic support for LOC SMS integration

This commit is contained in:
Lance Edgar 2020-09-20 22:09:44 -05:00
parent 9cda5b6ce8
commit 5260270ae7
8 changed files with 148 additions and 3 deletions

View file

@ -109,6 +109,15 @@ extras = {
'rattail-fabric2', # 0.2.3
],
'locsms': [
#
# package # low high
'luckysmores', # 0.2.3
'rattail-luckysmores', # 0.8.2
'tailbone-locsms', # 0.1.0
],
}

View file

@ -56,6 +56,12 @@ class TheoConfig(ConfigExtension):
config.setdefault('rattail.mail', 'emails', 'theo.emails.theo, theo.emails.catapult')
config.setdefault('rattail.importing', 'versions.handler', 'theo.importing.versions_catapult:FromTheoToTheoVersions')
# do we integrate w/ LOC SMS?
elif integrate_locsms(config):
config.setdefault('rattail', 'model', 'theo.db.model_locsms')
config.setdefault('rattail.mail', 'emails', 'theo.emails.theo, theo.emails.locsms')
config.setdefault('rattail.importing', 'versions.handler', 'theo.importing.versions_locsms:FromTheoToTheoVersions')
else: # no integration
config.setdefault('rattail.mail', 'emails', 'theo.emails.theo')
@ -68,3 +74,8 @@ def integrate_catapult(config):
def integrate_corepos(config):
return config.getbool('theo', 'integrate_corepos', default=False,
usedb=False)
def integrate_locsms(config):
return config.getbool('theo', 'integrate_locsms', default=False,
usedb=False)

31
theo/db/model_locsms.py Normal file
View 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/ LOC SMS integration
"""
# bring in all the normal stuff from Rattail
from rattail.db.model import *
# also bring in LOC SMS integration models
from rattail_luckysmores.db.model import *

27
theo/emails/locsms.py Normal file
View file

@ -0,0 +1,27 @@
# -*- 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 email profile settings
"""
from rattail_luckysmores.emails import rattail_import_locsms_updates

View file

@ -0,0 +1,40 @@
# -*- 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 -> Theo "versions" data import, w/ LOC SMS integration
"""
from rattail.importing import versions as base
from rattail_luckysmores.importing.versions import LocVersionMixin
class FromTheoToTheoVersions(base.FromRattailToRattailVersions,
LocVersionMixin):
"""
Handler for Theo -> Theo "versions" data import
"""
def get_importers(self):
importers = super(FromTheoToTheoVersions, self).get_importers()
importers = self.add_locsms_importers(importers)
return importers

View file

@ -26,7 +26,7 @@ Theo web app
from tailbone import app
from theo.config import integrate_catapult, integrate_corepos
from theo.config import integrate_catapult, integrate_corepos, integrate_locsms
def main(global_config, **settings):
@ -42,6 +42,8 @@ def main(global_config, **settings):
directories.append('tailbone_corepos:templates')
if integrate_catapult(rattail_config):
directories.append('tailbone_onager:templates')
if integrate_locsms(rattail_config):
directories.append('tailbone_locsms:templates')
directories.append('tailbone:templates')
settings.setdefault('mako.directories', directories)
@ -58,6 +60,9 @@ def main(global_config, **settings):
if integrate_corepos(rattail_config):
from tailbone_corepos.db import CoreOfficeSession
CoreOfficeSession.configure(bind=rattail_config.corepos_engine)
if integrate_locsms(rattail_config):
from tailbone_locsms.db import SmsSession
SmsSession.configure(bind=rattail_config.locsms_engine)
# bring in the rest of Theo
pyramid_config.include('theo.web.static')

View file

@ -24,7 +24,7 @@
Web Menus
"""
from theo.config import integrate_catapult, integrate_corepos
from theo.config import integrate_catapult, integrate_corepos, integrate_locsms
def simple_menus(request):
@ -33,6 +33,7 @@ def simple_menus(request):
include_catapult = integrate_catapult(rattail_config)
include_corepos = integrate_corepos(rattail_config)
include_locsms = integrate_locsms(rattail_config)
orders_menu = {
'title': "Orders",
@ -174,6 +175,10 @@ def simple_menus(request):
from tailbone_corepos.menus import make_corepos_menu
corepos_menu = make_corepos_menu(request)
if include_locsms:
from tailbone_locsms.menus import make_locsms_menu
locsms_menu = make_locsms_menu(request)
admin_menu = {
'title': "Admin",
'type': 'menu',
@ -248,6 +253,8 @@ def simple_menus(request):
menus.append(catapult_menu)
if include_corepos:
menus.append(corepos_menu)
if include_locsms:
menus.append(locsms_menu)
menus.append(admin_menu)

View file

@ -24,7 +24,7 @@
Views
"""
from theo.config import integrate_catapult, integrate_corepos
from theo.config import integrate_catapult, integrate_corepos, integrate_locsms
def includeme(config):
@ -78,6 +78,21 @@ def includeme(config):
config.include('tailbone_corepos.views.products')
config.include('tailbone_corepos.views.corepos')
# do we integrate w/ LOC SMS?
elif integrate_locsms(rattail_config):
config.include('tailbone.views.stores')
config.include('tailbone.views.customers')
config.include('tailbone.views.members')
config.include('tailbone.views.employees')
config.include('tailbone.views.people')
config.include('tailbone.views.taxes')
config.include('tailbone.views.departments')
config.include('tailbone.views.subdepartments')
config.include('tailbone.views.brands')
config.include('tailbone.views.vendors')
config.include('tailbone.views.products')
config.include('tailbone_locsms.views.locsms')
else: # no POS integration
config.include('tailbone.views.stores')
config.include('tailbone.views.customers')