本文整理汇总了Python中stoqlib.domain.till.Till.add_debit_entry方法的典型用法代码示例。如果您正苦于以下问题:Python Till.add_debit_entry方法的具体用法?Python Till.add_debit_entry怎么用?Python Till.add_debit_entry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.domain.till.Till
的用法示例。
在下文中一共展示了Till.add_debit_entry方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testGetCashAmount
# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import add_debit_entry [as 别名]
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)
示例2: test_add_debit_entry
# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import add_debit_entry [as 别名]
def test_add_debit_entry(self):
till = Till(store=self.store, station=self.create_station())
till.open_till()
self.assertEqual(till.get_balance(), 0)
till.add_debit_entry(10)
self.assertEqual(till.get_balance(), -10)
示例3: test_get_balance
# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import add_debit_entry [as 别名]
def test_get_balance(self):
till = Till(store=self.store, station=self.create_station())
till.open_till()
old = till.get_balance()
till.add_credit_entry(currency(10), u"")
self.assertEqual(till.get_balance(), old + 10)
till.add_debit_entry(currency(5), u"")
self.assertEqual(till.get_balance(), old + 5)
示例4: test_get_debits_total
# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import add_debit_entry [as 别名]
def test_get_debits_total(self):
till = Till(store=self.store, station=self.create_station())
till.open_till()
old = till.get_debits_total()
till.add_debit_entry(currency(10), u"")
self.assertEqual(till.get_debits_total(), old - 10)
# This should not affect the debit
till.add_credit_entry(currency(5), u"")
self.assertEqual(till.get_debits_total(), old - 10)
示例5: testTillCloseMoreThanBalance
# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import add_debit_entry [as 别名]
def testTillCloseMoreThanBalance(self):
station = self.create_station()
till = Till(store=self.store, station=station)
till.open_till()
till.add_debit_entry(currency(20), u"")
self.assertRaises(ValueError, till.close_till)