Documentation ¶
Index ¶
- func BootStrap()
- func LoadFromEtree(element *etree.Element)
- type Action
- type ActionRef
- func (ar ActionRef) ID() string
- func (ar ActionRef) IsNull() bool
- func (ar ActionRef) MarshalJSON() ([]byte, error)
- func (ar ActionRef) Name() string
- func (ar *ActionRef) Scan(src interface{}) error
- func (ar *ActionRef) UnmarshalJSON(data []byte) error
- func (ar ActionRef) Value() (driver.Value, error)
- type ActionString
- type ActionType
- type ActionViewType
- type Collection
- func (ar *Collection) Add(a *Action)
- func (ar *Collection) GetActionLinksForModel(modelName string) []*Action
- func (ar *Collection) GetAll() []*Action
- func (ar *Collection) GetByID(id int64) (*Action, bool)
- func (ar *Collection) GetByXMLID(id string) (*Action, bool)
- func (ar *Collection) LoadFromEtree(element *etree.Element)
- func (ar *Collection) MustGetById(id int64) *Action
- func (ar *Collection) MustGetByXMLID(id string) *Action
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BootStrap ¶
func BootStrap()
BootStrap actions. This function must be called prior to any access to the actions Registry.
func LoadFromEtree ¶
LoadFromEtree reads the action given etree.Element, creates or updates the action and adds it to the action registry if it not already.
Types ¶
type Action ¶
type Action struct { ID int64 `json:"id" xml:"-"` XMLID string `json:"xmlid" xml:"id,attr"` Type ActionType `json:"type" xml:"type,attr"` Name string `json:"name" xml:"name,attr"` Model string `json:"res_model" xml:"model,attr"` ResID int64 `json:"res_id" xml:"res_id,attr"` Method string `json:"method" xml:"method,attr"` Groups []string `json:"groups_id" xml:"groups,attr"` Domain string `json:"domain" xml:"domain,attr"` HelpXML actionHelp `json:"-" xml:"help"` Help string `json:"help" xml:"-"` SearchView views.ViewRef `json:"search_view_id" xml:"search_view_id,attr"` SrcModel string `json:"src_model" xml:"src_model,attr"` Usage string `json:"usage" xml:"usage,attr"` Views []views.ViewTuple `json:"views" xml:"view"` View views.ViewRef `json:"view_id" xml:"view_id,attr"` AutoRefresh bool `json:"auto_refresh" xml:"auto_refresh,attr"` ManualSearch bool `json:"-" xml:"-"` ActViewType ActionViewType `json:"-" xml:"view_type"` ViewMode string `json:"view_mode" xml:"view_mode,attr"` Multi bool `json:"multi" xml:"multi,attr"` Target string `json:"target" xml:"target,attr"` AutoSearch bool `json:"auto_search" xml:"auto_search,attr"` Filter bool `json:"filter" xml:"filter,attr"` Limit int64 `json:"limit" xml:"limit,attr"` Context *types.Context `json:"context" xml:"context,attr"` Flags map[string]interface{} `json:"flags"` Tag string `json:"tag"` ReportName string `json:"report_name"` ReportType string `json:"report_type"` ReportFile string `json:"report_file"` Data map[string]interface{} `json:"data"` // contains filtered or unexported fields }
A Action is the definition of an action. Actions define the behavior of the system in response to user requests.
func (Action) ActionString ¶
func (a Action) ActionString() ActionString
ActionString returns the ActionString associated with this action.
func (*Action) Sanitize ¶
func (a *Action) Sanitize()
Sanitize makes the necessary updates to action definitions. It is good practice to call Sanitize before sending an action to the client.
func (Action) TranslatedName ¶
TranslatedName returns the translated name of this action in the given language
type ActionRef ¶
type ActionRef [2]string
ActionRef is an array of two strings representing an action: - The first one is the ID of the action - The second one is the name of the action
func MakeActionRef ¶
MakeActionRef creates an ActionRef from an action id
func (ActionRef) MarshalJSON ¶
MarshalJSON is the JSON marshalling method of ActionRef It marshals empty ActionRef into null instead of ["", ""].
func (*ActionRef) Scan ¶
Scan fetches the name of our action from the ID stored in the database to fill the ActionRef.
func (*ActionRef) UnmarshalJSON ¶
UnmarshalJSON for ActionRef. Unmarshals false as an empty ActionRef
type ActionString ¶
An ActionString is the concatenation of the action type and its ID e.g. ir.actions.act_window,76
func (ActionString) MarshalJSON ¶
func (as ActionString) MarshalJSON() ([]byte, error)
MarshalJSON for the actionString type. Marshals to false if the action string is empty
type ActionType ¶
type ActionType string
An ActionType defines the type of action
const ( ActionActWindow ActionType = "ir.actions.act_window" ActionURL ActionType = "ir.actions.act_url" ActionServer ActionType = "ir.actions.server" ActionReport ActionType = "ir.actions.report" ActionClient ActionType = "ir.actions.client" ActionCloseWindow ActionType = "ir.actions.act_window_close" )
Action types
type ActionViewType ¶
type ActionViewType string
ActionViewType defines the type of view of an action
const ( ActionViewTypeForm ActionViewType = "form" ActionViewTypeTree ActionViewType = "tree" )
Action view types
type Collection ¶
A Collection is a collection of actions
var Registry *Collection
Registry is the action collection of the application
func NewCollection ¶
func NewCollection() *Collection
NewCollection returns a pointer to a new Collection instance
func (*Collection) Add ¶
func (ar *Collection) Add(a *Action)
Add adds the given action to our Collection
func (*Collection) GetActionLinksForModel ¶
func (ar *Collection) GetActionLinksForModel(modelName string) []*Action
GetActionLinksForModel returns the list of linked actions for the model with the given name
func (*Collection) GetAll ¶
func (ar *Collection) GetAll() []*Action
GetAll returns a list of all actions of this Collection. Actions are returned in an arbitrary order
func (*Collection) GetByID ¶
func (ar *Collection) GetByID(id int64) (*Action, bool)
GetByID returns the Action with the given id
func (*Collection) GetByXMLID ¶
func (ar *Collection) GetByXMLID(id string) (*Action, bool)
GetByXMLID returns the Action with the given xmlid
func (*Collection) LoadFromEtree ¶
func (ar *Collection) LoadFromEtree(element *etree.Element)
LoadFromEtree reads the action given etree.Element, creates or updates the action and adds it to the given Collection if it not already.
func (*Collection) MustGetById ¶
func (ar *Collection) MustGetById(id int64) *Action
MustGetById returns the Action with the given id It panics if the id is not found in the action registry
func (*Collection) MustGetByXMLID ¶
func (ar *Collection) MustGetByXMLID(id string) *Action
MustGetByXMLID returns the Action with the given xmlid It panics if the id is not found in the action registry