+ Recursive search of suitable commission price & delivery price
This commit is contained in:
parent
4ac1ee501a
commit
a7b1f6981f
|
|
@ -85,10 +85,17 @@ class Category(MPTTModel):
|
||||||
@property
|
@property
|
||||||
def delivery_price(self):
|
def delivery_price(self):
|
||||||
if not self.delivery_price_CN_RU and self.parent_id:
|
if not self.delivery_price_CN_RU and self.parent_id:
|
||||||
return self.parent.delivery_price_CN_RU
|
return self.parent.delivery_price
|
||||||
else:
|
else:
|
||||||
return self.delivery_price_CN_RU
|
return self.delivery_price_CN_RU
|
||||||
|
|
||||||
|
@property
|
||||||
|
def commission_price(self):
|
||||||
|
if not self.commission and self.parent_id:
|
||||||
|
return self.parent.commission_price
|
||||||
|
else:
|
||||||
|
return self.commission
|
||||||
|
|
||||||
|
|
||||||
class UserQuerySet(models.QuerySet):
|
class UserQuerySet(models.QuerySet):
|
||||||
pass
|
pass
|
||||||
|
|
@ -474,7 +481,7 @@ class Checklist(models.Model):
|
||||||
|
|
||||||
if self.category_id:
|
if self.category_id:
|
||||||
# Add commission of bottom-most category
|
# Add commission of bottom-most category
|
||||||
category_commission = getattr(self.category, 'commission', 0)
|
category_commission = getattr(self.category, 'commission_price', 0)
|
||||||
commission = max(commission, category_commission * self.price_rub / 100)
|
commission = max(commission, category_commission * self.price_rub / 100)
|
||||||
|
|
||||||
return commission
|
return commission
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user