fix print and preview quote and add broker to req and complete company model.
This commit is contained in:
		
							parent
							
								
									5ce94214d5
								
							
						
					
					
						commit
						246a2c0759
					
				
					 19 changed files with 872 additions and 260 deletions
				
			
		| 
						 | 
				
			
			@ -15,6 +15,7 @@ from common.consts import UserRoles
 | 
			
		|||
from .models import Item, Quote, QuoteItem, Payment, Invoice
 | 
			
		||||
from installations.models import InstallationReport, InstallationItemChange
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@login_required
 | 
			
		||||
def quote_step(request, instance_id, step_id):
 | 
			
		||||
    """مرحله انتخاب اقلام و ساخت پیشفاکتور"""
 | 
			
		||||
| 
						 | 
				
			
			@ -62,6 +63,7 @@ def quote_step(request, instance_id, step_id):
 | 
			
		|||
        'is_broker': is_broker,
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@require_POST
 | 
			
		||||
@login_required
 | 
			
		||||
def create_quote(request, instance_id, step_id):
 | 
			
		||||
| 
						 | 
				
			
			@ -90,7 +92,7 @@ def create_quote(request, instance_id, step_id):
 | 
			
		|||
        except Exception:
 | 
			
		||||
            continue
 | 
			
		||||
 | 
			
		||||
    default_item_ids = set(Item.objects.filter(is_default_in_quotes=True, is_deleted=False).values_list('id', flat=True))
 | 
			
		||||
    default_item_ids = set(Item.objects.filter(is_default_in_quotes=True, is_deleted=False, is_special=False).values_list('id', flat=True))
 | 
			
		||||
    if default_item_ids:
 | 
			
		||||
        for default_id in default_item_ids:
 | 
			
		||||
            if default_id not in payload_by_id:
 | 
			
		||||
| 
						 | 
				
			
			@ -158,11 +160,12 @@ def create_quote(request, instance_id, step_id):
 | 
			
		|||
 | 
			
		||||
    return JsonResponse({'success': True, 'quote_id': quote.id, 'redirect': redirect_url})
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@login_required
 | 
			
		||||
def quote_preview_step(request, instance_id, step_id):
 | 
			
		||||
    """مرحله صدور پیشفاکتور - نمایش و تایید فاکتور"""
 | 
			
		||||
    instance = get_object_or_404(
 | 
			
		||||
        ProcessInstance.objects.select_related('process', 'well', 'requester', 'representative', 'representative__profile'),
 | 
			
		||||
        ProcessInstance.objects.select_related('process', 'well', 'requester', 'representative', 'representative__profile', 'broker', 'broker__company', 'broker__affairs', 'broker__affairs__county', 'broker__affairs__county__city'),
 | 
			
		||||
        id=instance_id
 | 
			
		||||
    )
 | 
			
		||||
    step = get_object_or_404(instance.process.steps, id=step_id)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue