コード例 #1
0
    def __init__(self):
        self._ui = None
        self.default_store = get_default_store()
        self._printer_verified = False
        # Delay printer creation until we are accessing pos or till app. Other
        # applications should still be accessible without a printer
        self._printer = None

        SaleStatusChangedEvent.connect(self._on_SaleStatusChanged)
        ECFIsLastSaleEvent.connect(self._on_ECFIsLastSale)
        TillOpenEvent.connect(self._on_TillOpen)
        TillCloseEvent.connect(self._on_TillClose)
        TillAddCashEvent.connect(self._on_TillAddCash)
        TillAddTillEntryEvent.connect(self._on_AddTillEntry)
        TillRemoveCashEvent.connect(self._on_TillRemoveCash)
        StartApplicationEvent.connect(self._on_StartApplicationEvent)
        StopApplicationEvent.connect(self._on_StopApplicationEvent)
        CouponCreatedEvent.connect(self._on_CouponCreatedEvent)
        GerencialReportPrintEvent.connect(self._on_GerencialReportPrintEvent)
        GerencialReportCancelEvent.connect(self._on_GerencialReportCancelEvent)
        CheckECFStateEvent.connect(self._on_CheckECFStateEvent)
        HasPendingReduceZ.connect(self._on_HasPendingReduceZ)
        HasOpenCouponEvent.connect(self._on_HasOpenCouponEvent)

        self._till_summarize_action = gtk.Action('Summary', _('Summary'), None,
                                                 None)
        self._till_summarize_action.connect('activate',
                                            self._on_TillSummary__activate)

        add_bindings([
            ('plugin.ecf.read_memory', '<Primary>F9'),
            ('plugin.ecf.summarize', '<Primary>F11'),
        ])
コード例 #2
0
ファイル: ecfui.py プロジェクト: LeonamSilva/stoq
    def __init__(self):
        self._ui = None
        self.default_store = get_default_store()
        self._printer_verified = False
        # Delay printer creation until we are accessing pos or till app. Other
        # applications should still be accessible without a printer
        self._printer = None

        SaleStatusChangedEvent.connect(self._on_SaleStatusChanged)
        ECFIsLastSaleEvent.connect(self._on_ECFIsLastSale)
        TillOpenEvent.connect(self._on_TillOpen)
        TillCloseEvent.connect(self._on_TillClose)
        TillAddCashEvent.connect(self._on_TillAddCash)
        TillAddTillEntryEvent.connect(self._on_AddTillEntry)
        TillRemoveCashEvent.connect(self._on_TillRemoveCash)
        StartApplicationEvent.connect(self._on_StartApplicationEvent)
        StopApplicationEvent.connect(self._on_StopApplicationEvent)
        CouponCreatedEvent.connect(self._on_CouponCreatedEvent)
        GerencialReportPrintEvent.connect(self._on_GerencialReportPrintEvent)
        GerencialReportCancelEvent.connect(self._on_GerencialReportCancelEvent)
        CheckECFStateEvent.connect(self._on_CheckECFStateEvent)
        HasPendingReduceZ.connect(self._on_HasPendingReduceZ)
        HasOpenCouponEvent.connect(self._on_HasOpenCouponEvent)

        self._till_summarize_action = gtk.Action(
            'Summary', _('Summary'), None, None)
        self._till_summarize_action.connect(
            'activate', self._on_TillSummary__activate)

        add_bindings([
            ('plugin.ecf.read_memory', '<Primary>F9'),
            ('plugin.ecf.summarize', '<Primary>F11'),
        ])
コード例 #3
0
ファイル: tilleditor.py プロジェクト: romaia/stoq
    def on_confirm(self):
        till = self.model.till
        removed = abs(self.model.value)
        if removed:
            # We need to do this inside a new transaction, because if the
            # till closing fails further on, this still needs to be recorded
            # in the database
            store = api.new_store()
            t_till = store.fetch(till)
            TillRemoveCashEvent.emit(till=t_till, value=removed)

            reason = _('Amount removed from Till by %s') % (
                api.get_current_user(self.store).get_description(), )
            till_entry = t_till.add_debit_entry(removed, reason)

            # Financial transaction
            _create_transaction(store, till_entry)
            # DB transaction
            store.confirm(True)
            store.close()

        if self._close_ecf:
            try:
                retval = TillCloseEvent.emit(till=till,
                                             previous_day=self._previous_day)
            except (TillError, DeviceError), e:
                warning(str(e))
                return None

            # If the event was captured and its return value is False, then we
            # should not close the till.
            if retval is False:
                return False
