Expose, start to honor "units only" setting for products
This commit is contained in:
parent
8c201dced7
commit
c6765fd9a9
|
@ -50,6 +50,15 @@
|
|||
</b-checkbox>
|
||||
</b-field>
|
||||
|
||||
<b-field message="If set, then "case size" etc. will not be shown.">
|
||||
<b-checkbox name="rattail.products.units_only"
|
||||
v-model="simpleSettings['rattail.products.units_only']"
|
||||
native-value="true"
|
||||
@input="settingsNeedSaved = true">
|
||||
Products only come in units
|
||||
</b-checkbox>
|
||||
</b-field>
|
||||
|
||||
</div>
|
||||
|
||||
<h3 class="block is-size-3">Labels</h3>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2020 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -41,7 +41,6 @@ class ImporterBatchView(BatchMasterView):
|
|||
"""
|
||||
model_class = model.ImporterBatch
|
||||
default_handler_spec = 'rattail.batch.importer:ImporterBatchHandler'
|
||||
model_title_plural = "Import / Export Batches"
|
||||
route_prefix = 'batch.importer'
|
||||
url_prefix = '/batches/importer'
|
||||
template_prefix = '/batch/importer'
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -1320,11 +1320,8 @@ class ProductView(MasterView):
|
|||
def get_context_vendor_sources(self, product):
|
||||
app = self.get_rattail_app()
|
||||
route_prefix = self.get_route_prefix()
|
||||
units_only = self.products_handler.units_only()
|
||||
|
||||
factory = self.get_grid_factory()
|
||||
g = factory(
|
||||
key='{}.vendor_sources'.format(route_prefix),
|
||||
data=[],
|
||||
columns = [
|
||||
'preferred',
|
||||
'vendor',
|
||||
|
@ -1333,7 +1330,16 @@ class ProductView(MasterView):
|
|||
'case_cost',
|
||||
'unit_cost',
|
||||
'status',
|
||||
],
|
||||
]
|
||||
if units_only:
|
||||
columns.remove('case_size')
|
||||
columns.remove('case_cost')
|
||||
|
||||
factory = self.get_grid_factory()
|
||||
g = factory(
|
||||
key='{}.vendor_sources'.format(route_prefix),
|
||||
data=[],
|
||||
columns=columns,
|
||||
labels={
|
||||
'preferred': "Pref.",
|
||||
'vendor_item_code': "Order Code",
|
||||
|
@ -1348,12 +1354,14 @@ class ProductView(MasterView):
|
|||
'uuid': cost.uuid,
|
||||
'preferred': "X" if cost.preference == 1 else None,
|
||||
'vendor_item_code': cost.code,
|
||||
'case_size': app.render_quantity(cost.case_size),
|
||||
'case_cost': app.render_currency(cost.case_cost),
|
||||
'unit_cost': app.render_currency(cost.unit_cost, scale=4),
|
||||
'status': "discontinued" if cost.discontinued else "available",
|
||||
}
|
||||
|
||||
if not units_only:
|
||||
source['case_size'] = app.render_quantity(cost.case_size)
|
||||
source['case_cost'] = app.render_currency(cost.case_cost)
|
||||
|
||||
text = six.text_type(cost.vendor)
|
||||
if link_vendor:
|
||||
url = self.request.route_url('vendors.view', uuid=cost.vendor.uuid)
|
||||
|
@ -2145,6 +2153,9 @@ class ProductView(MasterView):
|
|||
{'section': 'rattail',
|
||||
'option': 'products.convert_type2_for_gpc_lookup',
|
||||
'type': bool},
|
||||
{'section': 'rattail',
|
||||
'option': 'products.units_only',
|
||||
'type': bool},
|
||||
|
||||
# labels
|
||||
{'section': 'tailbone',
|
||||
|
|
Loading…
Reference in a new issue