Added support for product codes.
These are shown when viewing a product, and may be used to locate a product via search filters.
This commit is contained in:
parent
c7995c5241
commit
fec34d8290
|
@ -4,6 +4,28 @@ ${parent.body()}
|
|||
|
||||
<% product = form.fieldset.model %>
|
||||
|
||||
<div id="product-codes">
|
||||
<h2>Product Codes:</h2>
|
||||
% if product.codes:
|
||||
<div class="grid hoverable">
|
||||
<table>
|
||||
<thead>
|
||||
<th>Code</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
% for i, code in enumerate(product.codes, 1):
|
||||
<tr class="${'odd' if i % 2 else 'even'}">
|
||||
<td>${code}</td>
|
||||
</tr>
|
||||
% endfor
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
% else:
|
||||
<p>None on file.</p>
|
||||
% endif
|
||||
</div>
|
||||
|
||||
<div id="product-costs">
|
||||
<h2>Product Costs:</h2>
|
||||
% if product.costs:
|
||||
|
|
|
@ -44,7 +44,7 @@ from rattail import sil
|
|||
from rattail import batches
|
||||
from rattail.threads import Thread
|
||||
from rattail.exceptions import LabelPrintingError
|
||||
from rattail.db.model import ProductPrice
|
||||
from rattail.db.model import ProductPrice, ProductCode
|
||||
|
||||
from rattail.pyramid import Session
|
||||
from rattail.pyramid.forms import (AutocompleteFieldRenderer,
|
||||
|
@ -87,6 +87,8 @@ class ProductsGrid(SearchableAlchemyGridView):
|
|||
rattail.ProductPrice.uuid == rattail.Product.current_price_uuid),
|
||||
'vendor':
|
||||
join_vendor,
|
||||
'code':
|
||||
lambda q: q.outerjoin(ProductCode),
|
||||
}
|
||||
|
||||
def filter_map(self):
|
||||
|
@ -117,7 +119,8 @@ class ProductsGrid(SearchableAlchemyGridView):
|
|||
brand=self.filter_ilike(rattail.Brand.name),
|
||||
department=self.filter_ilike(rattail.Department.name),
|
||||
subdepartment=self.filter_ilike(rattail.Subdepartment.name),
|
||||
vendor=self.filter_ilike(rattail.Vendor.name))
|
||||
vendor=self.filter_ilike(rattail.Vendor.name),
|
||||
code=self.filter_ilike(ProductCode.code))
|
||||
|
||||
def filter_config(self):
|
||||
return self.make_filter_config(
|
||||
|
|
Loading…
Reference in a new issue