Add feature demo for importing Square transactions to CORE-POS
also allow delete of CORE-POS transactions, for sake of demo
This commit is contained in:
parent
e20a9b8123
commit
b7512e0b31
|
@ -0,0 +1,11 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
<%inherit file="/master/index.mako" />
|
||||
|
||||
<%def name="context_menu_items()">
|
||||
${parent.context_menu_items()}
|
||||
% if request.has_perm('{}.import_file'.format(permission_prefix)):
|
||||
<li>${h.link_to("Import {} from Square CSV".format(model_title_plural), url('{}.import_square'.format(route_prefix)))}</li>
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
${parent.body()}
|
|
@ -97,7 +97,7 @@
|
|||
</li>
|
||||
% endif
|
||||
|
||||
% if request.has_any_perm('batch.handheld.list', 'batch.inventory.list'):
|
||||
% if request.has_any_perm('batch.handheld.list', 'batch.inventory.list', 'batch.importer.list'):
|
||||
<li>
|
||||
<a>Batches</a>
|
||||
<ul>
|
||||
|
@ -107,6 +107,9 @@
|
|||
% if request.has_perm('batch.inventory.list'):
|
||||
<li>${h.link_to("Inventory", url('batch.inventory'))}</li>
|
||||
% endif
|
||||
% if request.has_perm('batch.importer.list'):
|
||||
<li>${h.link_to("Import / Export", url('batch.importer'))}</li>
|
||||
% endif
|
||||
</ul>
|
||||
</li>
|
||||
% endif
|
||||
|
|
|
@ -41,3 +41,4 @@ def includeme(config):
|
|||
# batch views
|
||||
config.include('tailbone.views.handheld')
|
||||
config.include('tailbone.views.inventory')
|
||||
config.include('tailbone.views.batch.importer')
|
||||
|
|
|
@ -10,6 +10,8 @@ from corepos.trans.db import model as coretrans
|
|||
from .master import CoreMasterView
|
||||
from rattail_demo.web.db import CoreTransSession
|
||||
|
||||
from rattail_corepos.corepos.importing.square import FromSquareToCoreTrans
|
||||
|
||||
|
||||
class TransactionDetailView(CoreMasterView):
|
||||
"""
|
||||
|
@ -20,6 +22,9 @@ class TransactionDetailView(CoreMasterView):
|
|||
model_title = "CORE-POS Transaction Detail"
|
||||
url_prefix = '/corepos/transaction-details'
|
||||
route_prefix = 'corepos.transaction_details'
|
||||
deletable = True
|
||||
bulk_deletable = True
|
||||
supports_import_batch_from_file = True
|
||||
|
||||
labels = {
|
||||
'store_row_id': "Store Row ID",
|
||||
|
@ -43,6 +48,11 @@ class TransactionDetailView(CoreMasterView):
|
|||
'total',
|
||||
]
|
||||
|
||||
def get_bulk_delete_session(self):
|
||||
from corepos.trans.db import Session as CoreTransSession
|
||||
|
||||
return CoreTransSession()
|
||||
|
||||
def configure_grid(self, g):
|
||||
super(TransactionDetailView, self).configure_grid(g)
|
||||
|
||||
|
@ -71,6 +81,23 @@ class TransactionDetailView(CoreMasterView):
|
|||
f.set_type('discount', 'currency')
|
||||
f.set_type('total', 'currency')
|
||||
|
||||
def import_square(self):
|
||||
return self.import_batch_from_file(FromSquareToCoreTrans, 'TransactionDetail',
|
||||
importer_host_title="Square CSV")
|
||||
|
||||
@classmethod
|
||||
def defaults(cls, config):
|
||||
route_prefix = cls.get_route_prefix()
|
||||
url_prefix = cls.get_url_prefix()
|
||||
permission_prefix = cls.get_permission_prefix()
|
||||
|
||||
# import from square
|
||||
config.add_route('{}.import_square'.format(route_prefix), '{}/import-square'.format(url_prefix))
|
||||
config.add_view(cls, attr='import_square', route_name='{}.import_square'.format(route_prefix),
|
||||
permission='{}.import_file'.format(permission_prefix))
|
||||
|
||||
cls._defaults(config)
|
||||
|
||||
|
||||
def includeme(config):
|
||||
TransactionDetailView.defaults(config)
|
||||
|
|
Loading…
Reference in a new issue