-
Notifications
You must be signed in to change notification settings - Fork 0
/
account_common_journal_report.go
123 lines (107 loc) · 5.16 KB
/
account_common_journal_report.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
package odoo
// AccountCommonJournalReport represents account.common.journal.report model.
type AccountCommonJournalReport struct {
LastUpdate *Time `xmlrpc:"__last_update,omitempty"`
AmountCurrency *Bool `xmlrpc:"amount_currency,omitempty"`
CompanyId *Many2One `xmlrpc:"company_id,omitempty"`
CreateDate *Time `xmlrpc:"create_date,omitempty"`
CreateUid *Many2One `xmlrpc:"create_uid,omitempty"`
DateFrom *Time `xmlrpc:"date_from,omitempty"`
DateTo *Time `xmlrpc:"date_to,omitempty"`
DisplayName *String `xmlrpc:"display_name,omitempty"`
Id *Int `xmlrpc:"id,omitempty"`
JournalIds *Relation `xmlrpc:"journal_ids,omitempty"`
TargetMove *Selection `xmlrpc:"target_move,omitempty"`
WriteDate *Time `xmlrpc:"write_date,omitempty"`
WriteUid *Many2One `xmlrpc:"write_uid,omitempty"`
}
// AccountCommonJournalReports represents array of account.common.journal.report model.
type AccountCommonJournalReports []AccountCommonJournalReport
// AccountCommonJournalReportModel is the odoo model name.
const AccountCommonJournalReportModel = "account.common.journal.report"
// Many2One convert AccountCommonJournalReport to *Many2One.
func (acjr *AccountCommonJournalReport) Many2One() *Many2One {
return NewMany2One(acjr.Id.Get(), "")
}
// CreateAccountCommonJournalReport creates a new account.common.journal.report model and returns its id.
func (c *Client) CreateAccountCommonJournalReport(acjr *AccountCommonJournalReport) (int64, error) {
ids, err := c.CreateAccountCommonJournalReports([]*AccountCommonJournalReport{acjr})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}
// CreateAccountCommonJournalReports creates a new account.common.journal.report model and returns its id.
func (c *Client) CreateAccountCommonJournalReports(acjrs []*AccountCommonJournalReport) ([]int64, error) {
var vv []interface{}
for _, v := range acjrs {
vv = append(vv, v)
}
return c.Create(AccountCommonJournalReportModel, vv, nil)
}
// UpdateAccountCommonJournalReport updates an existing account.common.journal.report record.
func (c *Client) UpdateAccountCommonJournalReport(acjr *AccountCommonJournalReport) error {
return c.UpdateAccountCommonJournalReports([]int64{acjr.Id.Get()}, acjr)
}
// UpdateAccountCommonJournalReports updates existing account.common.journal.report records.
// All records (represented by ids) will be updated by acjr values.
func (c *Client) UpdateAccountCommonJournalReports(ids []int64, acjr *AccountCommonJournalReport) error {
return c.Update(AccountCommonJournalReportModel, ids, acjr, nil)
}
// DeleteAccountCommonJournalReport deletes an existing account.common.journal.report record.
func (c *Client) DeleteAccountCommonJournalReport(id int64) error {
return c.DeleteAccountCommonJournalReports([]int64{id})
}
// DeleteAccountCommonJournalReports deletes existing account.common.journal.report records.
func (c *Client) DeleteAccountCommonJournalReports(ids []int64) error {
return c.Delete(AccountCommonJournalReportModel, ids)
}
// GetAccountCommonJournalReport gets account.common.journal.report existing record.
func (c *Client) GetAccountCommonJournalReport(id int64) (*AccountCommonJournalReport, error) {
acjrs, err := c.GetAccountCommonJournalReports([]int64{id})
if err != nil {
return nil, err
}
return &((*acjrs)[0]), nil
}
// GetAccountCommonJournalReports gets account.common.journal.report existing records.
func (c *Client) GetAccountCommonJournalReports(ids []int64) (*AccountCommonJournalReports, error) {
acjrs := &AccountCommonJournalReports{}
if err := c.Read(AccountCommonJournalReportModel, ids, nil, acjrs); err != nil {
return nil, err
}
return acjrs, nil
}
// FindAccountCommonJournalReport finds account.common.journal.report record by querying it with criteria.
func (c *Client) FindAccountCommonJournalReport(criteria *Criteria) (*AccountCommonJournalReport, error) {
acjrs := &AccountCommonJournalReports{}
if err := c.SearchRead(AccountCommonJournalReportModel, criteria, NewOptions().Limit(1), acjrs); err != nil {
return nil, err
}
return &((*acjrs)[0]), nil
}
// FindAccountCommonJournalReports finds account.common.journal.report records by querying it
// and filtering it with criteria and options.
func (c *Client) FindAccountCommonJournalReports(criteria *Criteria, options *Options) (*AccountCommonJournalReports, error) {
acjrs := &AccountCommonJournalReports{}
if err := c.SearchRead(AccountCommonJournalReportModel, criteria, options, acjrs); err != nil {
return nil, err
}
return acjrs, nil
}
// FindAccountCommonJournalReportIds finds records ids by querying it
// and filtering it with criteria and options.
func (c *Client) FindAccountCommonJournalReportIds(criteria *Criteria, options *Options) ([]int64, error) {
return c.Search(AccountCommonJournalReportModel, criteria, options)
}
// FindAccountCommonJournalReportId finds record id by querying it with criteria.
func (c *Client) FindAccountCommonJournalReportId(criteria *Criteria, options *Options) (int64, error) {
ids, err := c.Search(AccountCommonJournalReportModel, criteria, options)
if err != nil {
return -1, err
}
return ids[0], nil
}