You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
34 lines
1.0 KiB
# -*- coding: utf-8 -*-
|
|
from django.db import models
|
|
|
|
from .base_models import BaseInvoiceModel, BaseItemInvoiceModel
|
|
from .. import consts
|
|
|
|
|
|
class Invoice(BaseInvoiceModel):
|
|
"""Счет."""
|
|
UNPAID = 1
|
|
PARTLY_PAID = 2
|
|
PAID = 3
|
|
|
|
PAID_CHOICES = (
|
|
(UNPAID, u'Нет'),
|
|
(PARTLY_PAID, u'Частично'),
|
|
(PAID, u'Да'),
|
|
)
|
|
|
|
paid_status = models.PositiveSmallIntegerField(u'Оплачен?', choices=PAID_CHOICES, default=UNPAID)
|
|
closed_status = models.BooleanField(u'Закрыт?', choices=consts.BOOL_CHOICES, default=False)
|
|
|
|
class Meta(BaseInvoiceModel.Meta):
|
|
verbose_name = u'Счёт'
|
|
verbose_name_plural = u'Счета'
|
|
|
|
|
|
class InvoiceItem(BaseItemInvoiceModel):
|
|
"""Табличная часть счета."""
|
|
parent = models.ForeignKey(Invoice, related_name='invoice_items')
|
|
|
|
class Meta(BaseItemInvoiceModel.Meta):
|
|
verbose_name = u'Табл. часть счета'
|
|
verbose_name_plural = u'Табл. части счетов'
|
|
|