コード例 #4
0
ファイル: tilleditor.py プロジェクト: romaia/stoq
 def on_confirm(self):
     value = abs(self.model.value)
     till = self.model.till
     assert till
     try:
         TillRemoveCashEvent.emit(till=till, value=value)
     except (TillError, DeviceError, DriverError), e:
         warning(str(e))
         self.retval = False
         return
コード例 #5
0
    def on_confirm(self):
        value = abs(self.model.value)
        till = self.model.till
        assert till
        try:
            TillRemoveCashEvent.emit(till=till, value=value)
        except (TillError, DeviceError, DriverError) as e:
            warning(str(e))
            self.retval = False
            return

        till_entry = till.add_debit_entry(value, (_(u"Cash out: %s") % (self.reason.get_text(),)))

        TillAddTillEntryEvent.emit(till_entry, self.store)
        _create_transaction(self.store, till_entry)
コード例 #6
0
ファイル: tilleditor.py プロジェクト: Felipebros/stoq
    def on_confirm(self):
        till = self.model.till
        value = abs(self.model.value)
        assert till
        try:
            TillRemoveCashEvent.emit(till=till, value=value)
        except (TillError, DeviceError, DriverError) as e:
            warning(str(e))
            self.retval = False
            return
        till_entry = till.add_debit_entry(
            value, (_(u'Cash advance paid to employee: %s') %
                    (self._get_employee_name(), )))

        TillAddTillEntryEvent.emit(till_entry, self.store)
        _create_transaction(self.store, till_entry)
コード例 #7
0
ファイル: tilleditor.py プロジェクト: EasyDevSolutions/stoq
    def on_confirm(self):
        till = self.model.till
        value = abs(self.model.value)
        assert till
        try:
            TillRemoveCashEvent.emit(till=till, value=value)
        except (TillError, DeviceError, DriverError) as e:
            warning(str(e))
            self.retval = False
            return
        till_entry = till.add_debit_entry(
            value, (_(u'Cash advance paid to employee: %s') % (
                    self._get_employee_name(), )))

        TillAddTillEntryEvent.emit(till_entry, self.store)
        _create_transaction(self.store, till_entry)
コード例 #8
0
ファイル: tilleditor.py プロジェクト: tmaxter/stoq
    def on_confirm(self):
        value = abs(self.model.value)
        till = self.model.till
        assert till
        try:
            TillRemoveCashEvent.emit(till=till, value=value)
        except (TillError, DeviceError, DriverError) as e:
            warning(str(e))
            self.retval = False
            return

        till_entry = till.add_debit_entry(
            value, (_(u'Cash out: %s') % (self.reason.get_text(), )))

        TillAddTillEntryEvent.emit(till_entry, self.store)
        _create_transaction(self.store, till_entry)
コード例 #9
0
ファイル: tilleditor.py プロジェクト: Felipebros/stoq
    def on_confirm(self):
        till = self.model.till
        removed = abs(self.model.value)
        if removed:
            # We need to do this inside a new transaction, because if the
            # till closing fails further on, this still needs to be recorded
            # in the database
            store = api.new_store()
            t_till = store.fetch(till)
            TillRemoveCashEvent.emit(till=t_till, value=removed)

            reason = _('Amount removed from Till by %s') % (
                api.get_current_user(self.store).get_description(), )
            till_entry = t_till.add_debit_entry(removed, reason)

            # Financial transaction
            _create_transaction(store, till_entry)

            # DB transaction
            store.confirm(True)
            store.close()

        if self._close_ecf:
            try:
                retval = TillCloseEvent.emit(till=till,
                                             previous_day=self._previous_day)
            except (TillError, DeviceError) as e:
                warning(str(e))
                return None

            # If the event was captured and its return value is False, then we
            # should not close the till.
            if retval is False:
                return False

        if self._close_db:
            try:
                till.close_till(user=api.get_current_user(self.store),
                                observations=self.model.observations)
            except ValueError as err:
                warning(str(err))
                return

        # The callsite is responsible for interacting with
        # the fiscal printer
        return self.model
