From 081c99a7f24337f1142c44b91347dc77c95efa69 Mon Sep 17 00:00:00 2001 From: Romain Mussard Date: Sun, 13 Sep 2020 21:32:02 +0200 Subject: [PATCH] Add address on dormitory --- .../templates/cotisations/factures.tex | 2 +- cotisations/views.py | 1 - .../migrations/0075_auto_20200913_2130.py | 35 +++++++++++++++++++ topologie/models.py | 7 ++++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 topologie/migrations/0075_auto_20200913_2130.py diff --git a/cotisations/templates/cotisations/factures.tex b/cotisations/templates/cotisations/factures.tex index 2cfd4f46..36db8a3f 100644 --- a/cotisations/templates/cotisations/factures.tex +++ b/cotisations/templates/cotisations/factures.tex @@ -73,7 +73,7 @@ \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l r} {\bf Pour :} {{recipient_name|safe}} & {\bf Date :} {{DATE}} \\ - {\bf Adresse :} {% if address is None %}Aucune adresse renseignée{% else %}{{address}}{% endif %} & \\ + {\bf Adresse :} {% if address is None %}Aucune adresse renseignée{% else %}{{addresse1 \\ addresse2 \\addresse3 \\ addresse4}}{% endif %} & \\ {% if fid is not None %} {% if is_estimate %} {\bf Devis n\textsuperscript{o} :} {{ fid }} & \\ diff --git a/cotisations/views.py b/cotisations/views.py index 680b9483..2ffb8935 100644 --- a/cotisations/views.py +++ b/cotisations/views.py @@ -315,7 +315,6 @@ def facture_pdf(request, facture, **_kwargs): "fid": facture.id, "DATE": facture.date, "recipient_name": "{} {}".format(facture.user.name, facture.user.surname), - "address": facture.user.room, "article": purchases_info, "total": facture.prix_total(), "asso_name": AssoOption.get_cached_value("name"), diff --git a/topologie/migrations/0075_auto_20200913_2130.py b/topologie/migrations/0075_auto_20200913_2130.py new file mode 100644 index 00000000..340ec0c9 --- /dev/null +++ b/topologie/migrations/0075_auto_20200913_2130.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.29 on 2020-09-13 19:30 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('topologie', '0074_auto_20200419_1640'), + ] + + operations = [ + migrations.AddField( + model_name='dormitory', + name='city', + field=models.CharField(blank=True, max_length=64, null=True), + ), + migrations.AddField( + model_name='dormitory', + name='country', + field=models.CharField(blank=True, max_length=64, null=True), + ), + migrations.AddField( + model_name='dormitory', + name='street', + field=models.CharField(blank=True, max_length=64, null=True), + ), + migrations.AddField( + model_name='dormitory', + name='zipcode', + field=models.CharField(blank=True, max_length=64, null=True), + ), + ] diff --git a/topologie/models.py b/topologie/models.py index ef93c899..cbd032bb 100644 --- a/topologie/models.py +++ b/topologie/models.py @@ -713,6 +713,10 @@ class Dormitory(AclMixin, RevMixin, models.Model): """ name = models.CharField(max_length=255) + street = models.CharField(max_length=64, blank=True, null=True) + city = models.CharField(max_length=64, blank=True, null=True) + zipcode = models.CharField(max_length=64, blank=True, null=True) + country = models.CharField(max_length=64, blank=True, null=True) class Meta: permissions = (("view_dormitory", _("Can view a dormitory object")),) @@ -947,6 +951,9 @@ class Room(AclMixin, RevMixin, models.Model): def __str__(self): return self.building.cached_name + " " + self.name + def full_address(self): + return "Appartement " + self.name + ", Batiment " + self.building.name + ", " + "Residence " + self.building.dormitory.name + ", " + str(self.building.dormitory.address) + class PortProfile(AclMixin, RevMixin, models.Model): """Port profile.