-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathbase_partner_merge_automatic_wizard.go
131 lines (115 loc) · 6.13 KB
/
base_partner_merge_automatic_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
119
120
121
122
123
124
125
126
127
128
129
130
131
package odoo
// BasePartnerMergeAutomaticWizard represents base.partner.merge.automatic.wizard model.
type BasePartnerMergeAutomaticWizard struct {
LastUpdate *Time `xmlrpc:"__last_update,omitempty"`
CreateDate *Time `xmlrpc:"create_date,omitempty"`
CreateUid *Many2One `xmlrpc:"create_uid,omitempty"`
CurrentLineId *Many2One `xmlrpc:"current_line_id,omitempty"`
DisplayName *String `xmlrpc:"display_name,omitempty"`
DstPartnerId *Many2One `xmlrpc:"dst_partner_id,omitempty"`
ExcludeContact *Bool `xmlrpc:"exclude_contact,omitempty"`
ExcludeJournalItem *Bool `xmlrpc:"exclude_journal_item,omitempty"`
GroupByEmail *Bool `xmlrpc:"group_by_email,omitempty"`
GroupByIsCompany *Bool `xmlrpc:"group_by_is_company,omitempty"`
GroupByName *Bool `xmlrpc:"group_by_name,omitempty"`
GroupByParentId *Bool `xmlrpc:"group_by_parent_id,omitempty"`
GroupByVat *Bool `xmlrpc:"group_by_vat,omitempty"`
Id *Int `xmlrpc:"id,omitempty"`
LineIds *Relation `xmlrpc:"line_ids,omitempty"`
MaximumGroup *Int `xmlrpc:"maximum_group,omitempty"`
NumberGroup *Int `xmlrpc:"number_group,omitempty"`
PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"`
State *Selection `xmlrpc:"state,omitempty"`
WriteDate *Time `xmlrpc:"write_date,omitempty"`
WriteUid *Many2One `xmlrpc:"write_uid,omitempty"`
}
// BasePartnerMergeAutomaticWizards represents array of base.partner.merge.automatic.wizard model.
type BasePartnerMergeAutomaticWizards []BasePartnerMergeAutomaticWizard
// BasePartnerMergeAutomaticWizardModel is the odoo model name.
const BasePartnerMergeAutomaticWizardModel = "base.partner.merge.automatic.wizard"
// Many2One convert BasePartnerMergeAutomaticWizard to *Many2One.
func (bpmaw *BasePartnerMergeAutomaticWizard) Many2One() *Many2One {
return NewMany2One(bpmaw.Id.Get(), "")
}
// CreateBasePartnerMergeAutomaticWizard creates a new base.partner.merge.automatic.wizard model and returns its id.
func (c *Client) CreateBasePartnerMergeAutomaticWizard(bpmaw *BasePartnerMergeAutomaticWizard) (int64, error) {
ids, err := c.CreateBasePartnerMergeAutomaticWizards([]*BasePartnerMergeAutomaticWizard{bpmaw})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}
// CreateBasePartnerMergeAutomaticWizards creates a new base.partner.merge.automatic.wizard model and returns its id.
func (c *Client) CreateBasePartnerMergeAutomaticWizards(bpmaws []*BasePartnerMergeAutomaticWizard) ([]int64, error) {
var vv []interface{}
for _, v := range bpmaws {
vv = append(vv, v)
}
return c.Create(BasePartnerMergeAutomaticWizardModel, vv, nil)
}
// UpdateBasePartnerMergeAutomaticWizard updates an existing base.partner.merge.automatic.wizard record.
func (c *Client) UpdateBasePartnerMergeAutomaticWizard(bpmaw *BasePartnerMergeAutomaticWizard) error {
return c.UpdateBasePartnerMergeAutomaticWizards([]int64{bpmaw.Id.Get()}, bpmaw)
}
// UpdateBasePartnerMergeAutomaticWizards updates existing base.partner.merge.automatic.wizard records.
// All records (represented by ids) will be updated by bpmaw values.
func (c *Client) UpdateBasePartnerMergeAutomaticWizards(ids []int64, bpmaw *BasePartnerMergeAutomaticWizard) error {
return c.Update(BasePartnerMergeAutomaticWizardModel, ids, bpmaw, nil)
}
// DeleteBasePartnerMergeAutomaticWizard deletes an existing base.partner.merge.automatic.wizard record.
func (c *Client) DeleteBasePartnerMergeAutomaticWizard(id int64) error {
return c.DeleteBasePartnerMergeAutomaticWizards([]int64{id})
}
// DeleteBasePartnerMergeAutomaticWizards deletes existing base.partner.merge.automatic.wizard records.
func (c *Client) DeleteBasePartnerMergeAutomaticWizards(ids []int64) error {
return c.Delete(BasePartnerMergeAutomaticWizardModel, ids)
}
// GetBasePartnerMergeAutomaticWizard gets base.partner.merge.automatic.wizard existing record.
func (c *Client) GetBasePartnerMergeAutomaticWizard(id int64) (*BasePartnerMergeAutomaticWizard, error) {
bpmaws, err := c.GetBasePartnerMergeAutomaticWizards([]int64{id})
if err != nil {
return nil, err
}
return &((*bpmaws)[0]), nil
}
// GetBasePartnerMergeAutomaticWizards gets base.partner.merge.automatic.wizard existing records.
func (c *Client) GetBasePartnerMergeAutomaticWizards(ids []int64) (*BasePartnerMergeAutomaticWizards, error) {
bpmaws := &BasePartnerMergeAutomaticWizards{}
if err := c.Read(BasePartnerMergeAutomaticWizardModel, ids, nil, bpmaws); err != nil {
return nil, err
}
return bpmaws, nil
}
// FindBasePartnerMergeAutomaticWizard finds base.partner.merge.automatic.wizard record by querying it with criteria.
func (c *Client) FindBasePartnerMergeAutomaticWizard(criteria *Criteria) (*BasePartnerMergeAutomaticWizard, error) {
bpmaws := &BasePartnerMergeAutomaticWizards{}
if err := c.SearchRead(BasePartnerMergeAutomaticWizardModel, criteria, NewOptions().Limit(1), bpmaws); err != nil {
return nil, err
}
return &((*bpmaws)[0]), nil
}
// FindBasePartnerMergeAutomaticWizards finds base.partner.merge.automatic.wizard records by querying it
// and filtering it with criteria and options.
func (c *Client) FindBasePartnerMergeAutomaticWizards(criteria *Criteria, options *Options) (*BasePartnerMergeAutomaticWizards, error) {
bpmaws := &BasePartnerMergeAutomaticWizards{}
if err := c.SearchRead(BasePartnerMergeAutomaticWizardModel, criteria, options, bpmaws); err != nil {
return nil, err
}
return bpmaws, nil
}
// FindBasePartnerMergeAutomaticWizardIds finds records ids by querying it
// and filtering it with criteria and options.
func (c *Client) FindBasePartnerMergeAutomaticWizardIds(criteria *Criteria, options *Options) ([]int64, error) {
return c.Search(BasePartnerMergeAutomaticWizardModel, criteria, options)
}
// FindBasePartnerMergeAutomaticWizardId finds record id by querying it with criteria.
func (c *Client) FindBasePartnerMergeAutomaticWizardId(criteria *Criteria, options *Options) (int64, error) {
ids, err := c.Search(BasePartnerMergeAutomaticWizardModel, criteria, options)
if err != nil {
return -1, err
}
return ids[0], nil
}