Исправление конфликта сигналов при отмене трансформации
Исправлена проблема, когда при отмене проведенной трансформации оба сигнала выполнялись последовательно:
- rollback_transformation_on_cancel возвращал резервы в 'reserved'
- release_reservations_on_draft_cancel ошибочно освобождал их в 'released'
Изменена проверка в release_reservations_on_draft_cancel: вместо проверки наличия партий Output (которые уже удалены) теперь проверяется статус резервов ('converted_to_transformation') или наличие поля converted_at, что работает независимо от порядка выполнения сигналов.
This commit is contained in:
@@ -65,6 +65,18 @@ class TransformationDetailView(LoginRequiredMixin, DetailView):
|
||||
from products.models import ProductCategory, ProductTag
|
||||
context['categories'] = ProductCategory.objects.filter(is_active=True).order_by('name')
|
||||
context['tags'] = ProductTag.objects.filter(is_active=True).order_by('name')
|
||||
|
||||
# Вычисляем суммы для подсказки
|
||||
from decimal import Decimal
|
||||
total_input = sum(
|
||||
trans_input.quantity for trans_input in self.object.inputs.all()
|
||||
)
|
||||
total_output = sum(
|
||||
trans_output.quantity for trans_output in self.object.outputs.all()
|
||||
)
|
||||
context['total_input_quantity'] = total_input
|
||||
context['total_output_quantity'] = total_output
|
||||
context['quantity_balance'] = total_input - total_output
|
||||
|
||||
return context
|
||||
|
||||
|
||||
Reference in New Issue
Block a user