HimoolERP/apps/finance/models.py

85 lines
3.7 KiB
Python
Raw Normal View History

2021-11-04 23:49:56 +08:00
from extensions.models import *
2021-11-04 17:35:34 +08:00
2021-11-04 23:49:56 +08:00
2021-11-07 18:12:52 +08:00
class PaymentOrder(Model):
"""付款单据"""
2021-11-05 18:49:51 +08:00
2021-11-07 18:12:52 +08:00
number = CharField(max_length=32, verbose_name='编号')
supplier = ForeignKey('data.Supplier', on_delete=PROTECT, related_name='payment_orders', verbose_name='供应商')
handler = ForeignKey('system.User', on_delete=PROTECT, related_name='payment_orders', verbose_name='经手人')
handle_time = DateTimeField(verbose_name='处理时间')
remark = CharField(max_length=256, null=True, blank=True, verbose_name='备注')
total_amount = AmountField(null=True, verbose_name='总金额')
discount_amount = AmountField(default=0, verbose_name='优惠金额')
payment_amount = AmountField(null=True, verbose_name='实付金额')
is_void = BooleanField(default=False, verbose_name='作废状态')
creator = ForeignKey('system.User', on_delete=PROTECT,
related_name='created_payment_orders', verbose_name='创建人')
create_time = DateTimeField(auto_now_add=True, verbose_name='创建时间')
team = ForeignKey('system.Team', on_delete=CASCADE, related_name='payment_orders')
2021-11-05 18:49:51 +08:00
2021-11-07 18:12:52 +08:00
class Meta:
unique_together = [('number', 'team')]
class PaymentAccount(Model):
"""付款账户"""
payment_order = ForeignKey('finance.PaymentOrder', on_delete=CASCADE,
related_name='payment_accounts', verbose_name='付款单据')
account = ForeignKey('data.Account', on_delete=PROTECT, related_name='payment_accounts', verbose_name='结算账户')
payment_amount = AmountField(verbose_name='付款金额')
is_void = BooleanField(default=False, verbose_name='作废状态')
team = ForeignKey('system.Team', on_delete=CASCADE, related_name='payment_accounts')
class Meta:
unique_together = [('patment_order', 'account')]
class CollectionOrder(Model):
"""收款单据"""
number = CharField(max_length=32, verbose_name='编号')
client = ForeignKey('data.Client', on_delete=PROTECT, related_name='collection_orders', verbose_name='客户')
handler = ForeignKey('system.User', on_delete=PROTECT, related_name='collection_orders', verbose_name='经手人')
handle_time = DateTimeField(verbose_name='处理时间')
remark = CharField(max_length=256, null=True, blank=True, verbose_name='备注')
total_amount = AmountField(null=True, verbose_name='总金额')
discount_amount = AmountField(default=0, verbose_name='优惠金额')
collection_amount = AmountField(null=True, verbose_name='实收金额')
is_void = BooleanField(default=False, verbose_name='作废状态')
creator = ForeignKey('system.User', on_delete=PROTECT,
related_name='created_collection_orders', verbose_name='创建人')
create_time = DateTimeField(auto_now_add=True, verbose_name='创建时间')
team = ForeignKey('system.Team', on_delete=CASCADE, related_name='collection_orders')
class Meta:
unique_together = [('number', 'team')]
class CollectionAccount(Model):
"""收款账户"""
collection_order = ForeignKey('finance.CollectionOrder', on_delete=CASCADE,
related_name='collection_accounts', verbose_name='收款单据')
account = ForeignKey('data.Account', on_delete=PROTECT, related_name='collection_accounts', verbose_name='结算账户')
collection_amount = AmountField(verbose_name='付款金额')
is_void = BooleanField(default=False, verbose_name='作废状态')
team = ForeignKey('system.Team', on_delete=CASCADE, related_name='collection_accounts')
class Meta:
unique_together = [('collection_order', 'account')]
2021-11-05 18:49:51 +08:00
class ChargeRecord(Model):
"""收支记录"""
2021-11-06 00:55:40 +08:00
class AccountTransferRecord(Model):
"""结算账户转账记录"""
2021-11-04 23:49:56 +08:00
__all__ = [
]