예제 #1
0
 def _setup_events(self):
     SaleReturnWizardFinishEvent.connect(self._on_SaleReturnWizardFinish)
     SaleStatusChangedEvent.connect(self._on_SaleStatusChanged)
     StockDecreaseWizardFinishEvent.connect(
         self._on_StockDecreaseWizardFinish)
     StockTransferWizardFinishEvent.connect(
         self._on_StockTransferWizardFinish)
예제 #2
0
    def finish(self):
        missing = get_missing_items(self.model, self.store)
        if missing:
            run_dialog(MissingItemsDialog, self, self.model, missing)
            return False

        order = TransferOrder(
            open_date=self.model.open_date,
            receival_date=self.model.receival_date,
            source_branch=self.model.source_branch,
            destination_branch=self.model.destination_branch,
            source_responsible=self.model.source_responsible,
            destination_responsible=self.model.destination_responsible,
            store=self.store)
        for item in self.model.get_items():
            transfer_item = order.add_sellable(item.sellable,
                                               quantity=item.quantity,
                                               batch=item.batch)
            transfer_item.send()

        # XXX Waiting for transfer order receiving wizard implementation
        order.receive()

        self.retval = self.model
        self.close()
        StockTransferWizardFinishEvent.emit(order)
        self._receipt_dialog(order)
예제 #3
0
    def finish(self):
        missing = get_missing_items(self.model, self.store)
        if missing:
            run_dialog(MissingItemsDialog, self, self.model, missing)
            return False

        invoice_ok = InvoiceSetupEvent.emit()
        if invoice_ok is False:
            # If there is any problem with the invoice, the event will display an error
            # message and the dialog is kept open so the user can fix whatever is wrong.
            return

        # FIXME: If any issue happen at any point of the "send process",
        # trying to issue it again would make some products have their stock
        # decreased twice. Make sure we undo it first.
        # The issue itself was related to missing stock. Why get_missing_items
        # failed above?
        self.store.savepoint('before_send_transfer')
        try:
            self.model.send()
        except Exception as e:
            warning(_("An error happened when trying to confirm the transfer"),
                    str(e))
            self.store.rollback_to_savepoint('before_send_transfer')
            raise

        self.retval = self.model
        self.close()

        StockTransferWizardFinishEvent.emit(self.model)
        # Commit before printing to avoid losing data if something breaks
        self.store.confirm(self.retval)
        self._receipt_dialog(self.model)
예제 #4
0
    def finish(self):
        missing = get_missing_items(self.model, self.store)
        if missing:
            run_dialog(MissingItemsDialog, self, self.model, missing)
            return False

        invoice_ok = InvoiceSetupEvent.emit()
        if invoice_ok is False:
            # If there is any problem with the invoice, the event will display an error
            # message and the dialog is kept open so the user can fix whatever is wrong.
            return

        # FIXME: If any issue happen at any point of the "send process",
        # trying to issue it again would make some products have their stock
        # decreased twice. Make sure we undo it first.
        # The issue itself was related to missing stock. Why get_missing_items
        # failed above?
        self.store.savepoint('before_send_transfer')
        try:
            self.model.send()
        except Exception as e:
            warning(_("An error happened when trying to confirm the transfer"),
                    str(e))
            self.store.rollback_to_savepoint('before_send_transfer')
            raise

        self.retval = self.model
        self.close()

        StockTransferWizardFinishEvent.emit(self.model)
        # Commit before printing to avoid losing data if something breaks
        self.store.confirm(self.retval)
        self._receipt_dialog(self.model)
예제 #5
0
    def finish(self):
        missing = get_missing_items(self.model, self.store)
        if missing:
            run_dialog(MissingItemsDialog, self, self.model, missing)
            return False

        order = TransferOrder(
            open_date=self.model.open_date,
            receival_date=self.model.receival_date,
            source_branch=self.model.source_branch,
            destination_branch=self.model.destination_branch,
            source_responsible=self.model.source_responsible,
            destination_responsible=self.model.destination_responsible,
            store=self.store)
        for item in self.model.get_items():
            transfer_item = order.add_sellable(item.sellable, batch=None,
                                               quantity=item.quantity)
            transfer_item.send()

        # XXX Waiting for transfer order receiving wizard implementation
        order.receive()

        self.retval = self.model
        self.close()
        StockTransferWizardFinishEvent.emit(order)
        self._receipt_dialog(order)
예제 #6
0
    def finish(self):
        missing = get_missing_items(self.model, self.store)
        if missing:
            run_dialog(MissingItemsDialog, self, self.model, missing)
            return False

        self.model.send()

        self.retval = self.model
        self.close()
        StockTransferWizardFinishEvent.emit(self.model)
        self._receipt_dialog(self.model)
예제 #7
0
    def finish(self):
        missing = get_missing_items(self.model, self.store)
        if missing:
            run_dialog(MissingItemsDialog, self, self.model, missing)
            return False

        self.model.send()

        self.retval = self.model
        self.close()
        StockTransferWizardFinishEvent.emit(self.model)
        self._receipt_dialog(self.model)
