Expose vendor_id
column in pricing batch row grid
This commit is contained in:
parent
1fb9ef4d58
commit
c064bb275f
|
@ -84,6 +84,7 @@ class PricingBatchView(BatchMasterView):
|
|||
|
||||
row_labels = {
|
||||
'upc': "UPC",
|
||||
'vendor_id': "Vendor ID",
|
||||
'regular_unit_cost': "Reg. Cost",
|
||||
'price_diff': "$ Diff",
|
||||
'price_diff_percent': "% Diff",
|
||||
|
@ -98,6 +99,7 @@ class PricingBatchView(BatchMasterView):
|
|||
'brand_name',
|
||||
'description',
|
||||
'size',
|
||||
'vendor_id',
|
||||
'discounted_unit_cost',
|
||||
'old_price',
|
||||
'new_price',
|
||||
|
@ -157,10 +159,20 @@ class PricingBatchView(BatchMasterView):
|
|||
def configure_row_grid(self, g):
|
||||
super(PricingBatchView, self).configure_row_grid(g)
|
||||
|
||||
g.set_joiner('vendor_id', lambda q: q.outerjoin(model.Vendor))
|
||||
g.set_sorter('vendor_id', model.Vendor.id)
|
||||
g.set_renderer('vendor_id', self.render_vendor_id)
|
||||
|
||||
g.set_type('old_price', 'currency')
|
||||
g.set_type('new_price', 'currency')
|
||||
g.set_type('price_diff', 'currency')
|
||||
|
||||
def render_vendor_id(self, row, field):
|
||||
vendor_id = row.vendor.id if row.vendor else None
|
||||
if not vendor_id:
|
||||
return ""
|
||||
return vendor_id
|
||||
|
||||
def row_grid_extra_class(self, row, i):
|
||||
if row.status_code == row.STATUS_CANNOT_CALCULATE_PRICE:
|
||||
return 'warning'
|
||||
|
|
Loading…
Reference in a new issue