I am trying to have a banner in form view. The banner has to contain text dynamically selected from the form view field value. My code is below. You may refer to the image attached.
========================================================
Controller
========================================================
from odoo import http
class TestController(http.Controller):
@http.route("/test/", type='json', auth='user')
def test_det(self):
htm_result = """<html><body>
<div class="bg-info text-center p-2">
<b> Document: XMLID (Dynamic Document name and XMLID) </b>
</div>
</body>
</html>
"""
return {'html': htm_result}
===========================================================
Form View
===========================================================
<record id="template_module_tree_view" model="ir.ui.view" style="color:#e8bf6a;">>
<field name="name">template.module.tree style="color:#e8bf6a;"></field>
<field name="model">template.module</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
</tree>
</field>
</record>
<record id="template_module_form" model="ir.ui.view" style="color:#e8bf6a;">>
<field name="name">template.module.form style="color:#e8bf6a;"></field>
<field name="model">template.module</field>
<field name="arch" type="xml">
<form banner_route="/test/"> # banner_route to call controller
<sheet>
<group name="main">
<group name="left">
<field name="name"/>
</group>
<group name="right"></group>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids"/>
<field name="activity_ids"/>
<field name="message_ids"/>
</div>
</form>
</field>
</record>
<record id="template_module_action" model="ir.actions.act_window">
<field name="name">Template Module</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">template.module</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new record!
</p>
</field>
</record>