[FIX] l10n_id_efaktur: fix the issue of invalid literal base10 in efaktur
If applied, this commit will solve the min-max issues for efaktur. - invalid literal for int() with base 10: when we enter all characters string in the min or max it will raise an error like this. - Error is also raised when the min or max is blank and try to save the record. So, I have update the value as 0 if the min value or max value not generated. see - https://tinyurl.com/2lx9j2kr Sentry - 3936020226 closes odoo/odoo#122340 X-original-commit: 78ecfd66f1d6e043cefa4f88faa49505e4418f06 Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
@@ -98,12 +98,14 @@ class Efaktur(models.Model):
|
||||
|
||||
@api.onchange('min')
|
||||
def _onchange_min(self):
|
||||
self.min = '%013d' % int(re.sub(r'\D', '', self.min))
|
||||
min_val = re.sub(r'\D', '', str(self.min)) or 0
|
||||
self.min = '%013d' % int(min_val)
|
||||
if not self.max or int(self.min) > int(self.max):
|
||||
self.max = self.min
|
||||
|
||||
@api.onchange('max')
|
||||
def _onchange_max(self):
|
||||
self.max = '%013d' % int(re.sub(r'\D', '', self.max))
|
||||
max_val = re.sub(r'\D', '', str(self.max)) or 0
|
||||
self.max = '%013d' % int(max_val)
|
||||
if not self.min or int(self.min) > int(self.max):
|
||||
self.min = self.max
|
||||
|
||||
Reference in New Issue
Block a user