take PricePerUnit from customer if not set in invoice position

This commit is contained in:
Torsten Ueberschar
2024-02-19 10:12:52 +01:00
parent 6f1120c8b4
commit b8bd3f288b
4 changed files with 24 additions and 15 deletions

View File

@@ -32,8 +32,7 @@ class HtmlTemplate:
@staticmethod
def calculate_total(invoice_data):
return sum(
(pos['Quantity'] * (pos['PricePerUnit'] or invoice_data.PricePerUnit)) for pos in invoice_data.Positions)
return sum((pos['Quantity'] * pos['PricePerUnit']) for pos in invoice_data.Positions)
@staticmethod
def named_replace(value, **replacements):