@@ -50,22 +50,26 @@ def _get_document(self, code):
5050
5151 def get_content (self ):
5252 self .ensure_one ()
53- raw = self .content or ""
53+ raw = str ( self .content or "" )
5454 content_parsed = Markup (raw )
5555 for text in re .findall (r"\{\{.*?\}\}" , raw ):
5656 reference = re .sub (r"<[^>]*>" , "" , text ).replace ("{{" , "" ).replace ("}}" , "" )
5757 content_parsed = content_parsed .replace (
5858 text , self ._resolve_reference (reference )
5959 )
60+ # Find all oe_direct_line links and re-resolve them
61+ # We look for a <a> tag with class='oe_direct_line' and its 'name' attribute
62+ # name attribute contains the reference code
6063 link_regex = (
6164 r"<a[^>]*class=['\"][^'\"]*oe_direct_line[^'\"]*['\"]"
6265 r"[^>]*name=['\"]([^'\"]*)['\"][^>]*>.*?</a>"
6366 )
6467 for match in re .finditer (link_regex , raw ):
6568 full_link = match .group (0 )
6669 reference = match .group (1 )
70+ # Ensure we replace exactly what was found in raw
6771 content_parsed = content_parsed .replace (
68- full_link , self ._resolve_reference (reference )
72+ Markup ( full_link ) , self ._resolve_reference (reference )
6973 )
7074 return content_parsed
7175
@@ -91,7 +95,7 @@ def _resolve_reference(self, code):
9195 )
9296
9397 def get_raw_content (self ):
94- return Markup (self .with_context (raw_reference = True ).get_content ())
98+ return str (self .with_context (raw_reference = True ).get_content ())
9599
96100 @api .model_create_multi
97101 def create (self , vals_list ):
0 commit comments