Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(invoices): use different wording for quotes #2259

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
43 changes: 36 additions & 7 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 All @@ -157,7 +180,13 @@ <h2>Issued by</h2>
<table id="details">
<tbody>
<tr>
<th>Date of taxable supply</th>
<th>
{% if invoice.is_draft %}
Quote date
{% else %}
Date of taxable supply
{% endif %}
</th>
<th>CIN (IČ)</th>
<th>Managing director</th>
<th>Trade register</th>
Expand Down
Loading