Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2123 Lượt xem

how can i hide the edit button on res.partner without changing the group-rights?

i tried this ( https://www.odoo.com/de_DE/forum/hilfe-1/question/is-it-possible-hide-edit-button-on-form-view-by-extending-base-xml-117347 ) but it doesn`t seems to work in Odoo V12.



odoo.define('custom_web_changes.custom_form_view', function (require) {
"use strict";
var core = require('web.core');
var FormView = require('web.FormView');
var _t = core._t;
var QWeb = core.qweb;
console.log("asd");
FormView.include({
load_record: function(record) {
this._super.apply(this, arguments);
console.log("222");
if (this.model=='res.partner'){
console.log("333");
this.$buttons.find('.o_form_button_edit').css({"display":"none"});
}
}
});
});


in the browser console i just see my "asd" Debug note but not following console.log statements.

whats wrong with my code?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello,

You can inherit res.partner view using xpath and add attribute edit="false".

For example:

<form string="Signup Terms &amp; Condition" edit="false" create="false">

Regards,

Mustufa Rangwala 

Ảnh đại diện
Huỷ bỏ