Skip to content

Commit

Permalink
changed create low level function to create multiple instances in one…
Browse files Browse the repository at this point in the history
… api call, added high level methods and changed template accordingly
  • Loading branch information
ahuret committed Apr 13, 2023
1 parent ebddbd1 commit 6b74ea2
Show file tree
Hide file tree
Showing 365 changed files with 6,178 additions and 1,115 deletions.
18 changes: 17 additions & 1 deletion account_abstract_payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,23 @@ func (aap *AccountAbstractPayment) Many2One() *Many2One {

// CreateAccountAbstractPayment creates a new account.abstract.payment model and returns its id.
func (c *Client) CreateAccountAbstractPayment(aap *AccountAbstractPayment) (int64, error) {
return c.Create(AccountAbstractPaymentModel, aap)
ids, err := c.Create(AccountAbstractPaymentModel, []interface{}{aap})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}

// CreateAccountAbstractPayment creates a new account.abstract.payment model and returns its id.
func (c *Client) CreateAccountAbstractPayments(aaps []*AccountAbstractPayment) ([]int64, error) {
var vv []interface{}
for _, v := range aaps {
vv = append(vv, v)
}
return c.Create(AccountAbstractPaymentModel, vv)
}

// UpdateAccountAbstractPayment updates an existing account.abstract.payment record.
Expand Down
18 changes: 17 additions & 1 deletion account_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,23 @@ func (aa *AccountAccount) Many2One() *Many2One {

// CreateAccountAccount creates a new account.account model and returns its id.
func (c *Client) CreateAccountAccount(aa *AccountAccount) (int64, error) {
return c.Create(AccountAccountModel, aa)
ids, err := c.Create(AccountAccountModel, []interface{}{aa})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}

// CreateAccountAccount creates a new account.account model and returns its id.
func (c *Client) CreateAccountAccounts(aas []*AccountAccount) ([]int64, error) {
var vv []interface{}
for _, v := range aas {
vv = append(vv, v)
}
return c.Create(AccountAccountModel, vv)
}

// UpdateAccountAccount updates an existing account.account record.
Expand Down
18 changes: 17 additions & 1 deletion account_account_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,23 @@ func (aat *AccountAccountTag) Many2One() *Many2One {

// CreateAccountAccountTag creates a new account.account.tag model and returns its id.
func (c *Client) CreateAccountAccountTag(aat *AccountAccountTag) (int64, error) {
return c.Create(AccountAccountTagModel, aat)
ids, err := c.Create(AccountAccountTagModel, []interface{}{aat})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}

// CreateAccountAccountTag creates a new account.account.tag model and returns its id.
func (c *Client) CreateAccountAccountTags(aats []*AccountAccountTag) ([]int64, error) {
var vv []interface{}
for _, v := range aats {
vv = append(vv, v)
}
return c.Create(AccountAccountTagModel, vv)
}

// UpdateAccountAccountTag updates an existing account.account.tag record.
Expand Down
18 changes: 17 additions & 1 deletion account_account_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,23 @@ func (aat *AccountAccountTemplate) Many2One() *Many2One {

// CreateAccountAccountTemplate creates a new account.account.template model and returns its id.
func (c *Client) CreateAccountAccountTemplate(aat *AccountAccountTemplate) (int64, error) {
return c.Create(AccountAccountTemplateModel, aat)
ids, err := c.Create(AccountAccountTemplateModel, []interface{}{aat})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}

// CreateAccountAccountTemplate creates a new account.account.template model and returns its id.
func (c *Client) CreateAccountAccountTemplates(aats []*AccountAccountTemplate) ([]int64, error) {
var vv []interface{}
for _, v := range aats {
vv = append(vv, v)
}
return c.Create(AccountAccountTemplateModel, vv)
}

// UpdateAccountAccountTemplate updates an existing account.account.template record.
Expand Down
18 changes: 17 additions & 1 deletion account_account_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,23 @@ func (aat *AccountAccountType) Many2One() *Many2One {

// CreateAccountAccountType creates a new account.account.type model and returns its id.
func (c *Client) CreateAccountAccountType(aat *AccountAccountType) (int64, error) {
return c.Create(AccountAccountTypeModel, aat)
ids, err := c.Create(AccountAccountTypeModel, []interface{}{aat})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}

// CreateAccountAccountType creates a new account.account.type model and returns its id.
func (c *Client) CreateAccountAccountTypes(aats []*AccountAccountType) ([]int64, error) {
var vv []interface{}
for _, v := range aats {
vv = append(vv, v)
}
return c.Create(AccountAccountTypeModel, vv)
}

// UpdateAccountAccountType updates an existing account.account.type record.
Expand Down
18 changes: 17 additions & 1 deletion account_aged_trial_balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,23 @@ func (aatb *AccountAgedTrialBalance) Many2One() *Many2One {

// CreateAccountAgedTrialBalance creates a new account.aged.trial.balance model and returns its id.
func (c *Client) CreateAccountAgedTrialBalance(aatb *AccountAgedTrialBalance) (int64, error) {
return c.Create(AccountAgedTrialBalanceModel, aatb)
ids, err := c.Create(AccountAgedTrialBalanceModel, []interface{}{aatb})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}

// CreateAccountAgedTrialBalance creates a new account.aged.trial.balance model and returns its id.
func (c *Client) CreateAccountAgedTrialBalances(aatbs []*AccountAgedTrialBalance) ([]int64, error) {
var vv []interface{}
for _, v := range aatbs {
vv = append(vv, v)
}
return c.Create(AccountAgedTrialBalanceModel, vv)
}

// UpdateAccountAgedTrialBalance updates an existing account.aged.trial.balance record.
Expand Down
21 changes: 18 additions & 3 deletions account_analytic_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type AccountAnalyticAccount struct {
DisplayName *String `xmlrpc:"display_name,omptempty"`
Id *Int `xmlrpc:"id,omptempty"`
LineIds *Relation `xmlrpc:"line_ids,omptempty"`
MachineProjectName *String `xmlrpc:"machine_project_name,omptempty"`
MachineInitiativeName *String `xmlrpc:"machine_initiative_name,omptempty"`
MessageChannelIds *Relation `xmlrpc:"message_channel_ids,omptempty"`
MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omptempty"`
MessageIds *Relation `xmlrpc:"message_ids,omptempty"`
Expand All @@ -34,7 +34,6 @@ type AccountAnalyticAccount struct {
Name *String `xmlrpc:"name,omptempty"`
PartnerId *Many2One `xmlrpc:"partner_id,omptempty"`
ProjectCount *Int `xmlrpc:"project_count,omptempty"`
ProjectCreated *Bool `xmlrpc:"project_created,omptempty"`
ProjectIds *Relation `xmlrpc:"project_ids,omptempty"`
TagIds *Relation `xmlrpc:"tag_ids,omptempty"`
WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omptempty"`
Expand All @@ -55,7 +54,23 @@ func (aaa *AccountAnalyticAccount) Many2One() *Many2One {

// CreateAccountAnalyticAccount creates a new account.analytic.account model and returns its id.
func (c *Client) CreateAccountAnalyticAccount(aaa *AccountAnalyticAccount) (int64, error) {
return c.Create(AccountAnalyticAccountModel, aaa)
ids, err := c.Create(AccountAnalyticAccountModel, []interface{}{aaa})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}

// CreateAccountAnalyticAccount creates a new account.analytic.account model and returns its id.
func (c *Client) CreateAccountAnalyticAccounts(aaas []*AccountAnalyticAccount) ([]int64, error) {
var vv []interface{}
for _, v := range aaas {
vv = append(vv, v)
}
return c.Create(AccountAnalyticAccountModel, vv)
}

// UpdateAccountAnalyticAccount updates an existing account.analytic.account record.
Expand Down
18 changes: 17 additions & 1 deletion account_analytic_line.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,23 @@ func (aal *AccountAnalyticLine) Many2One() *Many2One {

// CreateAccountAnalyticLine creates a new account.analytic.line model and returns its id.
func (c *Client) CreateAccountAnalyticLine(aal *AccountAnalyticLine) (int64, error) {
return c.Create(AccountAnalyticLineModel, aal)
ids, err := c.Create(AccountAnalyticLineModel, []interface{}{aal})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}

// CreateAccountAnalyticLine creates a new account.analytic.line model and returns its id.
func (c *Client) CreateAccountAnalyticLines(aals []*AccountAnalyticLine) ([]int64, error) {
var vv []interface{}
for _, v := range aals {
vv = append(vv, v)
}
return c.Create(AccountAnalyticLineModel, vv)
}

// UpdateAccountAnalyticLine updates an existing account.analytic.line record.
Expand Down
18 changes: 17 additions & 1 deletion account_analytic_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,23 @@ func (aat *AccountAnalyticTag) Many2One() *Many2One {

// CreateAccountAnalyticTag creates a new account.analytic.tag model and returns its id.
func (c *Client) CreateAccountAnalyticTag(aat *AccountAnalyticTag) (int64, error) {
return c.Create(AccountAnalyticTagModel, aat)
ids, err := c.Create(AccountAnalyticTagModel, []interface{}{aat})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}

// CreateAccountAnalyticTag creates a new account.analytic.tag model and returns its id.
func (c *Client) CreateAccountAnalyticTags(aats []*AccountAnalyticTag) ([]int64, error) {
var vv []interface{}
for _, v := range aats {
vv = append(vv, v)
}
return c.Create(AccountAnalyticTagModel, vv)
}

// UpdateAccountAnalyticTag updates an existing account.analytic.tag record.
Expand Down
18 changes: 17 additions & 1 deletion account_balance_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,23 @@ func (abr *AccountBalanceReport) Many2One() *Many2One {

// CreateAccountBalanceReport creates a new account.balance.report model and returns its id.
func (c *Client) CreateAccountBalanceReport(abr *AccountBalanceReport) (int64, error) {
return c.Create(AccountBalanceReportModel, abr)
ids, err := c.Create(AccountBalanceReportModel, []interface{}{abr})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}

// CreateAccountBalanceReport creates a new account.balance.report model and returns its id.
func (c *Client) CreateAccountBalanceReports(abrs []*AccountBalanceReport) ([]int64, error) {
var vv []interface{}
for _, v := range abrs {
vv = append(vv, v)
}
return c.Create(AccountBalanceReportModel, vv)
}

// UpdateAccountBalanceReport updates an existing account.balance.report record.
Expand Down
18 changes: 17 additions & 1 deletion account_bank_accounts_wizard.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,23 @@ func (abaw *AccountBankAccountsWizard) Many2One() *Many2One {

// CreateAccountBankAccountsWizard creates a new account.bank.accounts.wizard model and returns its id.
func (c *Client) CreateAccountBankAccountsWizard(abaw *AccountBankAccountsWizard) (int64, error) {
return c.Create(AccountBankAccountsWizardModel, abaw)
ids, err := c.Create(AccountBankAccountsWizardModel, []interface{}{abaw})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}

// CreateAccountBankAccountsWizard creates a new account.bank.accounts.wizard model and returns its id.
func (c *Client) CreateAccountBankAccountsWizards(abaws []*AccountBankAccountsWizard) ([]int64, error) {
var vv []interface{}
for _, v := range abaws {
vv = append(vv, v)
}
return c.Create(AccountBankAccountsWizardModel, vv)
}

// UpdateAccountBankAccountsWizard updates an existing account.bank.accounts.wizard record.
Expand Down
18 changes: 17 additions & 1 deletion account_bank_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,23 @@ func (abs *AccountBankStatement) Many2One() *Many2One {

// CreateAccountBankStatement creates a new account.bank.statement model and returns its id.
func (c *Client) CreateAccountBankStatement(abs *AccountBankStatement) (int64, error) {
return c.Create(AccountBankStatementModel, abs)
ids, err := c.Create(AccountBankStatementModel, []interface{}{abs})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}

// CreateAccountBankStatement creates a new account.bank.statement model and returns its id.
func (c *Client) CreateAccountBankStatements(abss []*AccountBankStatement) ([]int64, error) {
var vv []interface{}
for _, v := range abss {
vv = append(vv, v)
}
return c.Create(AccountBankStatementModel, vv)
}

// UpdateAccountBankStatement updates an existing account.bank.statement record.
Expand Down
18 changes: 17 additions & 1 deletion account_bank_statement_cashbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,23 @@ func (absc *AccountBankStatementCashbox) Many2One() *Many2One {

// CreateAccountBankStatementCashbox creates a new account.bank.statement.cashbox model and returns its id.
func (c *Client) CreateAccountBankStatementCashbox(absc *AccountBankStatementCashbox) (int64, error) {
return c.Create(AccountBankStatementCashboxModel, absc)
ids, err := c.Create(AccountBankStatementCashboxModel, []interface{}{absc})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}

// CreateAccountBankStatementCashbox creates a new account.bank.statement.cashbox model and returns its id.
func (c *Client) CreateAccountBankStatementCashboxs(abscs []*AccountBankStatementCashbox) ([]int64, error) {
var vv []interface{}
for _, v := range abscs {
vv = append(vv, v)
}
return c.Create(AccountBankStatementCashboxModel, vv)
}

// UpdateAccountBankStatementCashbox updates an existing account.bank.statement.cashbox record.
Expand Down
18 changes: 17 additions & 1 deletion account_bank_statement_closebalance.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,23 @@ func (absc *AccountBankStatementClosebalance) Many2One() *Many2One {

// CreateAccountBankStatementClosebalance creates a new account.bank.statement.closebalance model and returns its id.
func (c *Client) CreateAccountBankStatementClosebalance(absc *AccountBankStatementClosebalance) (int64, error) {
return c.Create(AccountBankStatementClosebalanceModel, absc)
ids, err := c.Create(AccountBankStatementClosebalanceModel, []interface{}{absc})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}

// CreateAccountBankStatementClosebalance creates a new account.bank.statement.closebalance model and returns its id.
func (c *Client) CreateAccountBankStatementClosebalances(abscs []*AccountBankStatementClosebalance) ([]int64, error) {
var vv []interface{}
for _, v := range abscs {
vv = append(vv, v)
}
return c.Create(AccountBankStatementClosebalanceModel, vv)
}

// UpdateAccountBankStatementClosebalance updates an existing account.bank.statement.closebalance record.
Expand Down
18 changes: 17 additions & 1 deletion account_bank_statement_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,23 @@ func (absi *AccountBankStatementImport) Many2One() *Many2One {

// CreateAccountBankStatementImport creates a new account.bank.statement.import model and returns its id.
func (c *Client) CreateAccountBankStatementImport(absi *AccountBankStatementImport) (int64, error) {
return c.Create(AccountBankStatementImportModel, absi)
ids, err := c.Create(AccountBankStatementImportModel, []interface{}{absi})
if err != nil {
return -1, err
}
if len(ids) == 0 {
return -1, nil
}
return ids[0], nil
}

// CreateAccountBankStatementImport creates a new account.bank.statement.import model and returns its id.
func (c *Client) CreateAccountBankStatementImports(absis []*AccountBankStatementImport) ([]int64, error) {
var vv []interface{}
for _, v := range absis {
vv = append(vv, v)
}
return c.Create(AccountBankStatementImportModel, vv)
}

// UpdateAccountBankStatementImport updates an existing account.bank.statement.import record.
Expand Down
Loading

0 comments on commit 6b74ea2

Please sign in to comment.