Features: 1) Initialize order.attributes as an empty dictionary if undefined;
Fixes: 1) Prevent potential errors when accessing `order.attributes` without initialization; Extra: None;
This commit is contained in:
parent
def55e9221
commit
aa643f6773
1 changed files with 3 additions and 0 deletions
|
|
@ -1275,6 +1275,9 @@ class PromoCode(ExportModelOperationsMixin("promocode"), NiceModel): # type: ig
|
||||||
if self.used_on:
|
if self.used_on:
|
||||||
raise ValueError(_("promocode already used"))
|
raise ValueError(_("promocode already used"))
|
||||||
|
|
||||||
|
if not order.attributes:
|
||||||
|
order.attributes = {}
|
||||||
|
|
||||||
promo_amount = order.total_price
|
promo_amount = order.total_price
|
||||||
|
|
||||||
if self.discount_type == "percent":
|
if self.discount_type == "percent":
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue