Add missing vat_number field to user billing address

This commit is contained in:
PCoder 2019-12-21 10:05:58 +05:30
parent e3078f3ea9
commit 32cfdea68c
2 changed files with 12 additions and 4 deletions

View file

@ -182,6 +182,7 @@ class UserBillingAddressForm(forms.ModelForm):
'city': _('City'), 'city': _('City'),
'postal_code': _('Postal Code'), 'postal_code': _('Postal Code'),
'Country': _('Country'), 'Country': _('Country'),
'vat_number': _('VAT Number'),
} }

View file

@ -38,10 +38,16 @@ class UserBillingAddress(BaseBillingAddress):
current = models.BooleanField(default=True) current = models.BooleanField(default=True)
def __str__(self): def __str__(self):
return "%s, %s, %s, %s, %s" % ( if self.vat_number:
self.cardholder_name, self.street_address, self.city, return "%s, %s, %s, %s, %s, %s" % (
self.postal_code, self.country self.cardholder_name, self.street_address, self.city,
) self.postal_code, self.country, self.vat_number
)
else:
return "%s, %s, %s, %s, %s" % (
self.cardholder_name, self.street_address, self.city,
self.postal_code, self.country
)
def to_dict(self): def to_dict(self):
return { return {
@ -50,6 +56,7 @@ class UserBillingAddress(BaseBillingAddress):
'City': self.city, 'City': self.city,
'Postal Code': self.postal_code, 'Postal Code': self.postal_code,
'Country': self.country, 'Country': self.country,
'VAT Number': self.vat_number
} }