From c5d119a5422aafd1b6b7b50a353444683ba66447 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 20 Aug 2020 14:41:55 -0500 Subject: [PATCH] Include "superdepartment_number" in Excel products download --- tailbone_corepos/views/corepos/products.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tailbone_corepos/views/corepos/products.py b/tailbone_corepos/views/corepos/products.py index 4428f66..6c53e21 100644 --- a/tailbone_corepos/views/corepos/products.py +++ b/tailbone_corepos/views/corepos/products.py @@ -141,6 +141,21 @@ class ProductView(CoreOfficeMasterView): return '{}/item/ItemEditorPage.php?searchupc={}'.format( office_url, product.upc) + def get_xlsx_fields(self): + fields = super(ProductView, self).get_xlsx_fields() + fields.append('superdepartment_number') + return fields + + def get_xlsx_row(self, product, fields): + row = super(ProductView, self).get_xlsx_row(product, fields) + + row['superdepartment_number'] = None + dept = product.department + if dept and dept._super_parents: + row['superdepartment_number'] = dept._super_parents[0].parent_id + + return row + class ProductFlagView(CoreOfficeMasterView): """