Tags

,


.py selection field.

class sale_order(osv.osv):
    _inherit="sale.order"
    _columns ={
        'resource_selection':fields.selection([
                                               ('customer','Customer'),
                                               ('lead','Lead'),
                                               ],default='customer'),
    }

.xml file

<record id="ep_sale_view_order_form" model="ir.ui.view">
   <field name="name">Sale</field>
   <field name="model">sale.order</field>
   <field name="inherit_id" ref="sale.view_order_form"/>
   <field name="arch" type="xml">
              <xpath expr="//field[@name='partner_id']" position="before">
                  <field name="resource_selection" string="Resource"/>

             </xpath>
              <field name="partner_id"  position="replace">
                  <field name="partner_id" attrs="{'invisible':[('resource_selection','=','lead')]}" />
              </field>
   </field>
</record>
Advertisements