コンテンツへスキップ
メニュー
この質問にフラグが付けられました
4 返信
2852 ビュー

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.

アバター
破棄

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

最善の回答

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

アバター
破棄
著作者

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

関連投稿 返信 ビュー 活動
1
4月 23
21846
1
7月 15
7235
0
3月 15
3767
2
10月 22
4900
1
7月 22
2145