Odoo_to Do_list小记

odoo to-do list 小记

应用逻辑

- 数据层 model / postgreSQL database ORM
- 逻辑层 controle / logic  实现CRUD
- 展示层 view
- 安全组 Users / Manager

Todo-list

  1. 数据层 model Settings -> Technical -> Database structure -> Models -> res.partner add a line: Field Name: x_is_work_team Field Label: Is Work Team? Filed Type: boolean

  2. 视图 res.partner -> views , windows action 可以指定要用的base视图 views type: Form Tree(list) Search Kanban

    Contacts -> 任意名片 -> edit view:form , 通过external ID 查看模块所有者 base.view_partner_form Inherited views 继承视图 add a line: View Name: Contacts - Custom “Is Work Team” flag Architecture: <field name="category_id" position="after"> <field name="x_is_work_team" /> </field>

  3. 数据模型 Settings -> Technical -> Database Structure -> Models -> Create Model Description: To-do Item Model: x_todo_item Save -> Edit add a line: Field Name: x_is_done Field Label: Is Done? Filed Type: boolean add a line: Field Name: x_work_team_ids Field Label: Work team Field Type: many2many Object Relation: res.partner Domain: [(‘x_is_work_team’,‘=’,True)]

  4. 用户组 Settings -> Users & Companies -> Groups -> Create Application: 空 Name: To-do User Inherited add a line: User types -> Internal User Access Rights / Settings -> Technical -> Security -> Access Rights add a line: Name: To-do Item User Access Object: 选择 To-do Item 勾选 read acess, write access, create access, delete access

  5. 访问控制 Settings -> Technical -> Security -> Record Rules - Create 设置用户只能访问自己的内容 Name: To-do Own Items Object: To-do Item Access Rights: 全选 Rule Definition: 域过滤器 [(‘create_uid’,‘=’,user.id)] Groups: To-do User

  6. 目录视图 Settings -> Technical -> User Interface -> Menu Items -> Create Menu: To-do Parent Menu : 空 Action: ir.actions.act_windows ,下拉中点 create and edit Action name: To-do Items External ID Object: x_todo_item Save

  7. 页面视图 Settings -> Technical -> User Interface -> Views -> Create
    View Name: To-do List View View Type: Tree Model: x_todo_item Architecture:

        <tree>
            <field name="x_name" />
            <field name="x_is_done" />
        </tree>
    

    Save -> Create View Name: To-do Form View View Type: Form Model:x_todo_item Architecture:

        <form>
          <group>
            <field name="x_name" />
            <field name="x_is_done" />
            <field name="x_work_team_ids" 
                  widget="many2many_tags"
                  context="{'default_x_is_work_team': True}" />
          </group>
        </form>
    
  8. 搜索视图 Settings -> Technical -> User Interface -> Views -> Create View Name :To-do Items Filter View Type: Search Model: x_todo_item Architecture:

    <search>
        <filter name="item_not_done"
        string="Not Done"
        domain="[('x_is_done','=',False)]" />
    </search> 
    
  9. 搜索视图默认选项 To-do menu -> Edit Action -> Filter: {'search_default_item_not_done':True}