Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3 Antwoorden
10843 Weergaven

There is a way to remove an attribute completely:

<xpath expr="//field[@name='order_line']/tree" position="attributes">
    <attribute name="editable"/>
</xpath>

And there is a way to completely replace an attribute with smth else:

<xpath expr="//label[@for='type']" position="attributes">
    <attribute name="groups">sale.group_delivery_invoice_address</attribute>
    <attribute name="invisible">False</attribute>
</xpath>

But is there a short way to append a value to an attribute?

So that after appending my_second_class to attribute class in <div class="my_first_class"> we receive <div class="my_first_class my_second_class">.

Avatar
Annuleer
Beste antwoord

I think there is no way to do such thing for attributes.
Your only choice is to retype the previous value of the attribute!

Avatar
Annuleer
Auteur

Looks like nobody knows of a better solution, indeed. Let's mark yours as a good one then.

Beste antwoord

Yes, there is. If you have an element like


    <div id="my_div" class="my_first_class">


You can add something to the class-attribute using the following xpath:


    <xpath expr="//div[@id='my_div']" position="attributes">
    <attribute name="class" separator=" " add="my_second_class"/>
    </xpath>

The resulting div would look like:

    <div id="my_div" class="my_first_class my_second_class">

Avatar
Annuleer

this is a new thingI guess, which odoo version?

I didn't check older versions than V13, but I can say that it works at least in V13, V14, V15, V16 and V17.

Gerelateerde posts Antwoorden Weergaven Activiteit
0
jan. 22
1987
1
jan. 19
8872
0
dec. 24
1336
0
dec. 24
1174
2
jul. 24
3123