diff --git a/tailbone/views/custorders/batch.py b/tailbone/views/custorders/batch.py index c9a4a4b6..18ff9a00 100644 --- a/tailbone/views/custorders/batch.py +++ b/tailbone/views/custorders/batch.py @@ -58,6 +58,7 @@ class CustomerOrderBatchView(BatchMasterView): form_fields = [ 'id', + 'store', 'customer', 'person', 'phone_number', @@ -107,6 +108,8 @@ class CustomerOrderBatchView(BatchMasterView): f.set_readonly('rows') f.set_readonly('status_code') + f.set_renderer('store', self.render_store) + # customer if 'customer' in f.fields and self.editing: f.replace('customer', 'customer_uuid') diff --git a/tailbone/views/custorders/orders.py b/tailbone/views/custorders/orders.py index 4553a19b..36414a89 100644 --- a/tailbone/views/custorders/orders.py +++ b/tailbone/views/custorders/orders.py @@ -60,12 +60,15 @@ class CustomerOrderView(MasterView): form_fields = [ 'id', + 'store', 'customer', 'person', 'phone_number', 'email_address', - 'created', + 'total_price', 'status_code', + 'created', + 'created_by', ] has_rows = True @@ -128,14 +131,20 @@ class CustomerOrderView(MasterView): f.set_readonly('id') f.set_label('id', "ID") + f.set_renderer('store', self.render_store) f.set_renderer('customer', self.render_customer) f.set_renderer('person', self.render_person) + f.set_type('total_price', 'currency') + f.set_enum('status_code', self.enum.CUSTORDER_STATUS) f.set_label('status_code', "Status") f.set_readonly('created') + f.set_readonly('created_by') + f.set_renderer('created_by', self.render_user) + def render_person(self, order, field): person = order.person if not person: diff --git a/tailbone/views/master.py b/tailbone/views/master.py index a4210ba2..d238a4bb 100644 --- a/tailbone/views/master.py +++ b/tailbone/views/master.py @@ -747,6 +747,13 @@ class MasterView(View): return obj.upc.pretty() if obj.upc else '' 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): product = getattr(obj, field) if not product: