forked from Helvethink/go-odoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccount_automatic_entry_wizard.go
More file actions
132 lines (116 loc) · 5.96 KB
/
account_automatic_entry_wizard.go
File metadata and controls
132 lines (116 loc) · 5.96 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
package odoo
// AccountAutomaticEntryWizard represents account.automatic.entry.wizard model.
type AccountAutomaticEntryWizard struct {
AccountType *Selection `xmlrpc:"account_type,omitempty"`
Action *Selection `xmlrpc:"action,omitempty"`
CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"`
CompanyId *Many2One `xmlrpc:"company_id,omitempty"`
CreateDate *Time `xmlrpc:"create_date,omitempty"`
CreateUid *Many2One `xmlrpc:"create_uid,omitempty"`
Date *Time `xmlrpc:"date,omitempty"`
DestinationAccountId *Many2One `xmlrpc:"destination_account_id,omitempty"`
DisplayCurrencyHelper *Bool `xmlrpc:"display_currency_helper,omitempty"`
DisplayName *String `xmlrpc:"display_name,omitempty"`
ExpenseAccrualAccount *Many2One `xmlrpc:"expense_accrual_account,omitempty"`
Id *Int `xmlrpc:"id,omitempty"`
JournalId *Many2One `xmlrpc:"journal_id,omitempty"`
LockDateMessage *String `xmlrpc:"lock_date_message,omitempty"`
MoveData *String `xmlrpc:"move_data,omitempty"`
MoveLineIds *Relation `xmlrpc:"move_line_ids,omitempty"`
Percentage *Float `xmlrpc:"percentage,omitempty"`
PreviewMoveData *String `xmlrpc:"preview_move_data,omitempty"`
RevenueAccrualAccount *Many2One `xmlrpc:"revenue_accrual_account,omitempty"`
TotalAmount *Float `xmlrpc:"total_amount,omitempty"`
WriteDate *Time `xmlrpc:"write_date,omitempty"`
WriteUid *Many2One `xmlrpc:"write_uid,omitempty"`
}
// AccountAutomaticEntryWizards represents array of account.automatic.entry.wizard model.
type AccountAutomaticEntryWizards []AccountAutomaticEntryWizard
// AccountAutomaticEntryWizardModel is the odoo model name.
const AccountAutomaticEntryWizardModel = "account.automatic.entry.wizard"
// Many2One convert AccountAutomaticEntryWizard to *Many2One.
func (aaew *AccountAutomaticEntryWizard) Many2One() *Many2One {
return NewMany2One(aaew.Id.Get(), "")
}
// CreateAccountAutomaticEntryWizard creates a new account.automatic.entry.wizard model and returns its id.
func (c *Client) CreateAccountAutomaticEntryWizard(aaew *AccountAutomaticEntryWizard) (int64, error) {
ids, err := c.CreateAccountAutomaticEntryWizards([]*AccountAutomaticEntryWizard{aaew})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}
// CreateAccountAutomaticEntryWizard creates a new account.automatic.entry.wizard model and returns its id.
func (c *Client) CreateAccountAutomaticEntryWizards(aaews []*AccountAutomaticEntryWizard) ([]int64, error) {
var vv []interface{}
for _, v := range aaews {
vv = append(vv, v)
}
return c.Create(AccountAutomaticEntryWizardModel, vv, nil)
}
// UpdateAccountAutomaticEntryWizard updates an existing account.automatic.entry.wizard record.
func (c *Client) UpdateAccountAutomaticEntryWizard(aaew *AccountAutomaticEntryWizard) error {
return c.UpdateAccountAutomaticEntryWizards([]int64{aaew.Id.Get()}, aaew)
}
// UpdateAccountAutomaticEntryWizards updates existing account.automatic.entry.wizard records.
// All records (represented by ids) will be updated by aaew values.
func (c *Client) UpdateAccountAutomaticEntryWizards(ids []int64, aaew *AccountAutomaticEntryWizard) error {
return c.Update(AccountAutomaticEntryWizardModel, ids, aaew, nil)
}
// DeleteAccountAutomaticEntryWizard deletes an existing account.automatic.entry.wizard record.
func (c *Client) DeleteAccountAutomaticEntryWizard(id int64) error {
return c.DeleteAccountAutomaticEntryWizards([]int64{id})
}
// DeleteAccountAutomaticEntryWizards deletes existing account.automatic.entry.wizard records.
func (c *Client) DeleteAccountAutomaticEntryWizards(ids []int64) error {
return c.Delete(AccountAutomaticEntryWizardModel, ids)
}
// GetAccountAutomaticEntryWizard gets account.automatic.entry.wizard existing record.
func (c *Client) GetAccountAutomaticEntryWizard(id int64) (*AccountAutomaticEntryWizard, error) {
aaews, err := c.GetAccountAutomaticEntryWizards([]int64{id})
if err != nil {
return nil, err
}
return &((*aaews)[0]), nil
}
// GetAccountAutomaticEntryWizards gets account.automatic.entry.wizard existing records.
func (c *Client) GetAccountAutomaticEntryWizards(ids []int64) (*AccountAutomaticEntryWizards, error) {
aaews := &AccountAutomaticEntryWizards{}
if err := c.Read(AccountAutomaticEntryWizardModel, ids, nil, aaews); err != nil {
return nil, err
}
return aaews, nil
}
// FindAccountAutomaticEntryWizard finds account.automatic.entry.wizard record by querying it with criteria.
func (c *Client) FindAccountAutomaticEntryWizard(criteria *Criteria) (*AccountAutomaticEntryWizard, error) {
aaews := &AccountAutomaticEntryWizards{}
if err := c.SearchRead(AccountAutomaticEntryWizardModel, criteria, NewOptions().Limit(1), aaews); err != nil {
return nil, err
}
return &((*aaews)[0]), nil
}
// FindAccountAutomaticEntryWizards finds account.automatic.entry.wizard records by querying it
// and filtering it with criteria and options.
func (c *Client) FindAccountAutomaticEntryWizards(criteria *Criteria, options *Options) (*AccountAutomaticEntryWizards, error) {
aaews := &AccountAutomaticEntryWizards{}
if err := c.SearchRead(AccountAutomaticEntryWizardModel, criteria, options, aaews); err != nil {
return nil, err
}
return aaews, nil
}
// FindAccountAutomaticEntryWizardIds finds records ids by querying it
// and filtering it with criteria and options.
func (c *Client) FindAccountAutomaticEntryWizardIds(criteria *Criteria, options *Options) ([]int64, error) {
return c.Search(AccountAutomaticEntryWizardModel, criteria, options)
}
// FindAccountAutomaticEntryWizardId finds record id by querying it with criteria.
func (c *Client) FindAccountAutomaticEntryWizardId(criteria *Criteria, options *Options) (int64, error) {
ids, err := c.Search(AccountAutomaticEntryWizardModel, criteria, options)
if err != nil {
return -1, err
}
return ids[0], nil
}