Refactor purchasing batch views per master4

This commit is contained in:
Lance Edgar 2018-02-05 12:59:34 -06:00
parent dfc5e0f50e
commit 8137d715df
6 changed files with 328 additions and 186 deletions

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2017 Lance Edgar
# Copyright © 2010-2018 Lance Edgar
#
# This file is part of Rattail.
#
@ -35,7 +35,6 @@ from rattail.db import model, api
from rattail.gpc import GPC
from rattail.util import pretty_quantity, prettify
import formalchemy as fa
import formencode as fe
from webhelpers2.html import tags
@ -95,6 +94,11 @@ class ReceivingBatchView(PurchasingBatchView):
mobile_rows_filterable = True
mobile_rows_creatable = True
mobile_form_fields = [
'vendor',
'department',
]
row_grid_columns = [
'sequence',
'upc',
@ -112,6 +116,14 @@ class ReceivingBatchView(PurchasingBatchView):
'status_code',
]
row_form_fields = [
'vendor',
'department',
'complete',
'executed',
'executed_by',
]
@property
def batch_mode(self):
return self.enum.PURCHASE_BATCH_MODE_RECEIVING
@ -186,21 +198,14 @@ class ReceivingBatchView(PurchasingBatchView):
kwargs['sms_transaction_number'] = batch.sms_transaction_number
return kwargs
def configure_mobile_fieldset(self, fs):
fs.configure(include=[
fs.vendor.with_renderer(fa.TextFieldRenderer),
fs.department.with_renderer(fa.TextFieldRenderer),
fs.complete,
fs.executed,
fs.executed_by,
])
batch = fs.model
if not batch.executed:
del [fs.executed, fs.executed_by]
if not batch.complete:
del fs.complete
else:
del fs.complete
def configure_mobile_form(self, f):
super(ReceivingBatchView, self).configure_mobile_form(f)
# vendor
# fs.vendor.with_renderer(fa.TextFieldRenderer),
# department
# fs.department.with_renderer(fa.TextFieldRenderer),
def render_mobile_row_listitem(self, row, i):
description = row.product.full_description if row.product else row.description