Refactor trainwreck views per master4
This commit is contained in:
parent
38afb35b65
commit
4ab41ba82e
|
@ -30,9 +30,8 @@ import six
|
|||
|
||||
from rattail.time import localtime
|
||||
|
||||
from tailbone import forms
|
||||
from tailbone.db import TrainwreckSession
|
||||
from tailbone.views import MasterView3 as MasterView
|
||||
from tailbone.views import MasterView4 as MasterView
|
||||
|
||||
|
||||
class TransactionView(MasterView):
|
||||
|
@ -49,6 +48,10 @@ class TransactionView(MasterView):
|
|||
editable = False
|
||||
deletable = False
|
||||
|
||||
labels = {
|
||||
'cashback': "Cash Back",
|
||||
}
|
||||
|
||||
grid_columns = [
|
||||
'start_time',
|
||||
'system',
|
||||
|
@ -60,27 +63,6 @@ class TransactionView(MasterView):
|
|||
'total',
|
||||
]
|
||||
|
||||
labels = {
|
||||
'cashback': "Cash Back",
|
||||
}
|
||||
|
||||
has_rows = True
|
||||
# model_row_class = trainwreck.TransactionItem
|
||||
rows_default_pagesize = 100
|
||||
|
||||
row_grid_columns = [
|
||||
'sequence',
|
||||
'item_type',
|
||||
'item_scancode',
|
||||
'department_number',
|
||||
'description',
|
||||
'unit_quantity',
|
||||
'subtotal',
|
||||
'tax',
|
||||
'total',
|
||||
'void',
|
||||
]
|
||||
|
||||
form_fields = [
|
||||
'system',
|
||||
'system_id',
|
||||
|
@ -103,6 +85,42 @@ class TransactionView(MasterView):
|
|||
'void',
|
||||
]
|
||||
|
||||
has_rows = True
|
||||
# model_row_class = trainwreck.TransactionItem
|
||||
rows_default_pagesize = 100
|
||||
|
||||
row_labels = {
|
||||
'item_id': "Item ID",
|
||||
'department_number': "Dept. No.",
|
||||
}
|
||||
|
||||
row_grid_columns = [
|
||||
'sequence',
|
||||
'item_type',
|
||||
'item_scancode',
|
||||
'department_number',
|
||||
'description',
|
||||
'unit_quantity',
|
||||
'subtotal',
|
||||
'tax',
|
||||
'total',
|
||||
'void',
|
||||
]
|
||||
|
||||
row_form_fields = [
|
||||
'sequence',
|
||||
'item_type',
|
||||
'item_scancode',
|
||||
'item_id',
|
||||
'department_number',
|
||||
'description',
|
||||
'unit_quantity',
|
||||
'subtotal',
|
||||
'tax',
|
||||
'total',
|
||||
'void',
|
||||
]
|
||||
|
||||
def configure_grid(self, g):
|
||||
super(TransactionView, self).configure_grid(g)
|
||||
g.filters['receipt_number'].default_active = True
|
||||
|
@ -162,29 +180,14 @@ class TransactionView(MasterView):
|
|||
g.set_type('tax', 'currency')
|
||||
g.set_type('total', 'currency')
|
||||
|
||||
g.set_label('item_id', "Item ID")
|
||||
g.set_label('department_number', "Dept. No.")
|
||||
def configure_row_form(self, f):
|
||||
super(TransactionView, self).configure_row_form(f)
|
||||
|
||||
def _preconfigure_row_fieldset(self, fs):
|
||||
fs.item_id.set(label="Item ID")
|
||||
fs.department_number.set(label="Dept. No.")
|
||||
fs.unit_quantity.set(renderer=forms.renderers.QuantityFieldRenderer)
|
||||
fs.subtotal.set(renderer=forms.renderers.CurrencyFieldRenderer)
|
||||
fs.discounted_subtotal.set(renderer=forms.renderers.CurrencyFieldRenderer)
|
||||
fs.tax.set(renderer=forms.renderers.CurrencyFieldRenderer)
|
||||
fs.total.set(renderer=forms.renderers.CurrencyFieldRenderer)
|
||||
# quantity fields
|
||||
f.set_type('unit_quantity', 'quantity')
|
||||
|
||||
def configure_row_fieldset(self, fs):
|
||||
fs.configure(include=[
|
||||
fs.sequence,
|
||||
fs.item_type,
|
||||
fs.item_scancode,
|
||||
fs.item_id,
|
||||
fs.department_number,
|
||||
fs.description,
|
||||
fs.unit_quantity,
|
||||
fs.subtotal,
|
||||
fs.tax,
|
||||
fs.total,
|
||||
fs.void,
|
||||
])
|
||||
# currency fields
|
||||
f.set_type('subtotal', 'currency')
|
||||
f.set_type('discounted_subtotal', 'currency')
|
||||
f.set_type('tax', 'currency')
|
||||
f.set_type('total', 'currency')
|
||||
|
|
Loading…
Reference in a new issue