-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathreport_sale_report_saleproforma.go
114 lines (98 loc) · 4.68 KB
/
report_sale_report_saleproforma.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"
)
// ReportSaleReportSaleproforma represents report.sale.report_saleproforma model.
type ReportSaleReportSaleproforma struct {
LastUpdate *Time `xmlrpc:"__last_update,omptempty"`
DisplayName *String `xmlrpc:"display_name,omptempty"`
Id *Int `xmlrpc:"id,omptempty"`
}
// ReportSaleReportSaleproformas represents array of report.sale.report_saleproforma model.
type ReportSaleReportSaleproformas []ReportSaleReportSaleproforma
// ReportSaleReportSaleproformaModel is the odoo model name.
const ReportSaleReportSaleproformaModel = "report.sale.report_saleproforma"
// Many2One convert ReportSaleReportSaleproforma to *Many2One.
func (rsr *ReportSaleReportSaleproforma) Many2One() *Many2One {
return NewMany2One(rsr.Id.Get(), "")
}
// CreateReportSaleReportSaleproforma creates a new report.sale.report_saleproforma model and returns its id.
func (c *Client) CreateReportSaleReportSaleproforma(rsr *ReportSaleReportSaleproforma) (int64, error) {
return c.Create(ReportSaleReportSaleproformaModel, rsr)
}
// UpdateReportSaleReportSaleproforma updates an existing report.sale.report_saleproforma record.
func (c *Client) UpdateReportSaleReportSaleproforma(rsr *ReportSaleReportSaleproforma) error {
return c.UpdateReportSaleReportSaleproformas([]int64{rsr.Id.Get()}, rsr)
}
// UpdateReportSaleReportSaleproformas updates existing report.sale.report_saleproforma records.
// All records (represented by ids) will be updated by rsr values.
func (c *Client) UpdateReportSaleReportSaleproformas(ids []int64, rsr *ReportSaleReportSaleproforma) error {
return c.Update(ReportSaleReportSaleproformaModel, ids, rsr)
}
// DeleteReportSaleReportSaleproforma deletes an existing report.sale.report_saleproforma record.
func (c *Client) DeleteReportSaleReportSaleproforma(id int64) error {
return c.DeleteReportSaleReportSaleproformas([]int64{id})
}
// DeleteReportSaleReportSaleproformas deletes existing report.sale.report_saleproforma records.
func (c *Client) DeleteReportSaleReportSaleproformas(ids []int64) error {
return c.Delete(ReportSaleReportSaleproformaModel, ids)
}
// GetReportSaleReportSaleproforma gets report.sale.report_saleproforma existing record.
func (c *Client) GetReportSaleReportSaleproforma(id int64) (*ReportSaleReportSaleproforma, error) {
rsrs, err := c.GetReportSaleReportSaleproformas([]int64{id})
if err != nil {
return nil, err
}
if rsrs != nil && len(*rsrs) > 0 {
return &((*rsrs)[0]), nil
}
return nil, fmt.Errorf("id %v of report.sale.report_saleproforma not found", id)
}
// GetReportSaleReportSaleproformas gets report.sale.report_saleproforma existing records.
func (c *Client) GetReportSaleReportSaleproformas(ids []int64) (*ReportSaleReportSaleproformas, error) {
rsrs := &ReportSaleReportSaleproformas{}
if err := c.Read(ReportSaleReportSaleproformaModel, ids, nil, rsrs); err != nil {
return nil, err
}
return rsrs, nil
}
// FindReportSaleReportSaleproforma finds report.sale.report_saleproforma record by querying it with criteria.
func (c *Client) FindReportSaleReportSaleproforma(criteria *Criteria) (*ReportSaleReportSaleproforma, error) {
rsrs := &ReportSaleReportSaleproformas{}
if err := c.SearchRead(ReportSaleReportSaleproformaModel, criteria, NewOptions().Limit(1), rsrs); err != nil {
return nil, err
}
if rsrs != nil && len(*rsrs) > 0 {
return &((*rsrs)[0]), nil
}
return nil, fmt.Errorf("no report.sale.report_saleproforma was found with criteria %v", criteria)
}
// FindReportSaleReportSaleproformas finds report.sale.report_saleproforma records by querying it
// and filtering it with criteria and options.
func (c *Client) FindReportSaleReportSaleproformas(criteria *Criteria, options *Options) (*ReportSaleReportSaleproformas, error) {
rsrs := &ReportSaleReportSaleproformas{}
if err := c.SearchRead(ReportSaleReportSaleproformaModel, criteria, options, rsrs); err != nil {
return nil, err
}
return rsrs, nil
}
// FindReportSaleReportSaleproformaIds finds records ids by querying it
// and filtering it with criteria and options.
func (c *Client) FindReportSaleReportSaleproformaIds(criteria *Criteria, options *Options) ([]int64, error) {
ids, err := c.Search(ReportSaleReportSaleproformaModel, criteria, options)
if err != nil {
return []int64{}, err
}
return ids, nil
}
// FindReportSaleReportSaleproformaId finds record id by querying it with criteria.
func (c *Client) FindReportSaleReportSaleproformaId(criteria *Criteria, options *Options) (int64, error) {
ids, err := c.Search(ReportSaleReportSaleproformaModel, criteria, options)
if err != nil {
return -1, err
}
if len(ids) > 0 {
return ids[0], nil
}
return -1, fmt.Errorf("no report.sale.report_saleproforma was found with criteria %v and options %v", criteria, options)
}