-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathreport_account_report_tax.go
114 lines (98 loc) · 4.29 KB
/
report_account_report_tax.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"
)
// ReportAccountReportTax represents report.account.report_tax model.
type ReportAccountReportTax struct {
LastUpdate *Time `xmlrpc:"__last_update,omptempty"`
DisplayName *String `xmlrpc:"display_name,omptempty"`
Id *Int `xmlrpc:"id,omptempty"`
}
// ReportAccountReportTaxs represents array of report.account.report_tax model.
type ReportAccountReportTaxs []ReportAccountReportTax
// ReportAccountReportTaxModel is the odoo model name.
const ReportAccountReportTaxModel = "report.account.report_tax"
// Many2One convert ReportAccountReportTax to *Many2One.
func (rar *ReportAccountReportTax) Many2One() *Many2One {
return NewMany2One(rar.Id.Get(), "")
}
// CreateReportAccountReportTax creates a new report.account.report_tax model and returns its id.
func (c *Client) CreateReportAccountReportTax(rar *ReportAccountReportTax) (int64, error) {
return c.Create(ReportAccountReportTaxModel, rar)
}
// UpdateReportAccountReportTax updates an existing report.account.report_tax record.
func (c *Client) UpdateReportAccountReportTax(rar *ReportAccountReportTax) error {
return c.UpdateReportAccountReportTaxs([]int64{rar.Id.Get()}, rar)
}
// UpdateReportAccountReportTaxs updates existing report.account.report_tax records.
// All records (represented by ids) will be updated by rar values.
func (c *Client) UpdateReportAccountReportTaxs(ids []int64, rar *ReportAccountReportTax) error {
return c.Update(ReportAccountReportTaxModel, ids, rar)
}
// DeleteReportAccountReportTax deletes an existing report.account.report_tax record.
func (c *Client) DeleteReportAccountReportTax(id int64) error {
return c.DeleteReportAccountReportTaxs([]int64{id})
}
// DeleteReportAccountReportTaxs deletes existing report.account.report_tax records.
func (c *Client) DeleteReportAccountReportTaxs(ids []int64) error {
return c.Delete(ReportAccountReportTaxModel, ids)
}
// GetReportAccountReportTax gets report.account.report_tax existing record.
func (c *Client) GetReportAccountReportTax(id int64) (*ReportAccountReportTax, error) {
rars, err := c.GetReportAccountReportTaxs([]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_tax not found", id)
}
// GetReportAccountReportTaxs gets report.account.report_tax existing records.
func (c *Client) GetReportAccountReportTaxs(ids []int64) (*ReportAccountReportTaxs, error) {
rars := &ReportAccountReportTaxs{}
if err := c.Read(ReportAccountReportTaxModel, ids, nil, rars); err != nil {
return nil, err
}
return rars, nil
}
// FindReportAccountReportTax finds report.account.report_tax record by querying it with criteria.
func (c *Client) FindReportAccountReportTax(criteria *Criteria) (*ReportAccountReportTax, error) {
rars := &ReportAccountReportTaxs{}
if err := c.SearchRead(ReportAccountReportTaxModel, 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_tax was found with criteria %v", criteria)
}
// FindReportAccountReportTaxs finds report.account.report_tax records by querying it
// and filtering it with criteria and options.
func (c *Client) FindReportAccountReportTaxs(criteria *Criteria, options *Options) (*ReportAccountReportTaxs, error) {
rars := &ReportAccountReportTaxs{}
if err := c.SearchRead(ReportAccountReportTaxModel, criteria, options, rars); err != nil {
return nil, err
}
return rars, nil
}
// FindReportAccountReportTaxIds finds records ids by querying it
// and filtering it with criteria and options.
func (c *Client) FindReportAccountReportTaxIds(criteria *Criteria, options *Options) ([]int64, error) {
ids, err := c.Search(ReportAccountReportTaxModel, criteria, options)
if err != nil {
return []int64{}, err
}
return ids, nil
}
// FindReportAccountReportTaxId finds record id by querying it with criteria.
func (c *Client) FindReportAccountReportTaxId(criteria *Criteria, options *Options) (int64, error) {
ids, err := c.Search(ReportAccountReportTaxModel, criteria, options)
if err != nil {
return -1, err
}
if len(ids) > 0 {
return ids[0], nil
}
return -1, fmt.Errorf("no report.account.report_tax was found with criteria %v and options %v", criteria, options)
}