[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:
@@ -121,8 +121,15 @@ class DocusealTemplate(models.Model):
|
|||||||
value = partner[field_name]
|
value = partner[field_name]
|
||||||
if hasattr(value, "strftime"):
|
if hasattr(value, "strftime"):
|
||||||
value = value.strftime("%d/%m/%Y")
|
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:
|
elif value is False or value is None:
|
||||||
value = ""
|
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:
|
else:
|
||||||
value = str(value)
|
value = str(value)
|
||||||
# Lock pre-filled values so the signer cannot change them;
|
# Lock pre-filled values so the signer cannot change them;
|
||||||
|
|||||||
Reference in New Issue
Block a user