Skip to content

Commit

Permalink
feat(invoices): use different wording for quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Oct 23, 2024
1 parent 16edbb0 commit 6b8a727
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
8 changes: 7 additions & 1 deletion weblate_web/invoices/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ def save( # type: ignore[override]
):
extra_fields: list[str] = []
if not self.due_date:
self.due_date = self.issue_date + datetime.timedelta(days=14)
self.due_date = self.issue_date + datetime.timedelta(
days=30 if self.is_draft else 14
)
extra_fields.append("due_date")
if not self.sequence:
try:
Expand All @@ -181,6 +183,10 @@ def save( # type: ignore[override]
update_fields=update_fields,
)

@property
def is_draft(self):
return self.kind in {InvoiceKind.DRAFT, InvoiceKind.QUOTE}

def render_amount(self, amount: int | Decimal) -> str:
if self.currency == Currency.EUR:
return f"€{amount}"
Expand Down
35 changes: 29 additions & 6 deletions weblate_web/invoices/templates/invoice-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,26 @@
<head>
<meta charset="utf-8">
<link href="invoices:invoice.css" media="print" rel="stylesheet">
<title>Invoice {{ invoice.number }}</title>
<title>{{ invoice.get_kind_display }} {{ invoice.number }}</title>
<meta name="description" content="Weblate invoice">
</head>

<body>
<header>
<img class="logo" src="invoices:invoice-logo.svg" alt="Weblate">
<h1>Invoice number {{ invoice.number }}</h1>
<h1>{{ invoice.get_kind_display }} number {{ invoice.number }}</h1>
<p>{{ invoice.issue_date|date }}</p>
</header>

<div id="contacts" class="fullwidth">
<address id="to">
<h2>Invoice to</h2>
<h2>
{% if invoice.is_draft %}
Quote for
{% else %}
Invoice to
{% endif %}
</h2>
{{ invoice.customer.name }}
<br />
{{ invoice.customer.address }}
Expand Down Expand Up @@ -123,8 +129,20 @@ <h2>Issued by</h2>
<table id="total" class="fullwidth">
<thead>
<tr>
<th>Total due</th>
<th>Due by</th>
<th>
{% if invoice.is_draft %}
Quote amount
{% else %}
Total due
{% endif %}
</th>
<th>
{% if invoice.is_draft %}
Valid until
{% else %}
Due by
{% endif %}
</th>
<th>Payment</th>
</tr>
</thead>
Expand All @@ -135,7 +153,9 @@ <h2>Issued by</h2>
</td>
<td>{{ invoice.due_date|date }}</td>
<td>
{% if invoice.prepaid %}
{% if invoice.is_draft %}
Bank transfer od card payments are available
{% elif invoice.prepaid %}
Do not pay, already paid
{% else %}
Bank transfer
Expand All @@ -149,6 +169,9 @@ <h2>Issued by</h2>
</tr>
</tbody>
</table>
{% if invoice.is_draft %}
<p>Should you have any questions concerning this quotation, please contact us at [email protected].</p>
{% endif %}
{% if invoice.vat_rate == 0 %}
<p>
The place of supply is considered to be in your country pursuant to Section 9 (1) Value Added Tax Act No. 235/2004 Coll. The person to whom the service is rendered is liable to declare and pay VAT in his country (reverse charge) according to European Directive 206/112/ES.
Expand Down

0 comments on commit 6b8a727

Please sign in to comment.