From f612e4192f8ae5d4a5cf039d0453979e3553508c Mon Sep 17 00:00:00 2001 From: Hugo LEVY-FALK Date: Sat, 29 Dec 2018 15:25:52 +0100 Subject: [PATCH] Add remark to custom invoices --- .../migrations/0036_custominvoice_remark.py | 20 +++++++++++++++++++ cotisations/models.py | 5 +++++ .../templates/cotisations/factures.tex | 6 +++++- cotisations/views.py | 1 + 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 cotisations/migrations/0036_custominvoice_remark.py diff --git a/cotisations/migrations/0036_custominvoice_remark.py b/cotisations/migrations/0036_custominvoice_remark.py new file mode 100644 index 00000000..7719b31d --- /dev/null +++ b/cotisations/migrations/0036_custominvoice_remark.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2018-12-29 14:22 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cotisations', '0035_notepayment'), + ] + + operations = [ + migrations.AddField( + model_name='custominvoice', + name='remark', + field=models.TextField(blank=True, null=True, verbose_name='Remark'), + ), + ] diff --git a/cotisations/models.py b/cotisations/models.py index f8e53b50..979b444a 100644 --- a/cotisations/models.py +++ b/cotisations/models.py @@ -286,6 +286,11 @@ class CustomInvoice(BaseInvoice): paid = models.BooleanField( verbose_name=_("Paid") ) + remark = models.TextField( + verbose_name=_("Remark"), + blank=True, + null=True + ) # TODO : change Vente to Purchase diff --git a/cotisations/templates/cotisations/factures.tex b/cotisations/templates/cotisations/factures.tex index 226682e7..11e490d7 100644 --- a/cotisations/templates/cotisations/factures.tex +++ b/cotisations/templates/cotisations/factures.tex @@ -111,10 +111,14 @@ \end{tabular} \vspace{1cm} - \begin{tabularx}{\textwidth}{c X} + \begin{tabularx}{\textwidth}{r X} \hline \textbf{Moyen de paiement} & {{payment_method|default:"Non spécifié"}} \\ \hline + {% if remark %} + \textbf{Remarque} & {{remark|safe}} \\ + \hline + {% endif %} \end{tabularx} diff --git a/cotisations/views.py b/cotisations/views.py index 902db508..ec746bb7 100644 --- a/cotisations/views.py +++ b/cotisations/views.py @@ -408,6 +408,7 @@ def custom_invoice_pdf(request, invoice, **_kwargs): 'phone': AssoOption.get_cached_value('telephone'), 'tpl_path': os.path.join(settings.BASE_DIR, LOGO_PATH), 'payment_method': invoice.payment, + 'remark': invoice.remark, })