Odoo Help

0

How to creare drill down tree view in odoo V8 ?

By
Mohammed Khamis
on 12/30/15, 8:07 AM 517 views

Please I would like to create drill down like chart of account view , how can I make it .

Thanks in advance

1

hierarchy.py

#-*- coding: utf-8 -*-
from openerp import models, fields, api
class hierarchy(models.Model):
    _name = 'hierarchy'
    parent_id = fields.Many2one('hierarchy',string='Superior Level')
    code = fields.Char('Code',required=True)
    name = fields.Char('Name')
    child_ids = fields.One2many('hierarchy', 'parent_id',string='Sub Levels')


hierarchy_view.xml

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
        <!-- views -->
        <!-- form view -->
        <record id="view_form_hierarchy" model="ir.ui.view">
            <field name="name">hierarchy Form</field>
            <field name="model">hierarchy</field>
            <field name="arch" type="xml">
                <form>
                    <group>
                        <field name="parent_id"/>
                        <field name="code"/>
                        <field name="name"/>
                        <field name="child_ids"/>
                    </group>
                </form>
            </field>
    </record>
    <!-- tree ( tree ) view -->
    <record id="view_tree_hierarchy" model="ir.ui.view">
        <field name="name">hierarchy Tree</field>
        <field name="model">hierarchy</field>
        <field name="field_parent">child_ids</field>
        <field name="arch" type="xml">
            <tree toolbar="1">
                <field icon="icon" name="code"/>
                <field name="name"/>
            </tree>
        </field>
    </record>
    <!-- Actions -->
    <record model="ir.actions.act_window" id="action_hierarchy">
        <field name="name">hierarchy</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">hierarchy</field>
        <field name="view_type">tree</field>
        <field name="domain">[('parent_id','=',False)]</field>
    </record>
    <!-- Menu items -->
    <menuitem id="root_hierarchy" name="hierarchy"/>
    <menuitem id="menu_hierarchy" name="Menu" parent="root_hierarchy"/>
    <menuitem id="hierarchy_opcion" name="hierarchy" parent="menu_hierarchy" sequence="20" action="action_hierarchy"/>
    </data>

</openerp>

how to open a model while clicking on it(in odoo 9).

like chart of accounts in odoo 8

kampeons
on 2/16/17, 11:22 PM

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: 12/30/15, 8:07 AM
Seen: 517 times
Last updated: 1/9/17, 5:58 AM