feat: create a correct reconciliation jar.

This commit is contained in:
Mono Mono 2024-07-27 13:32:31 -05:00
parent 675b4f059f
commit 09f734f5cb
2 changed files with 5 additions and 2 deletions

View File

@ -52,7 +52,7 @@ class TestBilling(TestCase):
reconciliation_jar.add_payments(jar_summary.payments)
with self.assertRaises(ValidationError):
reconciliation_jar.clean()
reconciliation_jar.manual_clean()
def test_validate_reconciliation_jar_with_cash_float(self):
cash_payment1, cash_payment2 = self._create_two_cash_payments()
@ -69,6 +69,7 @@ class TestBilling(TestCase):
reconciliation_jar.add_payments(jar_summary.payments)
reconciliation_jar.clean()
reconciliation_jar.save()
reconciliation_jar.manual_clean()
self.assertTrue(reconciliation_jar.is_valid)
def _create_two_cash_payments(self):

View File

@ -1,7 +1,7 @@
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
#from django.template import loader
from django.template import loader
from django.core.exceptions import ValidationError
from .models import Sale, Product, ProductCategory, Payment
@ -95,9 +95,11 @@ def reconciliate_jar(request):
{'summary': summary, 'form': form}
)
def reconciliations(request):
return HttpResponse('<h1>Reconciliaciones</h1>')
def _categories_from_csv_string(categories_string, separator="&"):
categories = categories_string.split(separator)
clean_categories = [c.strip() for c in categories]