Odoo 10:从客户表单视图中删除按钮
Odoo 10 : Removing a button from customer form view
我想从客户表单视图中删除“未在网站上发布”按钮。
这个按钮不是表单视图的一部分,所以当我尝试下面的代码时,我得到一个错误,元素在父视图中不存在:
<xpath expr='//div[@class="oe_button_box"]//button[@name="website_publish_button"]' position='replace'>
<button type="object" name="callSurvey" icon="contacts_custom/static/description/survey.png" class="oe_stat_button">
<field string="Surveys" name="survey_count" widget="statinfo" modifiers="{'readonly': true}"/>
</button>
</xpath>
然后我尝试使用 css 删除它。我的 css.css 文件:
button[name=website_publish_button]
{
display:none !important;
}
和模板:
<openerp>
<data>
<!-- Adds all assets in Odoo -->
<template id="assets_backend" name="contacts_custom assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<!--These links will be called when loading your Odoo -->
<link rel="stylesheet" href="/contacts_custom/static/css/css.css"/>
</xpath>
</template>
</data>
</openerp>
但还是按钮 appears.Am 我做错了什么或者有没有其他方法可以删除这个按钮?
您可以像这样扩展视图:
<record id="view_partners_form_website" model="ir.ui.view">
<field name="name">view.res.partner.form.website</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="website_partner.view_partners_form_website"/>
<field eval="18" name="priority"/>
<field name="arch" type="xml">
<data>
<button name="website_publish_button" position="replace">
<button type="object" name="callSurvey" icon="contacts_custom/static/description/survey.png" class="oe_stat_button">
<field string="Surveys" name="survey_count" widget="statinfo" modifiers="{'readonly': true}"/>
</button>
</button>
</data>
</field>
</record>
向模块添加依赖条目website_partner
以便能够像上面的代码片段一样继承添加按钮的视图
我想从客户表单视图中删除“未在网站上发布”按钮。
这个按钮不是表单视图的一部分,所以当我尝试下面的代码时,我得到一个错误,元素在父视图中不存在:
<xpath expr='//div[@class="oe_button_box"]//button[@name="website_publish_button"]' position='replace'>
<button type="object" name="callSurvey" icon="contacts_custom/static/description/survey.png" class="oe_stat_button">
<field string="Surveys" name="survey_count" widget="statinfo" modifiers="{'readonly': true}"/>
</button>
</xpath>
然后我尝试使用 css 删除它。我的 css.css 文件:
button[name=website_publish_button]
{
display:none !important;
}
和模板:
<openerp>
<data>
<!-- Adds all assets in Odoo -->
<template id="assets_backend" name="contacts_custom assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<!--These links will be called when loading your Odoo -->
<link rel="stylesheet" href="/contacts_custom/static/css/css.css"/>
</xpath>
</template>
</data>
</openerp>
但还是按钮 appears.Am 我做错了什么或者有没有其他方法可以删除这个按钮?
您可以像这样扩展视图:
<record id="view_partners_form_website" model="ir.ui.view">
<field name="name">view.res.partner.form.website</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="website_partner.view_partners_form_website"/>
<field eval="18" name="priority"/>
<field name="arch" type="xml">
<data>
<button name="website_publish_button" position="replace">
<button type="object" name="callSurvey" icon="contacts_custom/static/description/survey.png" class="oe_stat_button">
<field string="Surveys" name="survey_count" widget="statinfo" modifiers="{'readonly': true}"/>
</button>
</button>
</data>
</field>
</record>
向模块添加依赖条目website_partner
以便能够像上面的代码片段一样继承添加按钮的视图