* Try to get delivery_price_CN_RU from parent category if it is zero
This commit is contained in:
parent
8a7e2865ed
commit
86a86e79f3
|
|
@ -82,6 +82,13 @@ class Category(MPTTModel):
|
||||||
verbose_name = 'Категория'
|
verbose_name = 'Категория'
|
||||||
verbose_name_plural = 'Категории'
|
verbose_name_plural = 'Категории'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def delivery_price(self):
|
||||||
|
if not self.delivery_price_CN_RU and self.parent_id:
|
||||||
|
return self.parent.delivery_price_CN_RU
|
||||||
|
else:
|
||||||
|
return self.delivery_price_CN_RU
|
||||||
|
|
||||||
|
|
||||||
class UserQuerySet(models.QuerySet):
|
class UserQuerySet(models.QuerySet):
|
||||||
pass
|
pass
|
||||||
|
|
@ -446,7 +453,7 @@ class Checklist(models.Model):
|
||||||
if self.price_snapshot_id:
|
if self.price_snapshot_id:
|
||||||
return self.price_snapshot.delivery_price_CN_RU
|
return self.price_snapshot.delivery_price_CN_RU
|
||||||
else:
|
else:
|
||||||
return getattr(self.category, 'delivery_price_CN_RU', Decimal(0))
|
return getattr(self.category, 'delivery_price', Decimal(0))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def commission_rub(self) -> Decimal:
|
def commission_rub(self) -> Decimal:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user