Odoo

动作定义

  • Action Name:动作名称,可以任意取名。
  • Action Type:动作类型,总是‘ir.actions.act_window’
  • View Ref:该动作关联的视图,即动作应显示的画面。
  • Object:该动作关联的对象,即动作应显示哪个对象的数据,或者说应显示哪个数据表的数据。
  • Source Object:指定应在哪个对象的视图的右边工具条上显示本Action。

view

The view describes how the edition form or the data tree/list appear on screen. The views can be of ‘Form’ or ‘Tree’ type, according to whether they represent a form for the edition or a list/tree for global data viewing. A form can be called by an action opening in ‘Tree’ mode. The form view is generally opened from the list mode (like if the user pushes on ‘switch view’).

domain

This parameter allows you to regulate which resources are visible in a selected view.(restriction) For example, in the invoice case, you can define an action that opens a view that shows only invoices not paid. The domains are written in python; list of tuples. The tuples have three elements;

  • the field on which the test must be done
  • the operator used for the test (<, >, =, like)
  • the tested value For example, if you want to obtain only ‘Draft’ invoice, use the following domain; [(‘state’,’=’,’draft’)] In the case of a simple view, the domain define the resources which are the roots of the tree. The other resources, even if they are not from a part of the domain will be posted if the user develop the branches of the tree.