Skip to Content
Menu
This question has been flagged
1 Reply
4667 Views

I have created a custom module in odoo 8 that allows me to add a sub_menu "convention" which I want to display a pivot view to display the numbers of the convention used as a table. My problem is how to display a pivot view because I found a problem to display a pivot view with version 8 of odoo. I tried this module with version 9 of odoo and it works well but with version 8 even the icon of the pivot view is not displayed. Any idea for help please?
here is a link to an image to explain my problem https://ibb.co/io0uZJ

Convention.xml 

<?xml version="1.0" encoding="UTF-8"?>

<openerp>
<data>
  <record id="convention_table_tree_view" model="ir.ui.view">
    <field name="name">Convention Table Tree View</field>
    <field name="model">hr.convention</field>
    <field name="arch" type="xml">
        <tree>
            <field name="Degree"/>
            <field name="Categorie_11"/>
            <field name="Categorie_12"/>
            <field name="Categorie_13"/>
            <field name="Categorie_21"/>
            <field name="Categorie_22"/>
            <field name="Categorie_23"/>
            <field name="Categorie_31"/>
            <field name="Categorie_32"/>
            <field name="Categorie_33"/>
            <field name="Categorie_41"/>
            <field name="Categorie_42"/>
            <field name="Categorie_43"/>
        </tree>
    </field>
</record>
<!-- salary_table graph view -->
<record id="convention_table_graph_view" model="ir.ui.view">
    <field name="name">Convention Table Graph View</field>
    <field name="model">hr.convention</field>
    <field name="arch" type="xml">
        <graph>              
            <field name="Degree" type="row"/>
        </graph>
    </field>
</record>
<!-- salary_table Pivot view -->
<record id="convention_table_pivot_view" model="ir.ui.view">
    <field name="name">Salary Table Pivot View</field>
    <field name="model">hr.convention</field>
    <field name="arch" type="xml">
        <graph string="pivot" type="pivot">
            <field name="Categorie_11" type="measure"/>
            <field name="Categorie_12" type="measure"/>
            <field name="Categorie_13" type="measure"/>
            <field name="Categorie_21" type="measure"/>
            <field name="Categorie_22" type="measure"/>
            <field name="Categorie_23" type="measure"/>
            <field name="Categorie_31" type="measure"/>
            <field name="Categorie_32" type="measure"/>
            <field name="Categorie_33" type="measure"/>
            <field name="Categorie_41" type="measure"/>
            <field name="Categorie_42" type="measure"/>
            <field name="Categorie_43" type="measure"/>
            <field name="Degree" type="row"/>
        </graph>
    </field>
</record>

    <record model="hr.convention" id="five1">
    <field name="Categorie_11" >2.253</field>
    <field name="Categorie_12" >2.418</field>
    <field name="Categorie_13" >2.494</field>
    <field name="Categorie_21" >2.548</field>
    <field name="Categorie_22" >2.784</field>
    <field name="Categorie_23" >2.964</field>
    <field name="Categorie_31" >3.165</field>
    <field name="Categorie_32" >3.321</field>
    <field name="Categorie_33" >3.396</field>
    <field name="Categorie_41" >3.165</field>
    <field name="Categorie_42" >3.321</field>
    <field name="Categorie_43" >3.396</field>
    <field name="Degree" >Degree_1</field>
</record>

<!-- salary_table Action -->
<record model="ir.actions.act_window" id="action_convention">
    <field name="name">Salary Table</field>
    <field name="res_model">hr.convention</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form,graph,pivot</field>
</record>


    <!-- convention menu item -->

     <menuitem action="action_convention" id="hr_menu_convention" parent="hr.menu_hr_configuration" name="Convention" sequence="0" groups="base.group_hr_manager"/>


</data>
</openerp> 

hr_convention.py

 from openerp.osv import fields, osv


 class Convention(osv.osv):
_name = 'hr.convention'
_columns = {

 "Degree" : fields.char(string="Degree"),
"Categorie_11"  : fields.float(string="Categorie_11"), 
"Categorie_12"  : fields.float(string="Categorie_12"),
"Categorie_13"  : fields.float(string="Categorie_13"),
"Categorie_21"  : fields.float(string="Categorie_21"),
"Categorie_22"  : fields.float(string="Categorie_22"),
"Categorie_23"  : fields.float(string="Categorie_23") ,
"Categorie_31"  : fields.float(string="Categorie_31"),
"Categorie_32"  : fields.float(string="Categorie_32"),
"Categorie_33"  : fields.float(string="Categorie_33"),
"Categorie_41"  : fields.float(string="Categorie_41"),
"Categorie_42"  : fields.float(string="Categorie_42"),
"Categorie_43"  : fields.float(string="Categorie_43"),

    }
Avatar
Discard
Best Answer

Hi  Dhouha,
In odoo 8 It's not Pivot view its gantt view.

<field name="view_mode">kanban,tree,form,calendar,gantt,graph</field>

so please change the code like bellow

<!-- salary_table Action -->
<record model="ir.actions.act_window" id="action_convention">
    <field name="name">Salary Table</field>
    <field name="res_model">hr.convention</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form,graph,gantt</field>
</record>


Avatar
Discard
Author

Thank you but how can i modify the record structure (id="salary_table_pivot_view") to suit the gantt view ?

Sorry, I can't get you exactly.!

you just edit the form " id="action_convention" ".

Update the module. then you check the pivot view.

Related Posts Replies Views Activity
2
Nov 17
4956
0
Jul 24
196
3
Oct 23
4380
2
Jan 23
3780
2
Dec 22
12876