From 674c8cf77b963f3d20e6439f6871b1640e9cd7b4 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Mon, 7 Jun 2021 11:36:38 +0530 Subject: [PATCH] chore: Use get_absolute_url to doc.get_url Avoid re-implementation to reduce interfaces for possible bugs/fixes --- frappe/model/document.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frappe/model/document.py b/frappe/model/document.py index 8f57aae475..61160e1f01 100644 --- a/frappe/model/document.py +++ b/frappe/model/document.py @@ -14,8 +14,8 @@ from frappe.model.workflow import set_workflow_state_on_action from frappe.utils.global_search import update_global_search from frappe.integrations.doctype.webhook import run_webhooks from frappe.desk.form.document_follow import follow_document -from frappe.desk.utils import slug from frappe.core.doctype.server_script.server_script_utils import run_server_script_for_doc_event +from frappe.utils.data import get_absolute_url # once_only validation # methods @@ -1200,8 +1200,8 @@ class Document(BaseDocument): doc.set(fieldname, flt(doc.get(fieldname), self.precision(fieldname, doc.parentfield))) def get_url(self): - """Returns Desk URL for this document. `/app/{doctype}/{name}`""" - return f"/app/{slug(self.doctype)}/{self.name}" + """Returns Desk URL for this document.""" + return get_absolute_url(self.doctype, self.name) def add_comment(self, comment_type='Comment', text=None, comment_email=None, link_doctype=None, link_name=None, comment_by=None): """Add a comment to this document.