From e3afb2c52a40475ee1aedc01760806a0a20a4643 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 14 Nov 2018 10:46:23 -0600 Subject: [PATCH] Add department, subdepartment "name" columns for products XLSX download --- tailbone/views/products.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tailbone/views/products.py b/tailbone/views/products.py index a8ba6447..0d49401b 100644 --- a/tailbone/views/products.py +++ b/tailbone/views/products.py @@ -485,9 +485,11 @@ class ProductsView(MasterView): i = fields.index('department_uuid') fields.insert(i + 1, 'department_number') + fields.insert(i + 2, 'department_name') i = fields.index('subdepartment_uuid') fields.insert(i + 1, 'subdepartment_number') + fields.insert(i + 2, 'subdepartment_name') i = fields.index('category_uuid') fields.insert(i + 1, 'category_code') @@ -526,9 +528,13 @@ class ProductsView(MasterView): if 'department_number' in fields: row['department_number'] = product.department.number if product.department else None + if 'department_name' in fields: + row['department_name'] = product.department.name if product.department else None if 'subdepartment_number' in fields: row['subdepartment_number'] = product.subdepartment.number if product.subdepartment else None + if 'subdepartment_name' in fields: + row['subdepartment_name'] = product.subdepartment.name if product.subdepartment else None if 'category_code' in fields: row['category_code'] = product.category.code if product.category else None