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