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

@ -159,6 +159,8 @@ class ReceivingBatchView(PurchasingBatchView):
'description',
'size',
'department_name',
'cases_ordered',
'units_ordered',
'cases_shipped',
'units_shipped',
'cases_received',
@ -904,6 +906,20 @@ class ReceivingBatchView(PurchasingBatchView):
g.set_joiner('credits', lambda q: q.outerjoin(Credits))
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"
# 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:
@ -1851,6 +1867,14 @@ class ReceivingBatchView(PurchasingBatchView):
'option': 'purchase.allow_truck_dump_receiving',
'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
{'section': 'rattail.batch',
'option': 'purchase.allow_cases',