Exemplo n.º 1
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.º 2
0
 def validate_decimal(value):
     if not validate_decimal(value):
         return ValidationError(
             _("This parameter only accepts "
               "decimal values."))
Exemplo n.º 3
0
 def validate_percentage(value):
     if not validate_percentage(value):
         return ValidationError(
             _("'%s' is not a valid percentage.") % value)
Exemplo n.º 4
0
 def on_daily_interest__validate(self, widget, value):
     if value < 0:
         return ValidationError(_(u'The value must be positive.'))
Exemplo n.º 5
0
 def on_max_installments__validate(self, widget, value):
     if value <= 0:
         return ValidationError(_(u'The value must be positive.'))
Exemplo n.º 6
0
 def validate_directory(path):
     if not validate_directory(path):
         return ValidationError(_("'%s is not a valid path.'") % path)
Exemplo n.º 7
0
 def on_monthly_cost__validate(self, widget, value):
     if value < 0:
         return ValidationError(_('Value cannot be zero or negative'))
Exemplo n.º 8
0
 def on_cost__validate(self, widget, value):
     if value <= 0:
         return ValidationError(_(u'Cost cannot be zero or negative.'))
     if not self._is_valid_cost(value):
         return ValidationError(self._cost_msg)
Exemplo n.º 9
0
 def on_code__validate(self, widget, new_code):
     if self.model.check_unique_value_exists(ProductManufacturer.code,
                                             new_code):
         return ValidationError(
             _("The code '%s' already exists") % new_code)
Exemplo n.º 10
0
 def on_lead_time__validate(self, entry, value):
     if value < 1:
         return ValidationError(
             _("Lead time must be greater or equal one "
               "day"))
Exemplo n.º 11
0
 def on_quantity__validate(self, widget, value):
     if not value > 0:
         # FIXME: value < upper bound
         return ValidationError(
             _(u'The component quantity must be '
               'greater than zero.'))
Exemplo n.º 12
0
 def on_base_cost__validate(self, entry, value):
     if not value or value <= currency(0):
         return ValidationError(_("Value must be greater than zero."))
Exemplo n.º 13
0
 def on_minimum_purchase__validate(self, entry, value):
     if not value or value <= Decimal(0):
         return ValidationError(
             _("Minimum purchase must be greater than "
               "zero."))
Exemplo n.º 14
0
 def on_height__validate(self, widget, value):
     if not value > 0:
         return ValidationError(_(u'height value must greater than zero.'))
Exemplo n.º 15
0
 def on_cost__validate(self, entry, value):
     if value <= 0:
         return ValidationError(_("Cost cannot be zero or negative"))
Exemplo n.º 16
0
 def on_value__validate(self, widget, newvalue):
     if newvalue is None or newvalue <= 0:
         return ValidationError(_("The value must be greater than zero."))
Exemplo n.º 17
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.º 18
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.º 19
0
 def validate_state(value):
     state_l10n = get_l10n_field(get_default_store(), 'state')
     if not state_l10n.validate(value):
         return ValidationError(
             _("'%s' is not a valid %s.")
             % (value, state_l10n.label.lower(), ))
Exemplo n.º 20
0
 def on_expected_start_date__validate(self, widget, value):
     today = localtoday().date()
     if value and value < today:
         return ValidationError(
             _(u'Expected start date should be a future date.'))
Exemplo n.º 21
0
 def on_max_installments__validate(self, widget, value):
     if value <= 0:
         return ValidationError(
             _("The max installments must be greater than zero."))
Exemplo n.º 22
0
 def on_quantity__validate(self, widget, value):
     if value <= 0:
         return ValidationError(
             _(u'Allocated value should be greater than zero.'))
Exemplo n.º 23
0
 def on_penalty__validate(self, widget, value):
     if value < 0:
         return ValidationError(_(u'The value must be positive.'))
Exemplo n.º 24
0
 def on_quantity__validate(self, widget, value):
     if value and value < 0:
         return ValidationError(_(u'This quantity should be positive.'))
Exemplo n.º 25
0
 def validate_int(value):
     if not validate_int(value):
         return ValidationError(
             _("This parameter only accepts "
               "integer values."))
Exemplo n.º 26
0
 def on_code__validate(self, widget, value):
     if not value:
         return ValidationError(_(u'The code can not be empty.'))
     if self.model.sellable.check_code_exists(value):
         return ValidationError(_(u'The code %s already exists.') % value)
Exemplo n.º 27
0
 def validate_area_code(code):
     if not validate_area_code(code):
         return ValidationError(
             _("'%s' is not a valid area code.\n"
               "Valid area codes are on 10-99 range.") % code)
Exemplo n.º 28
0
 def on_price__validate(self, entry, value):
     if value <= 0:
         return ValidationError(_("Price cannot be zero or negative"))
Exemplo n.º 29
0
 def on_credit_limit__validate(self, entry, value):
     if value < 0:
         return ValidationError(
             _("Credit limit must be greater than or equal to 0"))
Exemplo n.º 30
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."))