title: How to create a dynamic view on OpenERP
body: <p>I need a help to create a dynamic view. Let me explain: I have Form1 and Form2 views. Form1 contains <code>expression</code> field and <code>extract</code> button. Form2 contains extracted elements of the expression from Form1. For example when you enter <code>(a+b)*c-d*0,5</code> to Form1's expression field, Form2 should extract and display this:</p>
  
  <pre><code>( - open brace
  a - variable
  + - addition
  b - variable
  ) - close brace
  * - multiplication
  c - variable
  - - subtraction
  d - variable
  * - multiplication
  0,5 - constant number
  </code></pre>
  
  <p>Now, here is my class:</p>
  
  <pre><code>class wz_formula(osv.osv_memory):
      """
          Formula Wizard
      """
      _name = "wz.formula"
      _inherit = "ir.wizard.screen"
      _description = "Formula Wizard"
  
      _columns = {
              'name': fields.char('Formula name', required=True, size=64)
              , 'expression': fields.char('expression', required=True, size=64)
              , 'state': fields.selection([('init','init'),('done','done')], 'state', readonly=True)
      }
  
      _defaults = {
              'state': 'init'
      }
  
      def next(self, cr, uid, ids, context=None):
          if context is None:
              context = {}
          formula_obj = self.browse(cr, uid, ids)[0]
          formula_name = formula_obj.name
          infix = formula_obj.expression
          if formula_name and expression:
              modobj = self.pool.get('ir.module.module')
              mids = modobj.search(cr, uid, [('state', '=', 'installed')])
              modobj.update_translations(cr, uid, mids, [formula_name, expression], context or {})
              self.write(cr, uid, ids, {'state': 'done'}, context=context)
          return {
              'name': _('Formula')
              , 'view_type': 'form'
              , 'view_mode': 'form'
              , 'view_id': False
              , 'res_model': 'wz.formula'
              , 'domain': []
              , 'context': dict(context, active_ids=ids)
              , 'type': 'ir.actions.act_window'
              , 'target': 'new'
              , 'res_id': ids and ids[0] or False
          }
  
  # create an object
  wz_formula()
  </code></pre>
  
  <p>Here is my xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;openerp&gt;
      &lt;data&gt;
  
          &lt;record id="view_wz_formula" model="ir.ui.view"&gt;
              &lt;field name="name"&gt;Formula&lt;/field&gt;
              &lt;field name="model"&gt;wz.formula&lt;/field&gt;
              &lt;field name="type"&gt;form&lt;/field&gt;
              &lt;field name="arch" type="xml"&gt;
                  &lt;form string="Formula"&gt;
                      &lt;group colspan="8" col="8" states="init"&gt;
                          &lt;separator string="Formula" colspan="8"/&gt;
                          &lt;field name="state" invisible="1"/&gt;
                          &lt;field name="name"/&gt;
                          &lt;field name="expression" width="220"/&gt;
                          &lt;button special="cancel" string="Cancel" icon="gtk-cancel" colspan="1"/&gt;
                          &lt;button name="next" string="Next" type="object" icon="gtk-ok" colspan="1"/&gt;
                      &lt;/group&gt;
                      &lt;group colspan="8" col="8" states="done"&gt;
                          &lt;separator string="Done" colspan="8"/&gt;
                          &lt;button special="cancel" string="Close" icon="gtk-cancel"/&gt;
                      &lt;/group&gt;
                  &lt;/form&gt;
             &lt;/field&gt;
          &lt;/record&gt;
  
          &lt;record id="action_view_wz_formula" model="ir.actions.act_window"&gt;
              &lt;field name="name"&gt;Formula&lt;/field&gt;
              &lt;field name="type"&gt;ir.actions.act_window&lt;/field&gt;
              &lt;field name="res_model"&gt;wz.formula&lt;/field&gt;
              &lt;field name="view_type"&gt;form&lt;/field&gt;
              &lt;field name="view_mode"&gt;form&lt;/field&gt;
              &lt;field name="target"&gt;new&lt;/field&gt;
          &lt;/record&gt;
  
          &lt;menuitem
              name="Create a formula"
              action="action_view_wz_formula"
              id="menu_view_wz_formula"
              parent="menu_fs_root" sequence="2"/&gt;
  
      &lt;/data&gt;
  &lt;/openerp&gt;
  </code></pre>
  
  <p>So far, it just switches between Form1 and Form2. How can I extract the expression as I explained above?</p>