Features: 1) Allow skipping address validation for fully digital products;
Fixes: 1) Correct improper logic when checking for missing addresses; Extra: 1) Minor structural improvement to conditional logic for clarity;
This commit is contained in:
parent
880d7edda9
commit
41f8cf55b5
1 changed files with 5 additions and 2 deletions
|
|
@ -637,8 +637,11 @@ class Order(NiceModel):
|
||||||
def apply_addresses(self, billing_address_uuid, shipping_address_uuid):
|
def apply_addresses(self, billing_address_uuid, shipping_address_uuid):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not self.is_whole_digital and not any([shipping_address_uuid, billing_address_uuid]):
|
if not any([shipping_address_uuid, billing_address_uuid]):
|
||||||
raise ValueError(_("you can only buy physical products with shipping address specified"))
|
if self.is_whole_digital:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
raise ValueError(_("you can only buy physical products with shipping address specified"))
|
||||||
|
|
||||||
if billing_address_uuid and not shipping_address_uuid:
|
if billing_address_uuid and not shipping_address_uuid:
|
||||||
shipping_address = Address.objects.get(uuid=billing_address_uuid)
|
shipping_address = Address.objects.get(uuid=billing_address_uuid)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue