diff --git a/rattail_demo/config.py b/rattail_demo/config.py index 7815db9..29524c4 100644 --- a/rattail_demo/config.py +++ b/rattail_demo/config.py @@ -14,6 +14,8 @@ class DemoConfigExtension(ConfigExtension): def configure(self, config): + config.setdefault('rattail', 'app_package', 'rattail_demo') + # tell rattail where our stuff lives config.setdefault('rattail', 'model', 'rattail_demo.db.model') config.setdefault('rattail.mail', 'emails', 'rattail_demo.emails') diff --git a/rattail_demo/db/model/__init__.py b/rattail_demo/db/model/__init__.py index c1974e2..8e6126a 100644 --- a/rattail_demo/db/model/__init__.py +++ b/rattail_demo/db/model/__init__.py @@ -6,8 +6,11 @@ Rattail Demo data model # bring in all the normal stuff from Rattail from rattail.db.model import * -# also bring in CORE integration models +# also bring in CORE-POS integration models from rattail_corepos.db.model import * +# also bring in WooCommerce integration models +from rattail_woocommerce.db.model import * + # now bring in Demo-specific models from .shopfoo import ShopfooProduct, ShopfooProductExport diff --git a/rattail_demo/importing/versions.py b/rattail_demo/importing/versions.py index 07d4067..332a29d 100644 --- a/rattail_demo/importing/versions.py +++ b/rattail_demo/importing/versions.py @@ -6,10 +6,12 @@ Rattail Demo -> Rattail Demo "versions" data import from rattail_demo.db import model from rattail.importing import versions as base from rattail_corepos.importing.versions import CoreposVersionMixin +from rattail_woocommerce.importing.versions import WooVersionMixin class FromRattailDemoToRattailDemoVersions(base.FromRattailToRattailVersions, - CoreposVersionMixin): + CoreposVersionMixin, + WooVersionMixin): """ Handler for Rattail Demo -> Rattail Demo "versions" data import """ @@ -17,6 +19,7 @@ class FromRattailDemoToRattailDemoVersions(base.FromRattailToRattailVersions, def get_importers(self): importers = super(FromRattailDemoToRattailDemoVersions, self).get_importers() importers = self.add_corepos_importers(importers) + importers = self.add_woo_importers(importers) importers['ShopfooProduct'] = ShopfooProductImporter return importers diff --git a/rattail_demo/web/app.py b/rattail_demo/web/app.py index e6e9895..9e7dd14 100644 --- a/rattail_demo/web/app.py +++ b/rattail_demo/web/app.py @@ -16,6 +16,7 @@ def main(global_config, **settings): # prefer demo templates over tailbone settings.setdefault('mako.directories', ['rattail_demo.web:templates', 'tailbone_corepos:templates', + 'tailbone_woocommerce:templates', 'tailbone:templates',]) # for graceful handling of postgres restart diff --git a/rattail_demo/web/menus.py b/rattail_demo/web/menus.py index f981d4b..341447e 100644 --- a/rattail_demo/web/menus.py +++ b/rattail_demo/web/menus.py @@ -122,6 +122,12 @@ def simple_menus(request): 'url': url('shopfoo.product_exports'), 'perm': 'shopfoo.product_exports.list', }, + {'type': 'sep'}, + { + 'title': "WooCommerce Products", + 'url': url('woocommerce.products'), + 'perm': 'woocommerce.products.list', + }, ], }, { diff --git a/rattail_demo/web/templates/products/view.mako b/rattail_demo/web/templates/products/view.mako new file mode 100644 index 0000000..934bab2 --- /dev/null +++ b/rattail_demo/web/templates/products/view.mako @@ -0,0 +1,46 @@ +## -*- coding: utf-8; -*- +<%inherit file="tailbone:templates/products/view.mako" /> +<%namespace name="corepos" file="tailbone_corepos:templates/products/view.mako" /> +<%namespace name="woocommerce" file="tailbone_woocommerce:templates/products/view.mako" /> + +<%def name="object_helpers()"> + ${parent.object_helpers()} + ${self.render_xref_helper()} + +
+

Internal Links

+
+ +
+
+ + +<%def name="render_xref_helper()"> +
+

Cross-Reference

+
+ ${corepos.render_xref_button()} + ${woocommerce.render_xref_store_button()} + ${woocommerce.render_xref_admin_button()} +
+
+ + +<%def name="extra_main_fields(form)"> + ${parent.extra_main_fields(form)} + ${corepos.extra_main_fields_corepos(form)} + ${woocommerce.extra_main_fields_woocommerce(form)} + + + +${parent.body()} diff --git a/rattail_demo/web/views/__init__.py b/rattail_demo/web/views/__init__.py index acd7cd6..981f7eb 100644 --- a/rattail_demo/web/views/__init__.py +++ b/rattail_demo/web/views/__init__.py @@ -44,6 +44,9 @@ def includeme(config): # shopfoo views config.include('rattail_demo.web.views.shopfoo') + # woocommerce views + config.include('tailbone_woocommerce.views.woocommerce') + # batch views config.include('tailbone.views.handheld') config.include('tailbone.views.batch.inventory') diff --git a/rattail_demo/web/views/products.py b/rattail_demo/web/views/products.py index 82a70b6..53e5584 100644 --- a/rattail_demo/web/views/products.py +++ b/rattail_demo/web/views/products.py @@ -5,9 +5,10 @@ Product views from tailbone.views import products as base from tailbone_corepos.views import products as corepos_base +from tailbone_woocommerce.views import products as woocommerce_base -class ProductView(corepos_base.ProductView): +class ProductView(corepos_base.ProductView, woocommerce_base.ProductView): """ Product overrides for online demo """ diff --git a/setup.py b/setup.py index e51a661..65110e8 100644 --- a/setup.py +++ b/setup.py @@ -51,8 +51,10 @@ requires = [ 'psycopg2', # 2.6.2 'rattail[db]', # 0.9.86 'rattail-corepos', # 0.1.0 + 'rattail-woocommerce', # 0.1.0 'Tailbone', # 0.5.49 'tailbone-corepos', # 0.1.0 + 'tailbone-woocommerce', # 0.1.0 'xlrd', # 1.0.0 ]