Fix handling of Vendor.id field

since that is really a "synonym" we must be explicit about it (for now..?)
This commit is contained in:
Lance Edgar 2020-03-31 14:13:02 -05:00
parent 1ec511b60c
commit 700584a084

View file

@ -34,6 +34,7 @@ class VendorView(CoreOfficeMasterView):
Base class for vendor views. Base class for vendor views.
""" """
model_class = corepos.Vendor model_class = corepos.Vendor
model_key = 'id'
model_title = "CORE-POS Vendor" model_title = "CORE-POS Vendor"
url_prefix = '/core-pos/vendors' url_prefix = '/core-pos/vendors'
route_prefix = 'corepos.vendors' route_prefix = 'corepos.vendors'
@ -68,10 +69,17 @@ class VendorView(CoreOfficeMasterView):
def configure_grid(self, g): def configure_grid(self, g):
super(VendorView, self).configure_grid(g) super(VendorView, self).configure_grid(g)
# TODO: this is only needed b/c of orm.synonym usage
g.set_sorter('id', corepos.Vendor.id)
g.set_link('id') g.set_link('id')
g.set_link('name') g.set_link('name')
g.set_link('abbreviation') g.set_link('abbreviation')
# TODO: ugh, would be nice to not have to do this...
def get_action_route_kwargs(self, row):
return {'id': row.id}
def configure_form(self, f): def configure_form(self, f):
super(VendorView, self).configure_form(f) super(VendorView, self).configure_form(f)