[已解决]根据form数据 控制默认按钮(编辑/创建)
-
<record id="invoice_form_inherit" model="ir.ui.view">
<field name="name">invoice.form.inherit</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<xpath expt='//form[@string="Invoice"]' possition='attributes'>
<!-- Frist intent : nothing happened -->
<attribute name="edit" attrs="{'invisible:[('state','=','paid')]'}"/>
<!-- Second intent : edit, always hide -->
<attribute name="edit" attrs="{'invisible:[('state','=','paid')]'}">false</field>
<!-- Thirds intent : edit, never hide -->
<attribute name="edit" attrs="{'invisible:[('state','=','paid')]'}">true</field>
</field> -
attrs="{'invisible:[('state','=','paid')]'
is not needed
-