Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

how do display multiple views with different fields

By
Anuradha
on 9/7/13, 2:40 AM 5,431 views
i want to display two types of from views of my model in 2 different cases . But in both case it shows same form view.
I passed view_id for loading 2nd form view and  checked its value in database and it shows correct. Then why it always loads the first one? my code is

def add_caller(self, cr, uid, ids, context=None):

         models_data = self.pool.get('ir.model.data')
          view_id = models_data._get_id(
                                       cr, uid, 'calldetails1', 'calldata_form_view_popup')

            return {
               'type': 'ir.actions.act_window',
                'view_mode': 'form',
              'view_type': 'form',
               'view_id':view_id,
               'res_model': 'calldata1',
              'target':'new',
              'context': context,
}

    }

and my xml is

 <record model="ir.ui.view" id="calldata_form_view_popup">
   <field name="name">calldata1.form</field>
   <field name="model">calldata1</field>
   <field name="type">form</field>
   <field name="priority" eval="2"/>
   <field name="arch" type="xml">
   <form string="calldata">
     <field name="caller" string="Caller"/>
     <button name="save" type="object"  string="Save" class="oe_highlight"/>
    <button string="Cancel" class="oe_link" special="cancel"/>
    </form>
</field>
</record>
 <record model="ir.actions.act_window" id="action_calldata_popup_form">
   <field name="name">Calldetails</field>
   <field name="res_model">calldata1</field>
    <field name="view_type">form</field>
   <field name="view_mode">form</field>
   <field name="view_id" ref="calldata_form_view_popup"/>
</record>
 <record model="ir.ui.view" id="calldata_form_view">
   <field name="name">calldata1.form</field>
   <field name="model">calldata1</field>
   <field name="priority" eval="1"/>
   <field name="type">form</field>
   <field name="arch" type="xml">
   <form string="calldata">
        <field name="caller" string="Caller"/>
    </form>
 </field>
 </record>

 <record model="ir.actions.act_window" id="action_calldata_form">
   <field name="name">Calldetails</field>
   <field name="res_model">calldata1</field>
   <field name="view_type">form</field>
   <field name="view_mode">tree,form,graph,calendar</field>
</record>
Any one please help
0
Lucas Huber
On 9/18/15, 7:42 AM

This worked for me:

<record id="act_exchange_transaction_line_new" model="ir.actions.act_window">
    <field name="name">Transaction Line Message new </field> 
    <field name="view_id" ref="view_transaction_line_info_form"/> 
    <field name="res_model">exchange.transaction.line</field> 
    <field name="view_type">form</field> 
    <field name="view_mode">form</field>             
    field name="target">new</field> 
</record>

 

<field name="act_window_id"> did not work. 
But does anybody know how to integrate <field name="view_id" ref="view_transaction_line_info_form"/> into a function?

'view_id': 'view_transaction_line_info_form',

The line above does not work!

0
Anuradha
On 9/7/13, 8:40 AM
Solved the  issue by using   ir.actions.act_window.view
Changed code as 
 <record model="ir.ui.view" id="calldata_form_view">
   <field name="name">calldata1.form</field>
   <field name="model">calldata1</field>
   <field name="priority" eval="2"/>
   <field name="type">form</field>
   <field name="arch" type="xml">
   <form string="calldata">
          <field name="caller" string="Caller"/>
  </form>
 </field>
 </record>
 <record model="ir.actions.act_window" id="action_calldata_form">
   <field name="name">Calldetails</field>
   <field name="res_model">calldata1</field>
   <field name="view_type">form</field>
   <field name="view_mode">form,itree,graph,calendar</field>
 </record>
<record id="calldata_form_action_tree_view" model="ir.actions.act_window.view">
    <field eval="1" name="sequence"/>
    <field name="view_mode">tree</field>
    <field name="view_id" ref="calldata_tree_view"/>
    <field name="act_window_id" ref="action_calldata_form"/>
  </record>
  <record id="calldata_form_action_form_view" model="ir.actions.act_window.view">
    <field eval="2" name="sequence"/>
    <field name="view_mode">form</field>
    <field name="view_id" ref="calldata_form_view"/>
    <field name="act_window_id" ref="action_calldata_form"/>
  </record>
  <record model="ir.ui.view" id="calldata_form_view_popup">
   <field name="name">calldata1.form</field>
   <field name="model">calldata1</field>
   <field name="type">form</field>
   <field name="priority" eval="1"/>
   <field name="arch" type="xml">
   <form string="calldata">
        <field name="caller" string="Caller"/>
  </form>
   </field>
  </record>
 <record model="ir.actions.act_window" id="action_calldata_popup_form">
    <field name="name">Calldetails</field>
    <field name="res_model">calldata1</field>
    <field name="view_type">form</field>
    <field name="view_mode">form</field>
    <field name="view_id" ref="calldata_form_view_popup"/>
  </record>

and removed view_id from return

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/7/13, 2:40 AM
Seen: 5431 times
Last updated: 8/19/16, 3:46 AM