Exemple #1
0
    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()
Exemple #2
0
    def on_confirm(self):
        till = self.model.till
        # Using api.get_default_store instead of self.store
        # or it will return self.model.till
        last_opened = Till.get_last_opened(
            api.get_default_store(),
            api.get_current_station(api.get_default_store()))
        if (last_opened and last_opened.opening_date.date()
                == till.opening_date.date()):
            warning(_("A till was opened earlier this day."))
            self.retval = False
            return

        try:
            TillOpenEvent.emit(till=till)
        except (TillError, DeviceError) as e:
            warning(str(e))
            self.retval = False
            return

        value = self.proxy.model.value
        if value:
            TillAddCashEvent.emit(till=till, value=value)
            till_entry = till.add_credit_entry(value,
                                               _(u'Initial Cash amount'))
            _create_transaction(self.store, till_entry)
Exemple #3
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'),
        ])
Exemple #4
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'),
        ])
Exemple #5
0
 def on_confirm(self):
     till = self.model.till
     assert till
     try:
         TillAddCashEvent.emit(till=till, value=self.model.value)
     except (TillError, DeviceError, DriverError), e:
         warning(str(e))
         self.retval = False
         return
Exemple #6
0
    def test_confirm(self, warning):
        editor = CashInEditor(self.store)
        self.assertNotSensitive(editor.main_dialog, ['ok_button'])
        editor.cash_slave.proxy.update('value', currency(10))
        self.assertSensitive(editor.main_dialog, ['ok_button'])

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

        TillAddCashEvent.disconnect(_till_event)
        editor.confirm()
        self.assertEqual(editor.retval, editor.model)
    def testConfirm(self, warning):
        editor = CashInEditor(self.store)
        self.assertNotSensitive(editor.main_dialog, ['ok_button'])
        editor.cash_slave.proxy.update('value', currency(10))
        self.assertSensitive(editor.main_dialog, ['ok_button'])

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

        TillAddCashEvent.disconnect(_till_event)
        editor.confirm()
        self.assertEqual(editor.retval, editor.model)
Exemple #8
0
    def on_confirm(self):
        till = self.model.till
        assert till
        try:
            TillAddCashEvent.emit(till=till, value=self.model.value)
        except (TillError, DeviceError, DriverError) as e:
            warning(str(e))
            self.retval = False
            return

        till_entry = till.add_credit_entry(self.model.value, (_(u"Cash in: %s") % (self.reason.get_text(),)))

        TillAddTillEntryEvent.emit(till_entry, self.store)
        _create_transaction(self.store, till_entry)
Exemple #9
0
    def on_confirm(self):
        till = self.model.till
        assert till
        try:
            TillAddCashEvent.emit(till=till, value=self.model.value)
        except (TillError, DeviceError, DriverError) as e:
            warning(str(e))
            self.retval = False
            return

        till_entry = till.add_credit_entry(
            self.model.value,
            (_(u'Cash in: %s') % (self.reason.get_text(), )))

        TillAddTillEntryEvent.emit(till_entry, self.store)
        _create_transaction(self.store, till_entry)
Exemple #10
0
 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)
Exemple #11
0
 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)
Exemple #12
0
    def on_confirm(self):
        till = self.model.till
        # Using api.get_default_store instead of self.store
        # or it will return self.model.till
        last_opened = Till.get_last_opened(api.get_default_store())
        if last_opened and last_opened.opening_date.date() == till.opening_date.date():
            warning(_("A till was opened earlier this day."))
            self.retval = False
            return

        try:
            TillOpenEvent.emit(till=till)
        except (TillError, DeviceError) as e:
            warning(str(e))
            self.retval = False
            return

        value = self.proxy.model.value
        if value:
            TillAddCashEvent.emit(till=till, value=value)
            till_entry = till.add_credit_entry(value, _(u"Initial Cash amount"))
            _create_transaction(self.store, till_entry)