membershipworks: Provide details when an event is not ready for invoice
This commit is contained in:
parent
d12ac8f568
commit
fd26e2b17d
@ -613,18 +613,26 @@ class EventExt(Event):
|
||||
return self.instructor.member == member
|
||||
return False
|
||||
|
||||
@property
|
||||
def missing_for_invoice(self) -> list[str]:
|
||||
reasons = {
|
||||
"Missing instructor": self.instructor is None,
|
||||
"Instructor not linked to a member": (
|
||||
self.instructor is not None and self.instructor.member is None
|
||||
),
|
||||
"Missing materials fee": self.materials_fee is None,
|
||||
"Materials fee is not 0 and materials_fee_included_in_price not defined": (
|
||||
self.materials_fee != 0 and self.materials_fee_included_in_price is None
|
||||
),
|
||||
"total_due_to_instructor is None (this can have several causes)": (
|
||||
self.total_due_to_instructor is None
|
||||
),
|
||||
}
|
||||
return [k for k, v in reasons.items() if v]
|
||||
|
||||
@property
|
||||
def ready_for_invoice(self) -> bool:
|
||||
return (
|
||||
self.instructor is not None
|
||||
and self.instructor.member is not None
|
||||
and self.materials_fee is not None
|
||||
and (
|
||||
self.materials_fee_included_in_price is not None
|
||||
or self.materials_fee == 0
|
||||
)
|
||||
and self.total_due_to_instructor is not None
|
||||
)
|
||||
return len(self.missing_for_invoice) == 0
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
@ -38,6 +38,14 @@
|
||||
{% elif not event.ready_for_invoice %}
|
||||
<p class="card-text text-center">
|
||||
This event is missing required information to generate an invoice. Please contact us at <a href="mailto:info@claremontmakerspace.org">info@claremontmakerspace.org</a>.
|
||||
{% if perms.membershipworks.view_event %}
|
||||
<div>
|
||||
<h5>Issues:</h5>
|
||||
<ul>
|
||||
{{ event.missing_for_invoice|unordered_list }}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
</p>
|
||||
{% elif user_is_instructor %}
|
||||
<form method="post" class="card-text">
|
||||
|
Loading…
Reference in New Issue
Block a user