From 0ead06106c856849e34cb6ec51960161d5d0d64b Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 11 Feb 2022 16:48:46 -0600 Subject: [PATCH] Add config for showing ordered vs. shipped amounts when receiving --- tailbone/templates/receiving/configure.mako | 23 ++++++++++++++++++++ tailbone/views/purchasing/receiving.py | 24 +++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/tailbone/templates/receiving/configure.mako b/tailbone/templates/receiving/configure.mako index 349dc621..dff280bb 100644 --- a/tailbone/templates/receiving/configure.mako +++ b/tailbone/templates/receiving/configure.mako @@ -53,6 +53,29 @@ +

Display

+
+ + + + Show "ordered" quantities in row grid + + + + + + Show "shipped" quantities in row grid + + + +
+

Product Handling

diff --git a/tailbone/views/purchasing/receiving.py b/tailbone/views/purchasing/receiving.py index e481db82..12979d0b 100644 --- a/tailbone/views/purchasing/receiving.py +++ b/tailbone/views/purchasing/receiving.py @@ -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',