forked from erp-dev/erp
feat: new module for daily settlement
This commit is contained in:
49
settlement/models.py
Normal file
49
settlement/models.py
Normal file
@@ -0,0 +1,49 @@
|
||||
"""日结模块数据模型"""
|
||||
from django.db import models
|
||||
from flower.common import ModelBase
|
||||
|
||||
|
||||
class NotificationChannelEnum(models.TextChoices):
|
||||
"""通知渠道枚举"""
|
||||
WECOM = 'wecom', '企业微信'
|
||||
NONE = 'none', '不通知'
|
||||
|
||||
|
||||
class SettlementModuleEnum(models.TextChoices):
|
||||
"""日结模块枚举"""
|
||||
PLATE_ORDER = 'plate_order', '开版订单'
|
||||
PRINTING_ORDER = 'printing_order', '生产订单'
|
||||
|
||||
|
||||
class DailySettlementConfig(ModelBase):
|
||||
"""日结配置 - 每个商户一条记录(可选)"""
|
||||
id = models.BigAutoField(primary_key=True)
|
||||
merchant = models.OneToOneField(
|
||||
'basic_info.Merchant',
|
||||
on_delete=models.CASCADE,
|
||||
related_name='settlement_config',
|
||||
verbose_name='所属商户'
|
||||
)
|
||||
|
||||
# 统计模块配置(JSON数组,存储枚举值)
|
||||
settlement_modules = models.JSONField(
|
||||
default=list,
|
||||
verbose_name='统计模块',
|
||||
help_text='例如: ["plate_order", "printing_order"]'
|
||||
)
|
||||
|
||||
# 通知配置
|
||||
notification_enabled = models.BooleanField(default=False, verbose_name='启用通知')
|
||||
notification_channel = models.CharField(
|
||||
max_length=20,
|
||||
choices=NotificationChannelEnum.choices,
|
||||
default=NotificationChannelEnum.NONE,
|
||||
verbose_name='通知渠道'
|
||||
)
|
||||
|
||||
# 其他配置
|
||||
description = models.TextField(blank=True, null=True, verbose_name='备注')
|
||||
|
||||
class Meta:
|
||||
verbose_name = '日结配置'
|
||||
verbose_name_plural = '日结配置'
|
||||
Reference in New Issue
Block a user