Cleanup view config syntax for vendor catalog batch
also make sure vendor autocomplete url exists, before using that widget. this can be an issue when app deals "directly" with POS when making the batch etc.
This commit is contained in:
parent
0a42ec77b2
commit
b9fa324bb4
1 changed files with 23 additions and 2 deletions
|
@ -208,7 +208,17 @@ class VendorCatalogView(FileBatchMasterView):
|
|||
if self.creating and 'vendor' in f:
|
||||
f.replace('vendor', 'vendor_uuid')
|
||||
f.set_label('vendor_uuid', "Vendor")
|
||||
|
||||
# should we use dropdown or autocomplete? note that if
|
||||
# autocomplete is to be used, we also must make sure we
|
||||
# have an autocomplete url registered
|
||||
use_dropdown = vendor_handler.choice_uses_dropdown()
|
||||
if not use_dropdown:
|
||||
try:
|
||||
vendors_url = self.request.route_url('vendors.autocomplete')
|
||||
except KeyError:
|
||||
use_dropdown = True
|
||||
|
||||
if use_dropdown:
|
||||
vendors = self.Session.query(model.Vendor)\
|
||||
.order_by(model.Vendor.id)
|
||||
|
@ -225,7 +235,6 @@ class VendorCatalogView(FileBatchMasterView):
|
|||
self.request.POST['vendor_uuid'])
|
||||
if vendor:
|
||||
vendor_display = six.text_type(vendor)
|
||||
vendors_url = self.request.route_url('vendors.autocomplete')
|
||||
f.set_widget('vendor_uuid',
|
||||
forms.widgets.JQueryAutocompleteWidget(
|
||||
field_display=vendor_display,
|
||||
|
@ -328,6 +337,11 @@ class VendorCatalogView(FileBatchMasterView):
|
|||
g.set_label('unit_cost', "New Cost")
|
||||
g.set_label('unit_cost_diff', "Diff. $")
|
||||
|
||||
g.set_link('upc')
|
||||
g.set_link('brand')
|
||||
g.set_link('description')
|
||||
g.set_link('vendor_code')
|
||||
|
||||
def row_grid_extra_class(self, row, i):
|
||||
if row.status_code == row.STATUS_PRODUCT_NOT_FOUND:
|
||||
return 'warning'
|
||||
|
@ -422,5 +436,12 @@ class VendorCatalogView(FileBatchMasterView):
|
|||
VendorCatalogsView = VendorCatalogView
|
||||
|
||||
|
||||
def includeme(config):
|
||||
def defaults(config, **kwargs):
|
||||
base = globals()
|
||||
|
||||
VendorCatalogView = kwargs.get('VendorCatalogView', base['VendorCatalogView'])
|
||||
VendorCatalogView.defaults(config)
|
||||
|
||||
|
||||
def includeme(config):
|
||||
defaults(config)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue