From ba8b366ba652f1da86b664516f14a1af5de6fe33 2021-10-17 16:24:40 From: Lance Edgar Date: 2021-10-17 16:24:40 Subject: [PATCH] Restore "pending" customer when unassigning batch contact unassign means "unset contact uuid" essentially, i.e. unassign the "proper" contact. but if "pending" contact info is there, restore it --- diff --git a/rattail/batch/custorder.py b/rattail/batch/custorder.py index 6283a0673863453a35db80acda6e545fc08612d0..12d486bf12d19c2a66e9e71ed98ca8b209fa0543 100644 --- a/rattail/batch/custorder.py +++ b/rattail/batch/custorder.py @@ -253,9 +253,18 @@ class CustomerOrderBatchHandler(BatchHandler): """ batch.customer = None batch.person = None - batch.contact_name = None - batch.phone_number = None - batch.email_address = None + + # note that if batch already has a "pending" customer on file, + # we will "restore" it as the contact info for the batch + pending = batch.pending_customer + if pending: + batch.contact_name = pending.display_name + batch.phone_number = pending.phone_number + batch.email_address = pending.email_address + else: + batch.contact_name = None + batch.phone_number = None + batch.email_address = None # always reset "add to customer" flags batch.clear_param('add_phone_number')