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

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.

Imagine profil
Abandonează

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

Cel mai bun răspuns

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

Imagine profil
Abandonează
Autor

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

Related Posts Răspunsuri Vizualizări Activitate
1
apr. 23
21822
1
iul. 15
7220
0
mar. 15
3751
2
oct. 22
4863
1
iul. 22
2135