Ejemplo n.º 1
0
class ReceivingInvoiceStep(WizardEditorStep):
    gladefile = 'HolderTemplate'
    model_type = ReceivingOrder

    #
    # WizardStep hooks
    #

    def has_next_step(self):
        return False

    def post_init(self):
        self._is_valid = False
        self.invoice_slave = ReceivingInvoiceSlave(
            self.store, self.model.receiving_invoice)
        self.invoice_slave.connect('activate',
                                   self._on_invoice_slave__activate)
        self.attach_slave("place_holder", self.invoice_slave)
        # Slaves must be focused after being attached
        self.invoice_slave.invoice_number.grab_focus()
        self.register_validate_function(self._validate_func)
        self.force_validation()
        if not self.has_next_step():
            self.wizard.enable_finish()

    def validate_step(self):
        create_freight_payment = self.invoice_slave.create_freight_payment()
        self.model.update_payments(create_freight_payment)
        return self.model

    # Callbacks

    def _validate_func(self, is_valid):
        self._is_valid = is_valid
        self.wizard.refresh_next(is_valid)

    def _on_invoice_slave__activate(self, slave):
        if self._is_valid:
            self.wizard.finish()
Ejemplo n.º 2
0
class InvoiceDetailsStep(WizardEditorStep):
    gladefile = 'HolderTemplate'
    model_type = ReceivingInvoice

    #
    # WizardStep hooks
    #

    def next_step(self):
        if self.model.freight_total and self.invoice_slave.create_freight_payment():
            group = self.model.group if not self.model.transporter else None
            self.model.create_freight_payment(group=group)
        self.store.savepoint('before_invoicepayment_step')
        return InvoicePaymentStep(self.wizard, self, self.store, self.model)

    def post_init(self):
        # If the user is comming back from the next, make sure things don't get
        # messed
        if self.store.savepoint_exists('before_invoicepayment_step'):
            self.store.rollback_to_savepoint('before_invoicepayment_step')

        self._is_valid = False
        self.invoice_slave = ReceivingInvoiceSlave(self.store, self.model)
        self.invoice_slave.connect('activate', self._on_invoice_slave__activate)
        self.attach_slave("place_holder", self.invoice_slave)
        # Slaves must be focused after being attached
        self.invoice_slave.invoice_number.grab_focus()
        self.register_validate_function(self._validate_func)
        self.force_validation()

    # Callbacks

    def _validate_func(self, is_valid):
        self._is_valid = is_valid
        self.wizard.refresh_next(is_valid)

    def _on_invoice_slave__activate(self, slave):
        if self._is_valid:
            self.wizard.finish()
Ejemplo n.º 3
0
class InvoiceDetailsStep(WizardEditorStep):
    gladefile = 'HolderTemplate'
    model_type = ReceivingInvoice

    #
    # WizardStep hooks
    #

    def next_step(self):
        if self.model.freight_total and self.invoice_slave.create_freight_payment():
            group = self.model.group if not self.model.transporter else None
            self.model.create_freight_payment(group=group)
        self.store.savepoint('before_invoicepayment_step')
        return InvoicePaymentStep(self.wizard, self, self.store, self.model)

    def post_init(self):
        # If the user is comming back from the next, make sure things don't get
        # messed
        if self.store.savepoint_exists('before_invoicepayment_step'):
            self.store.rollback_to_savepoint('before_invoicepayment_step')

        self._is_valid = False
        self.invoice_slave = ReceivingInvoiceSlave(self.store, self.model)
        self.invoice_slave.connect('activate', self._on_invoice_slave__activate)
        self.attach_slave("place_holder", self.invoice_slave)
        # Slaves must be focused after being attached
        self.invoice_slave.invoice_number.grab_focus()
        self.register_validate_function(self._validate_func)
        self.force_validation()

    # Callbacks

    def _validate_func(self, is_valid):
        self._is_valid = is_valid
        self.wizard.refresh_next(is_valid)

    def _on_invoice_slave__activate(self, slave):
        if self._is_valid:
            self.wizard.finish()
Ejemplo n.º 4
0
class ReceivingInvoiceStep(WizardEditorStep):
    gladefile = 'HolderTemplate'
    model_type = ReceivingOrder

    #
    # WizardStep hooks
    #

    def has_next_step(self):
        return False

    def post_init(self):
        self._is_valid = False
        self.invoice_slave = ReceivingInvoiceSlave(
            self.store, self.model.receiving_invoice)
        self.invoice_slave.connect('activate', self._on_invoice_slave__activate)
        self.attach_slave("place_holder", self.invoice_slave)
        # Slaves must be focused after being attached
        self.invoice_slave.invoice_number.grab_focus()
        self.register_validate_function(self._validate_func)
        self.force_validation()
        if not self.has_next_step():
            self.wizard.enable_finish()

    def validate_step(self):
        create_freight_payment = self.invoice_slave.create_freight_payment()
        self.model.update_payments(create_freight_payment)
        return self.model

    # Callbacks

    def _validate_func(self, is_valid):
        self._is_valid = is_valid
        self.wizard.refresh_next(is_valid)

    def _on_invoice_slave__activate(self, slave):
        if self._is_valid:
            self.wizard.finish()