创建角色组分类
理解base.group_user 是内部用户,是所有内部用户基础,base.group_system 也是继承它
创建角色组
创建模型
class Lift(models.Model):
_name = 'tw.base.lift'
_description = "电梯台账"
_order = 'id desc'
uuid = fields.Char(string=u"多方唯一电梯识别")
code = fields.Char(string=u"救援编号", size=100, index=True)
en_code = fields.Char(string=u"加密编号", index=True)
device_code = fields.Char(string=u"设备代码", size=100, index=True)
factory_number = fields.Char(string=u'出厂编号', size=50)
lift_img = fields.Char(u"电梯照片")
use_address = fields.Char(string=u'电梯地址', size=100)
设计模型界面
<record id="tw_base_lift_form" model="ir.ui.view">
<field name="name">tw.base.lift.form</field>
<field name="model">tw.base.lift</field>
<field name="arch" type="xml">
<form string="Tags">
<sheet>
<group>
<group col="4" string="基础信息">
<field name="code"/>
<field name="en_code"/>
<field name="device_code"/>
<field name="factory_number"/>
<field name="lift_img"/>
<field name="use_address"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="tw_base_lift_tree" model="ir.ui.view">
<field name="name">tw.base.lift.tree</field>
<field name="model">tw.base.lift</field>
<field name="arch" type="xml">
<tree string="Lifts">
<field name="code"/>
<field name="device_code"/>
<field name="factory_number"/>
<field name="use_address"/>
</tree>
</field>
</record>
<record id="tw_base_lift_search" model="ir.ui.view">
<field name="name">tw.base.lift.search</field>
<field name="model">tw.base.lift</field>
<field name="arch" type="xml">
<search>
<field name="code"/>
<field name="device_code"/>
<field name="factory_number"/>
<field name="use_address"/>
</search>
</field>
</record>
<record id="action_tw_base_lift" model="ir.actions.act_window">
<field name="name">电梯台账</field>
<field name="res_model">tw.base.lift</field>
<field name="view_mode">tree,form</field>
</record>
</data>
给内部用户设置表权限
access_tw_lift_all,tw_base.tw_lift_all,model_tw_base_lift,base.group_system,1,1,1,1
给管理员的菜单
# 界面太丑,等待优化
标签:fields,tw,Char,lift,base,odoo,权限,分配,string From: https://www.cnblogs.com/a735474741/p/18182361