Skip to content

Commit 05ef1be

Browse files
committed
[FIX] util/report: Make 'name' argument optional
This [commit](odoo#215) ensure that if the name argument is not provided, it will automatically generate a default value for name based on the model and id. When we call method get_anchor_link_to_record without name, it fails with ``` TypeError: get_anchor_link_to_record() missing 1 required positional argument: 'name' ``` Updated get_anchor_link_to_record to default 'name' to None if not provided. Also added a check to ensure 'id' is not a tuple before proceeding with its use.
1 parent 9b2e0ac commit 05ef1be

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/util/report.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,11 @@ def ref(xid):
319319
_logger.warning("Cannot unfold chat window", exc_info=True)
320320

321321

322-
def get_anchor_link_to_record(model, id, name, action_id=None):
322+
def get_anchor_link_to_record(model, id, name=None, action_id=None):
323323
_validate_model(model)
324324
if not name:
325+
if isinstance(id, tuple):
326+
id = id[0]
325327
name = "{}(id={})".format(model, id)
326328
if version_gte("saas~17.2"):
327329
part1 = "action-{}".format(action_id) if action_id else model

0 commit comments

Comments
 (0)