本文整理汇总了Python中stoqlib.domain.till.Till.get_cash_amount方法的典型用法代码示例。如果您正苦于以下问题:Python Till.get_cash_amount方法的具体用法?Python Till.get_cash_amount怎么用?Python Till.get_cash_amount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.domain.till.Till
的用法示例。
在下文中一共展示了Till.get_cash_amount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testGetCashAmount
# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import get_cash_amount [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)