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:
parent
3ad19d05e5
commit
719e7c8441
30 changed files with 273 additions and 177 deletions
|
@ -77,7 +77,7 @@ log = logging.getLogger(__name__)
|
|||
# return query
|
||||
|
||||
|
||||
class ProductsView(MasterView):
|
||||
class ProductView(MasterView):
|
||||
"""
|
||||
Master view for the Product class.
|
||||
"""
|
||||
|
@ -171,7 +171,7 @@ class ProductsView(MasterView):
|
|||
CurrentPrice = orm.aliased(model.ProductPrice)
|
||||
|
||||
def __init__(self, request):
|
||||
super(ProductsView, self).__init__(request)
|
||||
super(ProductView, self).__init__(request)
|
||||
self.print_labels = request.rattail_config.getbool('tailbone', 'products.print_labels', default=False)
|
||||
|
||||
def query(self, session):
|
||||
|
@ -201,7 +201,7 @@ class ProductsView(MasterView):
|
|||
return query
|
||||
|
||||
def configure_grid(self, g):
|
||||
super(ProductsView, self).configure_grid(g)
|
||||
super(ProductView, self).configure_grid(g)
|
||||
|
||||
def join_vendor(q):
|
||||
return q.outerjoin(self.ProductVendorCost,
|
||||
|
@ -342,7 +342,7 @@ class ProductsView(MasterView):
|
|||
g.set_label('vendor', "Pref. Vendor")
|
||||
|
||||
def configure_common_form(self, f):
|
||||
super(ProductsView, self).configure_common_form(f)
|
||||
super(ProductView, self).configure_common_form(f)
|
||||
product = f.model_instance
|
||||
|
||||
# upc
|
||||
|
@ -594,7 +594,7 @@ class ProductsView(MasterView):
|
|||
return ' '.join(classes)
|
||||
|
||||
def get_xlsx_fields(self):
|
||||
fields = super(ProductsView, self).get_xlsx_fields()
|
||||
fields = super(ProductView, self).get_xlsx_fields()
|
||||
|
||||
i = fields.index('department_uuid')
|
||||
fields.insert(i + 1, 'department_number')
|
||||
|
@ -640,7 +640,7 @@ class ProductsView(MasterView):
|
|||
return fields
|
||||
|
||||
def get_xlsx_row(self, product, fields):
|
||||
row = super(ProductsView, self).get_xlsx_row(product, fields)
|
||||
row = super(ProductView, self).get_xlsx_row(product, fields)
|
||||
|
||||
if 'upc' in fields and isinstance(row['upc'], GPC):
|
||||
row['upc'] = row['upc'].pretty()
|
||||
|
@ -710,7 +710,7 @@ class ProductsView(MasterView):
|
|||
raise httpexceptions.HTTPNotFound()
|
||||
|
||||
def configure_form(self, f):
|
||||
super(ProductsView, self).configure_form(f)
|
||||
super(ProductView, self).configure_form(f)
|
||||
product = f.model_instance
|
||||
|
||||
# department
|
||||
|
@ -880,7 +880,7 @@ class ProductsView(MasterView):
|
|||
def objectify(self, form, data=None):
|
||||
if data is None:
|
||||
data = form.validated
|
||||
product = super(ProductsView, self).objectify(form, data=data)
|
||||
product = super(ProductView, self).objectify(form, data=data)
|
||||
|
||||
# regular_price_amount
|
||||
if (self.creating or self.editing) and 'regular_price_amount' in form.fields:
|
||||
|
@ -1792,6 +1792,9 @@ class ProductsView(MasterView):
|
|||
config.add_route('mobile.products.quick_lookup', '/mobile/products/quick-lookup')
|
||||
config.add_view(cls, attr='mobile_quick_lookup', route_name='mobile.products.quick_lookup')
|
||||
|
||||
# TODO: deprecate / remove this
|
||||
ProductsView = ProductView
|
||||
|
||||
|
||||
class ProductsAutocomplete(AutocompleteView):
|
||||
"""
|
||||
|
@ -1853,4 +1856,4 @@ def includeme(config):
|
|||
config.add_view(print_labels, route_name='products.print_labels',
|
||||
renderer='json', permission='products.print_labels')
|
||||
|
||||
ProductsView.defaults(config)
|
||||
ProductView.defaults(config)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue