Skip to content
Snippets Groups Projects
Commit 7b58a288 authored by Claire Bretton (clbr)'s avatar Claire Bretton (clbr)
Browse files

[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#135367

Signed-off-by: default avatarLaurent Smet (las) <las@odoo.com>
parent 58e463e7
No related branches found
No related tags found
No related merge requests found
......@@ -156,9 +156,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
query = f"""
SELECT {{field}} FROM {self._table}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment