Odoo Help

4

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

By
NIKHIL KRISHNAN
on 7/16/16, 7:36 AM 388 views

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')
1
NIKHIL KRISHNAN
On 7/19/16, 11:44 PM

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..

0
Chirag Chauhan (chc)
On 2/13/17, 1:15 AM

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

     

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 7/16/16, 7:36 AM
Seen: 388 times
Last updated: 3/3/17, 10:52 PM