From a24666c62a6151b6f4dc96ce94a5f30d1f7d032f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 23 Oct 2024 20:12:36 +0200 Subject: [PATCH] feat(invoices): use different wording for quotes --- weblate_web/invoices/models.py | 8 +++- .../invoices/templates/invoice-template.html | 43 ++++++++++++++++--- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/weblate_web/invoices/models.py b/weblate_web/invoices/models.py index 0c20e92dbf..eba9fd948f 100644 --- a/weblate_web/invoices/models.py +++ b/weblate_web/invoices/models.py @@ -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: @@ -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}" diff --git a/weblate_web/invoices/templates/invoice-template.html b/weblate_web/invoices/templates/invoice-template.html index 1866ba9538..9a29eac10a 100644 --- a/weblate_web/invoices/templates/invoice-template.html +++ b/weblate_web/invoices/templates/invoice-template.html @@ -3,20 +3,26 @@ - Invoice {{ invoice.number }} + {{ invoice.get_kind_display }} {{ invoice.number }}
-

Invoice number {{ invoice.number }}

+

{{ invoice.get_kind_display }} number {{ invoice.number }}

{{ invoice.issue_date|date }}

-

Invoice to

+

+ {% if invoice.is_draft %} + Quote for + {% else %} + Invoice to + {% endif %} +

{{ invoice.customer.name }}
{{ invoice.customer.address }} @@ -123,8 +129,20 @@

Issued by

- - + + @@ -135,7 +153,9 @@

Issued by

Total dueDue by + {% if invoice.is_draft %} + Quote amount + {% else %} + Total due + {% endif %} + + {% if invoice.is_draft %} + Valid until + {% else %} + Due by + {% endif %} + Payment
{{ invoice.due_date|date }} - {% 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 @@ -149,6 +169,9 @@

Issued by

+ {% if invoice.is_draft %} +

Should you have any questions concerning this quotation, please contact us at sales@weblate.org.

+ {% endif %} {% if invoice.vat_rate == 0 %}

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. @@ -157,7 +180,13 @@

Issued by

- +
Date of taxable supply + {% if invoice.is_draft %} + Quote date + {% else %} + Date of taxable supply + {% endif %} + CIN (IČ) Managing director Trade register