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
|
return sum(item.weight for item in self.items.all) # noqa
|
||||||
|
|
||||||
def __str__(self):
|
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):
|
def save(self, *args, **kwargs):
|
||||||
super(InventoryQuotaSaleTransaction, self).save(*args, **kwargs)
|
super(InventoryQuotaSaleTransaction, self).save(*args, **kwargs)
|
||||||
|
|||||||
@@ -137,10 +137,9 @@ class InventoryQuotaSaleTransactionSerializer(serializers.ModelSerializer):
|
|||||||
if transaction.transaction_status == 'success':
|
if transaction.transaction_status == 'success':
|
||||||
for item_data in items_data:
|
for item_data in items_data:
|
||||||
qs = warehouse_models.InventoryQuotaSaleItem.objects.filter(
|
qs = warehouse_models.InventoryQuotaSaleItem.objects.filter(
|
||||||
Q(transaction=transaction) & (
|
Q(free_product_id=item_data.get('free_product', None)),
|
||||||
Q(free_product_id=item_data.get('free_product', None)) |
|
Q(gov_product_id=item_data.get('gov_product', None)),
|
||||||
Q(gov_product_id=item_data.get('gov_product', None))
|
transaction=transaction,
|
||||||
)
|
|
||||||
).update(**item_data)
|
).update(**item_data)
|
||||||
return transaction
|
return transaction
|
||||||
|
|
||||||
@@ -172,10 +171,9 @@ class InventoryQuotaSaleTransactionSerializer(serializers.ModelSerializer):
|
|||||||
# items can change
|
# items can change
|
||||||
for item_data in items_data:
|
for item_data in items_data:
|
||||||
items = warehouse_models.InventoryQuotaSaleItem.objects.filter(
|
items = warehouse_models.InventoryQuotaSaleItem.objects.filter(
|
||||||
Q(transaction=transaction) & (
|
Q(free_product_id=item_data.get('free_product', None)),
|
||||||
Q(free_product_id=item_data.get('free_product', None)) |
|
Q(gov_product_id=item_data.get('gov_product', None)),
|
||||||
Q(gov_product_id=item_data.get('gov_product', None))
|
transaction=transaction,
|
||||||
)
|
|
||||||
)
|
)
|
||||||
items.update(**item_data)
|
items.update(**item_data)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user