我想隐藏"附件(s)"菜单在odoo 8中的特定组和模型/对象的表单视图中。我该怎么做?
我对隐藏附件菜单没有任何想法,但可以通过此JS代码限制附件:
odoo.define('module_name', function(require) {
"use strict";
var core = require('web.core');
var data = require('web.data');
var framework = require('web.framework');
var sideWidget = require('web.Sidebar');
var Model = require('web.Model');
var Dialog = require('web.Dialog');
var _t = core._t;
var QWeb = core.qweb;
var sidebar = sideWidget.include({
redraw: function() {
var self = this;
this._super.apply(this, arguments);
if (this.getParent()) {
var view = this.getParent();
if (this.getParent().dataset.model != "there which model you do not want attach files") {
this.$('.o_sidebar_add_attachment .o_form_binary_form').change(this.on_attachment_changed);
}
}
},
});
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="assets_backend_niwe" name="alfresco_odoo assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="file location"/>
</xpath>
</template>
</data>
</odoo>
将其保存单独的文件并将此JS文件添加到资产后端。