コード例 #10
0
ファイル: ecfui.py プロジェクト: hackedbellini/stoq
 def _setup_events(self):
     SaleStatusChangedEvent.connect(self._on_SaleStatusChanged)
     SaleAvoidCancelEvent.connect(self._on_SaleAvoidCancel)
     TillOpenEvent.connect(self._on_TillOpen)
     TillCloseEvent.connect(self._on_TillClose)
     TillAddCashEvent.connect(self._on_TillAddCash)
     TillAddTillEntryEvent.connect(self._on_AddTillEntry)
     TillRemoveCashEvent.connect(self._on_TillRemoveCash)
     StartApplicationEvent.connect(self._on_StartApplicationEvent)
     CouponCreatedEvent.connect(self._on_CouponCreatedEvent)
     GerencialReportPrintEvent.connect(self._on_GerencialReportPrintEvent)
     GerencialReportCancelEvent.connect(self._on_GerencialReportCancelEvent)
     CheckECFStateEvent.connect(self._on_CheckECFStateEvent)
     HasPendingReduceZ.connect(self._on_HasPendingReduceZ)
     HasOpenCouponEvent.connect(self._on_HasOpenCouponEvent)
     EditorCreateEvent.connect(self._on_EditorCreateEvent)
     ECFGetPrinterUserNumberEvent.connect(self._on_ECFGetPrinterUserNumberEvent)
コード例 #11
0
ファイル: ecfui.py プロジェクト: lucaslamounier/stoq
 def _setup_events(self):
     SaleStatusChangedEvent.connect(self._on_SaleStatusChanged)
     SaleAvoidCancelEvent.connect(self._on_SaleAvoidCancel)
     TillOpenEvent.connect(self._on_TillOpen)
     TillCloseEvent.connect(self._on_TillClose)
     TillAddCashEvent.connect(self._on_TillAddCash)
     TillAddTillEntryEvent.connect(self._on_AddTillEntry)
     TillRemoveCashEvent.connect(self._on_TillRemoveCash)
     StartApplicationEvent.connect(self._on_StartApplicationEvent)
     StopApplicationEvent.connect(self._on_StopApplicationEvent)
     CouponCreatedEvent.connect(self._on_CouponCreatedEvent)
     GerencialReportPrintEvent.connect(self._on_GerencialReportPrintEvent)
     GerencialReportCancelEvent.connect(self._on_GerencialReportCancelEvent)
     CheckECFStateEvent.connect(self._on_CheckECFStateEvent)
     HasPendingReduceZ.connect(self._on_HasPendingReduceZ)
     HasOpenCouponEvent.connect(self._on_HasOpenCouponEvent)
     EditorCreateEvent.connect(self._on_EditorCreateEvent)
コード例 #12
0
ファイル: test_tilleditor.py プロジェクト: rg3915/stoq
    def test_confirm(self, warning):
        # Add some amount to till so it can be removed above
        p = self.create_payment(payment_type=Payment.TYPE_IN, value=currency(50))
        self.till.add_entry(p)

        editor = CashOutEditor(self.store)
        self.assertNotSensitive(editor.main_dialog, ["ok_button"])
        editor.cash_slave.proxy.update("value", currency(10))
        self.assertSensitive(editor.main_dialog, ["ok_button"])

        TillRemoveCashEvent.connect(_till_event)
        editor.confirm()
        self.assertEqual(editor.retval, False)
        warning.assert_called_once_with("ERROR")

        TillRemoveCashEvent.disconnect(_till_event)
        editor.confirm()
        self.assertEqual(editor.retval, editor.model)
コード例 #13
0
ファイル: test_tilleditor.py プロジェクト: rosalin/stoq
    def test_confirm(self, warning):
        # Add some amount to till so it can be removed above
        p = self.create_payment(payment_type=Payment.TYPE_IN,
                                value=currency(50))
        self.till.add_entry(p)

        editor = CashOutEditor(self.store)
        self.assertNotSensitive(editor.main_dialog, ['ok_button'])
        editor.cash_slave.proxy.update('value', currency(10))
        self.assertSensitive(editor.main_dialog, ['ok_button'])

        TillRemoveCashEvent.connect(_till_event)
        editor.confirm()
        self.assertEqual(editor.retval, False)
        warning.assert_called_once_with("ERROR")

        TillRemoveCashEvent.disconnect(_till_event)
        editor.confirm()
        self.assertEqual(editor.retval, editor.model)