pos client & quota limit organization blank
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from django.db import models
|
||||
from apps.core.models import BaseModel
|
||||
from apps.authentication.models import Organization
|
||||
from django.contrib.postgres.fields import ArrayField
|
||||
|
||||
|
||||
class ProviderCompany(BaseModel):
|
||||
@@ -111,4 +112,46 @@ class POSClient(BaseModel):
|
||||
|
||||
|
||||
class POSClientAttribute(BaseModel):
|
||||
pass
|
||||
client_type = models.CharField(max_length=25, choices=[
|
||||
('business', 'صنف'),
|
||||
('person', 'شخص آزاد'), # noqa
|
||||
('organization', 'سازمان') # noqa
|
||||
], null=True)
|
||||
key = models.CharField(max_length=100, null=True)
|
||||
label = models.CharField(max_length=255, null=True)
|
||||
field_type = models.CharField(max_length=20, choices=[
|
||||
('text', 'متن'),
|
||||
('number', 'عدد'),
|
||||
('date', 'تاریخ'), # noqa
|
||||
('choice', 'چند کزینه ای'), # noqa
|
||||
], null=True)
|
||||
required = models.BooleanField(default=False)
|
||||
choices = ArrayField(base_field=models.CharField(max_length=150), null=True)
|
||||
|
||||
def __str__(self):
|
||||
return f'attribute: {self.key}-{self.field_type}'
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
return super(POSClientAttribute, self).save(*args, **kwargs)
|
||||
|
||||
|
||||
class POSClientAttributeValue(BaseModel):
|
||||
client = models.ForeignKey(
|
||||
POSClient,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='attribute_values',
|
||||
null=True
|
||||
)
|
||||
attribute = models.ForeignKey(
|
||||
POSClientAttribute,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='attribute_values',
|
||||
null=True
|
||||
)
|
||||
value = models.TextField(null=True)
|
||||
|
||||
def __str__(self):
|
||||
return f'Client Attribute: {self.client.name}-{self.attribute.key}'
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
return super(POSClientAttributeValue, self).save(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user