Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BootStrap ¶
func BootStrap()
BootStrap makes the necessary updates to view definitions. In particular: - sets the type of the view from the arch root. - populates the fields map from the views arch.
func LoadFromEtree ¶
LoadFromEtree reads the view given etree.Element, creates or updates the view and adds it to the view registry if it not already.
Types ¶
type Collection ¶
A Collection is a view collection
var Registry *Collection
Registry is the views collection of the application
func NewCollection ¶
func NewCollection() *Collection
NewCollection returns a pointer to a new Collection instance
func (*Collection) Add ¶
func (vc *Collection) Add(v *View)
Add adds the given view to our Collection
func (*Collection) GetAllViewsForModel ¶
func (vc *Collection) GetAllViewsForModel(model string) []*View
GetAllViewsForModel returns a list with all views for the given model
func (*Collection) GetByID ¶
func (vc *Collection) GetByID(id string) *View
GetByID returns the View with the given id
func (*Collection) GetFirstViewForModel ¶
func (vc *Collection) GetFirstViewForModel(model string, viewType ViewType) *View
GetFirstViewForModel returns the first view of type viewType for the given model
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"` FieldParent string `json:"field_parent"` //Toolbar actions.Toolbar `json:"toolbar"` Fields []models.FieldName }
View is the internal definition of a view in the application
type ViewRef ¶
type ViewRef [2]string
ViewRef is an array of two strings representing a view: - The first one is the ID of the view - The second one is the name of the view
func (ViewRef) MarshalJSON ¶
MarshalJSON is the JSON marshalling method of ViewRef. It marshals empty ViewRef into null instead of ["", ""].
func (*ViewRef) Scan ¶
Scan fetches the name of our view from the ID stored in the database to fill the ViewRef.
func (*ViewRef) UnmarshalJSON ¶
UnmarshalJSON is the JSON unmarshalling method of ViewRef. It unmarshals null into an empty ViewRef.
func (*ViewRef) UnmarshalXMLAttr ¶
UnmarshalXMLAttr is the XML unmarshalling method of ViewRef. It unmarshals null into an empty ViewRef.
type ViewTuple ¶
ViewTuple is an array of two strings representing a view: - The first one is the ID of the view - The second one is the view type corresponding to the view ID
func (ViewTuple) MarshalJSON ¶
MarshalJSON is the JSON marshalling method of ViewTuple. It marshals ViewTuple into a list [id, type].
type ViewType ¶
type ViewType string
A ViewType defines the type of a view
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" )
View types
type ViewXML ¶
type ViewXML struct { ID string `xml:"id,attr"` Name string `xml:"name,attr"` Model string `xml:"model,attr"` Priority uint8 `xml:"priority,attr"` Arch string `xml:",innerxml"` InheritID string `xml:"inherit_id,attr"` FieldParent string `xml:"field_parent,attr"` }
ViewXML is used to unmarshal the XML definition of a View