Add department, subdepartment "name" columns for products XLSX download

This commit is contained in:
Lance Edgar 2018-11-14 10:46:23 -06:00
parent fed42d4898
commit e3afb2c52a

View file

@ -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