Add config for showing ordered vs. shipped amounts when receiving

This commit is contained in:
Lance Edgar 2022-02-11 16:48:46 -06:00
parent 86a42064ea
commit 0ead06106c
2 changed files with 47 additions and 0 deletions

View file

@ -53,6 +53,29 @@
</div> </div>
<h3 class="block is-size-3">Display</h3>
<div class="block" style="padding-left: 2rem;">
<b-field>
<b-checkbox name="rattail.batch.purchase.receiving.show_ordered_column_in_grid"
v-model="simpleSettings['rattail.batch.purchase.receiving.show_ordered_column_in_grid']"
native-value="true"
@input="settingsNeedSaved = true">
Show "ordered" quantities in row grid
</b-checkbox>
</b-field>
<b-field>
<b-checkbox name="rattail.batch.purchase.receiving.show_shipped_column_in_grid"
v-model="simpleSettings['rattail.batch.purchase.receiving.show_shipped_column_in_grid']"
native-value="true"
@input="settingsNeedSaved = true">
Show "shipped" quantities in row grid
</b-checkbox>
</b-field>
</div>
<h3 class="block is-size-3">Product Handling</h3> <h3 class="block is-size-3">Product Handling</h3>
<div class="block" style="padding-left: 2rem;"> <div class="block" style="padding-left: 2rem;">

View file

@ -159,6 +159,8 @@ class ReceivingBatchView(PurchasingBatchView):
'description', 'description',
'size', 'size',
'department_name', 'department_name',
'cases_ordered',
'units_ordered',
'cases_shipped', 'cases_shipped',
'units_shipped', 'units_shipped',
'cases_received', 'cases_received',
@ -904,6 +906,20 @@ class ReceivingBatchView(PurchasingBatchView):
g.set_joiner('credits', lambda q: q.outerjoin(Credits)) g.set_joiner('credits', lambda q: q.outerjoin(Credits))
g.sorters['credits'] = lambda q, d: q.order_by(getattr(Credits.c.credit_count, d)()) g.sorters['credits'] = lambda q, d: q.order_by(getattr(Credits.c.credit_count, d)())
show_ordered = self.rattail_config.getbool(
'rattail.batch', 'purchase.receiving.show_ordered_column_in_grid',
default=False)
if not show_ordered:
g.remove('cases_ordered',
'units_ordered')
show_shipped = self.rattail_config.getbool(
'rattail.batch', 'purchase.receiving.show_shipped_column_in_grid',
default=False)
if not show_shipped:
g.remove('cases_shipped',
'units_shipped')
# hide 'ordered' columns for truck dump parent, if its "children first" # hide 'ordered' columns for truck dump parent, if its "children first"
# flag is set, since that batch type is only concerned with receiving # flag is set, since that batch type is only concerned with receiving
if batch.is_truck_dump_parent() and not batch.truck_dump_children_first: if batch.is_truck_dump_parent() and not batch.truck_dump_children_first:
@ -1851,6 +1867,14 @@ class ReceivingBatchView(PurchasingBatchView):
'option': 'purchase.allow_truck_dump_receiving', 'option': 'purchase.allow_truck_dump_receiving',
'type': bool}, 'type': bool},
# display
{'section': 'rattail.batch',
'option': 'purchase.receiving.show_ordered_column_in_grid',
'type': bool},
{'section': 'rattail.batch',
'option': 'purchase.receiving.show_shipped_column_in_grid',
'type': bool},
# product handling # product handling
{'section': 'rattail.batch', {'section': 'rattail.batch',
'option': 'purchase.allow_cases', 'option': 'purchase.allow_cases',