Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
2860 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ

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

Câu trả lời hay nhấ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

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 23
21853
1
thg 7 15
7249
0
thg 3 15
3772
2
thg 10 22
4913
1
thg 7 22
2175