From 87da286f2f7b5bee7a168ad9f0ccd35a68ae7e09 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 28 Jul 2023 15:28:50 +1000 Subject: [PATCH] Handle purchase price export for .xls files (#5362) --- InvenTree/order/admin.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/InvenTree/order/admin.py b/InvenTree/order/admin.py index 97ce316bda..b411b31699 100644 --- a/InvenTree/order/admin.py +++ b/InvenTree/order/admin.py @@ -171,6 +171,14 @@ class PurchaseOrderLineItemResource(PriceResourceMixin, InvenTreeResource): SKU = Field(attribute='part__SKU', readonly=True) + def dehydrate_purchase_price(self, line): + """Return a string value of the 'purchase_price' field, rather than the 'Money' object""" + + if line.purchase_price: + return line.purchase_price.amount + else: + return '' + class PurchaseOrderExtraLineResource(PriceResourceMixin, InvenTreeResource): """Class for managing import / export of PurchaseOrderExtraLine data."""