Tweaks to improve handling of "missing" items for receiving

This commit is contained in:
Lance Edgar 2023-09-17 18:30:38 -05:00
parent e894d1d1f4
commit 70956a2c47
4 changed files with 27 additions and 1 deletions

View file

@ -280,6 +280,15 @@ class ReceivingBatchRowViews(APIBatchRowView):
]},
])
# is_missing
elif filtr['field'] == 'is_missing' and filtr['op'] == 'eq' and filtr['value'] is True:
filters.extend([
{'or': [
{'field': 'cases_missing', 'op': '!=', 'value': 0},
{'field': 'units_missing', 'op': '!=', 'value': 0},
]},
])
else: # just some filter, use as-is
filters.append(filtr)
@ -326,6 +335,9 @@ class ReceivingBatchRowViews(APIBatchRowView):
data['cases_expired'] = row.cases_expired
data['units_expired'] = row.units_expired
data['cases_missing'] = row.cases_missing
data['units_missing'] = row.units_missing
cases, units = self.batch_handler.get_unconfirmed_counts(row)
data['cases_unconfirmed'] = cases
data['units_unconfirmed'] = units

View file

@ -151,6 +151,15 @@
</b-checkbox>
</b-field>
<b-field>
<b-checkbox name="rattail.batch.purchase.receiving.auto_missing_credits"
v-model="simpleSettings['rattail.batch.purchase.receiving.auto_missing_credits']"
native-value="true"
@input="settingsNeedSaved = true">
Auto-generate "missing" (DNR) credits for items not accounted for
</b-checkbox>
</b-field>
</div>
<h3 class="block is-size-3">Mobile Interface</h3>

View file

@ -96,10 +96,12 @@ class PurchaseCreditView(MasterView):
]
def configure_grid(self, g):
super(PurchaseCreditView, self).configure_grid(g)
super().configure_grid(g)
# vendor
g.set_joiner('vendor', lambda q: q.outerjoin(model.Vendor))
g.set_sorter('vendor', model.Vendor.name)
g.set_filter('vendor', model.Vendor.name, label="Vendor Name")
g.set_sort_defaults('date_received', 'desc')

View file

@ -1935,6 +1935,9 @@ class ReceivingBatchView(PurchasingBatchView):
{'section': 'rattail.batch',
'option': 'purchase.receiving.allow_edit_invoice_unit_cost',
'type': bool},
{'section': 'rattail.batch',
'option': 'purchase.receiving.auto_missing_credits',
'type': bool},
# mobile interface
{'section': 'rattail.batch',