Help

4

How to create a view which is same as the Opportunity tree view.?

Avatar
Nikhil Krishnan

In Xml

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
 <data>
 <record model="ir.actions.act_window" id="crm_todo_reminder">
 <field name="name">Todo</field>
 <field name="res_model">todo.my_todo</field>
 <field name="view_mode">tree</field>
 </record>
 <menuitem name="Todo Reminder" id="menu_crm_todo_reminder" parent="base.menu_base_partner" sequence="3" groups="base.group_sale_manager"/>
 <menuitem name="To do Reminder" id="menu_crm_leads" parent="menu_crm_todo_reminder" sequence="3" action="crm_todo_reminder"/>
 <!--************TREE VIEW******************************8-->
 <record model="ir.ui.view" id="crm_case_tree_view_oppor">
 <field name="name">Todo Opportunities Tree</field>
 <field name="model">todo.my_todo</field>
<field name="arch" type="xml">
<tree editable="bottom">
<field name="opportunity"/>
</tree>
 </field>
</record>>
</data>
</openerp>

In Python

from openerp import models, fields, api
class MyTodo(models.Model):
 _name = "todo.my_todo"
 opportunity = fields.One2many('crm.lead', 'todo', string='To DO')

class Opportunity(models.Model):
 _inherit = "crm.lead"
 todo = fields.Many2one('res.user', string='Partner')
Avatar
Discard
2 Answers
2
Avatar
Nikhil Krishnan
Best Answer

used " _name" to create a new table  todo_my_todo . So its inherits the table fields in a new table.  But not the data.So i just use the same table, that is crm.lead to get the data. i get the views as well as the data too..

Avatar
Discard
0
Avatar
Chirag Chauhan (chc)
Best Answer

hello NIKHIL KRISHNAN,

you can inherit module like

                 _inherit  = "todo.my_todo"

than you can see same view which shown in MyTodo module

thank you

     

1 Comment
Avatar
Discard
Avatar
Nikhil Krishnan
-

Thanks