Include "superdepartment_number" in Excel products download

This commit is contained in:
Lance Edgar 2020-08-20 14:41:55 -05:00
parent 56fd3a5a4b
commit c5d119a542

View file

@ -141,6 +141,21 @@ class ProductView(CoreOfficeMasterView):
return '{}/item/ItemEditorPage.php?searchupc={}'.format( return '{}/item/ItemEditorPage.php?searchupc={}'.format(
office_url, product.upc) 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): class ProductFlagView(CoreOfficeMasterView):
""" """