Skip to content

Commit e953067

Browse files
fix: Do not send invoice if amount < minimum (#7472)
1 parent 183e8af commit e953067

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/models/event_invoice.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
class EventInvoice(SoftDeletionModel):
2424
DUE_DATE_DAYS = 30
25+
MIN_AMOUNT = 2 # Minimum amount for which the invoice will be generated
2526

2627
__tablename__ = 'event_invoices'
2728

@@ -128,6 +129,14 @@ def generate_pdf(self, force=False):
128129
self.event,
129130
)
130131
return
132+
if not force and self.amount < EventInvoice.MIN_AMOUNT:
133+
logger.warning(
134+
'Invoice amount of Event %s is %f which is less than %f, hence skipping generation',
135+
self.event,
136+
self.amount,
137+
EventInvoice.MIN_AMOUNT,
138+
)
139+
return
131140
net_revenue = round_money(gross_revenue - invoice_amount)
132141
orders_query = self.event.get_orders_query(
133142
start=latest_invoice_date, end=self.issued_at

0 commit comments

Comments
 (0)