Add "true margin" to products XLSX export

This commit is contained in:
Lance Edgar 2021-11-09 15:49:42 -06:00
parent 85166d5beb
commit e7871380a9

View file

@ -663,6 +663,7 @@ class ProductView(MasterView):
fields.append('vendor_name') fields.append('vendor_name')
fields.append('vendor_item_code') fields.append('vendor_item_code')
fields.append('unit_cost') fields.append('unit_cost')
fields.append('true_margin')
return fields return fields
@ -724,6 +725,11 @@ class ProductView(MasterView):
if 'unit_cost' in fields: if 'unit_cost' in fields:
row['unit_cost'] = product.cost.unit_cost if product.cost else None row['unit_cost'] = product.cost.unit_cost if product.cost else None
if 'true_margin' in fields:
row['true_margin'] = None
if product.volatile and product.volatile.true_margin:
row['true_margin'] = product.volatile.true_margin
return row return row
def get_instance(self): def get_instance(self):