当前位置: 首页>>代码示例>>Python>>正文


Python Till.open_till方法代码示例

本文整理汇总了Python中stoqlib.domain.till.Till.open_till方法的典型用法代码示例。如果您正苦于以下问题:Python Till.open_till方法的具体用法?Python Till.open_till怎么用?Python Till.open_till使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在stoqlib.domain.till.Till的用法示例。


在下文中一共展示了Till.open_till方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_add_debit_entry

# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import open_till [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)
开发者ID:rg3915,项目名称:stoq,代码行数:9,代码来源:test_till.py

示例2: _open_till

# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import open_till [as 别名]
    def _open_till(self, store):
        till = Till(store=store, station=api.get_current_station(store))
        till.open_till()

        TillOpenEvent.emit(till=till)
        self.assertEquals(till, Till.get_current(store))
        return till
开发者ID:pkaislan,项目名称:stoq,代码行数:9,代码来源:test_pos.py

示例3: before_start

# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import open_till [as 别名]
 def before_start(self, store):
     till = Till.get_current(store)
     if till is None:
         till = Till(store=store,
                     station=get_current_station(store))
         till.open_till()
         assert till == Till.get_current(store)
开发者ID:romaia,项目名称:stoq,代码行数:9,代码来源:saleimporter.py

示例4: testGetCashAmount

# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import open_till [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)
开发者ID:leandrorchaves,项目名称:stoq,代码行数:29,代码来源:test_till.py

示例5: test_add_entry_out_payment

# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import open_till [as 别名]
    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)
开发者ID:rg3915,项目名称:stoq,代码行数:10,代码来源:test_till.py

示例6: test_till_open_other_station

# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import open_till [as 别名]
    def test_till_open_other_station(self):
        till = Till(station=self.create_station(), store=self.store)
        till.open_till()

        till = Till(station=get_current_station(self.store), store=self.store)
        till.open_till()

        self.assertEqual(Till.get_last_opened(self.store), till)
开发者ID:rg3915,项目名称:stoq,代码行数:10,代码来源:test_till.py

示例7: testTillOpenOnce

# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import open_till [as 别名]
    def testTillOpenOnce(self):
        station = get_current_station(self.store)
        till = Till(store=self.store, station=station)

        till.open_till()
        till.close_till()

        self.assertRaises(TillError, till.open_till)
开发者ID:leandrorchaves,项目名称:stoq,代码行数:10,代码来源:test_till.py

示例8: testTillClose

# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import open_till [as 别名]
 def testTillClose(self):
     station = self.create_station()
     till = Till(store=self.store, station=station)
     till.open_till()
     self.assertEqual(till.status, Till.STATUS_OPEN)
     till.close_till()
     self.assertEqual(till.status, Till.STATUS_CLOSED)
     self.assertRaises(TillError, till.close_till)
开发者ID:leandrorchaves,项目名称:stoq,代码行数:10,代码来源:test_till.py

示例9: test_needs_closing

# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import open_till [as 别名]
 def test_needs_closing(self):
     till = Till(station=self.create_station(), store=self.store)
     self.failIf(till.needs_closing())
     till.open_till()
     self.failIf(till.needs_closing())
     till.opening_date = localnow() - datetime.timedelta(1)
     self.failUnless(till.needs_closing())
     till.close_till()
     self.failIf(till.needs_closing())
开发者ID:rg3915,项目名称:stoq,代码行数:11,代码来源:test_till.py

示例10: testAddEntryInPayment

# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import open_till [as 别名]
    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)
开发者ID:leandrorchaves,项目名称:stoq,代码行数:11,代码来源:test_till.py

示例11: testGetCurrentTillClose

# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import open_till [as 别名]
    def testGetCurrentTillClose(self):
        station = get_current_station(self.store)
        self.assertEqual(Till.get_current(self.store), None)
        till = Till(store=self.store, station=station)
        till.open_till()

        self.assertEqual(Till.get_current(self.store), till)
        till.close_till()
        self.assertEqual(Till.get_current(self.store), None)
开发者ID:leandrorchaves,项目名称:stoq,代码行数:11,代码来源:test_till.py

示例12: test_get_balance

# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import open_till [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)
开发者ID:rg3915,项目名称:stoq,代码行数:11,代码来源:test_till.py

示例13: test_get_debits_total

# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import open_till [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)
开发者ID:rg3915,项目名称:stoq,代码行数:12,代码来源:test_till.py

示例14: test_till_history_report

# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import open_till [as 别名]
    def test_till_history_report(self):
        from stoqlib.gui.dialogs.tillhistory import TillHistoryDialog

        dialog = TillHistoryDialog(self.store)

        till = Till(station=get_current_station(self.store), store=self.store)
        till.open_till()

        sale = self.create_sale()
        sellable = self.create_sellable()
        sale.add_sellable(sellable, price=100)
        method = PaymentMethod.get_by_name(self.store, u"bill")
        payment = method.create_payment(Payment.TYPE_IN, sale.group, sale.branch, Decimal(100))
        TillEntry(
            value=25,
            identifier=20,
            description=u"Cash In",
            payment=None,
            till=till,
            branch=till.station.branch,
            date=datetime.date(2007, 1, 1),
            store=self.store,
        )
        TillEntry(
            value=-5,
            identifier=21,
            description=u"Cash Out",
            payment=None,
            till=till,
            branch=till.station.branch,
            date=datetime.date(2007, 1, 1),
            store=self.store,
        )

        TillEntry(
            value=100,
            identifier=22,
            description=sellable.get_description(),
            payment=payment,
            till=till,
            branch=till.station.branch,
            date=datetime.date(2007, 1, 1),
            store=self.store,
        )
        till_entry = list(self.store.find(TillEntry, till=till))
        today = datetime.date.today().strftime("%x")
        for item in till_entry:
            if today in item.description:
                date = datetime.date(2007, 1, 1).strftime("%x")
                item.description = item.description.replace(today, date)

            item.date = datetime.date(2007, 1, 1)
            dialog.results.append(item)

        self._diff_expected(TillHistoryReport, "till-history-report", dialog.results, list(dialog.results))
开发者ID:rg3915,项目名称:stoq,代码行数:57,代码来源:test_reporting.py

示例15: test_till_open_previously_not_closed

# 需要导入模块: from stoqlib.domain.till import Till [as 别名]
# 或者: from stoqlib.domain.till.Till import open_till [as 别名]
    def test_till_open_previously_not_closed(self):
        yesterday = localnow() - datetime.timedelta(1)

        # Open a till, set the opening_date to yesterday
        till = Till(station=get_current_station(self.store), store=self.store)
        till.open_till()
        till.opening_date = yesterday
        till.close_till()
        till.closing_date = None

        self.assertRaises(TillError, till.open_till)
开发者ID:rg3915,项目名称:stoq,代码行数:13,代码来源:test_till.py


注:本文中的stoqlib.domain.till.Till.open_till方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。