-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathreport_account_report_journal.go
114 lines (98 loc) · 4.55 KB
/
report_account_report_journal.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
package odoo
import (
"fmt"
)
// ReportAccountReportJournal represents report.account.report_journal model.
type ReportAccountReportJournal struct {
LastUpdate *Time `xmlrpc:"__last_update,omptempty"`
DisplayName *String `xmlrpc:"display_name,omptempty"`
Id *Int `xmlrpc:"id,omptempty"`
}
// ReportAccountReportJournals represents array of report.account.report_journal model.
type ReportAccountReportJournals []ReportAccountReportJournal
// ReportAccountReportJournalModel is the odoo model name.
const ReportAccountReportJournalModel = "report.account.report_journal"
// Many2One convert ReportAccountReportJournal to *Many2One.
func (rar *ReportAccountReportJournal) Many2One() *Many2One {
return NewMany2One(rar.Id.Get(), "")
}
// CreateReportAccountReportJournal creates a new report.account.report_journal model and returns its id.
func (c *Client) CreateReportAccountReportJournal(rar *ReportAccountReportJournal) (int64, error) {
return c.Create(ReportAccountReportJournalModel, rar)
}
// UpdateReportAccountReportJournal updates an existing report.account.report_journal record.
func (c *Client) UpdateReportAccountReportJournal(rar *ReportAccountReportJournal) error {
return c.UpdateReportAccountReportJournals([]int64{rar.Id.Get()}, rar)
}
// UpdateReportAccountReportJournals updates existing report.account.report_journal records.
// All records (represented by ids) will be updated by rar values.
func (c *Client) UpdateReportAccountReportJournals(ids []int64, rar *ReportAccountReportJournal) error {
return c.Update(ReportAccountReportJournalModel, ids, rar)
}
// DeleteReportAccountReportJournal deletes an existing report.account.report_journal record.
func (c *Client) DeleteReportAccountReportJournal(id int64) error {
return c.DeleteReportAccountReportJournals([]int64{id})
}
// DeleteReportAccountReportJournals deletes existing report.account.report_journal records.
func (c *Client) DeleteReportAccountReportJournals(ids []int64) error {
return c.Delete(ReportAccountReportJournalModel, ids)
}
// GetReportAccountReportJournal gets report.account.report_journal existing record.
func (c *Client) GetReportAccountReportJournal(id int64) (*ReportAccountReportJournal, error) {
rars, err := c.GetReportAccountReportJournals([]int64{id})
if err != nil {
return nil, err
}
if rars != nil && len(*rars) > 0 {
return &((*rars)[0]), nil
}
return nil, fmt.Errorf("id %v of report.account.report_journal not found", id)
}
// GetReportAccountReportJournals gets report.account.report_journal existing records.
func (c *Client) GetReportAccountReportJournals(ids []int64) (*ReportAccountReportJournals, error) {
rars := &ReportAccountReportJournals{}
if err := c.Read(ReportAccountReportJournalModel, ids, nil, rars); err != nil {
return nil, err
}
return rars, nil
}
// FindReportAccountReportJournal finds report.account.report_journal record by querying it with criteria.
func (c *Client) FindReportAccountReportJournal(criteria *Criteria) (*ReportAccountReportJournal, error) {
rars := &ReportAccountReportJournals{}
if err := c.SearchRead(ReportAccountReportJournalModel, criteria, NewOptions().Limit(1), rars); err != nil {
return nil, err
}
if rars != nil && len(*rars) > 0 {
return &((*rars)[0]), nil
}
return nil, fmt.Errorf("no report.account.report_journal was found with criteria %v", criteria)
}
// FindReportAccountReportJournals finds report.account.report_journal records by querying it
// and filtering it with criteria and options.
func (c *Client) FindReportAccountReportJournals(criteria *Criteria, options *Options) (*ReportAccountReportJournals, error) {
rars := &ReportAccountReportJournals{}
if err := c.SearchRead(ReportAccountReportJournalModel, criteria, options, rars); err != nil {
return nil, err
}
return rars, nil
}
// FindReportAccountReportJournalIds finds records ids by querying it
// and filtering it with criteria and options.
func (c *Client) FindReportAccountReportJournalIds(criteria *Criteria, options *Options) ([]int64, error) {
ids, err := c.Search(ReportAccountReportJournalModel, criteria, options)
if err != nil {
return []int64{}, err
}
return ids, nil
}
// FindReportAccountReportJournalId finds record id by querying it with criteria.
func (c *Client) FindReportAccountReportJournalId(criteria *Criteria, options *Options) (int64, error) {
ids, err := c.Search(ReportAccountReportJournalModel, criteria, options)
if err != nil {
return -1, err
}
if len(ids) > 0 {
return ids[0], nil
}
return -1, fmt.Errorf("no report.account.report_journal was found with criteria %v and options %v", criteria, options)
}