fix force approve and vat show
This commit is contained in:
parent
65cc48769d
commit
169a9bd624
10 changed files with 133 additions and 5 deletions
|
|
@ -151,6 +151,15 @@ class Quote(NameSlugModel):
|
|||
remaining = Decimal('0')
|
||||
return remaining
|
||||
|
||||
def get_vat_amount(self) -> Decimal:
|
||||
"""محاسبه مبلغ مالیات به صورت جداگانه بر اساس VAT_RATE."""
|
||||
base_amount = (self.total_amount or Decimal('0')) - (self.discount_amount or Decimal('0'))
|
||||
try:
|
||||
vat_rate = Decimal(str(getattr(settings, 'VAT_RATE', 0)))
|
||||
except Exception:
|
||||
vat_rate = Decimal('0')
|
||||
return base_amount * vat_rate
|
||||
|
||||
class QuoteItem(BaseModel):
|
||||
"""مدل آیتمهای پیشفاکتور"""
|
||||
quote = models.ForeignKey(Quote, on_delete=models.CASCADE, related_name='items', verbose_name="پیشفاکتور")
|
||||
|
|
@ -291,6 +300,15 @@ class Invoice(NameSlugModel):
|
|||
remaining = self.final_amount - paid
|
||||
return remaining
|
||||
|
||||
def get_vat_amount(self) -> Decimal:
|
||||
"""محاسبه مبلغ مالیات به صورت جداگانه بر اساس VAT_RATE."""
|
||||
base_amount = (self.total_amount or Decimal('0')) - (self.discount_amount or Decimal('0'))
|
||||
try:
|
||||
vat_rate = Decimal(str(getattr(settings, 'VAT_RATE', 0)))
|
||||
except Exception:
|
||||
vat_rate = Decimal('0')
|
||||
return base_amount * vat_rate
|
||||
|
||||
|
||||
def get_status_display_with_color(self):
|
||||
"""نمایش وضعیت با رنگ"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue