zoukankan      html  css  js  c++  java
  • odoo8 元素简介

    一:模型module:

    1. 字段类型

    (1)可控字段:

      fileds.char()

      fileds.Boolean()

      fileds.Date()

    (2)保留字段:(系统自动生成)

    id (Id)
    the unique identifier for a record in its model
    create_date (Datetime)
    creation date of the record
    create_uid (Many2one)
    user who created the record
    write_date (Datetime)
    last modification date of the record
    write_uid (Many2one)
    user who last modified the record

    2. 字段属性

    string (unicode, default: field’s name)
    在用户界面显示的标签名
    required (bool, default: False)
    如果是True, 则不可以为空值
    help (unicode, default: '')
    当用户悬停在UI字段上时,显示的提示。
    index (bool, default: False)
    要求odoo为此字段添加一个数据库索引。

    二:视图views

    1. 基本视图:

    (1)树状视图Tree views

    <tree string="Idea list">
        <field name="name"/>
        <field name="inventor_id"/>
    </tree>

    (2)表单视图Form views
    <form string="Idea form">
        <group colspan="4">
            <group colspan="2" col="2">
                <separator string="General stuff" colspan="2"/>
                <field name="name"/>
                <field name="inventor_id"/>
            </group>
    
            <group colspan="2" col="2">
                <separator string="Dates" colspan="2"/>
                <field name="active"/>
                <field name="invent_date" readonly="1"/>
            </group>
    
            <notebook colspan="4">
                <page string="Description">
                    <field name="description" nolabel="1"/>
                </page>
            </notebook>
    
            <field name="state"/>
        </group>
    </form>

    (3)搜索视图
    <search>
        <field name="name"/>
        <field name="inventor_id"/>
    </search>

    三:模型关系
    1. 多对一:
    (1)定义方式:
    Many2one(other_model, ondelete='set null')
    

     (2)取出方式

    print foo.other_id.name

    2. 一对多
    (1)定义方式:
    One2many(other_model, related_field)
    

      (2)取出方式

    for other in foo.other_ids:
        print other.name
    2. 多对多
    (1)定义方式:
    Many2many(other_model)
    

     (2)取出方式

    for other in foo.other_ids:
        print other.name


    待续
    翻译自:
    http://odoo-master.readthedocs.io/en/8.0/howtos/backend.html#build-an-odoo-module
     




  • 相关阅读:
    图解zookeeper FastLeader选举算法【转】
    win10 tensorflow python3*,Multiprocessing using fit_generator(pickle_safe=True) fail问题解决
    xcode从8升级到9出现的问题
    c++保存数据到TXT
    基于机器学习人脸识别face recognition具体的算法和原理
    pycharm 操作的一些设置,记录下
    ML-DL-各种资源汇总
    MATLAB实现多元线性回归预测
    【机器学习】 Matlab 2015a 自带机器学习算法汇总
    C++中嵌入python程序——命令行模式
  • 原文地址:https://www.cnblogs.com/chenyansu/p/8713801.html
Copyright © 2011-2022 走看看