Add initial support for WooCommerce integration
This commit is contained in:
parent
05ac07d2e6
commit
25bf17715c
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
46
rattail_demo/web/templates/products/view.mako
Normal file
46
rattail_demo/web/templates/products/view.mako
Normal file
|
@ -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()}
|
||||
|
||||
<div class="object-helper">
|
||||
<h3>Internal Links</h3>
|
||||
<div class="object-helper-content">
|
||||
<ul>
|
||||
% if instance.corepos_id:
|
||||
<li>${h.link_to("View CORE-POS Product", url('corepos.products.view', id=instance.corepos_id))}</li>
|
||||
% endif
|
||||
% if instance.demo_shopfoo_product:
|
||||
<li>${h.link_to("View Shopfoo Product", url('shopfoo.products.view', uuid=instance.demo_shopfoo_product.uuid))}</li>
|
||||
% endif
|
||||
% if instance.woocommerce_cache_product:
|
||||
<li>${h.link_to("View WooCommerce Product", url('woocommerce.products.view', uuid=instance.woocommerce_cache_product.uuid))}</li>
|
||||
% endif
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
<%def name="render_xref_helper()">
|
||||
<div class="object-helper">
|
||||
<h3>Cross-Reference</h3>
|
||||
<div class="object-helper-content buttons">
|
||||
${corepos.render_xref_button()}
|
||||
${woocommerce.render_xref_store_button()}
|
||||
${woocommerce.render_xref_admin_button()}
|
||||
</div>
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
<%def name="extra_main_fields(form)">
|
||||
${parent.extra_main_fields(form)}
|
||||
${corepos.extra_main_fields_corepos(form)}
|
||||
${woocommerce.extra_main_fields_woocommerce(form)}
|
||||
</%def>
|
||||
|
||||
|
||||
${parent.body()}
|
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue