-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbase_enable_profiling_wizard.go
118 lines (102 loc) · 4.77 KB
/
base_enable_profiling_wizard.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package odoo
// BaseEnableProfilingWizard represents base.enable.profiling.wizard model.
type BaseEnableProfilingWizard struct {
CreateDate *Time `xmlrpc:"create_date,omitempty"`
CreateUid *Many2One `xmlrpc:"create_uid,omitempty"`
DisplayName *String `xmlrpc:"display_name,omitempty"`
Duration *Selection `xmlrpc:"duration,omitempty"`
Expiration *Time `xmlrpc:"expiration,omitempty"`
Id *Int `xmlrpc:"id,omitempty"`
WriteDate *Time `xmlrpc:"write_date,omitempty"`
WriteUid *Many2One `xmlrpc:"write_uid,omitempty"`
}
// BaseEnableProfilingWizards represents array of base.enable.profiling.wizard model.
type BaseEnableProfilingWizards []BaseEnableProfilingWizard
// BaseEnableProfilingWizardModel is the odoo model name.
const BaseEnableProfilingWizardModel = "base.enable.profiling.wizard"
// Many2One convert BaseEnableProfilingWizard to *Many2One.
func (bepw *BaseEnableProfilingWizard) Many2One() *Many2One {
return NewMany2One(bepw.Id.Get(), "")
}
// CreateBaseEnableProfilingWizard creates a new base.enable.profiling.wizard model and returns its id.
func (c *Client) CreateBaseEnableProfilingWizard(bepw *BaseEnableProfilingWizard) (int64, error) {
ids, err := c.CreateBaseEnableProfilingWizards([]*BaseEnableProfilingWizard{bepw})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}
// CreateBaseEnableProfilingWizard creates a new base.enable.profiling.wizard model and returns its id.
func (c *Client) CreateBaseEnableProfilingWizards(bepws []*BaseEnableProfilingWizard) ([]int64, error) {
var vv []interface{}
for _, v := range bepws {
vv = append(vv, v)
}
return c.Create(BaseEnableProfilingWizardModel, vv, nil)
}
// UpdateBaseEnableProfilingWizard updates an existing base.enable.profiling.wizard record.
func (c *Client) UpdateBaseEnableProfilingWizard(bepw *BaseEnableProfilingWizard) error {
return c.UpdateBaseEnableProfilingWizards([]int64{bepw.Id.Get()}, bepw)
}
// UpdateBaseEnableProfilingWizards updates existing base.enable.profiling.wizard records.
// All records (represented by ids) will be updated by bepw values.
func (c *Client) UpdateBaseEnableProfilingWizards(ids []int64, bepw *BaseEnableProfilingWizard) error {
return c.Update(BaseEnableProfilingWizardModel, ids, bepw, nil)
}
// DeleteBaseEnableProfilingWizard deletes an existing base.enable.profiling.wizard record.
func (c *Client) DeleteBaseEnableProfilingWizard(id int64) error {
return c.DeleteBaseEnableProfilingWizards([]int64{id})
}
// DeleteBaseEnableProfilingWizards deletes existing base.enable.profiling.wizard records.
func (c *Client) DeleteBaseEnableProfilingWizards(ids []int64) error {
return c.Delete(BaseEnableProfilingWizardModel, ids)
}
// GetBaseEnableProfilingWizard gets base.enable.profiling.wizard existing record.
func (c *Client) GetBaseEnableProfilingWizard(id int64) (*BaseEnableProfilingWizard, error) {
bepws, err := c.GetBaseEnableProfilingWizards([]int64{id})
if err != nil {
return nil, err
}
return &((*bepws)[0]), nil
}
// GetBaseEnableProfilingWizards gets base.enable.profiling.wizard existing records.
func (c *Client) GetBaseEnableProfilingWizards(ids []int64) (*BaseEnableProfilingWizards, error) {
bepws := &BaseEnableProfilingWizards{}
if err := c.Read(BaseEnableProfilingWizardModel, ids, nil, bepws); err != nil {
return nil, err
}
return bepws, nil
}
// FindBaseEnableProfilingWizard finds base.enable.profiling.wizard record by querying it with criteria.
func (c *Client) FindBaseEnableProfilingWizard(criteria *Criteria) (*BaseEnableProfilingWizard, error) {
bepws := &BaseEnableProfilingWizards{}
if err := c.SearchRead(BaseEnableProfilingWizardModel, criteria, NewOptions().Limit(1), bepws); err != nil {
return nil, err
}
return &((*bepws)[0]), nil
}
// FindBaseEnableProfilingWizards finds base.enable.profiling.wizard records by querying it
// and filtering it with criteria and options.
func (c *Client) FindBaseEnableProfilingWizards(criteria *Criteria, options *Options) (*BaseEnableProfilingWizards, error) {
bepws := &BaseEnableProfilingWizards{}
if err := c.SearchRead(BaseEnableProfilingWizardModel, criteria, options, bepws); err != nil {
return nil, err
}
return bepws, nil
}
// FindBaseEnableProfilingWizardIds finds records ids by querying it
// and filtering it with criteria and options.
func (c *Client) FindBaseEnableProfilingWizardIds(criteria *Criteria, options *Options) ([]int64, error) {
return c.Search(BaseEnableProfilingWizardModel, criteria, options)
}
// FindBaseEnableProfilingWizardId finds record id by querying it with criteria.
func (c *Client) FindBaseEnableProfilingWizardId(criteria *Criteria, options *Options) (int64, error) {
ids, err := c.Search(BaseEnableProfilingWizardModel, criteria, options)
if err != nil {
return -1, err
}
return ids[0], nil
}