예제 #8
0
    def finish(self):
        missing = get_missing_items(self.model, self.store)
        if missing:
            run_dialog(MissingItemsDialog, self, self.model, missing)
            return False

        self.model.send()

        self.retval = self.model
        self.close()

        StockTransferWizardFinishEvent.emit(self.model)
        # Commit before printing to avoid losing data if something breaks
        self.store.confirm(self.retval)
        self._receipt_dialog(self.model)
예제 #9
0
    def finish(self):
        missing = get_missing_items(self.model, self.store)
        if missing:
            run_dialog(MissingItemsDialog, self, self.model, missing)
            return False

        self.model.send()

        self.retval = self.model
        self.close()

        StockTransferWizardFinishEvent.emit(self.model)
        # Commit before printing to avoid losing data if something breaks
        self.store.confirm(self.retval)
        self._receipt_dialog(self.model)
예제 #10
0
파일: nfeui.py 프로젝트: Guillon88/stoq
    def __init__(self):
        SaleReturnWizardFinishEvent.connect(self._on_SaleReturnWizardFinish)
        SaleStatusChangedEvent.connect(self._on_SaleStatusChanged)
        StockDecreaseWizardFinishEvent.connect(self._on_StockDecreaseWizardFinish)
        StockTransferWizardFinishEvent.connect(self._on_StockTransferWizardFinish)
        # TODO: Before enable the the NF-e generation. Save the invoice data,
        # in Invoice table (for each operation below).
#        NewLoanWizardFinishEvent.connect(self._on_NewLoanWizardFinish)

        pm = PermissionManager.get_permission_manager()
        pm.set('InvoiceLayout', pm.PERM_HIDDEN)
        pm.set('InvoicePrinter', pm.PERM_HIDDEN)

        # since the nfe plugin was enabled, the user must not be able to print
        # the regular fiscal invoice (replaced by the nfe).
        pm.set('app.sales.print_invoice', pm.PERM_HIDDEN)
        self._update_forms()
예제 #11
0
파일: nfeui.py 프로젝트: leandrodax/stoq
    def __init__(self):
        SaleReturnWizardFinishEvent.connect(self._on_SaleReturnWizardFinish)
        SaleStatusChangedEvent.connect(self._on_SaleStatusChanged)
        StockDecreaseWizardFinishEvent.connect(
            self._on_StockDecreaseWizardFinish)
        StockTransferWizardFinishEvent.connect(
            self._on_StockTransferWizardFinish)
        # TODO: Before enable the the NF-e generation. Save the invoice data,
        # in Invoice table (for each operation below).
        #        NewLoanWizardFinishEvent.connect(self._on_NewLoanWizardFinish)

        pm = PermissionManager.get_permission_manager()
        pm.set('InvoiceLayout', pm.PERM_HIDDEN)
        pm.set('InvoicePrinter', pm.PERM_HIDDEN)

        # since the nfe plugin was enabled, the user must not be able to print
        # the regular fiscal invoice (replaced by the nfe).
        pm.set('app.sales.print_invoice', pm.PERM_HIDDEN)
        self._update_forms()
예제 #12
0
    def finish(self):
        missing = get_missing_items(self.model, self.store)
        if missing:
            run_dialog(MissingItemsDialog, self, self.model, missing)
            return False

        invoice_ok = InvoiceSetupEvent.emit()
        if invoice_ok is False:
            # If there is any problem with the invoice, the event will display an error
            # message and the dialog is kept open so the user can fix whatever is wrong.
            return

        self.model.send()
        self.retval = self.model
        self.close()

        StockTransferWizardFinishEvent.emit(self.model)
        # Commit before printing to avoid losing data if something breaks
        self.store.confirm(self.retval)
        self._receipt_dialog(self.model)
예제 #13
0
    def finish(self):
        order = TransferOrder(
            open_date=self.model.open_date,
            receival_date=self.model.receival_date,
            source_branch=self.model.source_branch,
            destination_branch=self.model.destination_branch,
            source_responsible=self.model.source_responsible,
            destination_responsible=self.model.destination_responsible,
            store=self.store)
        for item in self.model.get_items():
            transfer_item = TransferOrderItem(store=self.store,
                                              transfer_order=order,
                                              sellable=item.sellable,
                                              quantity=item.quantity)
            order.send_item(transfer_item)
        #XXX Waiting for transfer order receiving wizard implementation
        order.receive()

        self.retval = self.model
        self.close()
        StockTransferWizardFinishEvent.emit(order)
        self._receipt_dialog(order)
예제 #14
0
파일: nfeui.py 프로젝트: adrianoaguiar/stoq
 def _setup_events(self):
     SaleReturnWizardFinishEvent.connect(self._on_SaleReturnWizardFinish)
     SaleStatusChangedEvent.connect(self._on_SaleStatusChanged)
     StockDecreaseWizardFinishEvent.connect(self._on_StockDecreaseWizardFinish)
     StockTransferWizardFinishEvent.connect(self._on_StockTransferWizardFinish)