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


Python runtime.get_current_station函数代码示例

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


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

示例1: test_till_open_previously_opened

    def test_till_open_previously_opened(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.add_credit_entry(currency(10), u"")
        till.close_till()
        till.closing_date = yesterday

        new_till = Till(station=get_current_station(self.store), store=self.store)
        self.failUnless(new_till._get_last_closed_till())
        new_till.open_till()
        self.assertEquals(new_till.initial_cash_amount, till.final_cash_amount)
开发者ID:rg3915,项目名称:stoq,代码行数:15,代码来源:test_till.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: _check_branch

    def _check_branch(self):
        from stoqlib.database.runtime import (get_default_store, new_store,
                                              get_current_station,
                                              set_current_branch_station)
        from stoqlib.domain.person import Company
        from stoqlib.lib.parameters import sysparam
        from stoqlib.lib.message import info

        default_store = get_default_store()

        compaines = default_store.find(Company)
        if (compaines.count() == 0 or
                not sysparam.has_object('MAIN_COMPANY')):
            from stoqlib.gui.base.dialogs import run_dialog
            from stoqlib.gui.dialogs.branchdialog import BranchDialog
            if self._ran_wizard:
                info(_("You need to register a company before start using Stoq"))
            else:
                info(_("Could not find a company. You'll need to register one "
                       "before start using Stoq"))
            store = new_store()
            person = run_dialog(BranchDialog, None, store)
            if not person:
                raise SystemExit
            branch = person.branch
            sysparam.set_object(store, 'MAIN_COMPANY', branch)
            current_station = get_current_station(store)
            if current_station is not None:
                current_station.branch = branch
            store.commit()
            store.close()

        set_current_branch_station(default_store, station_name=None)
开发者ID:hackedbellini,项目名称:stoq,代码行数:33,代码来源:shell.py

示例4: _update_te

    def _update_te(self):
        user = get_current_user(self.store)
        station = get_current_station(self.store)

        self.te_modified.te_time = TransactionTimestamp()
        self.te_modified.user_id = user and user.id
        self.te_modified.station_id = station and station.id
开发者ID:amaurihamasu,项目名称:stoq,代码行数:7,代码来源:domainv1.py

示例5: _get_interface

 def _get_interface(cls, iface):
     store = get_default_store()
     station = get_current_station(store)
     device = DeviceSettings.get_by_station_and_type(store, station, iface)
     if not device:
         return None
     return device.get_interface()
开发者ID:hackedbellini,项目名称:stoq,代码行数:7,代码来源:devicemanager.py

示例6: test_till_open_other_station

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

示例7: get_scale_settings

 def get_scale_settings(cls, store):
     """
     Get the scale device settings for the current station
     :param store: a store
     :returns: a :class:`DeviceSettings` object or None if there is none
     """
     station = get_current_station(store)
     return store.find(cls, station=station, type=cls.SCALE_DEVICE).one()
开发者ID:EasyDevSolutions,项目名称:stoq,代码行数:8,代码来源:devices.py

示例8: _update_te

    def _update_te(self):
        user = get_current_user(self.store)
        station = get_current_station(self.store)

        self.te.dirty = True
        self.te.te_time = StatementTimestamp()
        self.te.user_id = user and user.id
        self.te.station_id = station and station.id
开发者ID:Guillon88,项目名称:stoq,代码行数:8,代码来源:domainv2.py

示例9: 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

示例10: __init__

 def __init__(self, *args, **kwargs):
     if not kwargs.get('station_id', None) and not kwargs.get('station', None):
         # Use the station_id, since the object is not from the same store.
         kwargs['station_id'] = get_current_station().id
     if (not kwargs.get('branch_id', None) and not kwargs.get('branch', None)
             and type(self).__name__ != 'TransferOrder'):
         # Add a branch_id if None was provided
         kwargs['branch_id'] = get_current_branch().id
     super(IdentifiableDomain, self).__init__(*args, **kwargs)
开发者ID:hackedbellini,项目名称:stoq,代码行数:9,代码来源:base.py

示例11: testCreate

 def testCreate(self, select):
     # Station names change depending on the computer running the test. Make
     # sure only one station is in the list, and that the name is always de
     # same
     station = get_current_station(self.store)
     station.name = u'Test station'
     select.return_value = [station]
     editor = InvoicePrinterEditor(self.store)
     self.check_editor(editor, 'editor-invoiceprinter-create')
开发者ID:leandrorchaves,项目名称:stoq,代码行数:9,代码来源:test_invoiceprintereditor.py

示例12: __init__

    def __init__(self, store, model=None, visual_mode=False):
        BaseEditor.__init__(self, store, model, visual_mode)

        # do not let the user change the current station
        if model and get_current_station(store) == model:
            self.name.set_sensitive(False)
            self.is_active.set_sensitive(False)

        self.set_description(self.model.name)
开发者ID:romaia,项目名称:stoq,代码行数:9,代码来源:stationeditor.py

示例13: testGetCurrentTillClose

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

示例14: 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

示例15: _on_object_added

    def _on_object_added(self, obj_info):
        store = obj_info.get("store")
        store.block_implicit_flushes()
        user = get_current_user(store)
        station = get_current_station(store)
        store.unblock_implicit_flushes()

        self.te = TransactionEntry(store=store,
                                   te_time=StatementTimestamp(),
                                   user_id=user and user.id,
                                   station_id=station and station.id)
开发者ID:Guillon88,项目名称:stoq,代码行数:11,代码来源:domainv3.py


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