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


Python till.Till类代码示例

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


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

示例1: _open_till

    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,代码行数:7,代码来源:test_pos.py

示例2: before_start

 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,代码行数:7,代码来源:saleimporter.py

示例3: testTillOpenOnce

    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,代码行数:8,代码来源:test_till.py

示例4: testTillClose

 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,代码行数:8,代码来源:test_till.py

示例5: test_needs_closing

 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,代码行数:9,代码来源:test_till.py

示例6: test_get_balance

    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,代码行数:9,代码来源:test_till.py

示例7: test_get_debits_total

    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,代码行数:10,代码来源:test_till.py

示例8: test_till_history_report

    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,代码行数:55,代码来源:test_reporting.py

示例9: on_Edit__activate

    def on_Edit__activate(self, action):
        try:
            Till.get_current(self.store)
        except TillError as e:
            warning(str(e))
            return

        store = api.new_store()
        views = self.results.get_selected_rows()
        sale = store.fetch(views[0].sale)
        retval = run_dialog(SalePaymentsEditor, self, store, sale)

        if store.confirm(retval):
            self.refresh()
        store.close()
开发者ID:EasyDevSolutions,项目名称:stoq,代码行数:15,代码来源:receivable.py

示例10: open_till

    def open_till(self):
        """Opens the till
        """
        try:
            current_till = Till.get_current(self.store)
        except TillError as e:
            warning(str(e))
            return False

        if current_till is not None:
            warning(_("You already have a till operation opened. "
                      "Close the current Till and open another one."))
            return False

        store = api.new_store()
        try:
            model = run_dialog(TillOpeningEditor, self._parent, store)
        except TillError as e:
            warning(str(e))
            model = None

        retval = store.confirm(model)
        store.close()
        if retval:
            self._till_status_changed(closed=False, blocked=False)
        return retval
开发者ID:Guillon88,项目名称:stoq,代码行数:26,代码来源:fiscalprinter.py

示例11: needs_closing

    def needs_closing(self):
        """Checks if the last opened till was closed and asks the
        user if he wants to close it

        :returns:
            - CLOSE_TILL_BOTH if both DB and ECF needs closing.
            - CLOSE_TILL_DB if only DB needs closing.
            - CLOSE_TILL_ECF if only ECF needs closing.
            - CLOSE_TILL_NONE if both ECF and DB are consistent (they may be
                  closed, or open for the current day)
        """
        ecf_needs_closing = HasPendingReduceZ.emit()

        last_till = Till.get_last(self.store)
        if last_till:
            db_needs_closing = last_till.needs_closing()
        else:
            db_needs_closing = False

        if db_needs_closing and ecf_needs_closing:
            return CLOSE_TILL_BOTH
        elif db_needs_closing and not ecf_needs_closing:
            return CLOSE_TILL_DB
        elif ecf_needs_closing and not db_needs_closing:
            return CLOSE_TILL_ECF
        else:
            return CLOSE_TILL_NONE
开发者ID:igorferreira,项目名称:stoq,代码行数:27,代码来源:fiscalprinter.py

示例12: create_sale

    def create_sale(self, id_=None, branch=None, client=None):
        from stoqlib.domain.sale import Sale
        from stoqlib.domain.till import Till

        till = Till.get_current(self.store)
        if till is None:
            till = self.create_till()
            till.open_till()
        salesperson = self.create_sales_person()
        group = self.create_payment_group()
        if client:
            group.payer = client.person

        sale = Sale(
            coupon_id=0,
            open_date=TransactionTimestamp(),
            salesperson=salesperson,
            branch=branch or get_current_branch(self.store),
            cfop=sysparam(self.store).DEFAULT_SALES_CFOP,
            group=group,
            client=client,
            store=self.store,
        )
        if id_:
            sale.id = id_
            sale.identifier = id_
        return sale
开发者ID:rosalin,项目名称:stoq,代码行数:27,代码来源:exampledata.py

示例13: _receive

    def _receive(self):
        with api.new_store() as store:
            till = Till.get_current(store)
            assert till

            in_payment = self.results.get_selected()
            payment = store.fetch(in_payment.payment)
            assert self._can_receive(payment)

            retval = run_dialog(SalePaymentConfirmSlave, self, store,
                                payments=[payment], show_till_info=False)
            if not retval:
                return

            try:
                TillAddCashEvent.emit(till=till, value=payment.value)
            except (TillError, DeviceError, DriverError) as e:
                warning(str(e))
                return

            till_entry = till.add_credit_entry(payment.value,
                                               _(u'Received payment: %s') % payment.description)

            TillAddTillEntryEvent.emit(till_entry, store)

        if store.committed:
            self.search.refresh()
开发者ID:hackedbellini,项目名称:stoq,代码行数:27,代码来源:paymentreceivingsearch.py

示例14: _cancel_last_document

    def _cancel_last_document(self):
        try:
            self._validate_printer()
        except DeviceError as e:
            warning(str(e))
            return

        store = new_store()
        last_doc = self._get_last_document(store)
        if not self._confirm_last_document_cancel(last_doc):
            store.close()
            return

        if last_doc.last_till_entry:
            self._cancel_last_till_entry(last_doc, store)
        elif last_doc.last_sale:
            # Verify till balance before cancel the last sale.
            till = Till.get_current(store)
            if last_doc.last_sale.total_amount > till.get_balance():
                warning(_("You do not have this value on till."))
                store.close()
                return
            cancelled = self._printer.cancel()
            if not cancelled:
                info(_("Cancelling sale failed, nothing to cancel"))
                store.close()
                return
            else:
                self._cancel_last_sale(last_doc, store)
        store.commit()
开发者ID:LeonamSilva,项目名称:stoq,代码行数:30,代码来源:ecfui.py

示例15: testSalesPersonReport

    def testSalesPersonReport(self):
        sysparam(self.store).SALE_PAY_COMMISSION_WHEN_CONFIRMED = 1
        salesperson = self.create_sales_person()
        product = self.create_product(price=100)
        sellable = product.sellable

        sale = self.create_sale()
        sale.salesperson = salesperson
        sale.add_sellable(sellable, quantity=1)

        self.create_storable(product, get_current_branch(self.store), stock=100)

        CommissionSource(sellable=sellable,
                         direct_value=Decimal(10),
                         installments_value=1,
                         store=self.store)

        sale.order()

        method = PaymentMethod.get_by_name(self.store, u'money')
        till = Till.get_last_opened(self.store)
        method.create_inpayment(sale.group, sale.branch,
                                sale.get_sale_subtotal(),
                                till=till)
        sale.confirm()
        sale.set_paid()

        salesperson_name = salesperson.person.name
        commissions = list(self.store.find(CommissionView))
        commissions[0].identifier = 1
        commissions[1].identifier = 139

        self._diff_expected(SalesPersonReport, 'sales-person-report', commissions,
                            salesperson_name)
开发者ID:romaia,项目名称:stoq,代码行数:34,代码来源:test_reporting.py


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