在我的模型类中,我继承了hr.employee模型。但是我不需要该模型的某些字段。如何删除这些字段。?
class madulsima_plucker(osv.osv):
_name = "madulsima.plucker"
_description = "This table is for keeping personal data of madulsima pluckers"
_inherit = "hr.employee"
_columns = {
'reg_no': fields.char('Registration Number', size=256, required=True),
'worker_name': fields.char('Worker Name', size=256, required=True)
}
madulsima_plucker()
并且我也尝试使用view.xml删除这些字段,按照开发人员book.its not working.where是我的问题。?
<?xml version="1.0"?>
<openerp>
<data>
<!-- 1st part of the sim_view start -->
<record model="ir.ui.view" id="madulsima_plucker_form">
<field name="name">madulsima.plucker.form</field>
<field name="model">madulsima.plucker</field>
<field name="inherit_id" ref="hr.view_employee_form" />
<field name="type">form</field>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Madulsima Plucker Fields">
<field name="reg_no" />
<field name="worker_name" />
<field name="ssnid" position="replace" />
<field name="sinid" position="replace" />
</page>
</notebook>
</field>
</record>
<record model="ir.actions.act_window" id="action_plucker_registration">
<field name="name">Plucker Registration</field>
<field name="res_model">madulsima.plucker</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
</record>
<menuitem id="menu_madulsima_plucker" name="Madulsima/Checkroll" />
<menuitem id="menu_madulsima_plucker_registration" name="Plucker Registration"
parent="menu_madulsima_plucker" action="action_plucker_registration" />
</data>
</openerp>
答案 0 :(得分:0)
您的if (typeof nw !== "undefined" && nw !== null) {
console.log('NW detected, remove global !');
window.node_global = global;
window.global = void 0;
}
错了。
使用此:
arch
答案 1 :(得分:0)
<field name="ssnid" position="attributes" >
<attribute name="invisible">True</attribute>
</field>
在view.xml中只需使用上面的代码隐藏您要隐藏的任何字段,将其更改为<field name="ssnid"
答案 2 :(得分:0)
使用不可见的属性...我认为这是最好的解决方案,不要替换它,也许其他字段也依赖它
<field name="arch" type="xml">
<xpath expr="//field[@name='ssnid']" position="attributes">
<attribute name="invisible">True</attribute>
</xpath>
</field>