+ Recursive search of suitable commission price & delivery price
This commit is contained in:
parent
86a86e79f3
commit
5b0d0d205b
|
|
@ -85,10 +85,17 @@ class Category(MPTTModel):
|
|||
@property
|
||||
def delivery_price(self):
|
||||
if not self.delivery_price_CN_RU and self.parent_id:
|
||||
return self.parent.delivery_price_CN_RU
|
||||
return self.parent.delivery_price
|
||||
else:
|
||||
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):
|
||||
pass
|
||||
|
|
@ -474,7 +481,7 @@ class Checklist(models.Model):
|
|||
|
||||
if self.category_id:
|
||||
# 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)
|
||||
|
||||
return commission
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user