İçereği Atla
Menü
Bu soru işaretlendi
4 Cevaplar
2843 Görünümler

Hey, so we have added a state system to an existing module in our odoo installation.

However i cant seem to make the approve button only appear if its in draft with a name set.

Here is what ive tried:

    <xpath expr="//div[@name='button_box']/.." position="before">

        <header>

            

            <xpath expr="//field[@name='name']">

              <button name="action_approve_contract" type="object" string="Approve Contract" state="draft" confirm="Please make sure you have checked all the information on this contract before approving it." domain="[('name', '!=', False)]"/>

              <button name="action_contract_send" type="object" string="Send by Email" groups="base.group_user" state="approved"/>

            </xpath>

            

            

            <field name="x_state" widget="statusbar" statusbar_visible="draft,approved,sent,cancel,expired"/>

        </header>

    </xpath>


The result of this is that both of the buttons arent showing at all, regardless of state and name field data.

Avatar
Vazgeç

Inheritance in model and views: https://goo.gl/4Zyc9d

En İyi Yanıt

Hi,
You can add it like this

<xpath expr="//div[@name='button_box']/.." position="before">

     <xpath expr="//field[@name='name']">

            <button name="action_approve_contract" type="object" string="Approve Contract" state="draft" confirm="Please make sure you have checked all the information on this contract before approving it." domain="[('name', '!=', False)]"/>

             <button name="action_contract_send" type="object" string="Send by Email" groups="base.group_user" state="approved"/>

        </xpath>

</xpath>


Thanks & Regards
Urvisha (Odoo Developer)
Caret IT Solutions Pvt Ltd

Avatar
Vazgeç
Üretici

Does the state="approved" work even in the case of custom state selection e.g. my field is x_state

you can try it in both cases

İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Nis 23
21831
1
Tem 15
7223
0
Mar 15
3751
2
Eki 22
4877
1
Tem 22
2137