ir

package
v0.0.0-...-da20d80 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootStrap

func BootStrap()

BootStrap computes all views, actions and menus after they have been added by the modules.

func LoadActionFromEtree

func LoadActionFromEtree(element *etree.Element)

LoadActionFromEtree reads the action given etree.Element, creates or updates the action and adds it to the action registry if it not already.

func LoadMenuFromEtree

func LoadMenuFromEtree(element *etree.Element)

LoadMenuFromEtree reads the menu given etree.Element, creates or updates the menu and adds it to the menu registry if it not already.

func LoadViewFromEtree

func LoadViewFromEtree(element *etree.Element)

LoadViewFromEtree reads the view given etree.Element, creates or updates the view and adds it to the view 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

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

func (ar ActionRef) String() string

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
const (
	ACTION_ACT_WINDOW ActionType = "ir.actions.act_window"
	ACTION_SERVER     ActionType = "ir.actions.server"
)

type ActionViewType

type ActionViewType string
const (
	ACTION_VIEW_TYPE_FORM ActionViewType = "form"
	ACTION_VIEW_TYPE_TREE ActionViewType = "tree"
)

type ActionsCollection

type ActionsCollection struct {
	sync.RWMutex
	// contains filtered or unexported fields
}
var ActionsRegistry *ActionsCollection

func NewActionsCollection

func NewActionsCollection() *ActionsCollection

NewActionCollection returns a pointer to a new ActionsCollection instance

func (*ActionsCollection) AddAction

func (ar *ActionsCollection) AddAction(a *BaseAction)

AddAction adds the given action to our ActionsCollection

func (*ActionsCollection) GetActionById

func (ar *ActionsCollection) GetActionById(id string) *BaseAction

GetActionById returns the Action with the given id

type BaseAction

type BaseAction struct {
	ID         string     `json:"id"`
	Type       ActionType `json:"type"`
	Name       string     `json:"name"`
	Model      string     `json:"res_model"`
	ResID      int64      `json:"res_id"`
	Groups     []string   `json:"groups_id"`
	Domain     string     `json:"domain"`
	Help       string     `json:"help"`
	SearchView ViewRef    `json:"search_view_id"`
	SrcModel   string     `json:"src_model"`
	Usage      string     `json:"usage"`
	//Flags interface{}`json:"flags"`
	Views        []ViewRef      `json:"views"`
	View         ViewRef        `json:"view_id"`
	AutoRefresh  bool           `json:"auto_refresh"`
	ManualSearch bool           `json:"-"`
	ActViewType  ActionViewType `json:"-"`
	ViewMode     string         `json:"view_mode"`
	ViewIds      []string       `json:"view_ids"`
	Multi        bool           `json:"multi"`
	Target       string         `json:"target"`
	AutoSearch   bool           `json:"auto_search"`
	//SearchView  string         `json:"search_view"`
	Filter  bool          `json:"filter"`
	Limit   int64         `json:"limit"`
	Context tools.Context `json:"context"`
}
type MenuCollection struct {
	sync.RWMutex
	Menus []*UiMenu
	// contains filtered or unexported fields
}
var MenusRegistry *MenuCollection

func NewMenuCollection

func NewMenuCollection() *MenuCollection

NewMenuCollection returns a pointer to a new MenuCollection instance

func (mc *MenuCollection) AddMenu(m *UiMenu)

AddMenu adds a menu to the menu registry

func (mc *MenuCollection) GetMenuById(id string) *UiMenu

GetMenuById returns the Menu with the given id

func (mr *MenuCollection) Len() int
func (mr *MenuCollection) Less(i, j int) bool
func (mr *MenuCollection) Swap(i, j int)

type Toolbar

type Toolbar struct {
	Print  []*BaseAction `json:"print"`
	Action []*BaseAction `json:"action"`
	Relate []*BaseAction `json:"relate"`
}

type UiMenu

type UiMenu struct {
	ID               string
	Name             string
	Parent           *UiMenu
	ParentCollection *MenuCollection
	Children         *MenuCollection
	Sequence         uint8
	Action           *BaseAction
	HasChildren      bool
	HasAction        bool
}

type View

type View struct {
	ID                 string              `json:"id"`
	Name               string              `json:"name"`
	Model              string              `json:"model"`
	Type               ViewType            `json:"type"`
	Priority           uint8               `json:"priority"`
	Arch               string              `json:"arch"`
	InheritID          *View               `json:"inherit_id"`
	InheritChildrenIDs []*View             `json:"inherit_children_ids"`
	FieldParent        string              `json:"field_parent"`
	InheritanceMode    ViewInheritanceMode `json:"mode"`
	Fields             []string
}

type ViewInheritanceMode

type ViewInheritanceMode string
const (
	VIEW_PRIMARY   ViewInheritanceMode = "primary"
	VIEW_EXTENSION ViewInheritanceMode = "extension"
)

type ViewRef

type ViewRef [2]string

func MakeViewRef

func MakeViewRef(id string) ViewRef

func (*ViewRef) Scan

func (vr *ViewRef) Scan(src interface{}) error

Scan fetches the name of our view from the ID stored in the database to fill the ViewRef.

func (*ViewRef) String

func (e *ViewRef) String() string

func (ViewRef) Value

func (vr ViewRef) Value() (driver.Value, error)

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

type ViewType

type ViewType string
const (
	VIEW_TYPE_TREE     ViewType = "tree"
	VIEW_TYPE_LIST     ViewType = "list"
	VIEW_TYPE_FORM     ViewType = "form"
	VIEW_TYPE_GRAPH    ViewType = "graph"
	VIEW_TYPE_CALENDAR ViewType = "calendar"
	VIEW_TYPE_DIAGRAM  ViewType = "diagram"
	VIEW_TYPE_GANTT    ViewType = "gantt"
	VIEW_TYPE_KANBAN   ViewType = "kanban"
	VIEW_TYPE_SEARCH   ViewType = "search"
	VIEW_TYPE_QWEB     ViewType = "qweb"
)

type ViewsCollection

type ViewsCollection struct {
	sync.RWMutex
	// contains filtered or unexported fields
}
var ViewsRegistry *ViewsCollection

func NewViewsCollection

func NewViewsCollection() *ViewsCollection

NewViewCollection returns a pointer to a new ViewsCollection instance

func (*ViewsCollection) AddView

func (vc *ViewsCollection) AddView(v *View)

AddView adds the given view to our ViewsCollection

func (*ViewsCollection) GetFirstViewForModel

func (vc *ViewsCollection) GetFirstViewForModel(model string, viewType ViewType) *View

GetFirstViewForModel returns the first view of type viewType for the given model

func (*ViewsCollection) GetViewById

func (vc *ViewsCollection) GetViewById(id string) *View

GetViewById returns the View with the given id

Jump to

Keyboard shortcuts

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