class CloseConsignmentPaymentStep(BaseWizardStep): gladefile = 'HolderTemplate' slave_holder = 'place_holder' def __init__(self, wizard, previous, store, consignment, outstanding_value=Decimal(0)): self._method = PaymentMethod.get_by_name(store, u'money') BaseWizardStep.__init__(self, store, wizard, previous=None) self._consignment = consignment self._outstanding_value = outstanding_value self._setup_slaves() def _setup_slaves(self): self.slave = MultipleMethodSlave(self.wizard, self, self.store, self.store.fetch(self._consignment), None, self._outstanding_value, finish_on_total=False) self.attach_slave('place_holder', self.slave) def _validate_step(self, value): can_finish = value and self.slave.can_confirm() self.wizard.refresh_next(can_finish) def validate_step(self): return True def post_init(self): self.register_validate_function(self._validate_step) self.force_validation() self._validate_step(False) self.wizard.enable_finish() def has_next_step(self): return False
class CloseConsignmentPaymentStep(BaseWizardStep): gladefile = 'HolderTemplate' slave_holder = 'place_holder' def __init__(self, wizard, previous, store, consignment, outstanding_value=Decimal(0)): self._method = PaymentMethod.get_by_name(store, u'money') BaseWizardStep.__init__(self, store, wizard, previous=None) self._consignment = consignment self._outstanding_value = outstanding_value self._setup_slaves() def _setup_slaves(self): self.slave = MultipleMethodSlave(self.wizard, self, self.store, self.store.fetch(self._consignment), None, self._outstanding_value, finish_on_total=False) self.attach_slave('place_holder', self.slave) def _validate_step(self, value): can_finish = value and self.slave.can_confirm() self.wizard.refresh_next(can_finish) def validate_step(self): return True def post_init(self): self.register_validate_function(self._validate_step) self.force_validation() self._validate_step(False) self.wizard.enable_finish() def has_next_step(self): return False
class SaleReturnPaymentStep(WizardEditorStep): gladefile = 'HolderTemplate' model_type = ReturnedSale # # WizardEditorStep # def post_init(self): self.register_validate_function(self._validation_func) self.force_validation() before_debt = currency(self.model.sale_total - self.model.paid_total) now_debt = currency(before_debt - self.model.returned_total) short = _("The client's debt has changed. " "Use this step to adjust the payments.") longdesc = _( "The debt before was %s and now is %s. Cancel some unpaid " "installments and create new ones.") info( short, longdesc % (converter.as_string(currency, before_debt), converter.as_string(currency, now_debt))) def setup_slaves(self): register_payment_slaves() outstanding_value = (self.model.total_amount_abs + self.model.paid_total) self.slave = MultipleMethodSlave(self.wizard, self, self.store, self.model, None, outstanding_value=outstanding_value, finish_on_total=False, allow_remove_paid=False) self.slave.enable_remove() self.attach_slave('place_holder', self.slave) def validate_step(self): return True def has_next_step(self): return False # # Callbacks # def _validation_func(self, value): can_finish = value and self.slave.can_confirm() self.wizard.refresh_next(can_finish)
class SaleReturnPaymentStep(WizardEditorStep): gladefile = 'HolderTemplate' model_type = ReturnedSale # # WizardEditorStep # def post_init(self): self.register_validate_function(self._validation_func) self.force_validation() before_debt = currency(self.model.sale_total - self.model.paid_total) now_debt = currency(before_debt - self.model.returned_total) short = _("The client's debt has changed. " "Use this step to adjust the payments.") longdesc = _("The debt before was %s and now is %s. Cancel some unpaid " "installments and create new ones.") info(short, longdesc % (converter.as_string(currency, before_debt), converter.as_string(currency, now_debt))) def setup_slaves(self): register_payment_slaves() outstanding_value = (self.model.total_amount_abs + self.model.paid_total) self.slave = MultipleMethodSlave(self.wizard, self, self.store, self.model, None, outstanding_value=outstanding_value, finish_on_total=False, allow_remove_paid=False) self.slave.enable_remove() self.attach_slave('place_holder', self.slave) def validate_step(self): return True def has_next_step(self): return False # # Callbacks # def _validation_func(self, value): can_finish = value and self.slave.can_confirm() self.wizard.refresh_next(can_finish)
class SaleQuotePaymentStep(WizardEditorStep): """A step for creating payments for a |sale| All this step does is to attach :class:`stoqlib.gui.slaves.paymentslave.MultipleMethodSlave`, so see it for more information """ gladefile = 'HolderTemplate' model_type = Sale # # WizardEditorStep # def post_init(self): self.register_validate_function(self._validation_func) self.force_validation() missing_value = self.slave.get_missing_change_value() if missing_value < 0: info( _(u"Your payments total is greater than the sale total. Maybe" " you want to correct them.")) def setup_slaves(self): register_payment_slaves() self.slave = MultipleMethodSlave(wizard=self.wizard, parent=self, store=self.store, order=self.model, payment_method=None, finish_on_total=False, allow_remove_paid=False, require_total_value=False) self.slave.enable_remove() self.attach_slave('place_holder', self.slave) def has_next_step(self): return False # # Callbacks # def _validation_func(self, value): can_finish = value and self.slave.can_confirm() self.wizard.refresh_next(can_finish)
class SaleQuotePaymentStep(WizardEditorStep): """A step for creating payments for a |sale| All this step does is to attach :class:`stoqlib.gui.slaves.paymentslave.MultipleMethodSlave`, so see it for more information """ gladefile = 'HolderTemplate' model_type = Sale # # WizardEditorStep # def post_init(self): self.register_validate_function(self._validation_func) self.force_validation() missing_value = self.slave.get_missing_change_value() if missing_value < 0: info(_(u"Your payments total is greater than the sale total. Maybe" " you want to correct them.")) def setup_slaves(self): register_payment_slaves() self.slave = MultipleMethodSlave( wizard=self.wizard, parent=self, store=self.store, order=self.model, payment_method=None, finish_on_total=False, allow_remove_paid=False, require_total_value=False) self.slave.enable_remove() self.attach_slave('place_holder', self.slave) def has_next_step(self): return False # # Callbacks # def _validation_func(self, value): can_finish = value and self.slave.can_confirm() self.wizard.refresh_next(can_finish)