From 06719a84c52c7a97487b7ee0bef3bbe166d5b502 Mon Sep 17 00:00:00 2001 From: paso-odoo <paso@odoo.com> Date: Thu, 16 Feb 2023 05:16:21 +0000 Subject: [PATCH] [FIX] l10n_id_efaktur: fix the issue of invalid literal base10 in efaktur MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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#122302 X-original-commit: 78ecfd66f1d6e043cefa4f88faa49505e4418f06 Signed-off-by: William André (wan) <wan@odoo.com> --- addons/l10n_id_efaktur/models/efaktur.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/l10n_id_efaktur/models/efaktur.py b/addons/l10n_id_efaktur/models/efaktur.py index b54c8382fc76..71a9b5ea8b42 100644 --- a/addons/l10n_id_efaktur/models/efaktur.py +++ b/addons/l10n_id_efaktur/models/efaktur.py @@ -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 -- GitLab