quotas information by product - change broker & attribute sale unit

This commit is contained in:
2025-07-08 14:19:35 +03:30
parent 90b090e848
commit be08aec2b9
6 changed files with 97 additions and 25 deletions

View File

@@ -144,15 +144,11 @@ class Attribute(BaseModel):
null=True
)
name = models.CharField(max_length=100, default='empty')
type_choices = (
('K', 'Per Kilo'),
('', ''),
)
type = models.CharField(
max_length=10,
choices=type_choices,
default='empty',
help_text='type of attribute like: calculate product by kilogram'
type = models.ForeignKey(
'SaleUnit',
on_delete=models.CASCADE,
related_name="attributes",
null=True
)
is_global = models.BooleanField(default=False)
@@ -194,10 +190,6 @@ class AttributeValue(BaseModel):
class Broker(BaseModel):
""" Broker for product """
CALCULATION_CHOICES = (
('K', 'Per Kilo'),
('', ''),
)
BROKER_TYPES = (
('public', 'PUBLIC'),
('exclusive', 'EXCLUSIVE')
@@ -215,10 +207,11 @@ class Broker(BaseModel):
related_name='product_organization',
null=True
)
calculation_strategy = models.CharField(
max_length=3,
choices=CALCULATION_CHOICES,
default='empty'
calculation_strategy = models.ForeignKey(
'SaleUnit',
on_delete=models.CASCADE,
related_name='brokers',
null=True
)
broker_type = models.CharField(choices=BROKER_TYPES, max_length=20, null=True)
required = models.BooleanField(default=False)
@@ -239,12 +232,7 @@ class SaleUnit(BaseModel):
related_name='sale_unit',
null=True
)
unit_choices = (
('10P', '10KG Package'),
('50P', '50KG Package'),
('', ''),
)
unit = models.CharField(max_length=10, choices=unit_choices, null=True)
unit = models.CharField(max_length=250, null=True)
variation_coefficient = models.IntegerField(default=0)
required = models.BooleanField(default=False)