コード例 #1
0
    def finish(self):
        for payment in self.model.group.payments:
            if payment.is_preview():
                # Set payments created on SaleReturnPaymentStep as pending
                payment.set_pending()

        SaleReturnWizardFinishEvent.emit(self.model)

        total_amount = self.model.total_amount
        # If the user chose to create credit for the client instead of returning
        # money, there is no need to display this messages.
        if not self.credit:
            if total_amount == 0:
                info(_("The client does not have a debt to this sale anymore. "
                       "Any existing unpaid installment will be cancelled."))
            elif total_amount < 0:
                info(_("A reversal payment to the client will be created. "
                       "You can see it on the Payable Application."))

        self.model.return_(method_name=u'credit' if self.credit else u'money')
        self.retval = self.model
        self.close()

        if self.credit:
            if yesno(_(u'Would you like to print the credit letter?'),
                     gtk.RESPONSE_YES, _(u"Print Letter"), _(u"Don't print")):
                print_report(ClientCreditReport, self.model.client)
コード例 #2
0
ファイル: salereturnwizard.py プロジェクト: LeonamSilva/stoq
    def finish(self):
        for payment in self.model.group.payments:
            if payment.is_preview():
                # Set payments created on SaleReturnPaymentStep as pending
                payment.set_pending()

        SaleReturnWizardFinishEvent.emit(self.model)

        total_amount = self.model.total_amount
        # If the user chose to create credit for the client instead of returning
        # money, there is no need to display this messages.
        if not self.credit:
            if total_amount == 0:
                info(_("The client does not have a debt to this sale anymore. "
                       "Any existing unpaid installment will be cancelled."))
            elif total_amount < 0:
                info(_("A reversal payment to the client will be created. "
                       "You can see it on the Payable Application."))

        self.model.return_(method_name=u'credit' if self.credit else u'money')
        self.retval = self.model
        self.close()

        if self.credit:
            if yesno(_(u'Would you like to print the credit letter?'),
                     gtk.RESPONSE_YES, _(u"Print Letter"), _(u"Don't print")):
                print_report(ClientCreditReport, self.model.client)
コード例 #3
0
 def on_receive_button__clicked(self, event):
     if yesno(_(u'Receive pending returned sale?'), Gtk.ResponseType.NO,
              _(u'Receive'), _(u"Don't receive")):
         current_user = api.get_current_user(self.store)
         self.model.returned_sale.confirm(current_user)
         SaleReturnWizardFinishEvent.emit(self.model.returned_sale)
         self.store.commit(close=False)
         self._setup_status()
コード例 #4
0
 def on_receive_button__clicked(self, event):
     if yesno(_(u'Receive pending returned sale?'), gtk.RESPONSE_NO,
              _(u'Receive'), _(u"Don't receive")):
         current_user = api.get_current_user(self.store)
         self.model.returned_sale.confirm(current_user)
         SaleReturnWizardFinishEvent.emit(self.model.returned_sale)
         self.store.commit(close=False)
         self._setup_status()
コード例 #5
0
    def finish(self):
        for payment in self.model.group.payments:
            if payment.is_preview():
                # Set payments created on SaleReturnPaymentStep as pending
                payment.set_pending()

        SaleReturnWizardFinishEvent.emit(self.model)

        total_amount = self.model.total_amount
        if total_amount == 0:
            info(_("The client does not have a debt to this sale anymore. "
                   "Any existing unpaid installment will be cancelled."))
        elif total_amount < 0:
            info(_("A reversal payment to the client will be created. "
                   "You can see it on the Payable Application."))

        self.model.return_(method_name=u'credit' if self.credit else u'money')
        self.retval = self.model
        self.close()
コード例 #6
0
ファイル: salereturnwizard.py プロジェクト: metrorede/stak
    def finish(self):
        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

        login_user = api.get_current_user(self.store)
        self.model.return_(method_name=u'credit' if self.credit else u'money',
                           login_user=login_user)
        SaleReturnWizardFinishEvent.emit(self.model)
        self.retval = self.model
        self.close()

        # Commit before printing to avoid losing data if something breaks
        self.store.confirm(self.retval)
        if self.credit:
            if yesno(_(u'Would you like to print the credit letter?'),
                     Gtk.ResponseType.YES, _(u"Print Letter"), _(u"Don't print")):
                print_report(ClientCreditReport, self.model.client)
コード例 #7
0
    def finish(self):
        for payment in self.model.group.payments:
            if payment.is_preview():
                # Set payments created on SaleReturnPaymentStep as pending
                payment.set_pending()

        SaleReturnWizardFinishEvent.emit(self.model)

        total_amount = self.model.total_amount
        if total_amount == 0:
            info(
                _("The client does not have a debt to this sale anymore. "
                  "Any existing unpaid installment will be cancelled."))
        elif total_amount < 0:
            info(
                _("A reversal payment to the client will be created. "
                  "You can see it on the Payable Application."))

        self.model.return_(method_name=u'credit' if self.credit else u'money')
        self.retval = self.model
        self.close()
コード例 #8
0
    def finish(self):
        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

        for payment in self.model.group.payments:
            if payment.is_preview():
                # Set payments created on SaleReturnPaymentStep as pending
                payment.set_pending()

        total_amount = self.model.total_amount
        # If the user chose to create credit for the client instead of returning
        # money, there is no need to display this messages.
        if not self.credit:
            if total_amount == 0:
                info(
                    _("The client does not have a debt to this sale anymore. "
                      "Any existing unpaid installment will be cancelled."))
            elif total_amount < 0:
                info(
                    _("A reversal payment to the client will be created. "
                      "You can see it on the Payable Application."))

        login_user = api.get_current_user(self.store)
        self.model.return_(method_name=u'credit' if self.credit else u'money',
                           login_user=login_user)
        SaleReturnWizardFinishEvent.emit(self.model)
        self.retval = self.model
        self.close()

        # Commit before printing to avoid losing data if something breaks
        self.store.confirm(self.retval)
        if self.credit:
            if yesno(_(u'Would you like to print the credit letter?'),
                     Gtk.ResponseType.YES, _(u"Print Letter"),
                     _(u"Don't print")):
                print_report(ClientCreditReport, self.model.client)
コード例 #9
0
    def finish(self):
        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

        for payment in self.model.group.payments:
            if payment.is_preview():
                # Set payments created on SaleReturnPaymentStep as pending
                payment.set_pending()

        total_amount = self.model.total_amount
        # If the user chose to create credit for the client instead of returning
        # money, there is no need to display this messages.
        if not self.credit:
            if total_amount == 0:
                info(_("The client does not have a debt to this sale anymore. "
                       "Any existing unpaid installment will be cancelled."))
            elif total_amount < 0:
                info(_("A reversal payment to the client will be created. "
                       "You can see it on the Payable Application."))

        login_user = api.get_current_user(self.store)
        self.model.return_(method_name=u'credit' if self.credit else u'money',
                           login_user=login_user)
        SaleReturnWizardFinishEvent.emit(self.model)
        self.retval = self.model
        self.close()

        # Commit before printing to avoid losing data if something breaks
        self.store.confirm(self.retval)
        if self.credit:
            if yesno(_(u'Would you like to print the credit letter?'),
                     gtk.RESPONSE_YES, _(u"Print Letter"), _(u"Don't print")):
                print_report(ClientCreditReport, self.model.client)