#69 feat(ReconciliationJar): link purchases with other payment methods.
This commit is contained in:
@@ -165,6 +165,38 @@ class TestJarReconcliation(TestCase):
|
||||
purchases = Sale.objects.filter(reconciliation_id=content['id'])
|
||||
self.assertEqual(len(purchases), 2)
|
||||
|
||||
def test_create_reconciliation_with_purchases_and_other_totals(self):
|
||||
url = '/don_confiao/reconciliate_jar'
|
||||
total_purchases = (11 * 72500) + (27 * 72500)
|
||||
data = {
|
||||
'date_time': '2024-12-02T21:07',
|
||||
'reconcilier': 'carlos',
|
||||
'total_cash_purchases': total_purchases,
|
||||
'cash_taken': total_purchases,
|
||||
'cash_discrepancy': 0,
|
||||
'cash_purchases': [
|
||||
self.purchase.id,
|
||||
self.purchase2.id,
|
||||
],
|
||||
'other_totals': {
|
||||
'Confiar': {
|
||||
'total': (47 * 72500) + 1,
|
||||
'purchases': [self.purchase4.id],
|
||||
},
|
||||
},
|
||||
}
|
||||
response = self.client.post(url, data=json.dumps(data).encode('utf-8'),
|
||||
content_type='application/json')
|
||||
|
||||
rawContent = response.content.decode('utf-8')
|
||||
content = json.loads(rawContent)
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn('id', content)
|
||||
|
||||
purchases = Sale.objects.filter(reconciliation_id=content['id'])
|
||||
self.assertEqual(len(purchases), 3)
|
||||
|
||||
def _create_simple_reconciliation(self):
|
||||
reconciliation = ReconciliationJar()
|
||||
reconciliation.date_time = "2024-07-30"
|
||||
|
||||
Reference in New Issue
Block a user