Expose views for tenders, more columns for POS batch/rows
This commit is contained in:
parent
abcf1e1895
commit
f572757f00
|
@ -625,15 +625,30 @@ class MenuHandler(GenericHandler):
|
|||
"""
|
||||
items = []
|
||||
|
||||
if kwargs.get('include_stores', True):
|
||||
items.extend([
|
||||
{
|
||||
'title': "Stores",
|
||||
'route': 'stores',
|
||||
'perm': 'stores.list',
|
||||
},
|
||||
{'type': 'sep'},
|
||||
])
|
||||
include_stores = kwargs.get('include_stores', True)
|
||||
include_tenders = kwargs.get('include_tenders', True)
|
||||
|
||||
if include_stores or include_tenders:
|
||||
|
||||
if include_stores:
|
||||
items.extend([
|
||||
{
|
||||
'title': "Stores",
|
||||
'route': 'stores',
|
||||
'perm': 'stores.list',
|
||||
},
|
||||
])
|
||||
|
||||
if include_tenders:
|
||||
items.extend([
|
||||
{
|
||||
'title': "Tenders",
|
||||
'route': 'tenders',
|
||||
'perm': 'tenders.list',
|
||||
},
|
||||
])
|
||||
|
||||
items.append({'type': 'sep'})
|
||||
|
||||
items.extend([
|
||||
{
|
||||
|
|
|
@ -68,6 +68,10 @@ class POSBatchView(BatchMasterView):
|
|||
'sales_total',
|
||||
'tax1_total',
|
||||
'tax2_total',
|
||||
'tender_total',
|
||||
'balance',
|
||||
'void',
|
||||
'training_mode',
|
||||
'status_code',
|
||||
'created',
|
||||
'created_by',
|
||||
|
@ -84,6 +88,7 @@ class POSBatchView(BatchMasterView):
|
|||
'txn_price',
|
||||
'quantity',
|
||||
'sales_total',
|
||||
'tender_total',
|
||||
'status_code',
|
||||
]
|
||||
|
||||
|
@ -99,7 +104,10 @@ class POSBatchView(BatchMasterView):
|
|||
'sales_total',
|
||||
'tax1_total',
|
||||
'tax2_total',
|
||||
'tender_total',
|
||||
'status_code',
|
||||
'timestamp',
|
||||
'user',
|
||||
]
|
||||
|
||||
def configure_grid(self, g):
|
||||
|
@ -118,19 +126,33 @@ class POSBatchView(BatchMasterView):
|
|||
g.set_type('sales_total', 'currency')
|
||||
g.set_type('tax1_total', 'currency')
|
||||
g.set_type('tax2_total', 'currency')
|
||||
g.set_type('tender_total', 'currency')
|
||||
|
||||
# executed
|
||||
# nb. default view should show "all recent" batches regardless
|
||||
# of execution (i think..)
|
||||
if 'executed' in g.filters:
|
||||
g.filters['executed'].default_active = False
|
||||
|
||||
def grid_extra_class(self, batch, i):
|
||||
if batch.void:
|
||||
return 'warning'
|
||||
if batch.training_mode:
|
||||
return 'notice'
|
||||
|
||||
def configure_form(self, f):
|
||||
super().configure_form(f)
|
||||
app = self.get_rattail_app()
|
||||
|
||||
f.set_renderer('customer', self.render_customer)
|
||||
|
||||
f.set_type('sales_total', 'currency')
|
||||
f.set_type('tax1_total', 'currency')
|
||||
f.set_type('tax2_total', 'currency')
|
||||
f.set_type('tender_total', 'currency')
|
||||
f.set_type('tender_total', 'currency')
|
||||
|
||||
f.set_renderer('balance', lambda batch, field: app.render_currency(batch.get_balance()))
|
||||
|
||||
def configure_row_grid(self, g):
|
||||
super().configure_row_grid(g)
|
||||
|
@ -139,6 +161,7 @@ class POSBatchView(BatchMasterView):
|
|||
g.set_type('reg_price', 'currency')
|
||||
g.set_type('txn_price', 'currency')
|
||||
g.set_type('sales_total', 'currency')
|
||||
g.set_type('tender_total', 'currency')
|
||||
|
||||
g.set_link('product')
|
||||
g.set_link('description')
|
||||
|
@ -146,11 +169,15 @@ class POSBatchView(BatchMasterView):
|
|||
def configure_row_form(self, f):
|
||||
super().configure_row_form(f)
|
||||
|
||||
f.set_renderer('product', self.render_product)
|
||||
|
||||
f.set_type('quantity', 'quantity')
|
||||
f.set_type('reg_price', 'currency')
|
||||
f.set_type('txn_price', 'currency')
|
||||
f.set_type('sales_total', 'currency')
|
||||
f.set_renderer('product', self.render_product)
|
||||
f.set_type('tender_total', 'currency')
|
||||
|
||||
f.set_renderer('user', self.render_user)
|
||||
|
||||
|
||||
def defaults(config, **kwargs):
|
||||
|
|
67
tailbone/views/tenders.py
Normal file
67
tailbone/views/tenders.py
Normal file
|
@ -0,0 +1,67 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2023 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/>.
|
||||
#
|
||||
################################################################################
|
||||
"""
|
||||
Views for tenders
|
||||
"""
|
||||
|
||||
from rattail.db.model import Tender
|
||||
|
||||
from tailbone.views import MasterView
|
||||
|
||||
|
||||
class TenderView(MasterView):
|
||||
"""
|
||||
Master view for the Tender class.
|
||||
"""
|
||||
model_class = Tender
|
||||
has_versions = True
|
||||
|
||||
grid_columns = [
|
||||
'code',
|
||||
'name',
|
||||
]
|
||||
|
||||
form_fields = [
|
||||
'code',
|
||||
'name',
|
||||
'notes',
|
||||
]
|
||||
|
||||
def configure_grid(self, g):
|
||||
super().configure_grid(g)
|
||||
|
||||
g.set_link('code')
|
||||
|
||||
g.set_link('name')
|
||||
g.set_sort_defaults('name')
|
||||
|
||||
|
||||
def defaults(config, **kwargs):
|
||||
base = globals()
|
||||
|
||||
TenderView = kwargs.get('TenderView', base['TenderView'])
|
||||
TenderView.defaults(config)
|
||||
|
||||
|
||||
def includeme(config):
|
||||
defaults(config)
|
|
@ -43,6 +43,7 @@ def defaults(config, **kwargs):
|
|||
config.include(mod('tailbone.views.reportcodes'))
|
||||
config.include(mod('tailbone.views.stores'))
|
||||
config.include(mod('tailbone.views.subdepartments'))
|
||||
config.include(mod('tailbone.views.tenders'))
|
||||
config.include(mod('tailbone.views.uoms'))
|
||||
config.include(mod('tailbone.views.vendors'))
|
||||
|
||||
|
|
Loading…
Reference in a new issue