Fix ordering in items and fix qute to accept value more than remaining value.
This commit is contained in:
parent
8bc2bdef5f
commit
9cadf4eed5
3 changed files with 5 additions and 5 deletions
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
|
|
@ -147,8 +147,8 @@ class Quote(NameSlugModel):
|
||||||
"""مبلغ باقیمانده بر اساس پرداختها"""
|
"""مبلغ باقیمانده بر اساس پرداختها"""
|
||||||
paid = self.get_paid_amount()
|
paid = self.get_paid_amount()
|
||||||
remaining = self.final_amount - paid
|
remaining = self.final_amount - paid
|
||||||
if remaining < 0:
|
# if remaining < 0:
|
||||||
remaining = Decimal('0')
|
# remaining = Decimal('0')
|
||||||
return remaining
|
return remaining
|
||||||
|
|
||||||
def get_vat_amount(self) -> Decimal:
|
def get_vat_amount(self) -> Decimal:
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ def quote_step(request, instance_id, step_id):
|
||||||
return redirect('processes:request_list')
|
return redirect('processes:request_list')
|
||||||
|
|
||||||
# دریافت آیتمها
|
# دریافت آیتمها
|
||||||
items = Item.objects.filter(is_active=True, is_special=False, is_deleted=False).order_by('name')
|
items = Item.objects.filter(is_active=True, is_special=False, is_deleted=False).order_by('-is_default_in_quotes')
|
||||||
existing_quote = Quote.objects.filter(process_instance=instance).first()
|
existing_quote = Quote.objects.filter(process_instance=instance).first()
|
||||||
existing_quote_items = {}
|
existing_quote_items = {}
|
||||||
if existing_quote:
|
if existing_quote:
|
||||||
|
|
@ -556,8 +556,8 @@ def add_quote_payment(request, instance_id, step_id):
|
||||||
except InvalidOperation:
|
except InvalidOperation:
|
||||||
return JsonResponse({'success': False, 'message': 'مبلغ نامعتبر است'})
|
return JsonResponse({'success': False, 'message': 'مبلغ نامعتبر است'})
|
||||||
remaining = quote.get_remaining_amount()
|
remaining = quote.get_remaining_amount()
|
||||||
if amount_dec > remaining:
|
# if amount_dec > remaining:
|
||||||
return JsonResponse({'success': False, 'message': 'مبلغ فیش بیشتر از مانده پیشفاکتور است'})
|
# return JsonResponse({'success': False, 'message': 'مبلغ فیش بیشتر از مانده پیشفاکتور است'})
|
||||||
|
|
||||||
Payment.objects.create(
|
Payment.objects.create(
|
||||||
invoice=invoice,
|
invoice=invoice,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue