class Log(models.Model): id = UUIDField(primary_key=True, auto=True) operation = models.CharField(max_length=100) time_gen = models.DateTimeField(auto_now_add=True) class Meta: ordering = ['time_gen']
class CardTimesChange(models.Model): id = UUIDField(primary_key=True, auto=True) ledger = models.ForeignKey('Ledger') card = models.ForeignKey('CardTimes', on_delete=models.PROTECT) times = models.IntegerField() class Meta: ordering = ['-ledger__time_gen']
class SubjectBranchChange(models.Model): id = UUIDField(primary_key=True, auto=True) ledger = models.ForeignKey('Ledger') subject_branch = models.ForeignKey('SubjectBranch') money = models.DecimalField(max_digits=19, decimal_places=6) class Meta: ordering = ['-ledger__time_gen']
class CardValueChange(models.Model): id = UUIDField(primary_key=True, auto=True) ledger = models.ForeignKey('Ledger') card = models.ForeignKey('CardValue', on_delete=models.PROTECT) money = models.DecimalField(max_digits=19, decimal_places=6) class Meta: ordering = ['-ledger__time_gen']
class MaxID(models.Model): id = UUIDField(primary_key=True, auto=True) company = models.OneToOneField('Company') branch_max_id = models.IntegerField() user_max_id = models.IntegerField() unit_max_id = models.IntegerField() product_max_id = models.IntegerField() bill_max_id = models.IntegerField()
class Product(models.Model): id = UUIDField(primary_key=True, auto=True) company = models.ForeignKey('Company') product_id = models.CharField(max_length=7, null=True) product_name = models.CharField(verbose_name='商品名称', max_length=50) class Meta: unique_together = (('company', 'product_name'), ) ordering = ['-product_id']
class Branch(models.Model): id = UUIDField(primary_key=True, auto=True) company = models.ForeignKey('Company') branch_id = models.CharField(max_length=3, null=True) branch_name = models.CharField(max_length=20, verbose_name='店铺') is_base = models.BooleanField() class Meta: unique_together = (('company', 'branch_name'), ) ordering = ['branch_id']
class Document(models.Model): id = UUIDField(primary_key=True, auto=True) title = models.CharField(max_length=32) description = models.CharField(max_length=128) keyword = models.ManyToManyField('Keyword', verbose_name="角色") content = models.TextField() time_gen = models.DateTimeField(auto_now_add=True, db_index=True) time_update = models.DateTimeField(auto_now=True) class Meta: ordering = ['-time_gen']
class User(models.Model): id = UUIDField(primary_key=True, auto=True) company = models.ForeignKey('Company') branch = models.ForeignKey('Branch') user_id = models.CharField(max_length=3, null=True) real_name = models.CharField(max_length=5, verbose_name="真实姓名") mobile = models.CharField(max_length=11, unique=True, verbose_name="手机号") password = models.CharField(max_length=40, verbose_name="密码") role = models.ManyToManyField(Role, verbose_name="角色") is_admin = models.BooleanField() class Meta: ordering = ['user_id']
class Bill(models.Model): STATUS_CHOICES = ( (0, '已删除'), (1, '新单据'), (5, '已审核'), (10, '已执行'), ) id = UUIDField(primary_key=True, auto=True) branch = models.ForeignKey('Branch', on_delete=models.PROTECT) bill_id = models.CharField(max_length=9, null=True, db_index=True) time_gen = models.DateTimeField(auto_now_add=True, db_index=True) time_update = models.DateTimeField(auto_now=True) status = models.IntegerField(choices=STATUS_CHOICES) class Meta: ordering = ['-bill_id']
class Unit(models.Model): """Unit Unit is one of the base class for client,supplier and employee """ id = UUIDField(primary_key=True, auto=True) company = models.ForeignKey('Company') unit_id = models.CharField(verbose_name='客户编号', max_length=7, null=True, db_index=True) unit_name = models.CharField(verbose_name='客户名称', max_length=10) mobile = models.CharField(verbose_name='手机', max_length=11, null=True) time_gen = models.DateTimeField(auto_now_add=True, verbose_name='创建时间') class Meta: unique_together = (('company', 'mobile'), ) ordering = ['-unit_id']
class Company(models.Model): id = UUIDField(primary_key=True, auto=True) company_name = models.CharField(max_length=30, verbose_name="公司名称") time_gen = models.DateTimeField(auto_now_add=True) time_expired = models.DateTimeField(null=False) service = models.ForeignKey('Service')
class Ledger(models.Model): id = UUIDField(primary_key=True, auto=True) bill = models.OneToOneField('Bill') time_gen = models.DateTimeField(db_index=True)
class SubjectBranch(models.Model): id = UUIDField(primary_key=True, auto=True) branch = models.ForeignKey('Branch') subject = models.ForeignKey('Subject') amount = models.DecimalField(max_digits=19, decimal_places=6)
class Card(KnowsChild): id = UUIDField(primary_key=True, auto=True) unit = models.ForeignKey('Unit') cardno = models.CharField(verbose_name='卡号', max_length=16) time_gen = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
class BillItemProduct(models.Model): id = UUIDField(primary_key=True, auto=True) bill = models.ForeignKey('Bill') product = models.ForeignKey('Product', on_delete=models.PROTECT) quantity = models.DecimalField(max_digits=19, decimal_places=6) price = models.DecimalField(max_digits=19, decimal_places=6)
class CompanySetting(models.Model): id = UUIDField(primary_key=True, auto=True) company = models.OneToOneField('Company') card_type = models.IntegerField()
class Keyword(models.Model): id = UUIDField(primary_key=True, auto=True) keyword_name = models.CharField(max_length=32)