add scope to filter data
This commit is contained in:
parent
394546dc67
commit
e9dec3292c
13 changed files with 386 additions and 36 deletions
|
@ -11,6 +11,7 @@ from .models import ContractTemplate, ContractInstance
|
|||
from invoices.models import Invoice, Quote
|
||||
from _helpers.utils import jalali_converter2
|
||||
from django.http import JsonResponse
|
||||
from processes.utils import get_scoped_instance_or_404
|
||||
|
||||
|
||||
def build_contract_context(instance: ProcessInstance) -> dict:
|
||||
|
@ -52,7 +53,7 @@ def build_contract_context(instance: ProcessInstance) -> dict:
|
|||
|
||||
@login_required
|
||||
def contract_step(request, instance_id, step_id):
|
||||
instance = get_object_or_404(ProcessInstance, id=instance_id)
|
||||
instance = get_scoped_instance_or_404(request, instance_id)
|
||||
# Resolve step navigation
|
||||
step = get_object_or_404(instance.process.steps, id=step_id)
|
||||
previous_step = instance.process.steps.filter(order__lt=step.order).last()
|
||||
|
@ -117,7 +118,7 @@ def contract_step(request, instance_id, step_id):
|
|||
|
||||
@login_required
|
||||
def contract_print(request, instance_id):
|
||||
instance = get_object_or_404(ProcessInstance, id=instance_id)
|
||||
instance = get_scoped_instance_or_404(request, instance_id)
|
||||
contract = get_object_or_404(ContractInstance, process_instance=instance)
|
||||
return render(request, 'contracts/contract_print.html', {
|
||||
'instance': instance,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue