[FIX] docuseal_signing: send labels of relational and selection fields

Pre-filled values were converted with str(), so a Many2one such as the
partner title was sent as "res.partner.title(5,)" and a selection field
as its technical key. Send the display name of relational fields and the
label of selection fields instead.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-01 19:19:01 +01:00
parent de53394c0c
commit abbf44cab7

View File

@@ -121,8 +121,15 @@ class DocusealTemplate(models.Model):
value = partner[field_name]
if hasattr(value, "strftime"):
value = value.strftime("%d/%m/%Y")
elif isinstance(value, models.BaseModel):
value = ", ".join(value.mapped("display_name"))
elif value is False or value is None:
value = ""
elif partner._fields[field_name].type == "selection":
selection = partner._fields[field_name]._description_selection(
partner.env
)
value = str(dict(selection).get(value, value))
else:
value = str(value)
# Lock pre-filled values so the signer cannot change them;