Save VAT number

This commit is contained in:
PCoder 2019-12-17 22:52:22 +05:30
parent 0f3acf5db4
commit 5e97d70a5e
2 changed files with 8 additions and 0 deletions

View file

@ -942,6 +942,11 @@ class OrderConfirmationView(DetailView, FormView):
'user': custom_user.id 'user': custom_user.id
}) })
# Customer is created, we save his VAT Number
custom_user.vat_number = request.session.get(
'billing_address_data').get("vat_number")
custom_user.save()
if 'generic_payment_type' in request.session: if 'generic_payment_type' in request.session:
stripe_cus = StripeCustomer.objects.filter( stripe_cus = StripeCustomer.objects.filter(
stripe_id=stripe_api_cus_id stripe_id=stripe_api_cus_id

View file

@ -616,6 +616,9 @@ class SettingsView(LoginRequiredMixin, FormView):
instance=self.request.user.billing_addresses.first(), instance=self.request.user.billing_addresses.first(),
data=billing_address_data) data=billing_address_data)
billing_address_user_form.save() billing_address_user_form.save()
self.request.user.vat_number = billing_address_data.get(
"vat_number")
self.request.user.save()
msg = _("Billing address updated successfully") msg = _("Billing address updated successfully")
messages.add_message(request, messages.SUCCESS, msg) messages.add_message(request, messages.SUCCESS, msg)
else: else: