fix - update transaction bug in items
This commit is contained in:
@@ -166,7 +166,7 @@ class InventoryQuotaSaleTransaction(BaseModel):
|
||||
return sum(item.weight for item in self.items.all) # noqa
|
||||
|
||||
def __str__(self):
|
||||
return f"Inventory Sale: {self.transaction_id}-{self.quota_distribution.distribution_id}"
|
||||
return f"Inventory Sale: {self.transaction_id}"
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
super(InventoryQuotaSaleTransaction, self).save(*args, **kwargs)
|
||||
|
||||
@@ -137,10 +137,9 @@ class InventoryQuotaSaleTransactionSerializer(serializers.ModelSerializer):
|
||||
if transaction.transaction_status == 'success':
|
||||
for item_data in items_data:
|
||||
qs = warehouse_models.InventoryQuotaSaleItem.objects.filter(
|
||||
Q(transaction=transaction) & (
|
||||
Q(free_product_id=item_data.get('free_product', None)) |
|
||||
Q(gov_product_id=item_data.get('gov_product', None))
|
||||
)
|
||||
Q(free_product_id=item_data.get('free_product', None)),
|
||||
Q(gov_product_id=item_data.get('gov_product', None)),
|
||||
transaction=transaction,
|
||||
).update(**item_data)
|
||||
return transaction
|
||||
|
||||
@@ -172,10 +171,9 @@ class InventoryQuotaSaleTransactionSerializer(serializers.ModelSerializer):
|
||||
# items can change
|
||||
for item_data in items_data:
|
||||
items = warehouse_models.InventoryQuotaSaleItem.objects.filter(
|
||||
Q(transaction=transaction) & (
|
||||
Q(free_product_id=item_data.get('free_product', None)) |
|
||||
Q(gov_product_id=item_data.get('gov_product', None))
|
||||
)
|
||||
Q(free_product_id=item_data.get('free_product', None)),
|
||||
Q(gov_product_id=item_data.get('gov_product', None)),
|
||||
transaction=transaction,
|
||||
)
|
||||
items.update(**item_data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user