actions

package
v0.0.0-...-2b35e24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2019 License: Apache-2.0 Imports: 12 Imported by: 5

Documentation

Index

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

func LoadFromEtree(element *etree.Element)

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 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

func MakeActionRef(id string) ActionRef

MakeActionRef creates an ActionRef from an action id

func (ActionRef) MarshalJSON

func (ar ActionRef) MarshalJSON() ([]byte, error)

MarshalJSON is the JSON marshalling method of ActionRef It marshals empty ActionRef into null instead of ["", ""].

func (*ActionRef) Scan

func (ar *ActionRef) Scan(src interface{}) error

Scan fetches the name of our action from the ID stored in the database to fill the ActionRef.

func (ActionRef) Value

func (ar ActionRef) Value() (driver.Value, error)

Value extracts ID of our ActionRef for storing in the database.

type ActionType

type ActionType string

An ActionType defines the type of action

const (
	ActionActWindow ActionType = "ir.actions.act_window"
	ActionServer    ActionType = "ir.actions.server"
)

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 BaseAction

type BaseAction struct {
	ID           string            `json:"id" 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"`
	Help         string            `json:"help" xml:"help,attr"`
	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:"views"`
	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:"-"`
	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"`
}

A BaseAction is the definition of an action. Actions define the behavior of the system in response to user requests.

type Collection

type Collection struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

An Collection is a collection of actions

var Registry *Collection

Registry is the action collection of the application

func NewActionsCollection

func NewActionsCollection() *Collection

NewActionsCollection returns a pointer to a new Collection instance

func (*Collection) Add

func (ar *Collection) Add(a *BaseAction)

Add adds the given action to our Collection

func (*Collection) GetActionLinksForModel

func (ar *Collection) GetActionLinksForModel(modelName string) []*BaseAction

GetActionLinksForModel returns the list of linked actions for the model with the given name

func (*Collection) GetById

func (ar *Collection) GetById(id string) *BaseAction

GetById returns the Action with the given id

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL