Clear out contact for custorder if user clicks "customer is unknown"

also show pending customer reference when viewing proper custorder
This commit is contained in:
Lance Edgar 2021-10-06 18:43:52 -04:00
parent d933dd2723
commit c611eb3787
2 changed files with 20 additions and 0 deletions

View file

@ -892,6 +892,16 @@
this.customerPanelOpen = true
}
},
watch: {
contactIsKnown: function(val) {
// if user has already specified a proper contact, then
// clicks the "contact is unknown" button, then we want
// to *clear out* the existing contact
if (!val && this.contactUUID) {
this.contactChanged(null)
}
},
},
methods: {
startOverEntirely() {

View file

@ -68,6 +68,7 @@ class CustomerOrderView(MasterView):
'store',
'customer',
'person',
'pending_customer',
'phone_number',
'email_address',
'total_price',
@ -134,6 +135,7 @@ class CustomerOrderView(MasterView):
f.set_renderer('store', self.render_store)
f.set_renderer('customer', self.render_customer)
f.set_renderer('person', self.render_person)
f.set_renderer('pending_customer', self.render_pending_customer)
f.set_type('total_price', 'currency')
@ -152,6 +154,14 @@ class CustomerOrderView(MasterView):
url = self.request.route_url('people.view', uuid=person.uuid)
return tags.link_to(text, url)
def render_pending_customer(self, batch, field):
pending = batch.pending_customer
if not pending:
return
text = six.text_type(pending)
url = self.request.route_url('pending_customers.view', uuid=pending.uuid)
return tags.link_to(text, url)
def get_row_data(self, order):
return self.Session.query(model.CustomerOrderItem)\
.filter(model.CustomerOrderItem.order == order)