Improve phone/email handling when making new custorder
still needs more improvement, but this is a start
This commit is contained in:
parent
82074a37ba
commit
ad6562558d
2 changed files with 259 additions and 70 deletions
tailbone/views/custorders
|
@ -228,6 +228,8 @@ class CustomerOrderView(MasterView):
|
|||
json_actions = [
|
||||
'assign_contact',
|
||||
'unassign_contact',
|
||||
'update_phone_number',
|
||||
'update_email_address',
|
||||
'get_customer_info',
|
||||
# 'set_customer_data',
|
||||
'find_product_by_upc',
|
||||
|
@ -413,22 +415,28 @@ class CustomerOrderView(MasterView):
|
|||
|
||||
return context
|
||||
|
||||
# def set_customer_data(self, batch, data):
|
||||
# if 'customer_uuid' in data:
|
||||
# batch.customer_uuid = data['customer_uuid']
|
||||
# if 'person_uuid' in data:
|
||||
# batch.person_uuid = data['person_uuid']
|
||||
# elif batch.customer_uuid:
|
||||
# self.Session.flush()
|
||||
# batch.person = batch.customer.first_person()
|
||||
# else: # no customer set
|
||||
# batch.person_uuid = None
|
||||
# if 'phone_number' in data:
|
||||
# batch.phone_number = data['phone_number']
|
||||
# if 'email_address' in data:
|
||||
# batch.email_address = data['email_address']
|
||||
# self.Session.flush()
|
||||
# return {'success': True}
|
||||
def update_phone_number(self, batch, data):
|
||||
app = self.get_rattail_app()
|
||||
|
||||
batch.phone_number = app.format_phone_number(data['phone_number'])
|
||||
self.Session.flush()
|
||||
self.Session.refresh(batch)
|
||||
|
||||
return {
|
||||
'success': True,
|
||||
'phone_number': batch.phone_number,
|
||||
}
|
||||
|
||||
def update_email_address(self, batch, data):
|
||||
|
||||
batch.email_address = data['email_address']
|
||||
self.Session.flush()
|
||||
self.Session.refresh(batch)
|
||||
|
||||
return {
|
||||
'success': True,
|
||||
'email_address': batch.email_address,
|
||||
}
|
||||
|
||||
def product_autocomplete(self):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue