-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathbase_partner_merge_automatic_wizard.go
132 lines (116 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
132
package odoo
import (
"fmt"
)
// BasePartnerMergeAutomaticWizard represents base.partner.merge.automatic.wizard model.
type BasePartnerMergeAutomaticWizard struct {
LastUpdate *Time `xmlrpc:"__last_update,omptempty"`
CreateDate *Time `xmlrpc:"create_date,omptempty"`
CreateUid *Many2One `xmlrpc:"create_uid,omptempty"`
CurrentLineId *Many2One `xmlrpc:"current_line_id,omptempty"`
DisplayName *String `xmlrpc:"display_name,omptempty"`
DstPartnerId *Many2One `xmlrpc:"dst_partner_id,omptempty"`
ExcludeContact *Bool `xmlrpc:"exclude_contact,omptempty"`
ExcludeJournalItem *Bool `xmlrpc:"exclude_journal_item,omptempty"`
GroupByEmail *Bool `xmlrpc:"group_by_email,omptempty"`
GroupByIsCompany *Bool `xmlrpc:"group_by_is_company,omptempty"`
GroupByName *Bool `xmlrpc:"group_by_name,omptempty"`
GroupByParentId *Bool `xmlrpc:"group_by_parent_id,omptempty"`
GroupByVat *Bool `xmlrpc:"group_by_vat,omptempty"`
Id *Int `xmlrpc:"id,omptempty"`
LineIds *Relation `xmlrpc:"line_ids,omptempty"`
MaximumGroup *Int `xmlrpc:"maximum_group,omptempty"`
NumberGroup *Int `xmlrpc:"number_group,omptempty"`
PartnerIds *Relation `xmlrpc:"partner_ids,omptempty"`
State *Selection `xmlrpc:"state,omptempty"`
WriteDate *Time `xmlrpc:"write_date,omptempty"`
WriteUid *Many2One `xmlrpc:"write_uid,omptempty"`
}
// 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) {
return c.Create(BasePartnerMergeAutomaticWizardModel, bpmaw)
}
// 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)
}
// 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
}
if bpmaws != nil && len(*bpmaws) > 0 {
return &((*bpmaws)[0]), nil
}
return nil, fmt.Errorf("id %v of base.partner.merge.automatic.wizard not found", id)
}
// 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
}
if bpmaws != nil && len(*bpmaws) > 0 {
return &((*bpmaws)[0]), nil
}
return nil, fmt.Errorf("no base.partner.merge.automatic.wizard was found with criteria %v", criteria)
}
// 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) {
ids, err := c.Search(BasePartnerMergeAutomaticWizardModel, criteria, options)
if err != nil {
return []int64{}, err
}
return ids, nil
}
// 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
}
if len(ids) > 0 {
return ids[0], nil
}
return -1, fmt.Errorf("no base.partner.merge.automatic.wizard was found with criteria %v and options %v", criteria, options)
}