title: How to hide a field on a one2many in openerp?
body: <p>I have customize the sale order menu in openerp making it into two menus named as "Local" and the other one is "Export". 
  I add some field at <strong>sale.order</strong> class:</p>
  
  <pre><code>'is_local' : fields.boolean('Local'), #Default as true if user clicked the Local menu.
  'is_export' : fields.boolean('Export'), #Default as true if user clicked the Export menu.
  </code></pre>
  
  <p>and at <strong>sale.order.line</strong> class:</p>
  
  <pre><code>'is_local' : fields.related('order_id','is_local',type='boolean',string='Local',store=True)
  'is_export' : fields.related('order_id','is_export',type='boolean',string='Export',store=True)
  'length' : fields.float('Length', digits=(12,2)),
  'width' : fields.float('Width', digits=(12,2)),
  'height' : fields.float('Height', digits=(12,2)),
  </code></pre>
  
  <p>The situation is this, if i will click the Local menu the fields: <strong>length</strong>, <strong>width</strong>, and <strong>height</strong> at sale.order.line must be hide on the view.</p>
  
  <p>I did this on my sale_order view:</p>
  
  <pre><code>&lt;field name="order_line" context="{'default_is_local': local}"/&gt;
      &lt;tree string="Order line"&gt;
          &lt;field name="is_local"/&gt;
          &lt;field name="length" invisible="context.get('is_local',True)"/&gt;
      .
      .
      .
  &lt;/field&gt;
  </code></pre>
  
  <p>Using <strong>invisible="context.get('is_local',True)"</strong>, its problem that is it also hide the field if i choose the export menu w/c is not supposed to be hide. When i use <strong>attrs="{'invisible':[('is_local','=',True)]}"</strong> it doesn't hide the field both on Local and Export Menu. I don't know what technique is to be use.</p>
  
  <p>I am using openerp v7</p>
  
  <p><strong>Any help is much appreciated!</strong></p>
  
  <p>======================================
  EDIT</p>
  
  <pre><code>&lt;record id="view_order_form_inherit" model="ir.ui.view"&gt;
  &lt;field name="name"&gt;biz1.view.order.sale&lt;/field&gt;
  &lt;field name="model"&gt;sale.order&lt;/field&gt;
  &lt;field name="inherit_id" ref="sale.view_order_form" /&gt;
  &lt;field name="priority"&gt;1&lt;/field&gt;
  &lt;field name="arch" type="xml"&gt;
      &lt;xpath expr="//field[@name='partner_id']" position="after"&gt;
          &lt;field name="is_export" attrs="{'invisible':[('is_export','=',False)]}" /&gt;
          &lt;field name="is_local" attrs="{'invisible':[('is_local','=',False)]}" /&gt;
      &lt;/xpath&gt;
      &lt;xpath expr="//field[@name='order_line']" position="replace"&gt;
          &lt;field name="order_line" context="{'default_is_local':is_local}"
              colspan="4" nolabel="1" widget="one2many_list"&gt;
              &lt;tree string="Order Line" editable="bottom" /&gt;
              &lt;field name="sequence" widget="handle" /&gt;
              &lt;field name="state" invisible="1" /&gt;
              &lt;field name="th_weight" invisible="1" /&gt;
              &lt;field name="is_local" /&gt;
              &lt;field name="product_id"
                  context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
                  groups="base.group_user"
                  on_change="product_id_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, True, parent.date_order, False, parent.fiscal_position, False, context)" /&gt;
              &lt;field name="name" /&gt;
              &lt;field name="product_uom_qty"
                  context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
                  on_change="product_id_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, False, parent.date_order, False, parent.fiscal_position, True, context)" /&gt;
              &lt;field name="product_uom"
                  on_change="product_uom_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, False, parent.date_order, context)"
                  groups="product.group_uom" options='{"no_open": True}' /&gt;
              &lt;field name="product_uos_qty" groups="product.group_uos"
                  invisible="1" /&gt;
              &lt;field name="product_uos" string="UoS" groups="product.group_uos"
                  invisible="1" /&gt;
              &lt;field name="tax_id" widget="many2many_tags"
                  domain="[('parent_id','=',False),('type_tax_use','&amp;lt;&amp;gt;','purchase')]" /&gt;
              &lt;field name="price_unit" /&gt;
              &lt;field name="length" invisible="context.get('is_local',True)"  /&gt;
              &lt;field name="width" invisible="context.get('is_local',True)"   /&gt;
              &lt;field name="height" invisible="context.get('is_local',True)"  /&gt;
              &lt;field name="discount" groups="sale.group_discount_per_so_line" /&gt;
              &lt;field name="price_subtotal" /&gt;
          &lt;/tree&gt;
          &lt;/field&gt;
      &lt;/xpath&gt;
  &lt;/field&gt;&lt;/record&gt;
  
  
  &lt;!-- ##### LOCAL SO #### --&gt;
  
  &lt;record id="action_local_sale_orders" model="ir.actions.act_window"&gt;
  &lt;field name="name"&gt;Local SO&lt;/field&gt;
  &lt;field name="res_model"&gt;sale.order&lt;/field&gt;
  &lt;field name="view_type"&gt;form&lt;/field&gt;
  &lt;field name="view_mode"&gt;tree,form,calendar,graph&lt;/field&gt;
  &lt;field name="view_id" ref="view_order_form_inherit" /&gt;
  &lt;field name="context"&gt;
      {'default_is_local':'1'}
  &lt;/field&gt;
  &lt;field name="domain"&gt;[('is_local','=','1')]&lt;/field&gt;
  &lt;field name="help" type="html"&gt;
      &lt;p class="oe_view_nocontent_create"&gt;
          Click to create a quotation that can be converted into a sales order.
       &lt;/p&gt;
      &lt;p&gt;
          OpenERP will help you efficiently handle the complete sales flow: quotation,
          sales order, delivery, invoicing and payment.
      &lt;/p&gt;
  &lt;/field&gt;
  &lt;/record&gt;
  
  &lt;menuitem action="action_local_sale_orders" name="Local"
  id="menu_local_sale_order" parent="base.menu_sales" sequence="6"
  groups="base.group_sale_salesman,base.group_sale_manager" /&gt;
  
  
  &lt;!-- ##### EXPORT SO #### --&gt;
  
  &lt;record id="action_export_sale_orders" model="ir.actions.act_window"&gt;
  &lt;field name="name"&gt;Export SO&lt;/field&gt;
  &lt;field name="res_model"&gt;sale.order&lt;/field&gt;
  &lt;field name="view_type"&gt;form&lt;/field&gt;
  &lt;field name="view_mode"&gt;tree,form,calendar,graph&lt;/field&gt;
  &lt;field name="view_id" ref="view_order_form_inherit" /&gt;
  &lt;field name="context"&gt;
      {'default_is_export':'1'}
  &lt;/field&gt;
  &lt;field name="domain"&gt;[('is_export','=','1')]&lt;/field&gt;
  &lt;field name="help" type="html"&gt;
      &lt;p class="oe_view_nocontent_create"&gt;
          Click to create a quotation that can be converted into a sales order.
       &lt;/p&gt;
      &lt;p&gt;
          OpenERP will help you efficiently handle the complete sales flow: quotation,
          sales order, delivery, invoicing and payment.
      &lt;/p&gt;
  &lt;/field&gt;
  &lt;/record&gt;
  
  &lt;menuitem action="action_export_sale_orders" name="Export"
  id="menu_export_sale_order" parent="base.menu_sales" sequence="6"
  groups="base.group_sale_salesman,base.group_sale_manager" /&gt;
  </code></pre>