Normalize naming of all traditional master views

such names should never use plural forms.  for now what plural forms were
previously in use, should still work.  ideally can remove those at some point
This commit is contained in:
Lance Edgar 2021-01-28 16:32:25 -06:00
parent 3ad19d05e5
commit 719e7c8441
30 changed files with 273 additions and 177 deletions

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2019 Lance Edgar
# Copyright © 2010-2021 Lance Edgar
#
# This file is part of Rattail.
#
@ -45,7 +45,7 @@ from tailbone.views.batch import FileBatchMasterView
log = logging.getLogger(__name__)
class VendorCatalogsView(FileBatchMasterView):
class VendorCatalogView(FileBatchMasterView):
"""
Master view for vendor catalog batches.
"""
@ -132,7 +132,7 @@ class VendorCatalogsView(FileBatchMasterView):
return self.parsers
def configure_grid(self, g):
super(VendorCatalogsView, self).configure_grid(g)
super(VendorCatalogView, self).configure_grid(g)
g.joiners['vendor'] = lambda q: q.join(model.Vendor)
g.filters['vendor'] = g.make_filter('vendor', model.Vendor.name,
default_active=True, default_verb='contains')
@ -145,7 +145,7 @@ class VendorCatalogsView(FileBatchMasterView):
return six.text_type(batch.vendor)
def configure_form(self, f):
super(VendorCatalogsView, self).configure_form(f)
super(VendorCatalogView, self).configure_form(f)
# vendor
f.set_renderer('vendor', self.render_vendor)
@ -187,7 +187,7 @@ class VendorCatalogsView(FileBatchMasterView):
f.set_readonly('effective')
def get_batch_kwargs(self, batch):
kwargs = super(VendorCatalogsView, self).get_batch_kwargs(batch)
kwargs = super(VendorCatalogView, self).get_batch_kwargs(batch)
kwargs['parser_key'] = batch.parser_key
if batch.vendor:
kwargs['vendor'] = batch.vendor
@ -197,7 +197,7 @@ class VendorCatalogsView(FileBatchMasterView):
return kwargs
def configure_row_grid(self, g):
super(VendorCatalogsView, self).configure_row_grid(g)
super(VendorCatalogView, self).configure_row_grid(g)
batch = self.get_instance()
# starts
@ -230,7 +230,7 @@ class VendorCatalogsView(FileBatchMasterView):
return 'notice'
def configure_row_form(self, f):
super(VendorCatalogsView, self).configure_row_form(f)
super(VendorCatalogView, self).configure_row_form(f)
f.set_renderer('product', self.render_product)
f.set_type('discount_percent', 'percent')
@ -251,6 +251,9 @@ class VendorCatalogsView(FileBatchMasterView):
kwargs['parsers'] = parsers
return kwargs
# TODO: deprecate / remove this
VendorCatalogsView = VendorCatalogView
def includeme(config):
VendorCatalogsView.defaults(config)
VendorCatalogView.defaults(config)

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2019 Lance Edgar
# Copyright © 2010-2021 Lance Edgar
#
# This file is part of Rattail.
#
@ -38,7 +38,7 @@ from deform import widget as dfwidget
from tailbone.views.batch import FileBatchMasterView
class VendorInvoicesView(FileBatchMasterView):
class VendorInvoiceView(FileBatchMasterView):
"""
Master view for vendor invoice batches.
"""
@ -91,7 +91,7 @@ class VendorInvoicesView(FileBatchMasterView):
return six.text_type(batch.vendor)
def configure_grid(self, g):
super(VendorInvoicesView, self).configure_grid(g)
super(VendorInvoiceView, self).configure_grid(g)
# vendor
g.set_joiner('vendor', lambda q: q.join(model.Vendor))
@ -117,7 +117,7 @@ class VendorInvoicesView(FileBatchMasterView):
g.set_link('executed', False)
def configure_form(self, f):
super(VendorInvoicesView, self).configure_form(f)
super(VendorInvoiceView, self).configure_form(f)
# vendor
if self.creating:
@ -166,7 +166,7 @@ class VendorInvoicesView(FileBatchMasterView):
# raise formalchemy.ValidationError(unicode(error))
def get_batch_kwargs(self, batch):
kwargs = super(VendorInvoicesView, self).get_batch_kwargs(batch)
kwargs = super(VendorInvoiceView, self).get_batch_kwargs(batch)
kwargs['parser_key'] = batch.parser_key
return kwargs
@ -180,7 +180,7 @@ class VendorInvoicesView(FileBatchMasterView):
return True
def configure_row_grid(self, g):
super(VendorInvoicesView, self).configure_row_grid(g)
super(VendorInvoiceView, self).configure_row_grid(g)
g.set_label('upc', "UPC")
g.set_label('brand_name', "Brand")
g.set_label('shipped_cases', "Cases")
@ -197,6 +197,9 @@ class VendorInvoicesView(FileBatchMasterView):
row.STATUS_UNIT_COST_DIFFERS):
return 'notice'
# TODO: deprecate / remove this
VendorInvoicesView = VendorInvoiceView
def includeme(config):
VendorInvoicesView.defaults(config)
VendorInvoiceView.defaults(config)