From c09e51e103b93286d13ac90c013a28b1206ffcf4 Mon Sep 17 00:00:00 2001 From: Adrian Fedoreanu Date: Sat, 23 Mar 2024 20:39:13 +0100 Subject: [PATCH] update LegalEntity model --- ...005_legalentity_company_number_and_more.py | 23 +++++++++++++++++++ .../templates/oscar_invoices/invoice.html | 7 +++++- tests/factories.py | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 oscar_invoices/migrations/0005_legalentity_company_number_and_more.py diff --git a/oscar_invoices/migrations/0005_legalentity_company_number_and_more.py b/oscar_invoices/migrations/0005_legalentity_company_number_and_more.py new file mode 100644 index 0000000..6a30934 --- /dev/null +++ b/oscar_invoices/migrations/0005_legalentity_company_number_and_more.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.11 on 2024-03-23 19:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('oscar_invoices', '0004_date_banking_details'), + ] + + operations = [ + migrations.AddField( + model_name='legalentity', + name='company_number', + field=models.CharField(blank=True, max_length=20, null=True, verbose_name='Company identification number'), + ), + migrations.AlterField( + model_name='legalentity', + name='vat_number', + field=models.CharField(blank=True, max_length=20, null=True, verbose_name='VAT identification number'), + ), + ] diff --git a/oscar_invoices/templates/oscar_invoices/invoice.html b/oscar_invoices/templates/oscar_invoices/invoice.html index f4d4029..330fa25 100644 --- a/oscar_invoices/templates/oscar_invoices/invoice.html +++ b/oscar_invoices/templates/oscar_invoices/invoice.html @@ -133,7 +133,12 @@

{% trans "Original invoice" %} #{{ invoice.number }}


{{ legal_entity.business_name }}
- {% trans "VAT ID" %}: {{ legal_entity.vat_number }}
+ {% if legal_entity.vat_number %} + {% trans "VAT ID" %}: {{ legal_entity.vat_number }}
+ {% endif %} + {% if legal_entity.company_number %} + {% trans "Company ID" %}: {{ legal_entity.company_number }}
+ {% endif %}
{{ legal_entity_address.summary }}
{% if legal_entity_address.phone_number %} diff --git a/tests/factories.py b/tests/factories.py index 0a77ff4..929a188 100644 --- a/tests/factories.py +++ b/tests/factories.py @@ -6,7 +6,7 @@ class LegalEntityFactory(factory.django.DjangoModelFactory): business_name = 'Test Company' - vat_number = 'test-vat-number' + company_number = 'test-company-number' class Meta: model = get_model('oscar_invoices', 'LegalEntity')