strike_noir
strike_noir

Reputation: 4174

Output field as text in Odoo View

Straight to question. Can we output a field as text only in Odoo View?

    <record id="view_of_a_model" model="ir.ui.view">
        <field name="name">the_name_of_the_view</field>
        <field name="model">a.beautiful.model</field>
        <field name="arch" type="xml">
            <form>
                <sheet>
                    How to output fields as text here?
                </sheet>
            </form>
        </field>
    </record>

I want to add more explanation. What I wanted is something like...

<a href="http://localhost/DSLNG/dbo_View_PatientVisit_list.php?qs=??????put the field as text here??????" target="_blank">Open record in other application</a>

Sorry for confusion

PS : It seems that people think that using field tag is the way to go. But using field tag will display the field as input when in Edit mode. What I want is display it as text, regardless of the current view mode.

Upvotes: 2

Views: 1901

Answers (1)

Sankar guru
Sankar guru

Reputation: 1015

Text in odoo view

Python code:

notes = fields.Text(string='Notes') 

XML view:

<record id="view_of_a_model" model="ir.ui.view">
    <field name="name">the_name_of_the_view</field>
    <field name="model">a.beautiful.model</field>
    <field name="arch" type="xml">
        <form>
            <sheet>
               <i>notes</i> ===> Text here 
                <field name="notes" />
            </sheet>
        </form>
    </field>
</record>

Upvotes: 3

Related Questions