Display the Store field for Customer Orders
This commit is contained in:
parent
3ece3303db
commit
8095f2c9ea
|
@ -58,6 +58,7 @@ class CustomerOrderBatchView(BatchMasterView):
|
||||||
|
|
||||||
form_fields = [
|
form_fields = [
|
||||||
'id',
|
'id',
|
||||||
|
'store',
|
||||||
'customer',
|
'customer',
|
||||||
'person',
|
'person',
|
||||||
'phone_number',
|
'phone_number',
|
||||||
|
@ -107,6 +108,8 @@ class CustomerOrderBatchView(BatchMasterView):
|
||||||
f.set_readonly('rows')
|
f.set_readonly('rows')
|
||||||
f.set_readonly('status_code')
|
f.set_readonly('status_code')
|
||||||
|
|
||||||
|
f.set_renderer('store', self.render_store)
|
||||||
|
|
||||||
# customer
|
# customer
|
||||||
if 'customer' in f.fields and self.editing:
|
if 'customer' in f.fields and self.editing:
|
||||||
f.replace('customer', 'customer_uuid')
|
f.replace('customer', 'customer_uuid')
|
||||||
|
|
|
@ -60,12 +60,15 @@ class CustomerOrderView(MasterView):
|
||||||
|
|
||||||
form_fields = [
|
form_fields = [
|
||||||
'id',
|
'id',
|
||||||
|
'store',
|
||||||
'customer',
|
'customer',
|
||||||
'person',
|
'person',
|
||||||
'phone_number',
|
'phone_number',
|
||||||
'email_address',
|
'email_address',
|
||||||
'created',
|
'total_price',
|
||||||
'status_code',
|
'status_code',
|
||||||
|
'created',
|
||||||
|
'created_by',
|
||||||
]
|
]
|
||||||
|
|
||||||
has_rows = True
|
has_rows = True
|
||||||
|
@ -128,14 +131,20 @@ class CustomerOrderView(MasterView):
|
||||||
f.set_readonly('id')
|
f.set_readonly('id')
|
||||||
f.set_label('id', "ID")
|
f.set_label('id', "ID")
|
||||||
|
|
||||||
|
f.set_renderer('store', self.render_store)
|
||||||
f.set_renderer('customer', self.render_customer)
|
f.set_renderer('customer', self.render_customer)
|
||||||
f.set_renderer('person', self.render_person)
|
f.set_renderer('person', self.render_person)
|
||||||
|
|
||||||
|
f.set_type('total_price', 'currency')
|
||||||
|
|
||||||
f.set_enum('status_code', self.enum.CUSTORDER_STATUS)
|
f.set_enum('status_code', self.enum.CUSTORDER_STATUS)
|
||||||
f.set_label('status_code', "Status")
|
f.set_label('status_code', "Status")
|
||||||
|
|
||||||
f.set_readonly('created')
|
f.set_readonly('created')
|
||||||
|
|
||||||
|
f.set_readonly('created_by')
|
||||||
|
f.set_renderer('created_by', self.render_user)
|
||||||
|
|
||||||
def render_person(self, order, field):
|
def render_person(self, order, field):
|
||||||
person = order.person
|
person = order.person
|
||||||
if not person:
|
if not person:
|
||||||
|
|
|
@ -747,6 +747,13 @@ class MasterView(View):
|
||||||
return obj.upc.pretty() if obj.upc else ''
|
return obj.upc.pretty() if obj.upc else ''
|
||||||
return getattr(obj, product_key)
|
return getattr(obj, product_key)
|
||||||
|
|
||||||
|
def render_store(self, obj, field):
|
||||||
|
store = getattr(obj, field)
|
||||||
|
if store:
|
||||||
|
text = "({}) {}".format(store.id, store.name)
|
||||||
|
url = self.request.route_url('stores.view', uuid=store.uuid)
|
||||||
|
return tags.link_to(text, url)
|
||||||
|
|
||||||
def render_product(self, obj, field):
|
def render_product(self, obj, field):
|
||||||
product = getattr(obj, field)
|
product = getattr(obj, field)
|
||||||
if not product:
|
if not product:
|
||||||
|
|
Loading…
Reference in a new issue