free sale of inventory entry system deployment - add dhi state to rancher
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import string
|
||||
import random
|
||||
from apps.authentication.models import User, Organization
|
||||
from apps.product import models as product_models
|
||||
from apps.authentication.models import User
|
||||
from apps.pos_device.models import Device
|
||||
from apps.herd.models import Rancher
|
||||
from apps.core.models import BaseModel
|
||||
@@ -149,9 +149,44 @@ class InventoryQuotaSaleItem(BaseModel):
|
||||
weight = models.PositiveBigIntegerField(default=0)
|
||||
unit_price = models.PositiveBigIntegerField(default=0)
|
||||
total_price = models.PositiveBigIntegerField(default=0)
|
||||
is_extra = models.BooleanField(default=False)
|
||||
|
||||
def __str__(self):
|
||||
return f'Item {self.product} - {self.weight} Kg - {self.total_price}'
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
return super(InventoryQuotaSaleItem, self).save(*args, **kwargs)
|
||||
|
||||
|
||||
class ExtraSale(BaseModel):
|
||||
organization = models.ForeignKey(
|
||||
Organization,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='extra_sales',
|
||||
null=True
|
||||
)
|
||||
distribution = models.ForeignKey(
|
||||
product_models.QuotaDistribution,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='extra_sales',
|
||||
null=True
|
||||
)
|
||||
transaction = models.ForeignKey(
|
||||
InventoryQuotaSaleTransaction,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='transactions',
|
||||
null=True
|
||||
)
|
||||
sale_item = models.ForeignKey(
|
||||
InventoryQuotaSaleItem,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='sale_items',
|
||||
null=True
|
||||
)
|
||||
weight = models.IntegerField(default=0)
|
||||
|
||||
def __str__(self):
|
||||
return f'Extra Sale on {self.organization.name} - {self.distribution.distribution_id}'
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
return super(ExtraSale, self).save(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user