Exemplo n.º 1
0
 def on_description__validate(self, entry, value):
     if value is None:
         return ValidationError(_("Description must be filled in"))
Exemplo n.º 2
0
 def on_p_cred_sn_valid_until__validate(self, widget, value):
     if not self.p_cred_sn.get_value():
         return
     if value <= datetime.date.today():
         return ValidationError(_(u"This date must be set in the future."))
Exemplo n.º 3
0
 def on_quantity__validate(self, widget, value):
     if not value or value <= 0:
         return ValidationError(_(u'This quantity should be positive.'))
Exemplo n.º 4
0
 def on_invoice_number__validate(self, widget, value):
     if not 0 < value <= 999999999:
         return ValidationError(
             _("Invoice number must be between 1 and 999999999"))
Exemplo n.º 5
0
 def on_code__validate(self, widget, value):
     # FIXME: Consider the branch in this check
     if self.model.check_unique_value_exists(self.model_type.code, value):
         return ValidationError(_("Code already in use"))
Exemplo n.º 6
0
 def on_on_sale_price__validate(self, entry, value):
     if value < 0:
         return ValidationError(_("Sale price can not be 0"))
Exemplo n.º 7
0
 def _on_bank_account__validate(self, entry, value, bank_info):
     if bank_info:
         try:
             bank_info.validate_field(value)
         except BoletoException as e:
             return ValidationError(str(e))
Exemplo n.º 8
0
    def on_estimated_start__validate(self, widget, value):
        if (self._new_model and value < localtoday()
                and not api.sysparam.get_bool('ALLOW_OUTDATED_OPERATIONS')):
            return ValidationError(u"The start date cannot be on the past")

        self.estimated_finish.validate(force=True)
Exemplo n.º 9
0
 def on_end_date__validate(self, widget, date):
     if date > datetime.date.today():
         return ValidationError(_("End date must be less than today"))
     if date < self.model.start_date:
         self.start_date.set_date(date)
Exemplo n.º 10
0
 def on_max_installments__validate(self, widget, value):
     if value <= 0:
         return ValidationError(_(u'The value must be positive.'))
Exemplo n.º 11
0
    def on_quantity__validate(self, entry, value):
        if value <= 0:
            return ValidationError("The quantity must be greater than 0")

        return self._validate_quantity(value)
Exemplo n.º 12
0
 def on_penalty__validate(self, widget, value):
     if value < 0:
         return ValidationError(_(u'The value must be positive.'))
Exemplo n.º 13
0
 def on_daily_interest__validate(self, widget, value):
     if value < 0:
         return ValidationError(_(u'The value must be positive.'))
Exemplo n.º 14
0
 def on_value__validate(self, entry, value):
     if value <= 0:
         return ValidationError(_("Value must be greater than zero"))
Exemplo n.º 15
0
 def on_expire_date__validate(self, widget, value):
     # open_date has a seconds precision, so that why we are rounding it to
     # date here.
     if value.date() < self.model.open_date.date():
         msg = _(u"The expire date must be after the sale open date")
         return ValidationError(msg)
Exemplo n.º 16
0
 def on_start_reductions_number__validate(self, widget, number):
     if number <= 0:
         return ValidationError(
             _("This number must be positive "
               "and greater than 0"))
     self.end_reductions_number.set_range(number, 9999)
Exemplo n.º 17
0
 def on_expire_date__validate(self, widget, value):
     if value < localtoday().date():
         msg = _(u"The expire date must be set to today or a future date.")
         return ValidationError(msg)
Exemplo n.º 18
0
 def from_string(self, value, format='png'):
     try:
         return pixbuf_from_string(value, format)
     except GObject.GError as e:
         raise ValidationError(_("Could not load image: %s") % e)
Exemplo n.º 19
0
 def on_description__validate(self, entry, text):
     if not text:
         return ValidationError(_("Account description cannot be empty"))
Exemplo n.º 20
0
 def _positive_validator(self, value):
     if not value:
         return
     if value and value < 0:
         return ValidationError(_(u'The value must be positive.'))
Exemplo n.º 21
0
 def _on_bank_option__validate(self, entry, value, bank_info, option):
     try:
         bank_info.validate_option(option, value)
     except BoletoException as e:
         return ValidationError(str(e))
     self.bank_model.set_option(option, value)
Exemplo n.º 22
0
 def on_ncm__validate(self, widget, value):
     if len(value) not in (0, 8):
         return ValidationError(_(u'NCM must have 8 digits.'))
Exemplo n.º 23
0
 def on_profile_name__validate(self, widget, value):
     if self.model.check_unique_value_exists(UserProfile.name,
                                             value,
                                             case_sensitive=False):
         return ValidationError('This profile already exists!')
Exemplo n.º 24
0
 def on_ex_tipi__validate(self, widget, value):
     if len(value) not in (0, 2, 3):
         return ValidationError(_(u'EX TIPI must have 2 or 3 digits.'))
Exemplo n.º 25
0
 def on_number__validate(self, widget, value):
     query = And(Racer.race == self.race,
                 Racer.id != self._current_model.id, Racer.number == value)
     if self.store.find(Racer, query).any():
         return ValidationError('Número já utilizado')
Exemplo n.º 26
0
 def on_genero__validate(self, widget, value):
     if len(value) not in (0, 2):
         return ValidationError(_(u'Gênero must have 2 digits.'))
Exemplo n.º 27
0
 def on_p_cofins__validate(self, widget, value):
     if not 0 <= value <= 100:
         return ValidationError(
             _('The COFINS aliquot must be between 0 and 100'))
Exemplo n.º 28
0
 def on_yield_quantity__validate(self, widget, value):
     if value <= 0:
         return ValidationError(_(u'The value must be positive.'))
Exemplo n.º 29
0
 def on_quantity__validate(self, widget, value):
     if value <= 0:
         return ValidationError(
             _(u'Lost value should be greater than zero.'))
Exemplo n.º 30
0
 def on_combo__validate(self, widget, data):
     if data != 'Tre':
         return ValidationError("bar")