跳至内容
菜单
此问题已终结
3 回复
6558 查看

Create a new status in quotation, but when I change the quotation in my new status, the confirm sales button disappears.

Add these lines to my view by inheriting from sale.order

<xpath expr="//button[@name='action_confirm']" position="attributes"> <attribute name="visible"> [('state', '=', 'pending')]</attribute> </xpath>

But it does not work.

形象
丢弃
最佳答案

Hi Michael,

please check this eg:

if button is defined like this:

<button name="action_confirm" states="draft" string="Confirm Sale" type="object" context="{'show_sale': True}"/>

Replace it like:

<xpath expr="//button[@name='action_confirm']" position="replace">

    <button name="action_confirm" states="draft,pending" string="Confirm Sale" type="object" context="{'show_sale': True}"/>

</xpath>

形象
丢弃
最佳答案

 When states property is added to a button, you cannot use invisible or attrs to control the visibility, because it simply doesn't work, instead try to add convenient property i.e either stick to states or go with attrs, but not both to a button. 

So if want to change the states, then  try this below one

<xpath expr="//button[@name='action_confirm']" position="attributes"> 
<attribute name="states">pending</attribute>
</xpath>
形象
丢弃