def testGetCashAmount(self): till = Till(store=self.store, station=self.create_station()) till.open_till() old = till.get_cash_amount() # money operations till.add_credit_entry(currency(10), u"") self.assertEqual(till.get_cash_amount(), old + 10) till.add_debit_entry(currency(5), u"") self.assertEqual(till.get_cash_amount(), old + 5) # non-money operations payment1 = self._create_inpayment() till.add_entry(payment1) self.assertEqual(till.get_cash_amount(), old + 5) payment2 = self._create_outpayment() till.add_entry(payment2) self.assertEqual(till.get_cash_amount(), old + 5) # money payment method operation payment = self.create_payment() payment.due_date = till.opening_date payment.till = till payment.set_pending() TillEntry(description=u'test', value=payment.value, till=till, branch=till.station.branch, payment=payment, store=self.store) payment.pay() self.assertEqual(till.get_cash_amount(), old + 5 + payment.value)
def test_get_cash_amount(self): till = Till(store=self.store, station=self.create_station()) till.open_till() old = till.get_cash_amount() # money operations till.add_credit_entry(currency(10), u"") self.assertEqual(till.get_cash_amount(), old + 10) till.add_debit_entry(currency(5), u"") self.assertEqual(till.get_cash_amount(), old + 5) # non-money operations payment1 = self._create_inpayment() till.add_entry(payment1) self.assertEqual(till.get_cash_amount(), old + 5) payment2 = self._create_outpayment() till.add_entry(payment2) self.assertEqual(till.get_cash_amount(), old + 5) # money payment method operation payment = self.create_payment() payment.due_date = till.opening_date payment.set_pending() TillEntry(description=u'test', value=payment.value, till=till, branch=till.station.branch, payment=payment, store=self.store) payment.pay() self.assertEqual(till.get_cash_amount(), old + 5 + payment.value)
def test_add_entry_out_payment(self): till = Till(store=self.store, station=self.create_station()) till.open_till() payment = self._create_outpayment() self.assertEqual(till.get_balance(), 0) till.add_entry(payment) self.assertEqual(till.get_balance(), -10)
def testAddEntryInPayment(self): till = Till(store=self.store, station=self.create_station()) till.open_till() payment = self._create_inpayment() self.assertEqual(till.get_balance(), 0) till.add_entry(payment) self.assertEqual(till.get_balance(), 10)
def test_add_entry_in_payment(self): till = Till(store=self.store, branch=self.current_branch, station=self.create_station()) till.open_till(self.current_user) payment = self._create_inpayment() self.assertEqual(till.get_balance(), 0) till.add_entry(payment) self.assertEqual(till.get_balance(), 10)