Improve BillingAddress string representation

Include VAT number if available
This commit is contained in:
PCoder 2019-12-21 08:52:06 +05:30
parent 202a514b1b
commit 2d66ae6783

View file

@ -21,6 +21,12 @@ class BaseBillingAddress(models.Model):
class BillingAddress(BaseBillingAddress): class BillingAddress(BaseBillingAddress):
def __str__(self): def __str__(self):
if self.vat_number:
return "%s, %s, %s, %s, %s, %s" % (
self.cardholder_name, self.street_address, self.city,
self.postal_code, self.country, self.vat_number
)
else:
return "%s, %s, %s, %s, %s" % ( return "%s, %s, %s, %s, %s" % (
self.cardholder_name, self.street_address, self.city, self.cardholder_name, self.street_address, self.city,
self.postal_code, self.country self.postal_code, self.country