mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
fix wrong reference for POs
This commit is contained in:
parent
98ea838ec4
commit
f1f0027cef
@ -158,8 +158,10 @@ class Order(ReferenceIndexingMixin):
|
||||
target_currency = currency_code_default()
|
||||
total = Money(0, target_currency)
|
||||
|
||||
# gather name reference
|
||||
price_ref = 'sale_price' if isinstance(self, SalesOrder) else 'purchase_price'
|
||||
# order items
|
||||
total += sum([a.quantity * convert_money(a.sale_price, target_currency) for a in self.lines.all() if a.sale_price])
|
||||
total += sum([a.quantity * convert_money(getattr(a, price_ref), target_currency) for a in self.lines.all() if hasattr(a, price_ref)])
|
||||
|
||||
# additional lines
|
||||
total += sum([a.quantity * convert_money(a.sale_price, target_currency) for a in self.additional_lines.all() if a.sale_price])
|
||||
|
Loading…
Reference in New Issue
Block a user