forked from Helvethink/go-odoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccount_move_send_wizard.go
More file actions
133 lines (117 loc) · 5.67 KB
/
account_move_send_wizard.go
File metadata and controls
133 lines (117 loc) · 5.67 KB
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
133
package odoo
// AccountMoveSendWizard represents account.move.send.wizard model.
type AccountMoveSendWizard struct {
Alerts *String `xmlrpc:"alerts,omitempty"`
CompanyId *Many2One `xmlrpc:"company_id,omitempty"`
CreateDate *Time `xmlrpc:"create_date,omitempty"`
CreateUid *Many2One `xmlrpc:"create_uid,omitempty"`
DisplayName *String `xmlrpc:"display_name,omitempty"`
DisplayPdfReportId *Bool `xmlrpc:"display_pdf_report_id,omitempty"`
ExtraEdiCheckboxes *String `xmlrpc:"extra_edi_checkboxes,omitempty"`
ExtraEdis *String `xmlrpc:"extra_edis,omitempty"`
Id *Int `xmlrpc:"id,omitempty"`
InvoiceEdiFormat *Selection `xmlrpc:"invoice_edi_format,omitempty"`
IsDownloadOnly *Bool `xmlrpc:"is_download_only,omitempty"`
MailAttachmentsWidget *String `xmlrpc:"mail_attachments_widget,omitempty"`
MailBody *String `xmlrpc:"mail_body,omitempty"`
MailLang *String `xmlrpc:"mail_lang,omitempty"`
MailPartnerIds *Relation `xmlrpc:"mail_partner_ids,omitempty"`
MailSubject *String `xmlrpc:"mail_subject,omitempty"`
MailTemplateId *Many2One `xmlrpc:"mail_template_id,omitempty"`
MoveId *Many2One `xmlrpc:"move_id,omitempty"`
PdfReportId *Many2One `xmlrpc:"pdf_report_id,omitempty"`
SendingMethodCheckboxes *String `xmlrpc:"sending_method_checkboxes,omitempty"`
SendingMethods *String `xmlrpc:"sending_methods,omitempty"`
WriteDate *Time `xmlrpc:"write_date,omitempty"`
WriteUid *Many2One `xmlrpc:"write_uid,omitempty"`
}
// AccountMoveSendWizards represents array of account.move.send.wizard model.
type AccountMoveSendWizards []AccountMoveSendWizard
// AccountMoveSendWizardModel is the odoo model name.
const AccountMoveSendWizardModel = "account.move.send.wizard"
// Many2One convert AccountMoveSendWizard to *Many2One.
func (amsw *AccountMoveSendWizard) Many2One() *Many2One {
return NewMany2One(amsw.Id.Get(), "")
}
// CreateAccountMoveSendWizard creates a new account.move.send.wizard model and returns its id.
func (c *Client) CreateAccountMoveSendWizard(amsw *AccountMoveSendWizard) (int64, error) {
ids, err := c.CreateAccountMoveSendWizards([]*AccountMoveSendWizard{amsw})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}
// CreateAccountMoveSendWizard creates a new account.move.send.wizard model and returns its id.
func (c *Client) CreateAccountMoveSendWizards(amsws []*AccountMoveSendWizard) ([]int64, error) {
var vv []interface{}
for _, v := range amsws {
vv = append(vv, v)
}
return c.Create(AccountMoveSendWizardModel, vv, nil)
}
// UpdateAccountMoveSendWizard updates an existing account.move.send.wizard record.
func (c *Client) UpdateAccountMoveSendWizard(amsw *AccountMoveSendWizard) error {
return c.UpdateAccountMoveSendWizards([]int64{amsw.Id.Get()}, amsw)
}
// UpdateAccountMoveSendWizards updates existing account.move.send.wizard records.
// All records (represented by ids) will be updated by amsw values.
func (c *Client) UpdateAccountMoveSendWizards(ids []int64, amsw *AccountMoveSendWizard) error {
return c.Update(AccountMoveSendWizardModel, ids, amsw, nil)
}
// DeleteAccountMoveSendWizard deletes an existing account.move.send.wizard record.
func (c *Client) DeleteAccountMoveSendWizard(id int64) error {
return c.DeleteAccountMoveSendWizards([]int64{id})
}
// DeleteAccountMoveSendWizards deletes existing account.move.send.wizard records.
func (c *Client) DeleteAccountMoveSendWizards(ids []int64) error {
return c.Delete(AccountMoveSendWizardModel, ids)
}
// GetAccountMoveSendWizard gets account.move.send.wizard existing record.
func (c *Client) GetAccountMoveSendWizard(id int64) (*AccountMoveSendWizard, error) {
amsws, err := c.GetAccountMoveSendWizards([]int64{id})
if err != nil {
return nil, err
}
return &((*amsws)[0]), nil
}
// GetAccountMoveSendWizards gets account.move.send.wizard existing records.
func (c *Client) GetAccountMoveSendWizards(ids []int64) (*AccountMoveSendWizards, error) {
amsws := &AccountMoveSendWizards{}
if err := c.Read(AccountMoveSendWizardModel, ids, nil, amsws); err != nil {
return nil, err
}
return amsws, nil
}
// FindAccountMoveSendWizard finds account.move.send.wizard record by querying it with criteria.
func (c *Client) FindAccountMoveSendWizard(criteria *Criteria) (*AccountMoveSendWizard, error) {
amsws := &AccountMoveSendWizards{}
if err := c.SearchRead(AccountMoveSendWizardModel, criteria, NewOptions().Limit(1), amsws); err != nil {
return nil, err
}
return &((*amsws)[0]), nil
}
// FindAccountMoveSendWizards finds account.move.send.wizard records by querying it
// and filtering it with criteria and options.
func (c *Client) FindAccountMoveSendWizards(criteria *Criteria, options *Options) (*AccountMoveSendWizards, error) {
amsws := &AccountMoveSendWizards{}
if err := c.SearchRead(AccountMoveSendWizardModel, criteria, options, amsws); err != nil {
return nil, err
}
return amsws, nil
}
// FindAccountMoveSendWizardIds finds records ids by querying it
// and filtering it with criteria and options.
func (c *Client) FindAccountMoveSendWizardIds(criteria *Criteria, options *Options) ([]int64, error) {
return c.Search(AccountMoveSendWizardModel, criteria, options)
}
// FindAccountMoveSendWizardId finds record id by querying it with criteria.
func (c *Client) FindAccountMoveSendWizardId(criteria *Criteria, options *Options) (int64, error) {
ids, err := c.Search(AccountMoveSendWizardModel, criteria, options)
if err != nil {
return -1, err
}
return ids[0], nil
}