Exemplo n.º 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'),
        ])
Exemplo n.º 2
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'),
        ])
Exemplo n.º 3
0
    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
Exemplo n.º 4
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)
Exemplo n.º 5
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)
Exemplo n.º 6
0
    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