Removed VAT Number and Tax Exempt fields from Personal Info form
authorSybren A. Stüvel <sybren@blender.org>
Tue, 23 Jul 2019 09:53:08 +0000 (11:53 +0200)
committerSybren A. Stüvel <sybren@blender.org>
Tue, 23 Jul 2019 09:53:08 +0000 (11:53 +0200)
These fields, even though they're not mandatory, aren't applicable to
the DevFund, and are actively causing confusion.

The fields are still there in the database model so any filled-in data
will be maintained there (but invisible to the user).

looper/fixtures/testuser.json
looper/forms.py
looper/tests/test_customer.py

index 6345b68860c98bbe640644e43d01a7593bc8b98b..72c3a32f516a683a02ca3aa5b7e8aba69f0e03f6 100644 (file)
@@ -7,7 +7,7 @@
             "full_name": "Harry de B\u00f8ker",
             "company": "\u1002\u102e\u1010 for music",
             "billing_email": "harry+billing@example.com",
-            "vat_number": "",
+            "vat_number": "NL11ABCDEFQQQQ",
             "tax_exempt": true
         }
     },
index cc7e87d1e52c70eb421c696d8a58bb9647568fd1..2b09cf93bc069549850ce245a4314ce2777b66ec 100644 (file)
@@ -83,7 +83,7 @@ class ChangePaymentMethodForm(BasePaymentForm):
 class CustomerForm(BlenderClassesFormMixin, forms.ModelForm):
     class Meta:
         model = models.Customer
-        exclude = ['user']
+        exclude = ['user', 'vat_number', 'tax_exempt']
 
 
 class StateMachineMixin(forms.ModelForm):
index 091b20d54328e987c8c4cfc9d9d4a7543bd312e7..2b35183d93df4971e690df3832bd8a0757f822f7 100644 (file)
@@ -222,13 +222,15 @@ class CustomerEditTestCase(AbstractSingleUserTestCase):
         self.assertEqual(302, r.status_code, 'After POST the page should redirect')
         self.assertEqual(r['Location'], reverse('looper:settings_personal_info'))
 
-        # The customer shouldn't be updated; values are missing in the posted data.
+        # The customer should have been updated.
         self.customer.refresh_from_db()
         self.assertEqual(payload['full_name'], self.customer.full_name)
         self.assertEqual(payload['billing_email'], self.customer.billing_email)
         self.assertEqual(payload['company'], self.customer.company)
-        self.assertEqual('', self.customer.vat_number)
-        self.assertEqual(False, self.customer.tax_exempt)
+
+        # These fields weren't part of the form, so should keep their initial value.
+        self.assertEqual('NL11ABCDEFQQQQ', self.customer.vat_number)
+        self.assertEqual(True, self.customer.tax_exempt)
 
 
 class BillingAddressEditTestCase(AbstractSingleUserTestCase):