mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #2214 from SchrodingersGat/sales-order-export-fix
convert sale_price to string before exporting
This commit is contained in:
commit
fe5cb3ddca
@ -83,7 +83,9 @@ class POLineItemResource(ModelResource):
|
||||
|
||||
|
||||
class SOLineItemResource(ModelResource):
|
||||
""" Class for managing import / export of SOLineItem data """
|
||||
"""
|
||||
Class for managing import / export of SOLineItem data
|
||||
"""
|
||||
|
||||
part_name = Field(attribute='part__name', readonly=True)
|
||||
|
||||
@ -93,6 +95,17 @@ class SOLineItemResource(ModelResource):
|
||||
|
||||
fulfilled = Field(attribute='fulfilled_quantity', readonly=True)
|
||||
|
||||
def dehydrate_sale_price(self, item):
|
||||
"""
|
||||
Return a string value of the 'sale_price' field, rather than the 'Money' object.
|
||||
Ref: https://github.com/inventree/InvenTree/issues/2207
|
||||
"""
|
||||
|
||||
if item.sale_price:
|
||||
return str(item.sale_price)
|
||||
else:
|
||||
return ''
|
||||
|
||||
class Meta:
|
||||
model = SalesOrderLineItem
|
||||
skip_unchanged = True
|
||||
|
Loading…
Reference in New Issue
Block a user