Odoo Help

Welcome!

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

0

Display create button on dashboard

By
Mohamed Essakali
on 10/29/14, 11:06 AM 1,343 views

In dashboard view when displaying tree view of a model, I want to allow user to create new line (display create button). I guess this must be done in Javascript but can't figure how.

Thanks for your help

0
Mohamed Essakali
On 11/15/14, 2:28 PM

Well! here is the steps to achieve it.

1-  Create a web module (see for more details  http://openerp-web-v7.readthedocs.org/en/latest/module.html)

2-  Create a javascript file and copy the lines bellow to it :

    openerp.name_of_your_module = function (instance) {

    instance.web.ViewManagerAction.include({

        init: function(parent, action) {      
            var flags = action.flags || {};

            if (parent.__parentedParent.form_template == 'DashBoard') {
             _.extend(flags, {
                   search_view : false,
                    sidebar : true,
                    views_switcher : false,
                    action_buttons : true,
                    pager: true,
                    low_profile: true,
                    display_title: false,
                    list: {
                        selectable: true
                    }                    
                });

            };
            action.flags = flags;
            this._super(parent, action);
        },
        });    

};

3-  create a css file with this to display the header :

.openerp .oe_dashboard .oe_action .oe_content .oe_view_manager_header {
  display: -webkit-inline-box;
}

 

hope it helps!

I have to create a module as per your instruction ,But I cant see create button in any of Dash Board(like sales,hr,purchase etc. ) This is the module what i Did

Odoo
on 11/17/14, 5:10 AM

In which menu this feature is available,in sale/purchase reporting etc..?

Odoo
on 11/17/14, 5:23 AM

Sorry for late, i was overloaded with work. I test it on a new DB by using your code below and it works fine. You can see that in most reporting menu views, for example "sales/my quotations"

Mohamed Essakali
on 12/5/14, 3:17 PM
0

Odoo

--Odoo --
1328
| 5 2 5
kerala, India
--Odoo --

Working as a Odoo Functional and Technical Expert

Odoo
On 11/17/14, 5:12 AM

module name-------dashboard_sample

css--

.openerp .oe_dashboard .oe_action .oe_content .oe_view_manager_header {
  display: -webkit-inline-box;
}

js--

openerp.dashboard_sample = function (instance) {

    instance.web.ViewManagerAction.include({

        init: function(parent, action) {      
            var flags = action.flags || {};

            if (parent.__parentedParent.form_template == 'DashBoard') {
             _.extend(flags, {
                   search_view : false,
                    sidebar : true,
                    views_switcher : false,
                    action_buttons : true,
                    pager: true,
                    low_profile: true,
                    display_title: false,
                    list: {
                        selectable: true
                    }                    
                });

            };
            action.flags = flags;
            this._super(parent, action);
        },
        });    

};

init.py,

__openerp__.py-------

{
    'name': "Web Dashboard Example",
    'description': "Basic example of a (future) web module",
    'category': 'Hidden',
    'depends': ['base'],
    'js': ['static/src/js/test.js'],
    'css': ["static/src/css/testval.css"],
}

 

 

 

 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 10/29/14, 11:06 AM
Seen: 1343 times
Last updated: 3/16/15, 8:10 AM