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.6 KiB
34 lines
1.6 KiB
# -*- coding: utf-8 -*-
|
|
from django.db import models
|
|
|
|
from project.customer.models import Client
|
|
from .base_models import BaseInvoiceModel, BaseItemInvoiceModel
|
|
from .refs import Currency, Country, Measure
|
|
from .mixins import SignedStatusFieldMixin, InvoiceFieldMixin
|
|
|
|
|
|
class Faktura(BaseInvoiceModel, SignedStatusFieldMixin, InvoiceFieldMixin):
|
|
"""Счёт-фактура"""
|
|
doc_reason = models.CharField(u'Основание', max_length=256, blank=True, default='')
|
|
fixes = models.BooleanField(u'Изменения', default=False)
|
|
avance = models.BooleanField(u'аванс', default=False)
|
|
currency = models.ForeignKey(Currency, verbose_name=u'валюта', null=True)
|
|
sender = models.ForeignKey(Client, related_name='sender_fakturas', blank=True, null=True, verbose_name=u'Отправитель')
|
|
receiver = models.ForeignKey(Client, related_name='receiver_fakturas', blank=True, null=True, verbose_name=u'Получатель')
|
|
|
|
class Meta(BaseInvoiceModel.Meta):
|
|
verbose_name = u'Фактура'
|
|
verbose_name_plural = u'Фактуры'
|
|
app_label="docs"
|
|
|
|
|
|
class FakturaItem(BaseItemInvoiceModel):
|
|
"""Табличная часть фактуры"""
|
|
parent = models.ForeignKey(Faktura, related_name='faktura_items')
|
|
country = models.ForeignKey(Country, related_name='c_faktura_items')
|
|
measure = models.ForeignKey(Measure, related_name='m_faktura_items')
|
|
|
|
class Meta(BaseItemInvoiceModel.Meta):
|
|
verbose_name = u'Табл. часть фактуры'
|
|
verbose_name_plural = u'Табл. части фактур'
|
|
app_label="docs"
|
|
|