forked from skilld-labs/go-odoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
account_followup_followup_line.go
132 lines (116 loc) · 5.98 KB
/
account_followup_followup_line.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
// AccountFollowupFollowupLine represents account_followup.followup.line model.
type AccountFollowupFollowupLine struct {
LastUpdate *Time `xmlrpc:"__last_update,omitempty"`
AutoExecute *Bool `xmlrpc:"auto_execute,omitempty"`
CompanyId *Many2One `xmlrpc:"company_id,omitempty"`
CreateDate *Time `xmlrpc:"create_date,omitempty"`
CreateUid *Many2One `xmlrpc:"create_uid,omitempty"`
Delay *Int `xmlrpc:"delay,omitempty"`
Description *String `xmlrpc:"description,omitempty"`
DisplayName *String `xmlrpc:"display_name,omitempty"`
Id *Int `xmlrpc:"id,omitempty"`
JoinInvoices *Bool `xmlrpc:"join_invoices,omitempty"`
ManualAction *Bool `xmlrpc:"manual_action,omitempty"`
ManualActionNote *String `xmlrpc:"manual_action_note,omitempty"`
ManualActionResponsibleId *Many2One `xmlrpc:"manual_action_responsible_id,omitempty"`
ManualActionTypeId *Many2One `xmlrpc:"manual_action_type_id,omitempty"`
Name *String `xmlrpc:"name,omitempty"`
PrintLetter *Bool `xmlrpc:"print_letter,omitempty"`
SendEmail *Bool `xmlrpc:"send_email,omitempty"`
SendLetter *Bool `xmlrpc:"send_letter,omitempty"`
SendSms *Bool `xmlrpc:"send_sms,omitempty"`
SmsDescription *String `xmlrpc:"sms_description,omitempty"`
WriteDate *Time `xmlrpc:"write_date,omitempty"`
WriteUid *Many2One `xmlrpc:"write_uid,omitempty"`
}
// AccountFollowupFollowupLines represents array of account_followup.followup.line model.
type AccountFollowupFollowupLines []AccountFollowupFollowupLine
// AccountFollowupFollowupLineModel is the odoo model name.
const AccountFollowupFollowupLineModel = "account_followup.followup.line"
// Many2One convert AccountFollowupFollowupLine to *Many2One.
func (afl *AccountFollowupFollowupLine) Many2One() *Many2One {
return NewMany2One(afl.Id.Get(), "")
}
// CreateAccountFollowupFollowupLine creates a new account_followup.followup.line model and returns its id.
func (c *Client) CreateAccountFollowupFollowupLine(afl *AccountFollowupFollowupLine) (int64, error) {
ids, err := c.CreateAccountFollowupFollowupLines([]*AccountFollowupFollowupLine{afl})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}
// CreateAccountFollowupFollowupLine creates a new account_followup.followup.line model and returns its id.
func (c *Client) CreateAccountFollowupFollowupLines(afls []*AccountFollowupFollowupLine) ([]int64, error) {
var vv []interface{}
for _, v := range afls {
vv = append(vv, v)
}
return c.Create(AccountFollowupFollowupLineModel, vv, nil)
}
// UpdateAccountFollowupFollowupLine updates an existing account_followup.followup.line record.
func (c *Client) UpdateAccountFollowupFollowupLine(afl *AccountFollowupFollowupLine) error {
return c.UpdateAccountFollowupFollowupLines([]int64{afl.Id.Get()}, afl)
}
// UpdateAccountFollowupFollowupLines updates existing account_followup.followup.line records.
// All records (represented by ids) will be updated by afl values.
func (c *Client) UpdateAccountFollowupFollowupLines(ids []int64, afl *AccountFollowupFollowupLine) error {
return c.Update(AccountFollowupFollowupLineModel, ids, afl, nil)
}
// DeleteAccountFollowupFollowupLine deletes an existing account_followup.followup.line record.
func (c *Client) DeleteAccountFollowupFollowupLine(id int64) error {
return c.DeleteAccountFollowupFollowupLines([]int64{id})
}
// DeleteAccountFollowupFollowupLines deletes existing account_followup.followup.line records.
func (c *Client) DeleteAccountFollowupFollowupLines(ids []int64) error {
return c.Delete(AccountFollowupFollowupLineModel, ids)
}
// GetAccountFollowupFollowupLine gets account_followup.followup.line existing record.
func (c *Client) GetAccountFollowupFollowupLine(id int64) (*AccountFollowupFollowupLine, error) {
afls, err := c.GetAccountFollowupFollowupLines([]int64{id})
if err != nil {
return nil, err
}
return &((*afls)[0]), nil
}
// GetAccountFollowupFollowupLines gets account_followup.followup.line existing records.
func (c *Client) GetAccountFollowupFollowupLines(ids []int64) (*AccountFollowupFollowupLines, error) {
afls := &AccountFollowupFollowupLines{}
if err := c.Read(AccountFollowupFollowupLineModel, ids, nil, afls); err != nil {
return nil, err
}
return afls, nil
}
// FindAccountFollowupFollowupLine finds account_followup.followup.line record by querying it with criteria.
func (c *Client) FindAccountFollowupFollowupLine(criteria *Criteria) (*AccountFollowupFollowupLine, error) {
afls := &AccountFollowupFollowupLines{}
if err := c.SearchRead(AccountFollowupFollowupLineModel, criteria, NewOptions().Limit(1), afls); err != nil {
return nil, err
}
return &((*afls)[0]), nil
}
// FindAccountFollowupFollowupLines finds account_followup.followup.line records by querying it
// and filtering it with criteria and options.
func (c *Client) FindAccountFollowupFollowupLines(criteria *Criteria, options *Options) (*AccountFollowupFollowupLines, error) {
afls := &AccountFollowupFollowupLines{}
if err := c.SearchRead(AccountFollowupFollowupLineModel, criteria, options, afls); err != nil {
return nil, err
}
return afls, nil
}
// FindAccountFollowupFollowupLineIds finds records ids by querying it
// and filtering it with criteria and options.
func (c *Client) FindAccountFollowupFollowupLineIds(criteria *Criteria, options *Options) ([]int64, error) {
return c.Search(AccountFollowupFollowupLineModel, criteria, options)
}
// FindAccountFollowupFollowupLineId finds record id by querying it with criteria.
func (c *Client) FindAccountFollowupFollowupLineId(criteria *Criteria, options *Options) (int64, error) {
ids, err := c.Search(AccountFollowupFollowupLineModel, criteria, options)
if err != nil {
return -1, err
}
return ids[0], nil
}