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
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
2
Replies
21710
Views
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!
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
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
4
Sep 24
|
22243 | ||
|
3
Nov 18
|
3086 | ||
|
1
Sep 24
|
88 | ||
|
0
Sep 24
|
71 | ||
|
2
Dec 24
|
401 |