Add way to flag organic products within lookup dialog
This commit is contained in:
parent
f8ab8d462c
commit
4ccdf99a43
|
@ -171,7 +171,9 @@
|
|||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="extra_styles()"></%def>
|
||||
<%def name="extra_styles()">
|
||||
${base_meta.extra_styles()}
|
||||
</%def>
|
||||
|
||||
<%def name="head_tags()"></%def>
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
<%def name="global_title()">${"[STAGE] " if not request.rattail_config.production() else ''}${self.app_title()}</%def>
|
||||
|
||||
<%def name="extra_styles()"></%def>
|
||||
|
||||
<%def name="favicon()">
|
||||
<link rel="icon" type="image/x-icon" href="${request.rattail_config.get('tailbone', 'favicon_url', default=request.static_url('tailbone:static/img/rattail.ico'))}" />
|
||||
</%def>
|
||||
|
|
|
@ -109,8 +109,10 @@
|
|||
<b-table-column label="Description"
|
||||
field="description"
|
||||
v-slot="props">
|
||||
<span :class="{organic: props.row.organic}">
|
||||
{{ props.row.description }}
|
||||
{{ props.row.size }}
|
||||
</span>
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column label="Unit Price"
|
||||
|
|
|
@ -33,7 +33,8 @@ from sqlalchemy import orm
|
|||
import sqlalchemy_continuum as continuum
|
||||
|
||||
from rattail import enum, pod, sil
|
||||
from rattail.db import model, api, auth, Session as RattailSession
|
||||
from rattail.db import api, auth, Session as RattailSession
|
||||
from rattail.db.model import Product, PendingProduct, CustomerOrderItem
|
||||
from rattail.gpc import GPC
|
||||
from rattail.threads import Thread
|
||||
from rattail.exceptions import LabelPrintingError
|
||||
|
@ -74,7 +75,7 @@ class ProductView(MasterView):
|
|||
"""
|
||||
Master view for the Product class.
|
||||
"""
|
||||
model_class = model.Product
|
||||
model_class = Product
|
||||
has_versions = True
|
||||
results_downloadable_xlsx = True
|
||||
supports_autocomplete = True
|
||||
|
@ -173,6 +174,7 @@ class ProductView(MasterView):
|
|||
|
||||
def query(self, session):
|
||||
query = super().query(session)
|
||||
model = self.model
|
||||
|
||||
if not self.has_perm('view_deleted'):
|
||||
query = query.filter(model.Product.deleted == False)
|
||||
|
@ -685,6 +687,7 @@ class ProductView(MasterView):
|
|||
return data
|
||||
|
||||
def get_instance(self):
|
||||
model = self.model
|
||||
key = self.request.matchdict['uuid']
|
||||
product = self.Session.get(model.Product, key)
|
||||
if product:
|
||||
|
@ -696,6 +699,7 @@ class ProductView(MasterView):
|
|||
|
||||
def configure_form(self, f):
|
||||
super().configure_form(f)
|
||||
model = self.model
|
||||
product = f.model_instance
|
||||
|
||||
# unit_size
|
||||
|
@ -1396,6 +1400,7 @@ class ProductView(MasterView):
|
|||
product's regular price history.
|
||||
"""
|
||||
app = self.get_rattail_app()
|
||||
model = self.model
|
||||
Transaction = continuum.transaction_class(model.Product)
|
||||
ProductVersion = continuum.version_class(model.Product)
|
||||
ProductPriceVersion = continuum.version_class(model.ProductPrice)
|
||||
|
@ -1466,6 +1471,7 @@ class ProductView(MasterView):
|
|||
product's current price history.
|
||||
"""
|
||||
app = self.get_rattail_app()
|
||||
model = self.model
|
||||
Transaction = continuum.transaction_class(model.Product)
|
||||
ProductVersion = continuum.version_class(model.Product)
|
||||
ProductPriceVersion = continuum.version_class(model.ProductPrice)
|
||||
|
@ -1609,6 +1615,7 @@ class ProductView(MasterView):
|
|||
product's SRP history.
|
||||
"""
|
||||
app = self.get_rattail_app()
|
||||
model = self.model
|
||||
Transaction = continuum.transaction_class(model.Product)
|
||||
ProductVersion = continuum.version_class(model.Product)
|
||||
ProductPriceVersion = continuum.version_class(model.ProductPrice)
|
||||
|
@ -1679,6 +1686,7 @@ class ProductView(MasterView):
|
|||
product's cost history.
|
||||
"""
|
||||
app = self.get_rattail_app()
|
||||
model = self.model
|
||||
Transaction = continuum.transaction_class(model.Product)
|
||||
ProductVersion = continuum.version_class(model.Product)
|
||||
ProductCostVersion = continuum.version_class(model.ProductCost)
|
||||
|
@ -1746,6 +1754,7 @@ class ProductView(MasterView):
|
|||
'form': form})
|
||||
|
||||
def get_version_child_classes(self):
|
||||
model = self.model
|
||||
return [
|
||||
(model.ProductCode, 'product_uuid'),
|
||||
(model.ProductCost, 'product_uuid'),
|
||||
|
@ -1893,6 +1902,7 @@ class ProductView(MasterView):
|
|||
'case_price',
|
||||
'case_price_display',
|
||||
'uom_choices',
|
||||
'organic',
|
||||
])
|
||||
|
||||
# TODO: deprecate / remove this? not sure if/where it is used
|
||||
|
@ -1904,6 +1914,7 @@ class ProductView(MasterView):
|
|||
Eventually this should be more generic, or at least offer more fields for
|
||||
search. For now it operates only on the ``Product.upc`` field.
|
||||
"""
|
||||
model = self.model
|
||||
data = None
|
||||
upc = self.request.GET.get('upc', '').strip()
|
||||
upc = re.sub(r'\D', '', upc)
|
||||
|
@ -2091,6 +2102,7 @@ class ProductView(MasterView):
|
|||
"""
|
||||
Threat target for making a batch from current products query.
|
||||
"""
|
||||
model = self.model
|
||||
session = RattailSession()
|
||||
user = session.get(model.User, user_uuid)
|
||||
assert user
|
||||
|
@ -2231,7 +2243,7 @@ class PendingProductView(MasterView):
|
|||
"""
|
||||
Master view for the Pending Product class.
|
||||
"""
|
||||
model_class = model.PendingProduct
|
||||
model_class = PendingProduct
|
||||
route_prefix = 'pending_products'
|
||||
url_prefix = '/products/pending'
|
||||
bulk_deletable = True
|
||||
|
@ -2278,7 +2290,7 @@ class PendingProductView(MasterView):
|
|||
]
|
||||
|
||||
has_rows = True
|
||||
model_row_class = model.CustomerOrderItem
|
||||
model_row_class = CustomerOrderItem
|
||||
rows_title = "Customer Orders"
|
||||
# TODO: add support for this someday
|
||||
rows_viewable = False
|
||||
|
|
Loading…
Reference in a new issue