Add "auto-receive all items" support for receiving batch API

This commit is contained in:
Lance Edgar 2022-07-24 22:29:55 -05:00
parent f33d7b7f90
commit ad7b347e16
3 changed files with 26 additions and 22 deletions

View file

@ -129,9 +129,9 @@ class ReceivingBatchView(PurchasingBatchView):
'vendor_contact',
'vendor_phone',
'date_ordered',
'date_received',
'po_number',
'po_total',
'date_received',
'invoice_date',
'invoice_number',
'invoice_total',
@ -1824,22 +1824,7 @@ class ReceivingBatchView(PurchasingBatchView):
return pod.get_image_url(self.rattail_config, row.upc)
def can_auto_receive(self, batch):
if batch.executed:
return False
if batch.complete:
return False
if batch.is_truck_dump_related():
if not batch.is_truck_dump_parent():
return False
if not batch.truck_dump_children_first():
return False
# only auto-receive once per batch
if batch.get_param('auto_received'):
return False
return True
return self.handler.can_auto_receive(batch)
def auto_receive(self):
"""
@ -1865,7 +1850,7 @@ class ReceivingBatchView(PurchasingBatchView):
"""
session = RattailSession()
batch = session.query(model.PurchaseBatch).get(uuid)
user = session.query(model.User).get(user_uuid)
# user = session.query(model.User).get(user_uuid)
try:
self.handler.auto_receive_all_items(batch, progress=progress)