[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#135722 X-original-commit: d95aae51a23ff163e959a1f3064f42a89cfaf516 Signed-off-by: Laurent Smet (las) <las@odoo.com> Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
This commit is contained in:
@@ -179,9 +179,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
|
||||
|
||||
Reference in New Issue
Block a user