How can I hide the Create button from the tree view in a specific object. Since this object has all readonly fields

How to hide the Create button from a tree image in a specific object? Because this object has all read-only fields.

+5
source share
5 answers

Depending on which version of OpenERP you are running, specify this if you want more specific answers. If you ask this question, you probably aren't using 7.0 yet, but it might be useful to know though.

Openerp 7.0

OpenERP 7.0 : , , : ( ), node , . : create, write, unlink.

user1576199, , , , . , :

<tree create="false" delete="false">
....
</tree>
or
<kanban create="false" edit="false">
....
</kanban>
etc..

OpenERP 6.1

, OpenERP, . simahawk - 6.1, , , .

+15

. //etc , , ,

, javascript- - $('button.oe_form_button_edit'). hide() - . , -.

0

<tree string="String" create="false">

0

v6 - CSS ( , @simahawk). , CSS xml, . :

<html>
  <style>
    .openerp button.oe_form_button_edit { display:none }
  </style>
</html>
<tree ...

You can do the same for the delete and edit buttons as needed.

A bit of hacking ... I like the v7 function - I can’t wait for the update :)

0
source

I don't know if this solution is correct or not, but I'm trying to put this code below in javascript in the kernel, and it actually works.

openerp.web.ListView.include({

    start: function() {
        var self = this;
        var ret = this._super.apply(this, arguments);
        var res_model = this.dataset.model;
        if ($.inArray(res_model, MODELS_TO_HIDE) != -1) {
            self.options.addable = false; /* for create button */
            self.options.deletable= false; /* for delete button */
        };
        return ret;
    },
});

or you can link to this link: https://github.com/kdeldycke/kevin-deldycke-blog/blob/master/content/posts/openerp-61-web-javascript-hacks-hide-buttons.md

0
source

All Articles