From d95aae51a23ff163e959a1f3064f42a89cfaf516 Mon Sep 17 00:00:00 2001 From: "Claire Bretton (clbr)" <clbr@odoo.com> Date: Wed, 13 Sep 2023 16:05:22 +0000 Subject: [PATCH] [FIX] account: fix self.id.origin in get_last_sequence() When trying to customize Swiss invoice report with QR-Bill through Studio an error was thrown because it tries to _compute_name() on a dummy 'account.move' record with self.id=0. This is part of a more general task in master around report customization but it make sense to backport the fix in all stable versions. task-id:3492033 closes odoo/odoo#135627 X-original-commit: 7b58a288b3d79fbdc91dbf14aaeac0d69d65c327 Signed-off-by: Laurent Smet (las) <las@odoo.com> Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com> --- addons/account/models/sequence_mixin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/models/sequence_mixin.py b/addons/account/models/sequence_mixin.py index 7566e2556c29..fd4be733ea38 100644 --- a/addons/account/models/sequence_mixin.py +++ b/addons/account/models/sequence_mixin.py @@ -158,9 +158,9 @@ class SequenceMixin(models.AbstractModel): if self._sequence_field not in self._fields or not self._fields[self._sequence_field].store: raise ValidationError(_('%s is not a stored field', self._sequence_field)) where_string, param = self._get_last_sequence_domain(relaxed) - if self.id or self.id.origin: + if self._origin.id: where_string += " AND id != %(id)s " - param['id'] = self.id or self.id.origin + param['id'] = self._origin.id if with_prefix is not None: where_string += " AND sequence_prefix = %(with_prefix)s " param['with_prefix'] = with_prefix -- GitLab