Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
13263 Vizualizări

From always, Xpath has matched all elements with a given query, and I had to add [1] at the end to match only the first match.

In OpenERP 7 I have this view definition:

<record id="view" model="ir.ui.view">
    <field name="name">mail.message.full_expand</field>
    <field name="model">mail.message</field>
    <field name="inherit_id" ref="mail.view_message_form"/>
    <field name="arch" type="xml">
        <xpath expr="//field" position="attributes">
            <attribute name="readonly">1</attribute>
        </xpath>
    </field>
</record>

Its purpose is to copy another view, but fully read-only. However it stops at the first match. Is there any way to make Xpath match every field?

Imagine profil
Abandonează
Cel mai bun răspuns

You want to edit the root form tag directly to give it edit="false":

 <record id="view" model="ir.ui.view">
    <field name="name">mail.message.full_expand</field>
    <field name="model">mail.message</field>
    <field name="inherit_id" ref="mail.view_message_form"/>
    <field name="arch" type="xml">
        <xpath expr="/form" position="attributes">
            <attribute name="edit">false</attribute>
        </xpath>
    </field>
</record>
Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
aug. 24
2186
2
mai 24
2915
2
mar. 22
9826
1
ian. 22
2704
4
sept. 20
6160