콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
10839 화면

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">.

아바타
취소
베스트 답변

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

아바타
취소
작성자

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

베스트 답변

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">

아바타
취소

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.

관련 게시물 답글 화면 활동
0
1월 22
1985
1
1월 19
8870
0
12월 24
1335
0
12월 24
1173
2
7월 24
3122