From a1e3385e2e338a64b25e17548b23242fd8a1af88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Gon=C3=A7alves?= Date: Thu, 30 Jan 2025 17:36:56 +0100 Subject: [PATCH 1/2] Fix types --- types.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/types.go b/types.go index 4c3879b..53f8dea 100644 --- a/types.go +++ b/types.go @@ -1,7 +1,6 @@ package odoo import ( - "github.com/helvethink/go-odoo/client" "time" ) @@ -158,47 +157,47 @@ func (r *Relation) Get() []int64 { // AddNewRecord is an helper to create a new record of one2many or many2many. // https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write func (r *Relation) AddNewRecord(values interface{}) { - r.v = append(r.v, client.newTuple(0, 0, client.getValuesFromInterface(values))) + r.v = append(r.v, newTuple(0, 0, getValuesFromInterface(values))) } // UpdateRecord is an helper to update an existing record of one2many or many2many. // https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write func (r *Relation) UpdateRecord(record int64, values interface{}) { - r.v = append(r.v, client.newTuple(1, record, client.getValuesFromInterface(values))) + r.v = append(r.v, newTuple(1, record, getValuesFromInterface(values))) } // DeleteRecord is an helper to delete an existing record of one2many or many2many. // https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write func (r *Relation) DeleteRecord(record int64) { - r.v = append(r.v, client.newTuple(2, record, 0)) + r.v = append(r.v, newTuple(2, record, 0)) r.ids = []int64{} } // RemoveRecord is an helper to remove an existing record of one2many or many2many. // https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write func (r *Relation) RemoveRecord(record int64) { - r.v = append(r.v, client.newTuple(3, record, 0)) + r.v = append(r.v, newTuple(3, record, 0)) r.ids = []int64{} } // AddRecord is an helper to add an existing record of one2many or many2many. // https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write func (r *Relation) AddRecord(record int64) { - r.v = append(r.v, client.newTuple(4, record, 0)) + r.v = append(r.v, newTuple(4, record, 0)) r.ids = addRecord(r.ids, record) } // RemoveAllRecords is an helper to remove all records of one2many or many2many. // https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write func (r *Relation) RemoveAllRecords() { - r.v = append(r.v, client.newTuple(5, 0, 0)) + r.v = append(r.v, newTuple(5, 0, 0)) r.ids = []int64{} } // ReplaceAllRecords is an helper to replace all records of one2many or many2many. // https://www.odoo.com/documentation/13.0/reference/orm.html#odoo.models.Model.write func (r *Relation) ReplaceAllRecords(newRecords []int64) { - r.v = append(r.v, client.newTuple(6, 0, newRecords)) + r.v = append(r.v, newTuple(6, 0, newRecords)) r.ids = newRecords } From c88d5a1d160818e1b8eaff41d6b9a3db447a618d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Gon=C3=A7alves?= Date: Thu, 30 Jan 2025 17:37:15 +0100 Subject: [PATCH 2/2] Add new models --- account_account.go | 157 ++++++++ account_account_tag.go | 122 ++++++ account_accrued_orders_wizard.go | 125 ++++++ account_analytic_account.go | 147 +++++++ account_analytic_applicability.go | 123 ++++++ account_analytic_distribution_model.go | 127 ++++++ account_analytic_line.go | 156 ++++++++ account_analytic_plan.go | 131 ++++++ account_automatic_entry_wizard.go | 132 +++++++ account_autopost_bills_wizard.go | 119 ++++++ account_bank_statement.go | 131 ++++++ account_bank_statement_line.go | 307 ++++++++++++++ account_cash_rounding.go | 122 ++++++ account_code_mapping.go | 115 ++++++ account_financial_year_op.go | 121 ++++++ account_fiscal_position.go | 137 +++++++ account_fiscal_position_account.go | 120 ++++++ account_fiscal_position_tax.go | 121 ++++++ account_full_reconcile.go | 119 ++++++ account_group.go | 121 ++++++ account_incoterms.go | 119 ++++++ account_invoice_report.go | 139 +++++++ account_journal.go | 195 +++++++++ account_journal_group.go | 120 ++++++ account_lock_exception.go | 129 ++++++ account_merge_wizard.go | 120 ++++++ account_merge_wizard_line.go | 125 ++++++ account_move.go | 290 ++++++++++++++ account_move_line.go | 197 +++++++++ account_move_reversal.go | 127 ++++++ account_move_send_batch_wizard.go | 120 ++++++ account_move_send_wizard.go | 133 +++++++ account_partial_reconcile.go | 128 ++++++ account_payment.go | 195 +++++++++ account_payment_method.go | 119 ++++++ account_payment_method_line.go | 127 ++++++ account_payment_register.go | 167 ++++++++ account_payment_term.go | 134 +++++++ account_payment_term_line.go | 123 ++++++ account_reconcile_model.go | 165 ++++++++ account_reconcile_model_line.go | 134 +++++++ account_reconcile_model_partner_mapping.go | 121 ++++++ account_report.go | 152 +++++++ account_report_column.go | 124 ++++++ account_report_expression.go | 128 ++++++ account_report_external_value.go | 128 ++++++ account_report_line.go | 136 +++++++ account_resequence_wizard.go | 124 ++++++ account_root.go | 114 ++++++ account_secure_entries_wizard.go | 125 ++++++ account_setup_bank_manual_config.go | 170 ++++++++ account_tax.go | 160 ++++++++ account_tax_group.go | 126 ++++++ account_tax_repartition_line.go | 127 ++++++ applicant_get_refuse_reason.go | 125 ++++++ applicant_send_mail.go | 127 ++++++ auth_totp_device.go | 117 ++++++ auth_totp_wizard.go | 121 ++++++ base_document_layout.go | 155 ++++++++ base_enable_profiling_wizard.go | 118 ++++++ base_import_import.go | 120 ++++++ base_import_mapping.go | 119 ++++++ base_import_module.go | 122 ++++++ base_language_export.go | 126 ++++++ base_language_import.go | 121 ++++++ base_language_install.go | 119 ++++++ base_module_install_request.go | 120 ++++++ base_module_install_review.go | 119 ++++++ base_module_uninstall.go | 120 ++++++ base_module_update.go | 119 ++++++ base_module_upgrade.go | 117 ++++++ base_partner_merge_automatic_wizard.go | 130 ++++++ base_partner_merge_line.go | 119 ++++++ bill_to_po_wizard.go | 118 ++++++ bus_bus.go | 118 ++++++ bus_presence.go | 117 ++++++ calendar_alarm.go | 125 ++++++ calendar_attendee.go | 126 ++++++ calendar_event.go | 197 +++++++++ calendar_event_type.go | 118 ++++++ calendar_filters.go | 120 ++++++ calendar_popover_delete_wizard.go | 118 ++++++ calendar_provider_config.go | 123 ++++++ calendar_recurrence.go | 139 +++++++ candidate_send_mail.go | 127 ++++++ change_password_own.go | 118 ++++++ change_password_user.go | 120 ++++++ change_password_wizard.go | 117 ++++++ crm_activity_report.go | 131 ++++++ crm_iap_lead_helpers.go | 116 ++++++ crm_iap_lead_industry.go | 120 ++++++ crm_iap_lead_mining_request.go | 142 +++++++ crm_iap_lead_role.go | 119 ++++++ crm_iap_lead_seniority.go | 118 ++++++ crm_lead.go | 225 +++++++++++ crm_lead2opportunity_partner.go | 124 ++++++ crm_lead2opportunity_partner_mass.go | 127 ++++++ crm_lead_lost.go | 119 ++++++ crm_lead_pls_update.go | 118 ++++++ crm_lead_scoring_frequency.go | 121 ++++++ crm_lead_scoring_frequency_field.go | 118 ++++++ crm_lost_reason.go | 119 ++++++ crm_merge_opportunity.go | 119 ++++++ crm_quotation_partner.go | 119 ++++++ crm_recurring_plan.go | 120 ++++++ crm_stage.go | 123 ++++++ crm_tag.go | 118 ++++++ crm_team.go | 182 +++++++++ crm_team_member.go | 149 +++++++ decimal_precision.go | 118 ++++++ digest_digest.go | 141 +++++++ digest_tip.go | 121 ++++++ discuss_channel.go | 156 ++++++++ discuss_channel_member.go | 134 +++++++ discuss_channel_rtc_session.go | 124 ++++++ discuss_gif_favorite.go | 117 ++++++ discuss_voice_metadata.go | 117 ++++++ fetchmail_server.go | 139 +++++++ generator/cmd/tmpl/model.tmpl | 2 +- go.mod | 16 + go.sum | 17 + hr_applicant.go | 199 ++++++++++ hr_applicant_category.go | 118 ++++++ hr_applicant_refuse_reason.go | 120 ++++++ hr_candidate.go | 184 +++++++++ hr_candidate_skill.go | 121 ++++++ hr_contract.go | 167 ++++++++ hr_contract_history.go | 136 +++++++ hr_contract_type.go | 120 ++++++ hr_department.go | 164 ++++++++ hr_departure_reason.go | 119 ++++++ hr_departure_wizard.go | 121 ++++++ hr_employee.go | 276 +++++++++++++ hr_employee_category.go | 119 ++++++ hr_employee_cv_wizard.go | 124 ++++++ hr_employee_delete_wizard.go | 119 ++++++ hr_employee_public.go | 186 +++++++++ hr_employee_skill.go | 122 ++++++ hr_employee_skill_log.go | 123 ++++++ hr_employee_skill_report.go | 121 ++++++ hr_expense.go | 184 +++++++++ hr_expense_approve_duplicate.go | 118 ++++++ hr_expense_refuse_wizard.go | 118 ++++++ hr_expense_sheet.go | 174 ++++++++ hr_expense_split.go | 133 +++++++ hr_expense_split_wizard.go | 123 ++++++ hr_holidays_cancel_leave.go | 118 ++++++ hr_holidays_summary_employee.go | 119 ++++++ hr_job.go | 181 +++++++++ hr_job_platform.go | 119 ++++++ hr_leave.go | 187 +++++++++ hr_leave_accrual_level.go | 148 +++++++ hr_leave_accrual_plan.go | 133 +++++++ hr_leave_allocation.go | 175 ++++++++ hr_leave_allocation_generate_multi_wizard.go | 130 ++++++ hr_leave_employee_type_report.go | 123 ++++++ hr_leave_generate_multi_wizard.go | 125 ++++++ hr_leave_mandatory_day.go | 123 ++++++ hr_leave_report.go | 126 ++++++ hr_leave_report_calendar.go | 130 ++++++ hr_leave_type.go | 151 +++++++ hr_payroll_structure_type.go | 120 ++++++ hr_recruitment_degree.go | 118 ++++++ hr_recruitment_source.go | 123 ++++++ hr_recruitment_stage.go | 127 ++++++ hr_resume_line.go | 123 ++++++ hr_resume_line_type.go | 118 ++++++ hr_skill.go | 120 ++++++ hr_skill_level.go | 120 ++++++ hr_skill_type.go | 121 ++++++ hr_work_location.go | 122 ++++++ iap_account.go | 141 +++++++ iap_service.go | 121 ++++++ ir_actions_act_url.go | 126 ++++++ ir_actions_act_window.go | 140 +++++++ ir_actions_act_window_close.go | 124 ++++++ ir_actions_act_window_view.go | 121 ++++++ ir_actions_actions.go | 124 ++++++ ir_actions_client.go | 130 ++++++ ir_actions_report.go | 137 +++++++ ir_actions_server.go | 164 ++++++++ ir_actions_todo.go | 120 ++++++ ir_asset.go | 123 ++++++ ir_attachment.go | 141 +++++++ ir_config_parameter.go | 118 ++++++ ir_cron.go | 175 ++++++++ ir_cron_progress.go | 121 ++++++ ir_cron_trigger.go | 118 ++++++ ir_default.go | 121 ++++++ ir_demo.go | 116 ++++++ ir_demo_failure.go | 119 ++++++ ir_demo_failure_wizard.go | 118 ++++++ ir_embedded_actions.go | 131 ++++++ ir_exports.go | 119 ++++++ ir_exports_line.go | 118 ++++++ ir_filters.go | 127 ++++++ ir_logging.go | 124 ++++++ ir_mail_server.go | 137 +++++++ ir_model_access.go | 124 ++++++ ir_model_constraint.go | 122 ++++++ ir_model_data.go | 123 ++++++ ir_model_fields_selection.go | 120 ++++++ ir_model_inherit.go | 115 ++++++ ir_model_relation.go | 119 ++++++ ir_module_category.go | 125 ++++++ ir_module_module.go | 150 +++++++ ir_module_module_dependency.go | 117 ++++++ ir_module_module_exclusion.go | 120 ++++++ ir_profile.go | 125 ++++++ ir_rule.go | 126 ++++++ ir_sequence.go | 129 ++++++ ir_sequence_date_range.go | 121 ++++++ ir_ui_menu.go | 127 ++++++ ir_ui_view.go | 137 +++++++ ir_ui_view_custom.go | 119 ++++++ l10n_ch_qr_invoice_wizard.go | 120 ++++++ mail_activity.go | 142 +++++++ mail_activity_plan.go | 126 ++++++ mail_activity_plan_template.go | 129 ++++++ mail_activity_schedule.go | 138 +++++++ mail_activity_todo_create.go | 120 ++++++ mail_activity_type.go | 138 +++++++ mail_alias.go | 129 ++++++ mail_alias_domain.go | 125 ++++++ mail_blacklist.go | 131 ++++++ mail_blacklist_remove.go | 118 ++++++ mail_canned_response.go | 123 ++++++ mail_compose_message.go | 155 ++++++++ mail_followers.go | 119 ++++++ mail_gateway_allowed.go | 118 ++++++ mail_guest.go | 133 +++++++ mail_ice_server.go | 120 ++++++ mail_link_preview.go | 126 ++++++ mail_mail.go | 186 +++++++++ mail_message.go | 168 ++++++++ mail_message_reaction.go | 116 ++++++ mail_message_schedule.go | 119 ++++++ mail_message_subtype.go | 126 ++++++ mail_message_translation.go | 120 ++++++ mail_notification.go | 127 ++++++ mail_push.go | 118 ++++++ mail_push_device.go | 120 ++++++ mail_resend_message.go | 122 ++++++ mail_resend_partner.go | 125 ++++++ mail_scheduled_message.go | 126 ++++++ mail_template.go | 143 +++++++ mail_template_preview.go | 131 ++++++ mail_template_reset.go | 117 ++++++ mail_tracking_value.go | 130 ++++++ mail_wizard_invite.go | 121 ++++++ onboarding_onboarding.go | 127 ++++++ onboarding_onboarding_step.go | 131 ++++++ onboarding_progress.go | 121 ++++++ onboarding_progress_step.go | 120 ++++++ payment_capture_wizard.go | 128 ++++++ payment_link_wizard.go | 135 +++++++ payment_method.go | 131 ++++++ payment_provider.go | 152 +++++++ payment_provider_onboarding_wizard.go | 123 ++++++ payment_refund_wizard.go | 125 ++++++ payment_token.go | 126 ++++++ payment_transaction.go | 151 +++++++ phone_blacklist.go | 131 ++++++ phone_blacklist_remove.go | 118 ++++++ portal_share.go | 123 ++++++ portal_wizard.go | 119 ++++++ portal_wizard_user.go | 124 ++++++ privacy_log.go | 123 ++++++ privacy_lookup_wizard.go | 123 ++++++ privacy_lookup_wizard_line.go | 126 ++++++ product_attribute.go | 126 ++++++ product_attribute_custom_value.go | 120 ++++++ product_attribute_value.go | 129 ++++++ product_category.go | 139 +++++++ product_combo.go | 123 ++++++ product_combo_item.go | 122 ++++++ product_document.go | 146 +++++++ product_label_layout.go | 124 ++++++ product_packaging.go | 125 ++++++ product_pricelist.go | 147 +++++++ product_pricelist_item.go | 143 +++++++ product_product.go | 236 +++++++++++ product_supplierinfo.go | 133 +++++++ product_tag.go | 122 ++++++ product_template.go | 217 ++++++++++ product_template_attribute_exclusion.go | 119 ++++++ product_template_attribute_line.go | 123 ++++++ product_template_attribute_value.go | 131 ++++++ project_collaborator.go | 120 ++++++ project_create_invoice.go | 121 ++++++ project_milestone.go | 147 +++++++ project_project.go | 244 ++++++++++++ project_project_stage.go | 123 ++++++ project_project_stage_delete_wizard.go | 119 ++++++ project_sale_line_employee_map.go | 129 ++++++ project_share_collaborator_wizard.go | 120 ++++++ project_share_wizard.go | 125 ++++++ project_tags.go | 120 ++++++ project_task.go | 242 ++++++++++++ project_task_recurrence.go | 121 ++++++ project_task_stage_personal.go | 119 ++++++ project_task_type.go | 127 ++++++ project_task_type_delete_wizard.go | 120 ++++++ project_update.go | 159 ++++++++ purchase_bill_line_match.go | 131 ++++++ purchase_bill_union.go | 121 ++++++ purchase_order.go | 185 +++++++++ purchase_order_line.go | 157 ++++++++ purchase_report.go | 139 +++++++ quotation_document.go | 147 +++++++ rating_rating.go | 141 +++++++ report_layout.go | 121 ++++++ report_paperformat.go | 134 +++++++ report_project_task_user.go | 155 ++++++++ res_bank.go | 128 ++++++ res_company.go | 280 +++++++++++++ res_config.go | 116 ++++++ res_config_settings.go | 352 +++++++++++++++++ res_country.go | 130 ++++++ res_country_group.go | 119 ++++++ res_country_state.go | 119 ++++++ res_currency.go | 134 +++++++ res_currency_rate.go | 122 ++++++ res_device.go | 129 ++++++ res_device_log.go | 129 ++++++ res_groups.go | 130 ++++++ res_lang.go | 131 ++++++ res_partner.go | 285 +++++++++++++ res_partner_autocomplete_sync.go | 118 ++++++ res_partner_bank.go | 166 ++++++++ res_partner_category.go | 123 ++++++ res_partner_industry.go | 119 ++++++ res_partner_title.go | 118 ++++++ res_users.go | 396 +++++++++++++++++++ res_users_apikeys.go | 117 ++++++ res_users_apikeys_description.go | 119 ++++++ res_users_apikeys_show.go | 112 ++++++ res_users_deletion.go | 119 ++++++ res_users_identitycheck.go | 119 ++++++ res_users_log.go | 116 ++++++ res_users_settings.go | 126 ++++++ res_users_settings_volumes.go | 120 ++++++ reset_view_arch_wizard.go | 123 ++++++ resource_calendar.go | 131 ++++++ resource_calendar_attendance.go | 131 ++++++ resource_calendar_leaves.go | 125 ++++++ resource_resource.go | 137 +++++++ sale_advance_payment_inv.go | 133 +++++++ sale_mass_cancel_orders.go | 119 ++++++ sale_order.go | 232 +++++++++++ sale_order_cancel.go | 129 ++++++ sale_order_discount.go | 123 ++++++ sale_order_line.go | 191 +++++++++ sale_order_option.go | 127 ++++++ sale_order_template.go | 130 ++++++ sale_order_template_line.go | 125 ++++++ sale_order_template_option.go | 123 ++++++ sale_payment_provider_onboarding_wizard.go | 123 ++++++ sale_pdf_form_field.go | 121 ++++++ sale_report.go | 152 +++++++ sms_account_code.go | 118 ++++++ sms_account_phone.go | 118 ++++++ sms_account_sender.go | 118 ++++++ sms_composer.go | 137 +++++++ sms_resend.go | 122 ++++++ sms_resend_recipient.go | 123 ++++++ sms_sms.go | 125 ++++++ sms_template.go | 124 ++++++ sms_template_preview.go | 122 ++++++ sms_template_reset.go | 117 ++++++ sms_tracker.go | 118 ++++++ snailmail_letter.go | 140 +++++++ snailmail_letter_format_error.go | 118 ++++++ snailmail_letter_missing_required_fields.go | 124 ++++++ spreadsheet_dashboard.go | 128 ++++++ spreadsheet_dashboard_group.go | 120 ++++++ spreadsheet_dashboard_share.go | 125 ++++++ timesheets_analysis_report.go | 137 +++++++ timesheets_analysis_reporting.go | 140 +++++++ uom_category.go | 119 ++++++ uom_uom.go | 127 ++++++ update_product_attribute_value.go | 120 ++++++ utm_campaign.go | 130 ++++++ utm_medium.go | 118 ++++++ utm_source.go | 117 ++++++ utm_stage.go | 118 ++++++ utm_tag.go | 118 ++++++ validate_account_move.go | 124 ++++++ version.go | 9 + web_editor_converter_test.go | 127 ++++++ web_editor_converter_test_sub.go | 117 ++++++ web_tour_tour.go | 124 ++++++ web_tour_tour_step.go | 121 ++++++ wizard_ir_model_menu_create.go | 118 ++++++ 394 files changed, 52421 insertions(+), 1 deletion(-) create mode 100644 account_account.go create mode 100644 account_account_tag.go create mode 100644 account_accrued_orders_wizard.go create mode 100644 account_analytic_account.go create mode 100644 account_analytic_applicability.go create mode 100644 account_analytic_distribution_model.go create mode 100644 account_analytic_line.go create mode 100644 account_analytic_plan.go create mode 100644 account_automatic_entry_wizard.go create mode 100644 account_autopost_bills_wizard.go create mode 100644 account_bank_statement.go create mode 100644 account_bank_statement_line.go create mode 100644 account_cash_rounding.go create mode 100644 account_code_mapping.go create mode 100644 account_financial_year_op.go create mode 100644 account_fiscal_position.go create mode 100644 account_fiscal_position_account.go create mode 100644 account_fiscal_position_tax.go create mode 100644 account_full_reconcile.go create mode 100644 account_group.go create mode 100644 account_incoterms.go create mode 100644 account_invoice_report.go create mode 100644 account_journal.go create mode 100644 account_journal_group.go create mode 100644 account_lock_exception.go create mode 100644 account_merge_wizard.go create mode 100644 account_merge_wizard_line.go create mode 100644 account_move.go create mode 100644 account_move_line.go create mode 100644 account_move_reversal.go create mode 100644 account_move_send_batch_wizard.go create mode 100644 account_move_send_wizard.go create mode 100644 account_partial_reconcile.go create mode 100644 account_payment.go create mode 100644 account_payment_method.go create mode 100644 account_payment_method_line.go create mode 100644 account_payment_register.go create mode 100644 account_payment_term.go create mode 100644 account_payment_term_line.go create mode 100644 account_reconcile_model.go create mode 100644 account_reconcile_model_line.go create mode 100644 account_reconcile_model_partner_mapping.go create mode 100644 account_report.go create mode 100644 account_report_column.go create mode 100644 account_report_expression.go create mode 100644 account_report_external_value.go create mode 100644 account_report_line.go create mode 100644 account_resequence_wizard.go create mode 100644 account_root.go create mode 100644 account_secure_entries_wizard.go create mode 100644 account_setup_bank_manual_config.go create mode 100644 account_tax.go create mode 100644 account_tax_group.go create mode 100644 account_tax_repartition_line.go create mode 100644 applicant_get_refuse_reason.go create mode 100644 applicant_send_mail.go create mode 100644 auth_totp_device.go create mode 100644 auth_totp_wizard.go create mode 100644 base_document_layout.go create mode 100644 base_enable_profiling_wizard.go create mode 100644 base_import_import.go create mode 100644 base_import_mapping.go create mode 100644 base_import_module.go create mode 100644 base_language_export.go create mode 100644 base_language_import.go create mode 100644 base_language_install.go create mode 100644 base_module_install_request.go create mode 100644 base_module_install_review.go create mode 100644 base_module_uninstall.go create mode 100644 base_module_update.go create mode 100644 base_module_upgrade.go create mode 100644 base_partner_merge_automatic_wizard.go create mode 100644 base_partner_merge_line.go create mode 100644 bill_to_po_wizard.go create mode 100644 bus_bus.go create mode 100644 bus_presence.go create mode 100644 calendar_alarm.go create mode 100644 calendar_attendee.go create mode 100644 calendar_event.go create mode 100644 calendar_event_type.go create mode 100644 calendar_filters.go create mode 100644 calendar_popover_delete_wizard.go create mode 100644 calendar_provider_config.go create mode 100644 calendar_recurrence.go create mode 100644 candidate_send_mail.go create mode 100644 change_password_own.go create mode 100644 change_password_user.go create mode 100644 change_password_wizard.go create mode 100644 crm_activity_report.go create mode 100644 crm_iap_lead_helpers.go create mode 100644 crm_iap_lead_industry.go create mode 100644 crm_iap_lead_mining_request.go create mode 100644 crm_iap_lead_role.go create mode 100644 crm_iap_lead_seniority.go create mode 100644 crm_lead.go create mode 100644 crm_lead2opportunity_partner.go create mode 100644 crm_lead2opportunity_partner_mass.go create mode 100644 crm_lead_lost.go create mode 100644 crm_lead_pls_update.go create mode 100644 crm_lead_scoring_frequency.go create mode 100644 crm_lead_scoring_frequency_field.go create mode 100644 crm_lost_reason.go create mode 100644 crm_merge_opportunity.go create mode 100644 crm_quotation_partner.go create mode 100644 crm_recurring_plan.go create mode 100644 crm_stage.go create mode 100644 crm_tag.go create mode 100644 crm_team.go create mode 100644 crm_team_member.go create mode 100644 decimal_precision.go create mode 100644 digest_digest.go create mode 100644 digest_tip.go create mode 100644 discuss_channel.go create mode 100644 discuss_channel_member.go create mode 100644 discuss_channel_rtc_session.go create mode 100644 discuss_gif_favorite.go create mode 100644 discuss_voice_metadata.go create mode 100644 fetchmail_server.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 hr_applicant.go create mode 100644 hr_applicant_category.go create mode 100644 hr_applicant_refuse_reason.go create mode 100644 hr_candidate.go create mode 100644 hr_candidate_skill.go create mode 100644 hr_contract.go create mode 100644 hr_contract_history.go create mode 100644 hr_contract_type.go create mode 100644 hr_department.go create mode 100644 hr_departure_reason.go create mode 100644 hr_departure_wizard.go create mode 100644 hr_employee.go create mode 100644 hr_employee_category.go create mode 100644 hr_employee_cv_wizard.go create mode 100644 hr_employee_delete_wizard.go create mode 100644 hr_employee_public.go create mode 100644 hr_employee_skill.go create mode 100644 hr_employee_skill_log.go create mode 100644 hr_employee_skill_report.go create mode 100644 hr_expense.go create mode 100644 hr_expense_approve_duplicate.go create mode 100644 hr_expense_refuse_wizard.go create mode 100644 hr_expense_sheet.go create mode 100644 hr_expense_split.go create mode 100644 hr_expense_split_wizard.go create mode 100644 hr_holidays_cancel_leave.go create mode 100644 hr_holidays_summary_employee.go create mode 100644 hr_job.go create mode 100644 hr_job_platform.go create mode 100644 hr_leave.go create mode 100644 hr_leave_accrual_level.go create mode 100644 hr_leave_accrual_plan.go create mode 100644 hr_leave_allocation.go create mode 100644 hr_leave_allocation_generate_multi_wizard.go create mode 100644 hr_leave_employee_type_report.go create mode 100644 hr_leave_generate_multi_wizard.go create mode 100644 hr_leave_mandatory_day.go create mode 100644 hr_leave_report.go create mode 100644 hr_leave_report_calendar.go create mode 100644 hr_leave_type.go create mode 100644 hr_payroll_structure_type.go create mode 100644 hr_recruitment_degree.go create mode 100644 hr_recruitment_source.go create mode 100644 hr_recruitment_stage.go create mode 100644 hr_resume_line.go create mode 100644 hr_resume_line_type.go create mode 100644 hr_skill.go create mode 100644 hr_skill_level.go create mode 100644 hr_skill_type.go create mode 100644 hr_work_location.go create mode 100644 iap_account.go create mode 100644 iap_service.go create mode 100644 ir_actions_act_url.go create mode 100644 ir_actions_act_window.go create mode 100644 ir_actions_act_window_close.go create mode 100644 ir_actions_act_window_view.go create mode 100644 ir_actions_actions.go create mode 100644 ir_actions_client.go create mode 100644 ir_actions_report.go create mode 100644 ir_actions_server.go create mode 100644 ir_actions_todo.go create mode 100644 ir_asset.go create mode 100644 ir_attachment.go create mode 100644 ir_config_parameter.go create mode 100644 ir_cron.go create mode 100644 ir_cron_progress.go create mode 100644 ir_cron_trigger.go create mode 100644 ir_default.go create mode 100644 ir_demo.go create mode 100644 ir_demo_failure.go create mode 100644 ir_demo_failure_wizard.go create mode 100644 ir_embedded_actions.go create mode 100644 ir_exports.go create mode 100644 ir_exports_line.go create mode 100644 ir_filters.go create mode 100644 ir_logging.go create mode 100644 ir_mail_server.go create mode 100644 ir_model_access.go create mode 100644 ir_model_constraint.go create mode 100644 ir_model_data.go create mode 100644 ir_model_fields_selection.go create mode 100644 ir_model_inherit.go create mode 100644 ir_model_relation.go create mode 100644 ir_module_category.go create mode 100644 ir_module_module.go create mode 100644 ir_module_module_dependency.go create mode 100644 ir_module_module_exclusion.go create mode 100644 ir_profile.go create mode 100644 ir_rule.go create mode 100644 ir_sequence.go create mode 100644 ir_sequence_date_range.go create mode 100644 ir_ui_menu.go create mode 100644 ir_ui_view.go create mode 100644 ir_ui_view_custom.go create mode 100644 l10n_ch_qr_invoice_wizard.go create mode 100644 mail_activity.go create mode 100644 mail_activity_plan.go create mode 100644 mail_activity_plan_template.go create mode 100644 mail_activity_schedule.go create mode 100644 mail_activity_todo_create.go create mode 100644 mail_activity_type.go create mode 100644 mail_alias.go create mode 100644 mail_alias_domain.go create mode 100644 mail_blacklist.go create mode 100644 mail_blacklist_remove.go create mode 100644 mail_canned_response.go create mode 100644 mail_compose_message.go create mode 100644 mail_followers.go create mode 100644 mail_gateway_allowed.go create mode 100644 mail_guest.go create mode 100644 mail_ice_server.go create mode 100644 mail_link_preview.go create mode 100644 mail_mail.go create mode 100644 mail_message.go create mode 100644 mail_message_reaction.go create mode 100644 mail_message_schedule.go create mode 100644 mail_message_subtype.go create mode 100644 mail_message_translation.go create mode 100644 mail_notification.go create mode 100644 mail_push.go create mode 100644 mail_push_device.go create mode 100644 mail_resend_message.go create mode 100644 mail_resend_partner.go create mode 100644 mail_scheduled_message.go create mode 100644 mail_template.go create mode 100644 mail_template_preview.go create mode 100644 mail_template_reset.go create mode 100644 mail_tracking_value.go create mode 100644 mail_wizard_invite.go create mode 100644 onboarding_onboarding.go create mode 100644 onboarding_onboarding_step.go create mode 100644 onboarding_progress.go create mode 100644 onboarding_progress_step.go create mode 100644 payment_capture_wizard.go create mode 100644 payment_link_wizard.go create mode 100644 payment_method.go create mode 100644 payment_provider.go create mode 100644 payment_provider_onboarding_wizard.go create mode 100644 payment_refund_wizard.go create mode 100644 payment_token.go create mode 100644 payment_transaction.go create mode 100644 phone_blacklist.go create mode 100644 phone_blacklist_remove.go create mode 100644 portal_share.go create mode 100644 portal_wizard.go create mode 100644 portal_wizard_user.go create mode 100644 privacy_log.go create mode 100644 privacy_lookup_wizard.go create mode 100644 privacy_lookup_wizard_line.go create mode 100644 product_attribute.go create mode 100644 product_attribute_custom_value.go create mode 100644 product_attribute_value.go create mode 100644 product_category.go create mode 100644 product_combo.go create mode 100644 product_combo_item.go create mode 100644 product_document.go create mode 100644 product_label_layout.go create mode 100644 product_packaging.go create mode 100644 product_pricelist.go create mode 100644 product_pricelist_item.go create mode 100644 product_product.go create mode 100644 product_supplierinfo.go create mode 100644 product_tag.go create mode 100644 product_template.go create mode 100644 product_template_attribute_exclusion.go create mode 100644 product_template_attribute_line.go create mode 100644 product_template_attribute_value.go create mode 100644 project_collaborator.go create mode 100644 project_create_invoice.go create mode 100644 project_milestone.go create mode 100644 project_project.go create mode 100644 project_project_stage.go create mode 100644 project_project_stage_delete_wizard.go create mode 100644 project_sale_line_employee_map.go create mode 100644 project_share_collaborator_wizard.go create mode 100644 project_share_wizard.go create mode 100644 project_tags.go create mode 100644 project_task.go create mode 100644 project_task_recurrence.go create mode 100644 project_task_stage_personal.go create mode 100644 project_task_type.go create mode 100644 project_task_type_delete_wizard.go create mode 100644 project_update.go create mode 100644 purchase_bill_line_match.go create mode 100644 purchase_bill_union.go create mode 100644 purchase_order.go create mode 100644 purchase_order_line.go create mode 100644 purchase_report.go create mode 100644 quotation_document.go create mode 100644 rating_rating.go create mode 100644 report_layout.go create mode 100644 report_paperformat.go create mode 100644 report_project_task_user.go create mode 100644 res_bank.go create mode 100644 res_company.go create mode 100644 res_config.go create mode 100644 res_config_settings.go create mode 100644 res_country.go create mode 100644 res_country_group.go create mode 100644 res_country_state.go create mode 100644 res_currency.go create mode 100644 res_currency_rate.go create mode 100644 res_device.go create mode 100644 res_device_log.go create mode 100644 res_groups.go create mode 100644 res_lang.go create mode 100644 res_partner.go create mode 100644 res_partner_autocomplete_sync.go create mode 100644 res_partner_bank.go create mode 100644 res_partner_category.go create mode 100644 res_partner_industry.go create mode 100644 res_partner_title.go create mode 100644 res_users.go create mode 100644 res_users_apikeys.go create mode 100644 res_users_apikeys_description.go create mode 100644 res_users_apikeys_show.go create mode 100644 res_users_deletion.go create mode 100644 res_users_identitycheck.go create mode 100644 res_users_log.go create mode 100644 res_users_settings.go create mode 100644 res_users_settings_volumes.go create mode 100644 reset_view_arch_wizard.go create mode 100644 resource_calendar.go create mode 100644 resource_calendar_attendance.go create mode 100644 resource_calendar_leaves.go create mode 100644 resource_resource.go create mode 100644 sale_advance_payment_inv.go create mode 100644 sale_mass_cancel_orders.go create mode 100644 sale_order.go create mode 100644 sale_order_cancel.go create mode 100644 sale_order_discount.go create mode 100644 sale_order_line.go create mode 100644 sale_order_option.go create mode 100644 sale_order_template.go create mode 100644 sale_order_template_line.go create mode 100644 sale_order_template_option.go create mode 100644 sale_payment_provider_onboarding_wizard.go create mode 100644 sale_pdf_form_field.go create mode 100644 sale_report.go create mode 100644 sms_account_code.go create mode 100644 sms_account_phone.go create mode 100644 sms_account_sender.go create mode 100644 sms_composer.go create mode 100644 sms_resend.go create mode 100644 sms_resend_recipient.go create mode 100644 sms_sms.go create mode 100644 sms_template.go create mode 100644 sms_template_preview.go create mode 100644 sms_template_reset.go create mode 100644 sms_tracker.go create mode 100644 snailmail_letter.go create mode 100644 snailmail_letter_format_error.go create mode 100644 snailmail_letter_missing_required_fields.go create mode 100644 spreadsheet_dashboard.go create mode 100644 spreadsheet_dashboard_group.go create mode 100644 spreadsheet_dashboard_share.go create mode 100644 timesheets_analysis_report.go create mode 100644 timesheets_analysis_reporting.go create mode 100644 uom_category.go create mode 100644 uom_uom.go create mode 100644 update_product_attribute_value.go create mode 100644 utm_campaign.go create mode 100644 utm_medium.go create mode 100644 utm_source.go create mode 100644 utm_stage.go create mode 100644 utm_tag.go create mode 100644 validate_account_move.go create mode 100644 version.go create mode 100644 web_editor_converter_test.go create mode 100644 web_editor_converter_test_sub.go create mode 100644 web_tour_tour.go create mode 100644 web_tour_tour_step.go create mode 100644 wizard_ir_model_menu_create.go diff --git a/account_account.go b/account_account.go new file mode 100644 index 0000000..d62d7d5 --- /dev/null +++ b/account_account.go @@ -0,0 +1,157 @@ +package odoo + +// AccountAccount represents account.account model. +type AccountAccount struct { + AccountType *Selection `xmlrpc:"account_type,omitempty"` + AllowedJournalIds *Relation `xmlrpc:"allowed_journal_ids,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + CodeMappingIds *Relation `xmlrpc:"code_mapping_ids,omitempty"` + CodeStore *String `xmlrpc:"code_store,omitempty"` + CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"` + CompanyFiscalCountryCode *String `xmlrpc:"company_fiscal_country_code,omitempty"` + CompanyIds *Relation `xmlrpc:"company_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + CurrentBalance *Float `xmlrpc:"current_balance,omitempty"` + Deprecated *Bool `xmlrpc:"deprecated,omitempty"` + DisplayMappingTab *Bool `xmlrpc:"display_mapping_tab,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + GroupId *Many2One `xmlrpc:"group_id,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IncludeInitialBalance *Bool `xmlrpc:"include_initial_balance,omitempty"` + InternalGroup *Selection `xmlrpc:"internal_group,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NonTrade *Bool `xmlrpc:"non_trade,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + OpeningBalance *Float `xmlrpc:"opening_balance,omitempty"` + OpeningCredit *Float `xmlrpc:"opening_credit,omitempty"` + OpeningDebit *Float `xmlrpc:"opening_debit,omitempty"` + PlaceholderCode *String `xmlrpc:"placeholder_code,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + Reconcile *Bool `xmlrpc:"reconcile,omitempty"` + RelatedTaxesAmount *Int `xmlrpc:"related_taxes_amount,omitempty"` + RootId *Many2One `xmlrpc:"root_id,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TaxIds *Relation `xmlrpc:"tax_ids,omitempty"` + Used *Bool `xmlrpc:"used,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountAccounts represents array of account.account model. +type AccountAccounts []AccountAccount + +// AccountAccountModel is the odoo model name. +const AccountAccountModel = "account.account" + +// Many2One convert AccountAccount to *Many2One. +func (aa *AccountAccount) Many2One() *Many2One { + return NewMany2One(aa.Id.Get(), "") +} + +// CreateAccountAccount creates a new account.account model and returns its id. +func (c *Client) CreateAccountAccount(aa *AccountAccount) (int64, error) { + ids, err := c.CreateAccountAccounts([]*AccountAccount{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, nil) +} + +// UpdateAccountAccount updates an existing account.account record. +func (c *Client) UpdateAccountAccount(aa *AccountAccount) error { + return c.UpdateAccountAccounts([]int64{aa.Id.Get()}, aa) +} + +// UpdateAccountAccounts updates existing account.account records. +// All records (represented by ids) will be updated by aa values. +func (c *Client) UpdateAccountAccounts(ids []int64, aa *AccountAccount) error { + return c.Update(AccountAccountModel, ids, aa, nil) +} + +// DeleteAccountAccount deletes an existing account.account record. +func (c *Client) DeleteAccountAccount(id int64) error { + return c.DeleteAccountAccounts([]int64{id}) +} + +// DeleteAccountAccounts deletes existing account.account records. +func (c *Client) DeleteAccountAccounts(ids []int64) error { + return c.Delete(AccountAccountModel, ids) +} + +// GetAccountAccount gets account.account existing record. +func (c *Client) GetAccountAccount(id int64) (*AccountAccount, error) { + aas, err := c.GetAccountAccounts([]int64{id}) + if err != nil { + return nil, err + } + return &((*aas)[0]), nil +} + +// GetAccountAccounts gets account.account existing records. +func (c *Client) GetAccountAccounts(ids []int64) (*AccountAccounts, error) { + aas := &AccountAccounts{} + if err := c.Read(AccountAccountModel, ids, nil, aas); err != nil { + return nil, err + } + return aas, nil +} + +// FindAccountAccount finds account.account record by querying it with criteria. +func (c *Client) FindAccountAccount(criteria *Criteria) (*AccountAccount, error) { + aas := &AccountAccounts{} + if err := c.SearchRead(AccountAccountModel, criteria, NewOptions().Limit(1), aas); err != nil { + return nil, err + } + return &((*aas)[0]), nil +} + +// FindAccountAccounts finds account.account records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAccounts(criteria *Criteria, options *Options) (*AccountAccounts, error) { + aas := &AccountAccounts{} + if err := c.SearchRead(AccountAccountModel, criteria, options, aas); err != nil { + return nil, err + } + return aas, nil +} + +// FindAccountAccountIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAccountIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountAccountModel, criteria, options) +} + +// FindAccountAccountId finds record id by querying it with criteria. +func (c *Client) FindAccountAccountId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountAccountModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_account_tag.go b/account_account_tag.go new file mode 100644 index 0000000..22c5f9e --- /dev/null +++ b/account_account_tag.go @@ -0,0 +1,122 @@ +package odoo + +// AccountAccountTag represents account.account.tag model. +type AccountAccountTag struct { + Active *Bool `xmlrpc:"active,omitempty"` + Applicability *Selection `xmlrpc:"applicability,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + TaxNegate *Bool `xmlrpc:"tax_negate,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountAccountTags represents array of account.account.tag model. +type AccountAccountTags []AccountAccountTag + +// AccountAccountTagModel is the odoo model name. +const AccountAccountTagModel = "account.account.tag" + +// Many2One convert AccountAccountTag to *Many2One. +func (aat *AccountAccountTag) Many2One() *Many2One { + return NewMany2One(aat.Id.Get(), "") +} + +// CreateAccountAccountTag creates a new account.account.tag model and returns its id. +func (c *Client) CreateAccountAccountTag(aat *AccountAccountTag) (int64, error) { + ids, err := c.CreateAccountAccountTags([]*AccountAccountTag{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, nil) +} + +// UpdateAccountAccountTag updates an existing account.account.tag record. +func (c *Client) UpdateAccountAccountTag(aat *AccountAccountTag) error { + return c.UpdateAccountAccountTags([]int64{aat.Id.Get()}, aat) +} + +// UpdateAccountAccountTags updates existing account.account.tag records. +// All records (represented by ids) will be updated by aat values. +func (c *Client) UpdateAccountAccountTags(ids []int64, aat *AccountAccountTag) error { + return c.Update(AccountAccountTagModel, ids, aat, nil) +} + +// DeleteAccountAccountTag deletes an existing account.account.tag record. +func (c *Client) DeleteAccountAccountTag(id int64) error { + return c.DeleteAccountAccountTags([]int64{id}) +} + +// DeleteAccountAccountTags deletes existing account.account.tag records. +func (c *Client) DeleteAccountAccountTags(ids []int64) error { + return c.Delete(AccountAccountTagModel, ids) +} + +// GetAccountAccountTag gets account.account.tag existing record. +func (c *Client) GetAccountAccountTag(id int64) (*AccountAccountTag, error) { + aats, err := c.GetAccountAccountTags([]int64{id}) + if err != nil { + return nil, err + } + return &((*aats)[0]), nil +} + +// GetAccountAccountTags gets account.account.tag existing records. +func (c *Client) GetAccountAccountTags(ids []int64) (*AccountAccountTags, error) { + aats := &AccountAccountTags{} + if err := c.Read(AccountAccountTagModel, ids, nil, aats); err != nil { + return nil, err + } + return aats, nil +} + +// FindAccountAccountTag finds account.account.tag record by querying it with criteria. +func (c *Client) FindAccountAccountTag(criteria *Criteria) (*AccountAccountTag, error) { + aats := &AccountAccountTags{} + if err := c.SearchRead(AccountAccountTagModel, criteria, NewOptions().Limit(1), aats); err != nil { + return nil, err + } + return &((*aats)[0]), nil +} + +// FindAccountAccountTags finds account.account.tag records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAccountTags(criteria *Criteria, options *Options) (*AccountAccountTags, error) { + aats := &AccountAccountTags{} + if err := c.SearchRead(AccountAccountTagModel, criteria, options, aats); err != nil { + return nil, err + } + return aats, nil +} + +// FindAccountAccountTagIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAccountTagIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountAccountTagModel, criteria, options) +} + +// FindAccountAccountTagId finds record id by querying it with criteria. +func (c *Client) FindAccountAccountTagId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountAccountTagModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_accrued_orders_wizard.go b/account_accrued_orders_wizard.go new file mode 100644 index 0000000..54c3f17 --- /dev/null +++ b/account_accrued_orders_wizard.go @@ -0,0 +1,125 @@ +package odoo + +// AccountAccruedOrdersWizard represents account.accrued.orders.wizard model. +type AccountAccruedOrdersWizard struct { + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DisplayAmount *Bool `xmlrpc:"display_amount,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + PreviewData *String `xmlrpc:"preview_data,omitempty"` + ReversalDate *Time `xmlrpc:"reversal_date,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountAccruedOrdersWizards represents array of account.accrued.orders.wizard model. +type AccountAccruedOrdersWizards []AccountAccruedOrdersWizard + +// AccountAccruedOrdersWizardModel is the odoo model name. +const AccountAccruedOrdersWizardModel = "account.accrued.orders.wizard" + +// Many2One convert AccountAccruedOrdersWizard to *Many2One. +func (aaow *AccountAccruedOrdersWizard) Many2One() *Many2One { + return NewMany2One(aaow.Id.Get(), "") +} + +// CreateAccountAccruedOrdersWizard creates a new account.accrued.orders.wizard model and returns its id. +func (c *Client) CreateAccountAccruedOrdersWizard(aaow *AccountAccruedOrdersWizard) (int64, error) { + ids, err := c.CreateAccountAccruedOrdersWizards([]*AccountAccruedOrdersWizard{aaow}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountAccruedOrdersWizard creates a new account.accrued.orders.wizard model and returns its id. +func (c *Client) CreateAccountAccruedOrdersWizards(aaows []*AccountAccruedOrdersWizard) ([]int64, error) { + var vv []interface{} + for _, v := range aaows { + vv = append(vv, v) + } + return c.Create(AccountAccruedOrdersWizardModel, vv, nil) +} + +// UpdateAccountAccruedOrdersWizard updates an existing account.accrued.orders.wizard record. +func (c *Client) UpdateAccountAccruedOrdersWizard(aaow *AccountAccruedOrdersWizard) error { + return c.UpdateAccountAccruedOrdersWizards([]int64{aaow.Id.Get()}, aaow) +} + +// UpdateAccountAccruedOrdersWizards updates existing account.accrued.orders.wizard records. +// All records (represented by ids) will be updated by aaow values. +func (c *Client) UpdateAccountAccruedOrdersWizards(ids []int64, aaow *AccountAccruedOrdersWizard) error { + return c.Update(AccountAccruedOrdersWizardModel, ids, aaow, nil) +} + +// DeleteAccountAccruedOrdersWizard deletes an existing account.accrued.orders.wizard record. +func (c *Client) DeleteAccountAccruedOrdersWizard(id int64) error { + return c.DeleteAccountAccruedOrdersWizards([]int64{id}) +} + +// DeleteAccountAccruedOrdersWizards deletes existing account.accrued.orders.wizard records. +func (c *Client) DeleteAccountAccruedOrdersWizards(ids []int64) error { + return c.Delete(AccountAccruedOrdersWizardModel, ids) +} + +// GetAccountAccruedOrdersWizard gets account.accrued.orders.wizard existing record. +func (c *Client) GetAccountAccruedOrdersWizard(id int64) (*AccountAccruedOrdersWizard, error) { + aaows, err := c.GetAccountAccruedOrdersWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*aaows)[0]), nil +} + +// GetAccountAccruedOrdersWizards gets account.accrued.orders.wizard existing records. +func (c *Client) GetAccountAccruedOrdersWizards(ids []int64) (*AccountAccruedOrdersWizards, error) { + aaows := &AccountAccruedOrdersWizards{} + if err := c.Read(AccountAccruedOrdersWizardModel, ids, nil, aaows); err != nil { + return nil, err + } + return aaows, nil +} + +// FindAccountAccruedOrdersWizard finds account.accrued.orders.wizard record by querying it with criteria. +func (c *Client) FindAccountAccruedOrdersWizard(criteria *Criteria) (*AccountAccruedOrdersWizard, error) { + aaows := &AccountAccruedOrdersWizards{} + if err := c.SearchRead(AccountAccruedOrdersWizardModel, criteria, NewOptions().Limit(1), aaows); err != nil { + return nil, err + } + return &((*aaows)[0]), nil +} + +// FindAccountAccruedOrdersWizards finds account.accrued.orders.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAccruedOrdersWizards(criteria *Criteria, options *Options) (*AccountAccruedOrdersWizards, error) { + aaows := &AccountAccruedOrdersWizards{} + if err := c.SearchRead(AccountAccruedOrdersWizardModel, criteria, options, aaows); err != nil { + return nil, err + } + return aaows, nil +} + +// FindAccountAccruedOrdersWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAccruedOrdersWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountAccruedOrdersWizardModel, criteria, options) +} + +// FindAccountAccruedOrdersWizardId finds record id by querying it with criteria. +func (c *Client) FindAccountAccruedOrdersWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountAccruedOrdersWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_analytic_account.go b/account_analytic_account.go new file mode 100644 index 0000000..74ca39e --- /dev/null +++ b/account_analytic_account.go @@ -0,0 +1,147 @@ +package odoo + +// AccountAnalyticAccount represents account.analytic.account model. +type AccountAnalyticAccount struct { + Active *Bool `xmlrpc:"active,omitempty"` + Balance *Float `xmlrpc:"balance,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Credit *Float `xmlrpc:"credit,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + Debit *Float `xmlrpc:"debit,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceCount *Int `xmlrpc:"invoice_count,omitempty"` + LineIds *Relation `xmlrpc:"line_ids,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PlanId *Many2One `xmlrpc:"plan_id,omitempty"` + ProjectCount *Int `xmlrpc:"project_count,omitempty"` + ProjectIds *Relation `xmlrpc:"project_ids,omitempty"` + PurchaseOrderCount *Int `xmlrpc:"purchase_order_count,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RootPlanId *Many2One `xmlrpc:"root_plan_id,omitempty"` + VendorBillCount *Int `xmlrpc:"vendor_bill_count,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountAnalyticAccounts represents array of account.analytic.account model. +type AccountAnalyticAccounts []AccountAnalyticAccount + +// AccountAnalyticAccountModel is the odoo model name. +const AccountAnalyticAccountModel = "account.analytic.account" + +// Many2One convert AccountAnalyticAccount to *Many2One. +func (aaa *AccountAnalyticAccount) Many2One() *Many2One { + return NewMany2One(aaa.Id.Get(), "") +} + +// CreateAccountAnalyticAccount creates a new account.analytic.account model and returns its id. +func (c *Client) CreateAccountAnalyticAccount(aaa *AccountAnalyticAccount) (int64, error) { + ids, err := c.CreateAccountAnalyticAccounts([]*AccountAnalyticAccount{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, nil) +} + +// UpdateAccountAnalyticAccount updates an existing account.analytic.account record. +func (c *Client) UpdateAccountAnalyticAccount(aaa *AccountAnalyticAccount) error { + return c.UpdateAccountAnalyticAccounts([]int64{aaa.Id.Get()}, aaa) +} + +// UpdateAccountAnalyticAccounts updates existing account.analytic.account records. +// All records (represented by ids) will be updated by aaa values. +func (c *Client) UpdateAccountAnalyticAccounts(ids []int64, aaa *AccountAnalyticAccount) error { + return c.Update(AccountAnalyticAccountModel, ids, aaa, nil) +} + +// DeleteAccountAnalyticAccount deletes an existing account.analytic.account record. +func (c *Client) DeleteAccountAnalyticAccount(id int64) error { + return c.DeleteAccountAnalyticAccounts([]int64{id}) +} + +// DeleteAccountAnalyticAccounts deletes existing account.analytic.account records. +func (c *Client) DeleteAccountAnalyticAccounts(ids []int64) error { + return c.Delete(AccountAnalyticAccountModel, ids) +} + +// GetAccountAnalyticAccount gets account.analytic.account existing record. +func (c *Client) GetAccountAnalyticAccount(id int64) (*AccountAnalyticAccount, error) { + aaas, err := c.GetAccountAnalyticAccounts([]int64{id}) + if err != nil { + return nil, err + } + return &((*aaas)[0]), nil +} + +// GetAccountAnalyticAccounts gets account.analytic.account existing records. +func (c *Client) GetAccountAnalyticAccounts(ids []int64) (*AccountAnalyticAccounts, error) { + aaas := &AccountAnalyticAccounts{} + if err := c.Read(AccountAnalyticAccountModel, ids, nil, aaas); err != nil { + return nil, err + } + return aaas, nil +} + +// FindAccountAnalyticAccount finds account.analytic.account record by querying it with criteria. +func (c *Client) FindAccountAnalyticAccount(criteria *Criteria) (*AccountAnalyticAccount, error) { + aaas := &AccountAnalyticAccounts{} + if err := c.SearchRead(AccountAnalyticAccountModel, criteria, NewOptions().Limit(1), aaas); err != nil { + return nil, err + } + return &((*aaas)[0]), nil +} + +// FindAccountAnalyticAccounts finds account.analytic.account records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAnalyticAccounts(criteria *Criteria, options *Options) (*AccountAnalyticAccounts, error) { + aaas := &AccountAnalyticAccounts{} + if err := c.SearchRead(AccountAnalyticAccountModel, criteria, options, aaas); err != nil { + return nil, err + } + return aaas, nil +} + +// FindAccountAnalyticAccountIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAnalyticAccountIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountAnalyticAccountModel, criteria, options) +} + +// FindAccountAnalyticAccountId finds record id by querying it with criteria. +func (c *Client) FindAccountAnalyticAccountId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountAnalyticAccountModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_analytic_applicability.go b/account_analytic_applicability.go new file mode 100644 index 0000000..c83466a --- /dev/null +++ b/account_analytic_applicability.go @@ -0,0 +1,123 @@ +package odoo + +// AccountAnalyticApplicability represents account.analytic.applicability model. +type AccountAnalyticApplicability struct { + AccountPrefix *String `xmlrpc:"account_prefix,omitempty"` + AnalyticPlanId *Many2One `xmlrpc:"analytic_plan_id,omitempty"` + Applicability *Selection `xmlrpc:"applicability,omitempty"` + BusinessDomain *Selection `xmlrpc:"business_domain,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayAccountPrefix *Bool `xmlrpc:"display_account_prefix,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ProductCategId *Many2One `xmlrpc:"product_categ_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountAnalyticApplicabilitys represents array of account.analytic.applicability model. +type AccountAnalyticApplicabilitys []AccountAnalyticApplicability + +// AccountAnalyticApplicabilityModel is the odoo model name. +const AccountAnalyticApplicabilityModel = "account.analytic.applicability" + +// Many2One convert AccountAnalyticApplicability to *Many2One. +func (aaa *AccountAnalyticApplicability) Many2One() *Many2One { + return NewMany2One(aaa.Id.Get(), "") +} + +// CreateAccountAnalyticApplicability creates a new account.analytic.applicability model and returns its id. +func (c *Client) CreateAccountAnalyticApplicability(aaa *AccountAnalyticApplicability) (int64, error) { + ids, err := c.CreateAccountAnalyticApplicabilitys([]*AccountAnalyticApplicability{aaa}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountAnalyticApplicability creates a new account.analytic.applicability model and returns its id. +func (c *Client) CreateAccountAnalyticApplicabilitys(aaas []*AccountAnalyticApplicability) ([]int64, error) { + var vv []interface{} + for _, v := range aaas { + vv = append(vv, v) + } + return c.Create(AccountAnalyticApplicabilityModel, vv, nil) +} + +// UpdateAccountAnalyticApplicability updates an existing account.analytic.applicability record. +func (c *Client) UpdateAccountAnalyticApplicability(aaa *AccountAnalyticApplicability) error { + return c.UpdateAccountAnalyticApplicabilitys([]int64{aaa.Id.Get()}, aaa) +} + +// UpdateAccountAnalyticApplicabilitys updates existing account.analytic.applicability records. +// All records (represented by ids) will be updated by aaa values. +func (c *Client) UpdateAccountAnalyticApplicabilitys(ids []int64, aaa *AccountAnalyticApplicability) error { + return c.Update(AccountAnalyticApplicabilityModel, ids, aaa, nil) +} + +// DeleteAccountAnalyticApplicability deletes an existing account.analytic.applicability record. +func (c *Client) DeleteAccountAnalyticApplicability(id int64) error { + return c.DeleteAccountAnalyticApplicabilitys([]int64{id}) +} + +// DeleteAccountAnalyticApplicabilitys deletes existing account.analytic.applicability records. +func (c *Client) DeleteAccountAnalyticApplicabilitys(ids []int64) error { + return c.Delete(AccountAnalyticApplicabilityModel, ids) +} + +// GetAccountAnalyticApplicability gets account.analytic.applicability existing record. +func (c *Client) GetAccountAnalyticApplicability(id int64) (*AccountAnalyticApplicability, error) { + aaas, err := c.GetAccountAnalyticApplicabilitys([]int64{id}) + if err != nil { + return nil, err + } + return &((*aaas)[0]), nil +} + +// GetAccountAnalyticApplicabilitys gets account.analytic.applicability existing records. +func (c *Client) GetAccountAnalyticApplicabilitys(ids []int64) (*AccountAnalyticApplicabilitys, error) { + aaas := &AccountAnalyticApplicabilitys{} + if err := c.Read(AccountAnalyticApplicabilityModel, ids, nil, aaas); err != nil { + return nil, err + } + return aaas, nil +} + +// FindAccountAnalyticApplicability finds account.analytic.applicability record by querying it with criteria. +func (c *Client) FindAccountAnalyticApplicability(criteria *Criteria) (*AccountAnalyticApplicability, error) { + aaas := &AccountAnalyticApplicabilitys{} + if err := c.SearchRead(AccountAnalyticApplicabilityModel, criteria, NewOptions().Limit(1), aaas); err != nil { + return nil, err + } + return &((*aaas)[0]), nil +} + +// FindAccountAnalyticApplicabilitys finds account.analytic.applicability records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAnalyticApplicabilitys(criteria *Criteria, options *Options) (*AccountAnalyticApplicabilitys, error) { + aaas := &AccountAnalyticApplicabilitys{} + if err := c.SearchRead(AccountAnalyticApplicabilityModel, criteria, options, aaas); err != nil { + return nil, err + } + return aaas, nil +} + +// FindAccountAnalyticApplicabilityIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAnalyticApplicabilityIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountAnalyticApplicabilityModel, criteria, options) +} + +// FindAccountAnalyticApplicabilityId finds record id by querying it with criteria. +func (c *Client) FindAccountAnalyticApplicabilityId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountAnalyticApplicabilityModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_analytic_distribution_model.go b/account_analytic_distribution_model.go new file mode 100644 index 0000000..cf3b167 --- /dev/null +++ b/account_analytic_distribution_model.go @@ -0,0 +1,127 @@ +package odoo + +// AccountAnalyticDistributionModel represents account.analytic.distribution.model model. +type AccountAnalyticDistributionModel struct { + AccountPrefix *String `xmlrpc:"account_prefix,omitempty"` + AnalyticDistribution *String `xmlrpc:"analytic_distribution,omitempty"` + AnalyticPrecision *Int `xmlrpc:"analytic_precision,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DistributionAnalyticAccountIds *Relation `xmlrpc:"distribution_analytic_account_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PartnerCategoryId *Many2One `xmlrpc:"partner_category_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PrefixPlaceholder *String `xmlrpc:"prefix_placeholder,omitempty"` + ProductCategId *Many2One `xmlrpc:"product_categ_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountAnalyticDistributionModels represents array of account.analytic.distribution.model model. +type AccountAnalyticDistributionModels []AccountAnalyticDistributionModel + +// AccountAnalyticDistributionModelModel is the odoo model name. +const AccountAnalyticDistributionModelModel = "account.analytic.distribution.model" + +// Many2One convert AccountAnalyticDistributionModel to *Many2One. +func (aadm *AccountAnalyticDistributionModel) Many2One() *Many2One { + return NewMany2One(aadm.Id.Get(), "") +} + +// CreateAccountAnalyticDistributionModel creates a new account.analytic.distribution.model model and returns its id. +func (c *Client) CreateAccountAnalyticDistributionModel(aadm *AccountAnalyticDistributionModel) (int64, error) { + ids, err := c.CreateAccountAnalyticDistributionModels([]*AccountAnalyticDistributionModel{aadm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountAnalyticDistributionModel creates a new account.analytic.distribution.model model and returns its id. +func (c *Client) CreateAccountAnalyticDistributionModels(aadms []*AccountAnalyticDistributionModel) ([]int64, error) { + var vv []interface{} + for _, v := range aadms { + vv = append(vv, v) + } + return c.Create(AccountAnalyticDistributionModelModel, vv, nil) +} + +// UpdateAccountAnalyticDistributionModel updates an existing account.analytic.distribution.model record. +func (c *Client) UpdateAccountAnalyticDistributionModel(aadm *AccountAnalyticDistributionModel) error { + return c.UpdateAccountAnalyticDistributionModels([]int64{aadm.Id.Get()}, aadm) +} + +// UpdateAccountAnalyticDistributionModels updates existing account.analytic.distribution.model records. +// All records (represented by ids) will be updated by aadm values. +func (c *Client) UpdateAccountAnalyticDistributionModels(ids []int64, aadm *AccountAnalyticDistributionModel) error { + return c.Update(AccountAnalyticDistributionModelModel, ids, aadm, nil) +} + +// DeleteAccountAnalyticDistributionModel deletes an existing account.analytic.distribution.model record. +func (c *Client) DeleteAccountAnalyticDistributionModel(id int64) error { + return c.DeleteAccountAnalyticDistributionModels([]int64{id}) +} + +// DeleteAccountAnalyticDistributionModels deletes existing account.analytic.distribution.model records. +func (c *Client) DeleteAccountAnalyticDistributionModels(ids []int64) error { + return c.Delete(AccountAnalyticDistributionModelModel, ids) +} + +// GetAccountAnalyticDistributionModel gets account.analytic.distribution.model existing record. +func (c *Client) GetAccountAnalyticDistributionModel(id int64) (*AccountAnalyticDistributionModel, error) { + aadms, err := c.GetAccountAnalyticDistributionModels([]int64{id}) + if err != nil { + return nil, err + } + return &((*aadms)[0]), nil +} + +// GetAccountAnalyticDistributionModels gets account.analytic.distribution.model existing records. +func (c *Client) GetAccountAnalyticDistributionModels(ids []int64) (*AccountAnalyticDistributionModels, error) { + aadms := &AccountAnalyticDistributionModels{} + if err := c.Read(AccountAnalyticDistributionModelModel, ids, nil, aadms); err != nil { + return nil, err + } + return aadms, nil +} + +// FindAccountAnalyticDistributionModel finds account.analytic.distribution.model record by querying it with criteria. +func (c *Client) FindAccountAnalyticDistributionModel(criteria *Criteria) (*AccountAnalyticDistributionModel, error) { + aadms := &AccountAnalyticDistributionModels{} + if err := c.SearchRead(AccountAnalyticDistributionModelModel, criteria, NewOptions().Limit(1), aadms); err != nil { + return nil, err + } + return &((*aadms)[0]), nil +} + +// FindAccountAnalyticDistributionModels finds account.analytic.distribution.model records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAnalyticDistributionModels(criteria *Criteria, options *Options) (*AccountAnalyticDistributionModels, error) { + aadms := &AccountAnalyticDistributionModels{} + if err := c.SearchRead(AccountAnalyticDistributionModelModel, criteria, options, aadms); err != nil { + return nil, err + } + return aadms, nil +} + +// FindAccountAnalyticDistributionModelIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAnalyticDistributionModelIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountAnalyticDistributionModelModel, criteria, options) +} + +// FindAccountAnalyticDistributionModelId finds record id by querying it with criteria. +func (c *Client) FindAccountAnalyticDistributionModelId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountAnalyticDistributionModelModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_analytic_line.go b/account_analytic_line.go new file mode 100644 index 0000000..79bdc8f --- /dev/null +++ b/account_analytic_line.go @@ -0,0 +1,156 @@ +package odoo + +// AccountAnalyticLine represents account.analytic.line model. +type AccountAnalyticLine struct { + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + AllowBillable *Bool `xmlrpc:"allow_billable,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + AutoAccountId *Many2One `xmlrpc:"auto_account_id,omitempty"` + Category *Selection `xmlrpc:"category,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + CommercialPartnerId *Many2One `xmlrpc:"commercial_partner_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + EncodingUomId *Many2One `xmlrpc:"encoding_uom_id,omitempty"` + GeneralAccountId *Many2One `xmlrpc:"general_account_id,omitempty"` + GlobalLeaveId *Many2One `xmlrpc:"global_leave_id,omitempty"` + HolidayId *Many2One `xmlrpc:"holiday_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsSoLineEdited *Bool `xmlrpc:"is_so_line_edited,omitempty"` + JobTitle *String `xmlrpc:"job_title,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + ManagerId *Many2One `xmlrpc:"manager_id,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MilestoneId *Many2One `xmlrpc:"milestone_id,omitempty"` + MoveLineId *Many2One `xmlrpc:"move_line_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OrderId *Many2One `xmlrpc:"order_id,omitempty"` + ParentTaskId *Many2One `xmlrpc:"parent_task_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductUomCategoryId *Many2One `xmlrpc:"product_uom_category_id,omitempty"` + ProductUomId *Many2One `xmlrpc:"product_uom_id,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + ReadonlyTimesheet *Bool `xmlrpc:"readonly_timesheet,omitempty"` + Ref *String `xmlrpc:"ref,omitempty"` + SaleOrderState *Selection `xmlrpc:"sale_order_state,omitempty"` + SoLine *Many2One `xmlrpc:"so_line,omitempty"` + TaskId *Many2One `xmlrpc:"task_id,omitempty"` + TimesheetInvoiceId *Many2One `xmlrpc:"timesheet_invoice_id,omitempty"` + TimesheetInvoiceType *Selection `xmlrpc:"timesheet_invoice_type,omitempty"` + UnitAmount *Float `xmlrpc:"unit_amount,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountAnalyticLines represents array of account.analytic.line model. +type AccountAnalyticLines []AccountAnalyticLine + +// AccountAnalyticLineModel is the odoo model name. +const AccountAnalyticLineModel = "account.analytic.line" + +// Many2One convert AccountAnalyticLine to *Many2One. +func (aal *AccountAnalyticLine) Many2One() *Many2One { + return NewMany2One(aal.Id.Get(), "") +} + +// CreateAccountAnalyticLine creates a new account.analytic.line model and returns its id. +func (c *Client) CreateAccountAnalyticLine(aal *AccountAnalyticLine) (int64, error) { + ids, err := c.CreateAccountAnalyticLines([]*AccountAnalyticLine{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, nil) +} + +// UpdateAccountAnalyticLine updates an existing account.analytic.line record. +func (c *Client) UpdateAccountAnalyticLine(aal *AccountAnalyticLine) error { + return c.UpdateAccountAnalyticLines([]int64{aal.Id.Get()}, aal) +} + +// UpdateAccountAnalyticLines updates existing account.analytic.line records. +// All records (represented by ids) will be updated by aal values. +func (c *Client) UpdateAccountAnalyticLines(ids []int64, aal *AccountAnalyticLine) error { + return c.Update(AccountAnalyticLineModel, ids, aal, nil) +} + +// DeleteAccountAnalyticLine deletes an existing account.analytic.line record. +func (c *Client) DeleteAccountAnalyticLine(id int64) error { + return c.DeleteAccountAnalyticLines([]int64{id}) +} + +// DeleteAccountAnalyticLines deletes existing account.analytic.line records. +func (c *Client) DeleteAccountAnalyticLines(ids []int64) error { + return c.Delete(AccountAnalyticLineModel, ids) +} + +// GetAccountAnalyticLine gets account.analytic.line existing record. +func (c *Client) GetAccountAnalyticLine(id int64) (*AccountAnalyticLine, error) { + aals, err := c.GetAccountAnalyticLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*aals)[0]), nil +} + +// GetAccountAnalyticLines gets account.analytic.line existing records. +func (c *Client) GetAccountAnalyticLines(ids []int64) (*AccountAnalyticLines, error) { + aals := &AccountAnalyticLines{} + if err := c.Read(AccountAnalyticLineModel, ids, nil, aals); err != nil { + return nil, err + } + return aals, nil +} + +// FindAccountAnalyticLine finds account.analytic.line record by querying it with criteria. +func (c *Client) FindAccountAnalyticLine(criteria *Criteria) (*AccountAnalyticLine, error) { + aals := &AccountAnalyticLines{} + if err := c.SearchRead(AccountAnalyticLineModel, criteria, NewOptions().Limit(1), aals); err != nil { + return nil, err + } + return &((*aals)[0]), nil +} + +// FindAccountAnalyticLines finds account.analytic.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAnalyticLines(criteria *Criteria, options *Options) (*AccountAnalyticLines, error) { + aals := &AccountAnalyticLines{} + if err := c.SearchRead(AccountAnalyticLineModel, criteria, options, aals); err != nil { + return nil, err + } + return aals, nil +} + +// FindAccountAnalyticLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAnalyticLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountAnalyticLineModel, criteria, options) +} + +// FindAccountAnalyticLineId finds record id by querying it with criteria. +func (c *Client) FindAccountAnalyticLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountAnalyticLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_analytic_plan.go b/account_analytic_plan.go new file mode 100644 index 0000000..845b58b --- /dev/null +++ b/account_analytic_plan.go @@ -0,0 +1,131 @@ +package odoo + +// AccountAnalyticPlan represents account.analytic.plan model. +type AccountAnalyticPlan struct { + AccountCount *Int `xmlrpc:"account_count,omitempty"` + AccountIds *Relation `xmlrpc:"account_ids,omitempty"` + AllAccountCount *Int `xmlrpc:"all_account_count,omitempty"` + ApplicabilityIds *Relation `xmlrpc:"applicability_ids,omitempty"` + ChildrenCount *Int `xmlrpc:"children_count,omitempty"` + ChildrenIds *Relation `xmlrpc:"children_ids,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompleteName *String `xmlrpc:"complete_name,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DefaultApplicability *Selection `xmlrpc:"default_applicability,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + ParentPath *String `xmlrpc:"parent_path,omitempty"` + RootId *Many2One `xmlrpc:"root_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountAnalyticPlans represents array of account.analytic.plan model. +type AccountAnalyticPlans []AccountAnalyticPlan + +// AccountAnalyticPlanModel is the odoo model name. +const AccountAnalyticPlanModel = "account.analytic.plan" + +// Many2One convert AccountAnalyticPlan to *Many2One. +func (aap *AccountAnalyticPlan) Many2One() *Many2One { + return NewMany2One(aap.Id.Get(), "") +} + +// CreateAccountAnalyticPlan creates a new account.analytic.plan model and returns its id. +func (c *Client) CreateAccountAnalyticPlan(aap *AccountAnalyticPlan) (int64, error) { + ids, err := c.CreateAccountAnalyticPlans([]*AccountAnalyticPlan{aap}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountAnalyticPlan creates a new account.analytic.plan model and returns its id. +func (c *Client) CreateAccountAnalyticPlans(aaps []*AccountAnalyticPlan) ([]int64, error) { + var vv []interface{} + for _, v := range aaps { + vv = append(vv, v) + } + return c.Create(AccountAnalyticPlanModel, vv, nil) +} + +// UpdateAccountAnalyticPlan updates an existing account.analytic.plan record. +func (c *Client) UpdateAccountAnalyticPlan(aap *AccountAnalyticPlan) error { + return c.UpdateAccountAnalyticPlans([]int64{aap.Id.Get()}, aap) +} + +// UpdateAccountAnalyticPlans updates existing account.analytic.plan records. +// All records (represented by ids) will be updated by aap values. +func (c *Client) UpdateAccountAnalyticPlans(ids []int64, aap *AccountAnalyticPlan) error { + return c.Update(AccountAnalyticPlanModel, ids, aap, nil) +} + +// DeleteAccountAnalyticPlan deletes an existing account.analytic.plan record. +func (c *Client) DeleteAccountAnalyticPlan(id int64) error { + return c.DeleteAccountAnalyticPlans([]int64{id}) +} + +// DeleteAccountAnalyticPlans deletes existing account.analytic.plan records. +func (c *Client) DeleteAccountAnalyticPlans(ids []int64) error { + return c.Delete(AccountAnalyticPlanModel, ids) +} + +// GetAccountAnalyticPlan gets account.analytic.plan existing record. +func (c *Client) GetAccountAnalyticPlan(id int64) (*AccountAnalyticPlan, error) { + aaps, err := c.GetAccountAnalyticPlans([]int64{id}) + if err != nil { + return nil, err + } + return &((*aaps)[0]), nil +} + +// GetAccountAnalyticPlans gets account.analytic.plan existing records. +func (c *Client) GetAccountAnalyticPlans(ids []int64) (*AccountAnalyticPlans, error) { + aaps := &AccountAnalyticPlans{} + if err := c.Read(AccountAnalyticPlanModel, ids, nil, aaps); err != nil { + return nil, err + } + return aaps, nil +} + +// FindAccountAnalyticPlan finds account.analytic.plan record by querying it with criteria. +func (c *Client) FindAccountAnalyticPlan(criteria *Criteria) (*AccountAnalyticPlan, error) { + aaps := &AccountAnalyticPlans{} + if err := c.SearchRead(AccountAnalyticPlanModel, criteria, NewOptions().Limit(1), aaps); err != nil { + return nil, err + } + return &((*aaps)[0]), nil +} + +// FindAccountAnalyticPlans finds account.analytic.plan records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAnalyticPlans(criteria *Criteria, options *Options) (*AccountAnalyticPlans, error) { + aaps := &AccountAnalyticPlans{} + if err := c.SearchRead(AccountAnalyticPlanModel, criteria, options, aaps); err != nil { + return nil, err + } + return aaps, nil +} + +// FindAccountAnalyticPlanIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAnalyticPlanIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountAnalyticPlanModel, criteria, options) +} + +// FindAccountAnalyticPlanId finds record id by querying it with criteria. +func (c *Client) FindAccountAnalyticPlanId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountAnalyticPlanModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_automatic_entry_wizard.go b/account_automatic_entry_wizard.go new file mode 100644 index 0000000..173906c --- /dev/null +++ b/account_automatic_entry_wizard.go @@ -0,0 +1,132 @@ +package odoo + +// AccountAutomaticEntryWizard represents account.automatic.entry.wizard model. +type AccountAutomaticEntryWizard struct { + AccountType *Selection `xmlrpc:"account_type,omitempty"` + Action *Selection `xmlrpc:"action,omitempty"` + CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DestinationAccountId *Many2One `xmlrpc:"destination_account_id,omitempty"` + DisplayCurrencyHelper *Bool `xmlrpc:"display_currency_helper,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExpenseAccrualAccount *Many2One `xmlrpc:"expense_accrual_account,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + LockDateMessage *String `xmlrpc:"lock_date_message,omitempty"` + MoveData *String `xmlrpc:"move_data,omitempty"` + MoveLineIds *Relation `xmlrpc:"move_line_ids,omitempty"` + Percentage *Float `xmlrpc:"percentage,omitempty"` + PreviewMoveData *String `xmlrpc:"preview_move_data,omitempty"` + RevenueAccrualAccount *Many2One `xmlrpc:"revenue_accrual_account,omitempty"` + TotalAmount *Float `xmlrpc:"total_amount,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountAutomaticEntryWizards represents array of account.automatic.entry.wizard model. +type AccountAutomaticEntryWizards []AccountAutomaticEntryWizard + +// AccountAutomaticEntryWizardModel is the odoo model name. +const AccountAutomaticEntryWizardModel = "account.automatic.entry.wizard" + +// Many2One convert AccountAutomaticEntryWizard to *Many2One. +func (aaew *AccountAutomaticEntryWizard) Many2One() *Many2One { + return NewMany2One(aaew.Id.Get(), "") +} + +// CreateAccountAutomaticEntryWizard creates a new account.automatic.entry.wizard model and returns its id. +func (c *Client) CreateAccountAutomaticEntryWizard(aaew *AccountAutomaticEntryWizard) (int64, error) { + ids, err := c.CreateAccountAutomaticEntryWizards([]*AccountAutomaticEntryWizard{aaew}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountAutomaticEntryWizard creates a new account.automatic.entry.wizard model and returns its id. +func (c *Client) CreateAccountAutomaticEntryWizards(aaews []*AccountAutomaticEntryWizard) ([]int64, error) { + var vv []interface{} + for _, v := range aaews { + vv = append(vv, v) + } + return c.Create(AccountAutomaticEntryWizardModel, vv, nil) +} + +// UpdateAccountAutomaticEntryWizard updates an existing account.automatic.entry.wizard record. +func (c *Client) UpdateAccountAutomaticEntryWizard(aaew *AccountAutomaticEntryWizard) error { + return c.UpdateAccountAutomaticEntryWizards([]int64{aaew.Id.Get()}, aaew) +} + +// UpdateAccountAutomaticEntryWizards updates existing account.automatic.entry.wizard records. +// All records (represented by ids) will be updated by aaew values. +func (c *Client) UpdateAccountAutomaticEntryWizards(ids []int64, aaew *AccountAutomaticEntryWizard) error { + return c.Update(AccountAutomaticEntryWizardModel, ids, aaew, nil) +} + +// DeleteAccountAutomaticEntryWizard deletes an existing account.automatic.entry.wizard record. +func (c *Client) DeleteAccountAutomaticEntryWizard(id int64) error { + return c.DeleteAccountAutomaticEntryWizards([]int64{id}) +} + +// DeleteAccountAutomaticEntryWizards deletes existing account.automatic.entry.wizard records. +func (c *Client) DeleteAccountAutomaticEntryWizards(ids []int64) error { + return c.Delete(AccountAutomaticEntryWizardModel, ids) +} + +// GetAccountAutomaticEntryWizard gets account.automatic.entry.wizard existing record. +func (c *Client) GetAccountAutomaticEntryWizard(id int64) (*AccountAutomaticEntryWizard, error) { + aaews, err := c.GetAccountAutomaticEntryWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*aaews)[0]), nil +} + +// GetAccountAutomaticEntryWizards gets account.automatic.entry.wizard existing records. +func (c *Client) GetAccountAutomaticEntryWizards(ids []int64) (*AccountAutomaticEntryWizards, error) { + aaews := &AccountAutomaticEntryWizards{} + if err := c.Read(AccountAutomaticEntryWizardModel, ids, nil, aaews); err != nil { + return nil, err + } + return aaews, nil +} + +// FindAccountAutomaticEntryWizard finds account.automatic.entry.wizard record by querying it with criteria. +func (c *Client) FindAccountAutomaticEntryWizard(criteria *Criteria) (*AccountAutomaticEntryWizard, error) { + aaews := &AccountAutomaticEntryWizards{} + if err := c.SearchRead(AccountAutomaticEntryWizardModel, criteria, NewOptions().Limit(1), aaews); err != nil { + return nil, err + } + return &((*aaews)[0]), nil +} + +// FindAccountAutomaticEntryWizards finds account.automatic.entry.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAutomaticEntryWizards(criteria *Criteria, options *Options) (*AccountAutomaticEntryWizards, error) { + aaews := &AccountAutomaticEntryWizards{} + if err := c.SearchRead(AccountAutomaticEntryWizardModel, criteria, options, aaews); err != nil { + return nil, err + } + return aaews, nil +} + +// FindAccountAutomaticEntryWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAutomaticEntryWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountAutomaticEntryWizardModel, criteria, options) +} + +// FindAccountAutomaticEntryWizardId finds record id by querying it with criteria. +func (c *Client) FindAccountAutomaticEntryWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountAutomaticEntryWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_autopost_bills_wizard.go b/account_autopost_bills_wizard.go new file mode 100644 index 0000000..2157395 --- /dev/null +++ b/account_autopost_bills_wizard.go @@ -0,0 +1,119 @@ +package odoo + +// AccountAutopostBillsWizard represents account.autopost.bills.wizard model. +type AccountAutopostBillsWizard struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + NbUnmodifiedBills *Int `xmlrpc:"nb_unmodified_bills,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerName *String `xmlrpc:"partner_name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountAutopostBillsWizards represents array of account.autopost.bills.wizard model. +type AccountAutopostBillsWizards []AccountAutopostBillsWizard + +// AccountAutopostBillsWizardModel is the odoo model name. +const AccountAutopostBillsWizardModel = "account.autopost.bills.wizard" + +// Many2One convert AccountAutopostBillsWizard to *Many2One. +func (aabw *AccountAutopostBillsWizard) Many2One() *Many2One { + return NewMany2One(aabw.Id.Get(), "") +} + +// CreateAccountAutopostBillsWizard creates a new account.autopost.bills.wizard model and returns its id. +func (c *Client) CreateAccountAutopostBillsWizard(aabw *AccountAutopostBillsWizard) (int64, error) { + ids, err := c.CreateAccountAutopostBillsWizards([]*AccountAutopostBillsWizard{aabw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountAutopostBillsWizard creates a new account.autopost.bills.wizard model and returns its id. +func (c *Client) CreateAccountAutopostBillsWizards(aabws []*AccountAutopostBillsWizard) ([]int64, error) { + var vv []interface{} + for _, v := range aabws { + vv = append(vv, v) + } + return c.Create(AccountAutopostBillsWizardModel, vv, nil) +} + +// UpdateAccountAutopostBillsWizard updates an existing account.autopost.bills.wizard record. +func (c *Client) UpdateAccountAutopostBillsWizard(aabw *AccountAutopostBillsWizard) error { + return c.UpdateAccountAutopostBillsWizards([]int64{aabw.Id.Get()}, aabw) +} + +// UpdateAccountAutopostBillsWizards updates existing account.autopost.bills.wizard records. +// All records (represented by ids) will be updated by aabw values. +func (c *Client) UpdateAccountAutopostBillsWizards(ids []int64, aabw *AccountAutopostBillsWizard) error { + return c.Update(AccountAutopostBillsWizardModel, ids, aabw, nil) +} + +// DeleteAccountAutopostBillsWizard deletes an existing account.autopost.bills.wizard record. +func (c *Client) DeleteAccountAutopostBillsWizard(id int64) error { + return c.DeleteAccountAutopostBillsWizards([]int64{id}) +} + +// DeleteAccountAutopostBillsWizards deletes existing account.autopost.bills.wizard records. +func (c *Client) DeleteAccountAutopostBillsWizards(ids []int64) error { + return c.Delete(AccountAutopostBillsWizardModel, ids) +} + +// GetAccountAutopostBillsWizard gets account.autopost.bills.wizard existing record. +func (c *Client) GetAccountAutopostBillsWizard(id int64) (*AccountAutopostBillsWizard, error) { + aabws, err := c.GetAccountAutopostBillsWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*aabws)[0]), nil +} + +// GetAccountAutopostBillsWizards gets account.autopost.bills.wizard existing records. +func (c *Client) GetAccountAutopostBillsWizards(ids []int64) (*AccountAutopostBillsWizards, error) { + aabws := &AccountAutopostBillsWizards{} + if err := c.Read(AccountAutopostBillsWizardModel, ids, nil, aabws); err != nil { + return nil, err + } + return aabws, nil +} + +// FindAccountAutopostBillsWizard finds account.autopost.bills.wizard record by querying it with criteria. +func (c *Client) FindAccountAutopostBillsWizard(criteria *Criteria) (*AccountAutopostBillsWizard, error) { + aabws := &AccountAutopostBillsWizards{} + if err := c.SearchRead(AccountAutopostBillsWizardModel, criteria, NewOptions().Limit(1), aabws); err != nil { + return nil, err + } + return &((*aabws)[0]), nil +} + +// FindAccountAutopostBillsWizards finds account.autopost.bills.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAutopostBillsWizards(criteria *Criteria, options *Options) (*AccountAutopostBillsWizards, error) { + aabws := &AccountAutopostBillsWizards{} + if err := c.SearchRead(AccountAutopostBillsWizardModel, criteria, options, aabws); err != nil { + return nil, err + } + return aabws, nil +} + +// FindAccountAutopostBillsWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountAutopostBillsWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountAutopostBillsWizardModel, criteria, options) +} + +// FindAccountAutopostBillsWizardId finds record id by querying it with criteria. +func (c *Client) FindAccountAutopostBillsWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountAutopostBillsWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_bank_statement.go b/account_bank_statement.go new file mode 100644 index 0000000..a5e7c55 --- /dev/null +++ b/account_bank_statement.go @@ -0,0 +1,131 @@ +package odoo + +// AccountBankStatement represents account.bank.statement model. +type AccountBankStatement struct { + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + BalanceEnd *Float `xmlrpc:"balance_end,omitempty"` + BalanceEndReal *Float `xmlrpc:"balance_end_real,omitempty"` + BalanceStart *Float `xmlrpc:"balance_start,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FirstLineIndex *String `xmlrpc:"first_line_index,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsComplete *Bool `xmlrpc:"is_complete,omitempty"` + IsValid *Bool `xmlrpc:"is_valid,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + LineIds *Relation `xmlrpc:"line_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ProblemDescription *String `xmlrpc:"problem_description,omitempty"` + Reference *String `xmlrpc:"reference,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountBankStatements represents array of account.bank.statement model. +type AccountBankStatements []AccountBankStatement + +// AccountBankStatementModel is the odoo model name. +const AccountBankStatementModel = "account.bank.statement" + +// Many2One convert AccountBankStatement to *Many2One. +func (abs *AccountBankStatement) Many2One() *Many2One { + return NewMany2One(abs.Id.Get(), "") +} + +// CreateAccountBankStatement creates a new account.bank.statement model and returns its id. +func (c *Client) CreateAccountBankStatement(abs *AccountBankStatement) (int64, error) { + ids, err := c.CreateAccountBankStatements([]*AccountBankStatement{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, nil) +} + +// UpdateAccountBankStatement updates an existing account.bank.statement record. +func (c *Client) UpdateAccountBankStatement(abs *AccountBankStatement) error { + return c.UpdateAccountBankStatements([]int64{abs.Id.Get()}, abs) +} + +// UpdateAccountBankStatements updates existing account.bank.statement records. +// All records (represented by ids) will be updated by abs values. +func (c *Client) UpdateAccountBankStatements(ids []int64, abs *AccountBankStatement) error { + return c.Update(AccountBankStatementModel, ids, abs, nil) +} + +// DeleteAccountBankStatement deletes an existing account.bank.statement record. +func (c *Client) DeleteAccountBankStatement(id int64) error { + return c.DeleteAccountBankStatements([]int64{id}) +} + +// DeleteAccountBankStatements deletes existing account.bank.statement records. +func (c *Client) DeleteAccountBankStatements(ids []int64) error { + return c.Delete(AccountBankStatementModel, ids) +} + +// GetAccountBankStatement gets account.bank.statement existing record. +func (c *Client) GetAccountBankStatement(id int64) (*AccountBankStatement, error) { + abss, err := c.GetAccountBankStatements([]int64{id}) + if err != nil { + return nil, err + } + return &((*abss)[0]), nil +} + +// GetAccountBankStatements gets account.bank.statement existing records. +func (c *Client) GetAccountBankStatements(ids []int64) (*AccountBankStatements, error) { + abss := &AccountBankStatements{} + if err := c.Read(AccountBankStatementModel, ids, nil, abss); err != nil { + return nil, err + } + return abss, nil +} + +// FindAccountBankStatement finds account.bank.statement record by querying it with criteria. +func (c *Client) FindAccountBankStatement(criteria *Criteria) (*AccountBankStatement, error) { + abss := &AccountBankStatements{} + if err := c.SearchRead(AccountBankStatementModel, criteria, NewOptions().Limit(1), abss); err != nil { + return nil, err + } + return &((*abss)[0]), nil +} + +// FindAccountBankStatements finds account.bank.statement records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountBankStatements(criteria *Criteria, options *Options) (*AccountBankStatements, error) { + abss := &AccountBankStatements{} + if err := c.SearchRead(AccountBankStatementModel, criteria, options, abss); err != nil { + return nil, err + } + return abss, nil +} + +// FindAccountBankStatementIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountBankStatementIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountBankStatementModel, criteria, options) +} + +// FindAccountBankStatementId finds record id by querying it with criteria. +func (c *Client) FindAccountBankStatementId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountBankStatementModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_bank_statement_line.go b/account_bank_statement_line.go new file mode 100644 index 0000000..f199153 --- /dev/null +++ b/account_bank_statement_line.go @@ -0,0 +1,307 @@ +package odoo + +// AccountBankStatementLine represents account.bank.statement.line model. +type AccountBankStatementLine struct { + AbnormalAmountWarning *String `xmlrpc:"abnormal_amount_warning,omitempty"` + AbnormalDateWarning *String `xmlrpc:"abnormal_date_warning,omitempty"` + AccessToken *String `xmlrpc:"access_token,omitempty"` + AccessUrl *String `xmlrpc:"access_url,omitempty"` + AccessWarning *String `xmlrpc:"access_warning,omitempty"` + AccountNumber *String `xmlrpc:"account_number,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AlwaysTaxExigible *Bool `xmlrpc:"always_tax_exigible,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + AmountCurrency *Float `xmlrpc:"amount_currency,omitempty"` + AmountPaid *Float `xmlrpc:"amount_paid,omitempty"` + AmountResidual *Float `xmlrpc:"amount_residual,omitempty"` + AmountResidualSigned *Float `xmlrpc:"amount_residual_signed,omitempty"` + AmountTax *Float `xmlrpc:"amount_tax,omitempty"` + AmountTaxSigned *Float `xmlrpc:"amount_tax_signed,omitempty"` + AmountTotal *Float `xmlrpc:"amount_total,omitempty"` + AmountTotalInCurrencySigned *Float `xmlrpc:"amount_total_in_currency_signed,omitempty"` + AmountTotalSigned *Float `xmlrpc:"amount_total_signed,omitempty"` + AmountTotalWords *String `xmlrpc:"amount_total_words,omitempty"` + AmountUntaxed *Float `xmlrpc:"amount_untaxed,omitempty"` + AmountUntaxedInCurrencySigned *Float `xmlrpc:"amount_untaxed_in_currency_signed,omitempty"` + AmountUntaxedSigned *Float `xmlrpc:"amount_untaxed_signed,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + AuditTrailMessageIds *Relation `xmlrpc:"audit_trail_message_ids,omitempty"` + AuthorizedTransactionIds *Relation `xmlrpc:"authorized_transaction_ids,omitempty"` + AutoPost *Selection `xmlrpc:"auto_post,omitempty"` + AutoPostOriginId *Many2One `xmlrpc:"auto_post_origin_id,omitempty"` + AutoPostUntil *Time `xmlrpc:"auto_post_until,omitempty"` + BankPartnerId *Many2One `xmlrpc:"bank_partner_id,omitempty"` + CampaignId *Many2One `xmlrpc:"campaign_id,omitempty"` + Checked *Bool `xmlrpc:"checked,omitempty"` + CommercialPartnerId *Many2One `xmlrpc:"commercial_partner_id,omitempty"` + CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanyPriceInclude *Selection `xmlrpc:"company_price_include,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DeliveryDate *Time `xmlrpc:"delivery_date,omitempty"` + DirectionSign *Int `xmlrpc:"direction_sign,omitempty"` + DisplayInactiveCurrencyWarning *Bool `xmlrpc:"display_inactive_currency_warning,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayQrCode *Bool `xmlrpc:"display_qr_code,omitempty"` + DuplicatedRefIds *Relation `xmlrpc:"duplicated_ref_ids,omitempty"` + ExpenseSheetId *Many2One `xmlrpc:"expense_sheet_id,omitempty"` + FiscalPositionId *Many2One `xmlrpc:"fiscal_position_id,omitempty"` + ForeignCurrencyId *Many2One `xmlrpc:"foreign_currency_id,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + HasReconciledEntries *Bool `xmlrpc:"has_reconciled_entries,omitempty"` + HidePostButton *Bool `xmlrpc:"hide_post_button,omitempty"` + HighestName *String `xmlrpc:"highest_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InalterableHash *String `xmlrpc:"inalterable_hash,omitempty"` + IncotermLocation *String `xmlrpc:"incoterm_location,omitempty"` + InternalIndex *String `xmlrpc:"internal_index,omitempty"` + InvoiceCashRoundingId *Many2One `xmlrpc:"invoice_cash_rounding_id,omitempty"` + InvoiceCurrencyRate *Float `xmlrpc:"invoice_currency_rate,omitempty"` + InvoiceDate *Time `xmlrpc:"invoice_date,omitempty"` + InvoiceDateDue *Time `xmlrpc:"invoice_date_due,omitempty"` + InvoiceFilterTypeDomain *String `xmlrpc:"invoice_filter_type_domain,omitempty"` + InvoiceHasOutstanding *Bool `xmlrpc:"invoice_has_outstanding,omitempty"` + InvoiceIncotermId *Many2One `xmlrpc:"invoice_incoterm_id,omitempty"` + InvoiceLineIds *Relation `xmlrpc:"invoice_line_ids,omitempty"` + InvoiceOrigin *String `xmlrpc:"invoice_origin,omitempty"` + InvoiceOutstandingCreditsDebitsWidget *String `xmlrpc:"invoice_outstanding_credits_debits_widget,omitempty"` + InvoicePartnerDisplayName *String `xmlrpc:"invoice_partner_display_name,omitempty"` + InvoicePaymentTermId *Many2One `xmlrpc:"invoice_payment_term_id,omitempty"` + InvoicePaymentsWidget *String `xmlrpc:"invoice_payments_widget,omitempty"` + InvoicePdfReportFile *String `xmlrpc:"invoice_pdf_report_file,omitempty"` + InvoicePdfReportId *Many2One `xmlrpc:"invoice_pdf_report_id,omitempty"` + InvoiceSourceEmail *String `xmlrpc:"invoice_source_email,omitempty"` + InvoiceUserId *Many2One `xmlrpc:"invoice_user_id,omitempty"` + InvoiceVendorBillId *Many2One `xmlrpc:"invoice_vendor_bill_id,omitempty"` + IsBeingSent *Bool `xmlrpc:"is_being_sent,omitempty"` + IsManuallyModified *Bool `xmlrpc:"is_manually_modified,omitempty"` + IsMoveSent *Bool `xmlrpc:"is_move_sent,omitempty"` + IsPurchaseMatched *Bool `xmlrpc:"is_purchase_matched,omitempty"` + IsReconciled *Bool `xmlrpc:"is_reconciled,omitempty"` + IsStorno *Bool `xmlrpc:"is_storno,omitempty"` + JournalGroupId *Many2One `xmlrpc:"journal_group_id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + L10NChIsQrValid *Bool `xmlrpc:"l10n_ch_is_qr_valid,omitempty"` + LineIds *Relation `xmlrpc:"line_ids,omitempty"` + MadeSequenceGap *Bool `xmlrpc:"made_sequence_gap,omitempty"` + MatchedPaymentIds *Relation `xmlrpc:"matched_payment_ids,omitempty"` + MediumId *Many2One `xmlrpc:"medium_id,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageMainAttachmentId *Many2One `xmlrpc:"message_main_attachment_id,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MoveId *Many2One `xmlrpc:"move_id,omitempty"` + MoveSentValues *Selection `xmlrpc:"move_sent_values,omitempty"` + MoveType *Selection `xmlrpc:"move_type,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Narration *String `xmlrpc:"narration,omitempty"` + NeedCancelRequest *Bool `xmlrpc:"need_cancel_request,omitempty"` + NeededTerms *String `xmlrpc:"needed_terms,omitempty"` + NeededTermsDirty *Bool `xmlrpc:"needed_terms_dirty,omitempty"` + NextPaymentDate *Time `xmlrpc:"next_payment_date,omitempty"` + OriginPaymentId *Many2One `xmlrpc:"origin_payment_id,omitempty"` + PartnerBankId *Many2One `xmlrpc:"partner_bank_id,omitempty"` + PartnerCredit *Float `xmlrpc:"partner_credit,omitempty"` + PartnerCreditWarning *String `xmlrpc:"partner_credit_warning,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerName *String `xmlrpc:"partner_name,omitempty"` + PartnerShippingId *Many2One `xmlrpc:"partner_shipping_id,omitempty"` + PaymentCount *Int `xmlrpc:"payment_count,omitempty"` + PaymentIds *Relation `xmlrpc:"payment_ids,omitempty"` + PaymentRef *String `xmlrpc:"payment_ref,omitempty"` + PaymentReference *String `xmlrpc:"payment_reference,omitempty"` + PaymentState *Selection `xmlrpc:"payment_state,omitempty"` + PaymentTermDetails *String `xmlrpc:"payment_term_details,omitempty"` + PostedBefore *Bool `xmlrpc:"posted_before,omitempty"` + PreferredPaymentMethodLineId *Many2One `xmlrpc:"preferred_payment_method_line_id,omitempty"` + PurchaseId *Many2One `xmlrpc:"purchase_id,omitempty"` + PurchaseOrderCount *Int `xmlrpc:"purchase_order_count,omitempty"` + PurchaseOrderName *String `xmlrpc:"purchase_order_name,omitempty"` + PurchaseVendorBillId *Many2One `xmlrpc:"purchase_vendor_bill_id,omitempty"` + QrCodeMethod *Selection `xmlrpc:"qr_code_method,omitempty"` + QuickEditMode *Bool `xmlrpc:"quick_edit_mode,omitempty"` + QuickEditTotalAmount *Float `xmlrpc:"quick_edit_total_amount,omitempty"` + QuickEncodingVals *String `xmlrpc:"quick_encoding_vals,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + Ref *String `xmlrpc:"ref,omitempty"` + RestrictModeHashTable *Bool `xmlrpc:"restrict_mode_hash_table,omitempty"` + ReversalMoveIds *Relation `xmlrpc:"reversal_move_ids,omitempty"` + ReversedEntryId *Many2One `xmlrpc:"reversed_entry_id,omitempty"` + RunningBalance *Float `xmlrpc:"running_balance,omitempty"` + SaleOrderCount *Int `xmlrpc:"sale_order_count,omitempty"` + SecureSequenceNumber *Int `xmlrpc:"secure_sequence_number,omitempty"` + Secured *Bool `xmlrpc:"secured,omitempty"` + SendingData *String `xmlrpc:"sending_data,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SequenceNumber *Int `xmlrpc:"sequence_number,omitempty"` + SequencePrefix *String `xmlrpc:"sequence_prefix,omitempty"` + ShowCommercialPartnerWarning *Bool `xmlrpc:"show_commercial_partner_warning,omitempty"` + ShowDeliveryDate *Bool `xmlrpc:"show_delivery_date,omitempty"` + ShowDiscountDetails *Bool `xmlrpc:"show_discount_details,omitempty"` + ShowNameWarning *Bool `xmlrpc:"show_name_warning,omitempty"` + ShowPaymentTermDetails *Bool `xmlrpc:"show_payment_term_details,omitempty"` + ShowResetToDraftButton *Bool `xmlrpc:"show_reset_to_draft_button,omitempty"` + ShowUpdateFpos *Bool `xmlrpc:"show_update_fpos,omitempty"` + SourceId *Many2One `xmlrpc:"source_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StatementBalanceEndReal *Float `xmlrpc:"statement_balance_end_real,omitempty"` + StatementComplete *Bool `xmlrpc:"statement_complete,omitempty"` + StatementId *Many2One `xmlrpc:"statement_id,omitempty"` + StatementLineId *Many2One `xmlrpc:"statement_line_id,omitempty"` + StatementLineIds *Relation `xmlrpc:"statement_line_ids,omitempty"` + StatementName *String `xmlrpc:"statement_name,omitempty"` + StatementValid *Bool `xmlrpc:"statement_valid,omitempty"` + StatusInPayment *Selection `xmlrpc:"status_in_payment,omitempty"` + SuitableJournalIds *Relation `xmlrpc:"suitable_journal_ids,omitempty"` + TaxCalculationRoundingMethod *Selection `xmlrpc:"tax_calculation_rounding_method,omitempty"` + TaxCashBasisCreatedMoveIds *Relation `xmlrpc:"tax_cash_basis_created_move_ids,omitempty"` + TaxCashBasisOriginMoveId *Many2One `xmlrpc:"tax_cash_basis_origin_move_id,omitempty"` + TaxCashBasisRecId *Many2One `xmlrpc:"tax_cash_basis_rec_id,omitempty"` + TaxCountryCode *String `xmlrpc:"tax_country_code,omitempty"` + TaxCountryId *Many2One `xmlrpc:"tax_country_id,omitempty"` + TaxLockDateMessage *String `xmlrpc:"tax_lock_date_message,omitempty"` + TaxTotals *String `xmlrpc:"tax_totals,omitempty"` + TaxesLegalNotes *String `xmlrpc:"taxes_legal_notes,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + TimesheetCount *Int `xmlrpc:"timesheet_count,omitempty"` + TimesheetEncodeUomId *Many2One `xmlrpc:"timesheet_encode_uom_id,omitempty"` + TimesheetIds *Relation `xmlrpc:"timesheet_ids,omitempty"` + TimesheetTotalDuration *Int `xmlrpc:"timesheet_total_duration,omitempty"` + TransactionCount *Int `xmlrpc:"transaction_count,omitempty"` + TransactionDetails *String `xmlrpc:"transaction_details,omitempty"` + TransactionIds *Relation `xmlrpc:"transaction_ids,omitempty"` + TransactionType *String `xmlrpc:"transaction_type,omitempty"` + TypeName *String `xmlrpc:"type_name,omitempty"` + UblCiiXmlFile *String `xmlrpc:"ubl_cii_xml_file,omitempty"` + UblCiiXmlId *Many2One `xmlrpc:"ubl_cii_xml_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountBankStatementLines represents array of account.bank.statement.line model. +type AccountBankStatementLines []AccountBankStatementLine + +// AccountBankStatementLineModel is the odoo model name. +const AccountBankStatementLineModel = "account.bank.statement.line" + +// Many2One convert AccountBankStatementLine to *Many2One. +func (absl *AccountBankStatementLine) Many2One() *Many2One { + return NewMany2One(absl.Id.Get(), "") +} + +// CreateAccountBankStatementLine creates a new account.bank.statement.line model and returns its id. +func (c *Client) CreateAccountBankStatementLine(absl *AccountBankStatementLine) (int64, error) { + ids, err := c.CreateAccountBankStatementLines([]*AccountBankStatementLine{absl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountBankStatementLine creates a new account.bank.statement.line model and returns its id. +func (c *Client) CreateAccountBankStatementLines(absls []*AccountBankStatementLine) ([]int64, error) { + var vv []interface{} + for _, v := range absls { + vv = append(vv, v) + } + return c.Create(AccountBankStatementLineModel, vv, nil) +} + +// UpdateAccountBankStatementLine updates an existing account.bank.statement.line record. +func (c *Client) UpdateAccountBankStatementLine(absl *AccountBankStatementLine) error { + return c.UpdateAccountBankStatementLines([]int64{absl.Id.Get()}, absl) +} + +// UpdateAccountBankStatementLines updates existing account.bank.statement.line records. +// All records (represented by ids) will be updated by absl values. +func (c *Client) UpdateAccountBankStatementLines(ids []int64, absl *AccountBankStatementLine) error { + return c.Update(AccountBankStatementLineModel, ids, absl, nil) +} + +// DeleteAccountBankStatementLine deletes an existing account.bank.statement.line record. +func (c *Client) DeleteAccountBankStatementLine(id int64) error { + return c.DeleteAccountBankStatementLines([]int64{id}) +} + +// DeleteAccountBankStatementLines deletes existing account.bank.statement.line records. +func (c *Client) DeleteAccountBankStatementLines(ids []int64) error { + return c.Delete(AccountBankStatementLineModel, ids) +} + +// GetAccountBankStatementLine gets account.bank.statement.line existing record. +func (c *Client) GetAccountBankStatementLine(id int64) (*AccountBankStatementLine, error) { + absls, err := c.GetAccountBankStatementLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*absls)[0]), nil +} + +// GetAccountBankStatementLines gets account.bank.statement.line existing records. +func (c *Client) GetAccountBankStatementLines(ids []int64) (*AccountBankStatementLines, error) { + absls := &AccountBankStatementLines{} + if err := c.Read(AccountBankStatementLineModel, ids, nil, absls); err != nil { + return nil, err + } + return absls, nil +} + +// FindAccountBankStatementLine finds account.bank.statement.line record by querying it with criteria. +func (c *Client) FindAccountBankStatementLine(criteria *Criteria) (*AccountBankStatementLine, error) { + absls := &AccountBankStatementLines{} + if err := c.SearchRead(AccountBankStatementLineModel, criteria, NewOptions().Limit(1), absls); err != nil { + return nil, err + } + return &((*absls)[0]), nil +} + +// FindAccountBankStatementLines finds account.bank.statement.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountBankStatementLines(criteria *Criteria, options *Options) (*AccountBankStatementLines, error) { + absls := &AccountBankStatementLines{} + if err := c.SearchRead(AccountBankStatementLineModel, criteria, options, absls); err != nil { + return nil, err + } + return absls, nil +} + +// FindAccountBankStatementLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountBankStatementLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountBankStatementLineModel, criteria, options) +} + +// FindAccountBankStatementLineId finds record id by querying it with criteria. +func (c *Client) FindAccountBankStatementLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountBankStatementLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_cash_rounding.go b/account_cash_rounding.go new file mode 100644 index 0000000..5ebe575 --- /dev/null +++ b/account_cash_rounding.go @@ -0,0 +1,122 @@ +package odoo + +// AccountCashRounding represents account.cash.rounding model. +type AccountCashRounding struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LossAccountId *Many2One `xmlrpc:"loss_account_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ProfitAccountId *Many2One `xmlrpc:"profit_account_id,omitempty"` + Rounding *Float `xmlrpc:"rounding,omitempty"` + RoundingMethod *Selection `xmlrpc:"rounding_method,omitempty"` + Strategy *Selection `xmlrpc:"strategy,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountCashRoundings represents array of account.cash.rounding model. +type AccountCashRoundings []AccountCashRounding + +// AccountCashRoundingModel is the odoo model name. +const AccountCashRoundingModel = "account.cash.rounding" + +// Many2One convert AccountCashRounding to *Many2One. +func (acr *AccountCashRounding) Many2One() *Many2One { + return NewMany2One(acr.Id.Get(), "") +} + +// CreateAccountCashRounding creates a new account.cash.rounding model and returns its id. +func (c *Client) CreateAccountCashRounding(acr *AccountCashRounding) (int64, error) { + ids, err := c.CreateAccountCashRoundings([]*AccountCashRounding{acr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountCashRounding creates a new account.cash.rounding model and returns its id. +func (c *Client) CreateAccountCashRoundings(acrs []*AccountCashRounding) ([]int64, error) { + var vv []interface{} + for _, v := range acrs { + vv = append(vv, v) + } + return c.Create(AccountCashRoundingModel, vv, nil) +} + +// UpdateAccountCashRounding updates an existing account.cash.rounding record. +func (c *Client) UpdateAccountCashRounding(acr *AccountCashRounding) error { + return c.UpdateAccountCashRoundings([]int64{acr.Id.Get()}, acr) +} + +// UpdateAccountCashRoundings updates existing account.cash.rounding records. +// All records (represented by ids) will be updated by acr values. +func (c *Client) UpdateAccountCashRoundings(ids []int64, acr *AccountCashRounding) error { + return c.Update(AccountCashRoundingModel, ids, acr, nil) +} + +// DeleteAccountCashRounding deletes an existing account.cash.rounding record. +func (c *Client) DeleteAccountCashRounding(id int64) error { + return c.DeleteAccountCashRoundings([]int64{id}) +} + +// DeleteAccountCashRoundings deletes existing account.cash.rounding records. +func (c *Client) DeleteAccountCashRoundings(ids []int64) error { + return c.Delete(AccountCashRoundingModel, ids) +} + +// GetAccountCashRounding gets account.cash.rounding existing record. +func (c *Client) GetAccountCashRounding(id int64) (*AccountCashRounding, error) { + acrs, err := c.GetAccountCashRoundings([]int64{id}) + if err != nil { + return nil, err + } + return &((*acrs)[0]), nil +} + +// GetAccountCashRoundings gets account.cash.rounding existing records. +func (c *Client) GetAccountCashRoundings(ids []int64) (*AccountCashRoundings, error) { + acrs := &AccountCashRoundings{} + if err := c.Read(AccountCashRoundingModel, ids, nil, acrs); err != nil { + return nil, err + } + return acrs, nil +} + +// FindAccountCashRounding finds account.cash.rounding record by querying it with criteria. +func (c *Client) FindAccountCashRounding(criteria *Criteria) (*AccountCashRounding, error) { + acrs := &AccountCashRoundings{} + if err := c.SearchRead(AccountCashRoundingModel, criteria, NewOptions().Limit(1), acrs); err != nil { + return nil, err + } + return &((*acrs)[0]), nil +} + +// FindAccountCashRoundings finds account.cash.rounding records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountCashRoundings(criteria *Criteria, options *Options) (*AccountCashRoundings, error) { + acrs := &AccountCashRoundings{} + if err := c.SearchRead(AccountCashRoundingModel, criteria, options, acrs); err != nil { + return nil, err + } + return acrs, nil +} + +// FindAccountCashRoundingIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountCashRoundingIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountCashRoundingModel, criteria, options) +} + +// FindAccountCashRoundingId finds record id by querying it with criteria. +func (c *Client) FindAccountCashRoundingId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountCashRoundingModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_code_mapping.go b/account_code_mapping.go new file mode 100644 index 0000000..4351d60 --- /dev/null +++ b/account_code_mapping.go @@ -0,0 +1,115 @@ +package odoo + +// AccountCodeMapping represents account.code.mapping model. +type AccountCodeMapping struct { + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` +} + +// AccountCodeMappings represents array of account.code.mapping model. +type AccountCodeMappings []AccountCodeMapping + +// AccountCodeMappingModel is the odoo model name. +const AccountCodeMappingModel = "account.code.mapping" + +// Many2One convert AccountCodeMapping to *Many2One. +func (acm *AccountCodeMapping) Many2One() *Many2One { + return NewMany2One(acm.Id.Get(), "") +} + +// CreateAccountCodeMapping creates a new account.code.mapping model and returns its id. +func (c *Client) CreateAccountCodeMapping(acm *AccountCodeMapping) (int64, error) { + ids, err := c.CreateAccountCodeMappings([]*AccountCodeMapping{acm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountCodeMapping creates a new account.code.mapping model and returns its id. +func (c *Client) CreateAccountCodeMappings(acms []*AccountCodeMapping) ([]int64, error) { + var vv []interface{} + for _, v := range acms { + vv = append(vv, v) + } + return c.Create(AccountCodeMappingModel, vv, nil) +} + +// UpdateAccountCodeMapping updates an existing account.code.mapping record. +func (c *Client) UpdateAccountCodeMapping(acm *AccountCodeMapping) error { + return c.UpdateAccountCodeMappings([]int64{acm.Id.Get()}, acm) +} + +// UpdateAccountCodeMappings updates existing account.code.mapping records. +// All records (represented by ids) will be updated by acm values. +func (c *Client) UpdateAccountCodeMappings(ids []int64, acm *AccountCodeMapping) error { + return c.Update(AccountCodeMappingModel, ids, acm, nil) +} + +// DeleteAccountCodeMapping deletes an existing account.code.mapping record. +func (c *Client) DeleteAccountCodeMapping(id int64) error { + return c.DeleteAccountCodeMappings([]int64{id}) +} + +// DeleteAccountCodeMappings deletes existing account.code.mapping records. +func (c *Client) DeleteAccountCodeMappings(ids []int64) error { + return c.Delete(AccountCodeMappingModel, ids) +} + +// GetAccountCodeMapping gets account.code.mapping existing record. +func (c *Client) GetAccountCodeMapping(id int64) (*AccountCodeMapping, error) { + acms, err := c.GetAccountCodeMappings([]int64{id}) + if err != nil { + return nil, err + } + return &((*acms)[0]), nil +} + +// GetAccountCodeMappings gets account.code.mapping existing records. +func (c *Client) GetAccountCodeMappings(ids []int64) (*AccountCodeMappings, error) { + acms := &AccountCodeMappings{} + if err := c.Read(AccountCodeMappingModel, ids, nil, acms); err != nil { + return nil, err + } + return acms, nil +} + +// FindAccountCodeMapping finds account.code.mapping record by querying it with criteria. +func (c *Client) FindAccountCodeMapping(criteria *Criteria) (*AccountCodeMapping, error) { + acms := &AccountCodeMappings{} + if err := c.SearchRead(AccountCodeMappingModel, criteria, NewOptions().Limit(1), acms); err != nil { + return nil, err + } + return &((*acms)[0]), nil +} + +// FindAccountCodeMappings finds account.code.mapping records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountCodeMappings(criteria *Criteria, options *Options) (*AccountCodeMappings, error) { + acms := &AccountCodeMappings{} + if err := c.SearchRead(AccountCodeMappingModel, criteria, options, acms); err != nil { + return nil, err + } + return acms, nil +} + +// FindAccountCodeMappingIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountCodeMappingIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountCodeMappingModel, criteria, options) +} + +// FindAccountCodeMappingId finds record id by querying it with criteria. +func (c *Client) FindAccountCodeMappingId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountCodeMappingModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_financial_year_op.go b/account_financial_year_op.go new file mode 100644 index 0000000..c6c9925 --- /dev/null +++ b/account_financial_year_op.go @@ -0,0 +1,121 @@ +package odoo + +// AccountFinancialYearOp represents account.financial.year.op model. +type AccountFinancialYearOp struct { + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FiscalyearLastDay *Int `xmlrpc:"fiscalyear_last_day,omitempty"` + FiscalyearLastMonth *Selection `xmlrpc:"fiscalyear_last_month,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + OpeningDate *Time `xmlrpc:"opening_date,omitempty"` + OpeningMovePosted *Bool `xmlrpc:"opening_move_posted,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountFinancialYearOps represents array of account.financial.year.op model. +type AccountFinancialYearOps []AccountFinancialYearOp + +// AccountFinancialYearOpModel is the odoo model name. +const AccountFinancialYearOpModel = "account.financial.year.op" + +// Many2One convert AccountFinancialYearOp to *Many2One. +func (afyo *AccountFinancialYearOp) Many2One() *Many2One { + return NewMany2One(afyo.Id.Get(), "") +} + +// CreateAccountFinancialYearOp creates a new account.financial.year.op model and returns its id. +func (c *Client) CreateAccountFinancialYearOp(afyo *AccountFinancialYearOp) (int64, error) { + ids, err := c.CreateAccountFinancialYearOps([]*AccountFinancialYearOp{afyo}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountFinancialYearOp creates a new account.financial.year.op model and returns its id. +func (c *Client) CreateAccountFinancialYearOps(afyos []*AccountFinancialYearOp) ([]int64, error) { + var vv []interface{} + for _, v := range afyos { + vv = append(vv, v) + } + return c.Create(AccountFinancialYearOpModel, vv, nil) +} + +// UpdateAccountFinancialYearOp updates an existing account.financial.year.op record. +func (c *Client) UpdateAccountFinancialYearOp(afyo *AccountFinancialYearOp) error { + return c.UpdateAccountFinancialYearOps([]int64{afyo.Id.Get()}, afyo) +} + +// UpdateAccountFinancialYearOps updates existing account.financial.year.op records. +// All records (represented by ids) will be updated by afyo values. +func (c *Client) UpdateAccountFinancialYearOps(ids []int64, afyo *AccountFinancialYearOp) error { + return c.Update(AccountFinancialYearOpModel, ids, afyo, nil) +} + +// DeleteAccountFinancialYearOp deletes an existing account.financial.year.op record. +func (c *Client) DeleteAccountFinancialYearOp(id int64) error { + return c.DeleteAccountFinancialYearOps([]int64{id}) +} + +// DeleteAccountFinancialYearOps deletes existing account.financial.year.op records. +func (c *Client) DeleteAccountFinancialYearOps(ids []int64) error { + return c.Delete(AccountFinancialYearOpModel, ids) +} + +// GetAccountFinancialYearOp gets account.financial.year.op existing record. +func (c *Client) GetAccountFinancialYearOp(id int64) (*AccountFinancialYearOp, error) { + afyos, err := c.GetAccountFinancialYearOps([]int64{id}) + if err != nil { + return nil, err + } + return &((*afyos)[0]), nil +} + +// GetAccountFinancialYearOps gets account.financial.year.op existing records. +func (c *Client) GetAccountFinancialYearOps(ids []int64) (*AccountFinancialYearOps, error) { + afyos := &AccountFinancialYearOps{} + if err := c.Read(AccountFinancialYearOpModel, ids, nil, afyos); err != nil { + return nil, err + } + return afyos, nil +} + +// FindAccountFinancialYearOp finds account.financial.year.op record by querying it with criteria. +func (c *Client) FindAccountFinancialYearOp(criteria *Criteria) (*AccountFinancialYearOp, error) { + afyos := &AccountFinancialYearOps{} + if err := c.SearchRead(AccountFinancialYearOpModel, criteria, NewOptions().Limit(1), afyos); err != nil { + return nil, err + } + return &((*afyos)[0]), nil +} + +// FindAccountFinancialYearOps finds account.financial.year.op records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFinancialYearOps(criteria *Criteria, options *Options) (*AccountFinancialYearOps, error) { + afyos := &AccountFinancialYearOps{} + if err := c.SearchRead(AccountFinancialYearOpModel, criteria, options, afyos); err != nil { + return nil, err + } + return afyos, nil +} + +// FindAccountFinancialYearOpIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFinancialYearOpIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountFinancialYearOpModel, criteria, options) +} + +// FindAccountFinancialYearOpId finds record id by querying it with criteria. +func (c *Client) FindAccountFinancialYearOpId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountFinancialYearOpModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_fiscal_position.go b/account_fiscal_position.go new file mode 100644 index 0000000..78779ec --- /dev/null +++ b/account_fiscal_position.go @@ -0,0 +1,137 @@ +package odoo + +// AccountFiscalPosition represents account.fiscal.position model. +type AccountFiscalPosition struct { + AccountIds *Relation `xmlrpc:"account_ids,omitempty"` + AccountMap *String `xmlrpc:"account_map,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + AutoApply *Bool `xmlrpc:"auto_apply,omitempty"` + CompanyCountryId *Many2One `xmlrpc:"company_country_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryGroupId *Many2One `xmlrpc:"country_group_id,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FiscalCountryCodes *String `xmlrpc:"fiscal_country_codes,omitempty"` + ForeignVat *String `xmlrpc:"foreign_vat,omitempty"` + ForeignVatHeaderMode *Selection `xmlrpc:"foreign_vat_header_mode,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + StateIds *Relation `xmlrpc:"state_ids,omitempty"` + StatesCount *Int `xmlrpc:"states_count,omitempty"` + TaxIds *Relation `xmlrpc:"tax_ids,omitempty"` + TaxMap *String `xmlrpc:"tax_map,omitempty"` + VatRequired *Bool `xmlrpc:"vat_required,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + ZipFrom *String `xmlrpc:"zip_from,omitempty"` + ZipTo *String `xmlrpc:"zip_to,omitempty"` +} + +// AccountFiscalPositions represents array of account.fiscal.position model. +type AccountFiscalPositions []AccountFiscalPosition + +// AccountFiscalPositionModel is the odoo model name. +const AccountFiscalPositionModel = "account.fiscal.position" + +// Many2One convert AccountFiscalPosition to *Many2One. +func (afp *AccountFiscalPosition) Many2One() *Many2One { + return NewMany2One(afp.Id.Get(), "") +} + +// CreateAccountFiscalPosition creates a new account.fiscal.position model and returns its id. +func (c *Client) CreateAccountFiscalPosition(afp *AccountFiscalPosition) (int64, error) { + ids, err := c.CreateAccountFiscalPositions([]*AccountFiscalPosition{afp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountFiscalPosition creates a new account.fiscal.position model and returns its id. +func (c *Client) CreateAccountFiscalPositions(afps []*AccountFiscalPosition) ([]int64, error) { + var vv []interface{} + for _, v := range afps { + vv = append(vv, v) + } + return c.Create(AccountFiscalPositionModel, vv, nil) +} + +// UpdateAccountFiscalPosition updates an existing account.fiscal.position record. +func (c *Client) UpdateAccountFiscalPosition(afp *AccountFiscalPosition) error { + return c.UpdateAccountFiscalPositions([]int64{afp.Id.Get()}, afp) +} + +// UpdateAccountFiscalPositions updates existing account.fiscal.position records. +// All records (represented by ids) will be updated by afp values. +func (c *Client) UpdateAccountFiscalPositions(ids []int64, afp *AccountFiscalPosition) error { + return c.Update(AccountFiscalPositionModel, ids, afp, nil) +} + +// DeleteAccountFiscalPosition deletes an existing account.fiscal.position record. +func (c *Client) DeleteAccountFiscalPosition(id int64) error { + return c.DeleteAccountFiscalPositions([]int64{id}) +} + +// DeleteAccountFiscalPositions deletes existing account.fiscal.position records. +func (c *Client) DeleteAccountFiscalPositions(ids []int64) error { + return c.Delete(AccountFiscalPositionModel, ids) +} + +// GetAccountFiscalPosition gets account.fiscal.position existing record. +func (c *Client) GetAccountFiscalPosition(id int64) (*AccountFiscalPosition, error) { + afps, err := c.GetAccountFiscalPositions([]int64{id}) + if err != nil { + return nil, err + } + return &((*afps)[0]), nil +} + +// GetAccountFiscalPositions gets account.fiscal.position existing records. +func (c *Client) GetAccountFiscalPositions(ids []int64) (*AccountFiscalPositions, error) { + afps := &AccountFiscalPositions{} + if err := c.Read(AccountFiscalPositionModel, ids, nil, afps); err != nil { + return nil, err + } + return afps, nil +} + +// FindAccountFiscalPosition finds account.fiscal.position record by querying it with criteria. +func (c *Client) FindAccountFiscalPosition(criteria *Criteria) (*AccountFiscalPosition, error) { + afps := &AccountFiscalPositions{} + if err := c.SearchRead(AccountFiscalPositionModel, criteria, NewOptions().Limit(1), afps); err != nil { + return nil, err + } + return &((*afps)[0]), nil +} + +// FindAccountFiscalPositions finds account.fiscal.position records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFiscalPositions(criteria *Criteria, options *Options) (*AccountFiscalPositions, error) { + afps := &AccountFiscalPositions{} + if err := c.SearchRead(AccountFiscalPositionModel, criteria, options, afps); err != nil { + return nil, err + } + return afps, nil +} + +// FindAccountFiscalPositionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFiscalPositionIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountFiscalPositionModel, criteria, options) +} + +// FindAccountFiscalPositionId finds record id by querying it with criteria. +func (c *Client) FindAccountFiscalPositionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountFiscalPositionModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_fiscal_position_account.go b/account_fiscal_position_account.go new file mode 100644 index 0000000..e5bae19 --- /dev/null +++ b/account_fiscal_position_account.go @@ -0,0 +1,120 @@ +package odoo + +// AccountFiscalPositionAccount represents account.fiscal.position.account model. +type AccountFiscalPositionAccount struct { + AccountDestId *Many2One `xmlrpc:"account_dest_id,omitempty"` + AccountSrcId *Many2One `xmlrpc:"account_src_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PositionId *Many2One `xmlrpc:"position_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountFiscalPositionAccounts represents array of account.fiscal.position.account model. +type AccountFiscalPositionAccounts []AccountFiscalPositionAccount + +// AccountFiscalPositionAccountModel is the odoo model name. +const AccountFiscalPositionAccountModel = "account.fiscal.position.account" + +// Many2One convert AccountFiscalPositionAccount to *Many2One. +func (afpa *AccountFiscalPositionAccount) Many2One() *Many2One { + return NewMany2One(afpa.Id.Get(), "") +} + +// CreateAccountFiscalPositionAccount creates a new account.fiscal.position.account model and returns its id. +func (c *Client) CreateAccountFiscalPositionAccount(afpa *AccountFiscalPositionAccount) (int64, error) { + ids, err := c.CreateAccountFiscalPositionAccounts([]*AccountFiscalPositionAccount{afpa}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountFiscalPositionAccount creates a new account.fiscal.position.account model and returns its id. +func (c *Client) CreateAccountFiscalPositionAccounts(afpas []*AccountFiscalPositionAccount) ([]int64, error) { + var vv []interface{} + for _, v := range afpas { + vv = append(vv, v) + } + return c.Create(AccountFiscalPositionAccountModel, vv, nil) +} + +// UpdateAccountFiscalPositionAccount updates an existing account.fiscal.position.account record. +func (c *Client) UpdateAccountFiscalPositionAccount(afpa *AccountFiscalPositionAccount) error { + return c.UpdateAccountFiscalPositionAccounts([]int64{afpa.Id.Get()}, afpa) +} + +// UpdateAccountFiscalPositionAccounts updates existing account.fiscal.position.account records. +// All records (represented by ids) will be updated by afpa values. +func (c *Client) UpdateAccountFiscalPositionAccounts(ids []int64, afpa *AccountFiscalPositionAccount) error { + return c.Update(AccountFiscalPositionAccountModel, ids, afpa, nil) +} + +// DeleteAccountFiscalPositionAccount deletes an existing account.fiscal.position.account record. +func (c *Client) DeleteAccountFiscalPositionAccount(id int64) error { + return c.DeleteAccountFiscalPositionAccounts([]int64{id}) +} + +// DeleteAccountFiscalPositionAccounts deletes existing account.fiscal.position.account records. +func (c *Client) DeleteAccountFiscalPositionAccounts(ids []int64) error { + return c.Delete(AccountFiscalPositionAccountModel, ids) +} + +// GetAccountFiscalPositionAccount gets account.fiscal.position.account existing record. +func (c *Client) GetAccountFiscalPositionAccount(id int64) (*AccountFiscalPositionAccount, error) { + afpas, err := c.GetAccountFiscalPositionAccounts([]int64{id}) + if err != nil { + return nil, err + } + return &((*afpas)[0]), nil +} + +// GetAccountFiscalPositionAccounts gets account.fiscal.position.account existing records. +func (c *Client) GetAccountFiscalPositionAccounts(ids []int64) (*AccountFiscalPositionAccounts, error) { + afpas := &AccountFiscalPositionAccounts{} + if err := c.Read(AccountFiscalPositionAccountModel, ids, nil, afpas); err != nil { + return nil, err + } + return afpas, nil +} + +// FindAccountFiscalPositionAccount finds account.fiscal.position.account record by querying it with criteria. +func (c *Client) FindAccountFiscalPositionAccount(criteria *Criteria) (*AccountFiscalPositionAccount, error) { + afpas := &AccountFiscalPositionAccounts{} + if err := c.SearchRead(AccountFiscalPositionAccountModel, criteria, NewOptions().Limit(1), afpas); err != nil { + return nil, err + } + return &((*afpas)[0]), nil +} + +// FindAccountFiscalPositionAccounts finds account.fiscal.position.account records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFiscalPositionAccounts(criteria *Criteria, options *Options) (*AccountFiscalPositionAccounts, error) { + afpas := &AccountFiscalPositionAccounts{} + if err := c.SearchRead(AccountFiscalPositionAccountModel, criteria, options, afpas); err != nil { + return nil, err + } + return afpas, nil +} + +// FindAccountFiscalPositionAccountIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFiscalPositionAccountIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountFiscalPositionAccountModel, criteria, options) +} + +// FindAccountFiscalPositionAccountId finds record id by querying it with criteria. +func (c *Client) FindAccountFiscalPositionAccountId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountFiscalPositionAccountModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_fiscal_position_tax.go b/account_fiscal_position_tax.go new file mode 100644 index 0000000..7bf7e56 --- /dev/null +++ b/account_fiscal_position_tax.go @@ -0,0 +1,121 @@ +package odoo + +// AccountFiscalPositionTax represents account.fiscal.position.tax model. +type AccountFiscalPositionTax struct { + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PositionId *Many2One `xmlrpc:"position_id,omitempty"` + TaxDestActive *Bool `xmlrpc:"tax_dest_active,omitempty"` + TaxDestId *Many2One `xmlrpc:"tax_dest_id,omitempty"` + TaxSrcId *Many2One `xmlrpc:"tax_src_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountFiscalPositionTaxs represents array of account.fiscal.position.tax model. +type AccountFiscalPositionTaxs []AccountFiscalPositionTax + +// AccountFiscalPositionTaxModel is the odoo model name. +const AccountFiscalPositionTaxModel = "account.fiscal.position.tax" + +// Many2One convert AccountFiscalPositionTax to *Many2One. +func (afpt *AccountFiscalPositionTax) Many2One() *Many2One { + return NewMany2One(afpt.Id.Get(), "") +} + +// CreateAccountFiscalPositionTax creates a new account.fiscal.position.tax model and returns its id. +func (c *Client) CreateAccountFiscalPositionTax(afpt *AccountFiscalPositionTax) (int64, error) { + ids, err := c.CreateAccountFiscalPositionTaxs([]*AccountFiscalPositionTax{afpt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountFiscalPositionTax creates a new account.fiscal.position.tax model and returns its id. +func (c *Client) CreateAccountFiscalPositionTaxs(afpts []*AccountFiscalPositionTax) ([]int64, error) { + var vv []interface{} + for _, v := range afpts { + vv = append(vv, v) + } + return c.Create(AccountFiscalPositionTaxModel, vv, nil) +} + +// UpdateAccountFiscalPositionTax updates an existing account.fiscal.position.tax record. +func (c *Client) UpdateAccountFiscalPositionTax(afpt *AccountFiscalPositionTax) error { + return c.UpdateAccountFiscalPositionTaxs([]int64{afpt.Id.Get()}, afpt) +} + +// UpdateAccountFiscalPositionTaxs updates existing account.fiscal.position.tax records. +// All records (represented by ids) will be updated by afpt values. +func (c *Client) UpdateAccountFiscalPositionTaxs(ids []int64, afpt *AccountFiscalPositionTax) error { + return c.Update(AccountFiscalPositionTaxModel, ids, afpt, nil) +} + +// DeleteAccountFiscalPositionTax deletes an existing account.fiscal.position.tax record. +func (c *Client) DeleteAccountFiscalPositionTax(id int64) error { + return c.DeleteAccountFiscalPositionTaxs([]int64{id}) +} + +// DeleteAccountFiscalPositionTaxs deletes existing account.fiscal.position.tax records. +func (c *Client) DeleteAccountFiscalPositionTaxs(ids []int64) error { + return c.Delete(AccountFiscalPositionTaxModel, ids) +} + +// GetAccountFiscalPositionTax gets account.fiscal.position.tax existing record. +func (c *Client) GetAccountFiscalPositionTax(id int64) (*AccountFiscalPositionTax, error) { + afpts, err := c.GetAccountFiscalPositionTaxs([]int64{id}) + if err != nil { + return nil, err + } + return &((*afpts)[0]), nil +} + +// GetAccountFiscalPositionTaxs gets account.fiscal.position.tax existing records. +func (c *Client) GetAccountFiscalPositionTaxs(ids []int64) (*AccountFiscalPositionTaxs, error) { + afpts := &AccountFiscalPositionTaxs{} + if err := c.Read(AccountFiscalPositionTaxModel, ids, nil, afpts); err != nil { + return nil, err + } + return afpts, nil +} + +// FindAccountFiscalPositionTax finds account.fiscal.position.tax record by querying it with criteria. +func (c *Client) FindAccountFiscalPositionTax(criteria *Criteria) (*AccountFiscalPositionTax, error) { + afpts := &AccountFiscalPositionTaxs{} + if err := c.SearchRead(AccountFiscalPositionTaxModel, criteria, NewOptions().Limit(1), afpts); err != nil { + return nil, err + } + return &((*afpts)[0]), nil +} + +// FindAccountFiscalPositionTaxs finds account.fiscal.position.tax records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFiscalPositionTaxs(criteria *Criteria, options *Options) (*AccountFiscalPositionTaxs, error) { + afpts := &AccountFiscalPositionTaxs{} + if err := c.SearchRead(AccountFiscalPositionTaxModel, criteria, options, afpts); err != nil { + return nil, err + } + return afpts, nil +} + +// FindAccountFiscalPositionTaxIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFiscalPositionTaxIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountFiscalPositionTaxModel, criteria, options) +} + +// FindAccountFiscalPositionTaxId finds record id by querying it with criteria. +func (c *Client) FindAccountFiscalPositionTaxId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountFiscalPositionTaxModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_full_reconcile.go b/account_full_reconcile.go new file mode 100644 index 0000000..edc86ef --- /dev/null +++ b/account_full_reconcile.go @@ -0,0 +1,119 @@ +package odoo + +// AccountFullReconcile represents account.full.reconcile model. +type AccountFullReconcile struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExchangeMoveId *Many2One `xmlrpc:"exchange_move_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PartialReconcileIds *Relation `xmlrpc:"partial_reconcile_ids,omitempty"` + ReconciledLineIds *Relation `xmlrpc:"reconciled_line_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountFullReconciles represents array of account.full.reconcile model. +type AccountFullReconciles []AccountFullReconcile + +// AccountFullReconcileModel is the odoo model name. +const AccountFullReconcileModel = "account.full.reconcile" + +// Many2One convert AccountFullReconcile to *Many2One. +func (afr *AccountFullReconcile) Many2One() *Many2One { + return NewMany2One(afr.Id.Get(), "") +} + +// CreateAccountFullReconcile creates a new account.full.reconcile model and returns its id. +func (c *Client) CreateAccountFullReconcile(afr *AccountFullReconcile) (int64, error) { + ids, err := c.CreateAccountFullReconciles([]*AccountFullReconcile{afr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountFullReconcile creates a new account.full.reconcile model and returns its id. +func (c *Client) CreateAccountFullReconciles(afrs []*AccountFullReconcile) ([]int64, error) { + var vv []interface{} + for _, v := range afrs { + vv = append(vv, v) + } + return c.Create(AccountFullReconcileModel, vv, nil) +} + +// UpdateAccountFullReconcile updates an existing account.full.reconcile record. +func (c *Client) UpdateAccountFullReconcile(afr *AccountFullReconcile) error { + return c.UpdateAccountFullReconciles([]int64{afr.Id.Get()}, afr) +} + +// UpdateAccountFullReconciles updates existing account.full.reconcile records. +// All records (represented by ids) will be updated by afr values. +func (c *Client) UpdateAccountFullReconciles(ids []int64, afr *AccountFullReconcile) error { + return c.Update(AccountFullReconcileModel, ids, afr, nil) +} + +// DeleteAccountFullReconcile deletes an existing account.full.reconcile record. +func (c *Client) DeleteAccountFullReconcile(id int64) error { + return c.DeleteAccountFullReconciles([]int64{id}) +} + +// DeleteAccountFullReconciles deletes existing account.full.reconcile records. +func (c *Client) DeleteAccountFullReconciles(ids []int64) error { + return c.Delete(AccountFullReconcileModel, ids) +} + +// GetAccountFullReconcile gets account.full.reconcile existing record. +func (c *Client) GetAccountFullReconcile(id int64) (*AccountFullReconcile, error) { + afrs, err := c.GetAccountFullReconciles([]int64{id}) + if err != nil { + return nil, err + } + return &((*afrs)[0]), nil +} + +// GetAccountFullReconciles gets account.full.reconcile existing records. +func (c *Client) GetAccountFullReconciles(ids []int64) (*AccountFullReconciles, error) { + afrs := &AccountFullReconciles{} + if err := c.Read(AccountFullReconcileModel, ids, nil, afrs); err != nil { + return nil, err + } + return afrs, nil +} + +// FindAccountFullReconcile finds account.full.reconcile record by querying it with criteria. +func (c *Client) FindAccountFullReconcile(criteria *Criteria) (*AccountFullReconcile, error) { + afrs := &AccountFullReconciles{} + if err := c.SearchRead(AccountFullReconcileModel, criteria, NewOptions().Limit(1), afrs); err != nil { + return nil, err + } + return &((*afrs)[0]), nil +} + +// FindAccountFullReconciles finds account.full.reconcile records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFullReconciles(criteria *Criteria, options *Options) (*AccountFullReconciles, error) { + afrs := &AccountFullReconciles{} + if err := c.SearchRead(AccountFullReconcileModel, criteria, options, afrs); err != nil { + return nil, err + } + return afrs, nil +} + +// FindAccountFullReconcileIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountFullReconcileIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountFullReconcileModel, criteria, options) +} + +// FindAccountFullReconcileId finds record id by querying it with criteria. +func (c *Client) FindAccountFullReconcileId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountFullReconcileModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_group.go b/account_group.go new file mode 100644 index 0000000..5850bac --- /dev/null +++ b/account_group.go @@ -0,0 +1,121 @@ +package odoo + +// AccountGroup represents account.group model. +type AccountGroup struct { + CodePrefixEnd *String `xmlrpc:"code_prefix_end,omitempty"` + CodePrefixStart *String `xmlrpc:"code_prefix_start,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountGroups represents array of account.group model. +type AccountGroups []AccountGroup + +// AccountGroupModel is the odoo model name. +const AccountGroupModel = "account.group" + +// Many2One convert AccountGroup to *Many2One. +func (ag *AccountGroup) Many2One() *Many2One { + return NewMany2One(ag.Id.Get(), "") +} + +// CreateAccountGroup creates a new account.group model and returns its id. +func (c *Client) CreateAccountGroup(ag *AccountGroup) (int64, error) { + ids, err := c.CreateAccountGroups([]*AccountGroup{ag}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountGroup creates a new account.group model and returns its id. +func (c *Client) CreateAccountGroups(ags []*AccountGroup) ([]int64, error) { + var vv []interface{} + for _, v := range ags { + vv = append(vv, v) + } + return c.Create(AccountGroupModel, vv, nil) +} + +// UpdateAccountGroup updates an existing account.group record. +func (c *Client) UpdateAccountGroup(ag *AccountGroup) error { + return c.UpdateAccountGroups([]int64{ag.Id.Get()}, ag) +} + +// UpdateAccountGroups updates existing account.group records. +// All records (represented by ids) will be updated by ag values. +func (c *Client) UpdateAccountGroups(ids []int64, ag *AccountGroup) error { + return c.Update(AccountGroupModel, ids, ag, nil) +} + +// DeleteAccountGroup deletes an existing account.group record. +func (c *Client) DeleteAccountGroup(id int64) error { + return c.DeleteAccountGroups([]int64{id}) +} + +// DeleteAccountGroups deletes existing account.group records. +func (c *Client) DeleteAccountGroups(ids []int64) error { + return c.Delete(AccountGroupModel, ids) +} + +// GetAccountGroup gets account.group existing record. +func (c *Client) GetAccountGroup(id int64) (*AccountGroup, error) { + ags, err := c.GetAccountGroups([]int64{id}) + if err != nil { + return nil, err + } + return &((*ags)[0]), nil +} + +// GetAccountGroups gets account.group existing records. +func (c *Client) GetAccountGroups(ids []int64) (*AccountGroups, error) { + ags := &AccountGroups{} + if err := c.Read(AccountGroupModel, ids, nil, ags); err != nil { + return nil, err + } + return ags, nil +} + +// FindAccountGroup finds account.group record by querying it with criteria. +func (c *Client) FindAccountGroup(criteria *Criteria) (*AccountGroup, error) { + ags := &AccountGroups{} + if err := c.SearchRead(AccountGroupModel, criteria, NewOptions().Limit(1), ags); err != nil { + return nil, err + } + return &((*ags)[0]), nil +} + +// FindAccountGroups finds account.group records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountGroups(criteria *Criteria, options *Options) (*AccountGroups, error) { + ags := &AccountGroups{} + if err := c.SearchRead(AccountGroupModel, criteria, options, ags); err != nil { + return nil, err + } + return ags, nil +} + +// FindAccountGroupIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountGroupIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountGroupModel, criteria, options) +} + +// FindAccountGroupId finds record id by querying it with criteria. +func (c *Client) FindAccountGroupId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountGroupModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_incoterms.go b/account_incoterms.go new file mode 100644 index 0000000..ae048b0 --- /dev/null +++ b/account_incoterms.go @@ -0,0 +1,119 @@ +package odoo + +// AccountIncoterms represents account.incoterms model. +type AccountIncoterms struct { + Active *Bool `xmlrpc:"active,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountIncotermss represents array of account.incoterms model. +type AccountIncotermss []AccountIncoterms + +// AccountIncotermsModel is the odoo model name. +const AccountIncotermsModel = "account.incoterms" + +// Many2One convert AccountIncoterms to *Many2One. +func (ai *AccountIncoterms) Many2One() *Many2One { + return NewMany2One(ai.Id.Get(), "") +} + +// CreateAccountIncoterms creates a new account.incoterms model and returns its id. +func (c *Client) CreateAccountIncoterms(ai *AccountIncoterms) (int64, error) { + ids, err := c.CreateAccountIncotermss([]*AccountIncoterms{ai}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountIncoterms creates a new account.incoterms model and returns its id. +func (c *Client) CreateAccountIncotermss(ais []*AccountIncoterms) ([]int64, error) { + var vv []interface{} + for _, v := range ais { + vv = append(vv, v) + } + return c.Create(AccountIncotermsModel, vv, nil) +} + +// UpdateAccountIncoterms updates an existing account.incoterms record. +func (c *Client) UpdateAccountIncoterms(ai *AccountIncoterms) error { + return c.UpdateAccountIncotermss([]int64{ai.Id.Get()}, ai) +} + +// UpdateAccountIncotermss updates existing account.incoterms records. +// All records (represented by ids) will be updated by ai values. +func (c *Client) UpdateAccountIncotermss(ids []int64, ai *AccountIncoterms) error { + return c.Update(AccountIncotermsModel, ids, ai, nil) +} + +// DeleteAccountIncoterms deletes an existing account.incoterms record. +func (c *Client) DeleteAccountIncoterms(id int64) error { + return c.DeleteAccountIncotermss([]int64{id}) +} + +// DeleteAccountIncotermss deletes existing account.incoterms records. +func (c *Client) DeleteAccountIncotermss(ids []int64) error { + return c.Delete(AccountIncotermsModel, ids) +} + +// GetAccountIncoterms gets account.incoterms existing record. +func (c *Client) GetAccountIncoterms(id int64) (*AccountIncoterms, error) { + ais, err := c.GetAccountIncotermss([]int64{id}) + if err != nil { + return nil, err + } + return &((*ais)[0]), nil +} + +// GetAccountIncotermss gets account.incoterms existing records. +func (c *Client) GetAccountIncotermss(ids []int64) (*AccountIncotermss, error) { + ais := &AccountIncotermss{} + if err := c.Read(AccountIncotermsModel, ids, nil, ais); err != nil { + return nil, err + } + return ais, nil +} + +// FindAccountIncoterms finds account.incoterms record by querying it with criteria. +func (c *Client) FindAccountIncoterms(criteria *Criteria) (*AccountIncoterms, error) { + ais := &AccountIncotermss{} + if err := c.SearchRead(AccountIncotermsModel, criteria, NewOptions().Limit(1), ais); err != nil { + return nil, err + } + return &((*ais)[0]), nil +} + +// FindAccountIncotermss finds account.incoterms records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountIncotermss(criteria *Criteria, options *Options) (*AccountIncotermss, error) { + ais := &AccountIncotermss{} + if err := c.SearchRead(AccountIncotermsModel, criteria, options, ais); err != nil { + return nil, err + } + return ais, nil +} + +// FindAccountIncotermsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountIncotermsIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountIncotermsModel, criteria, options) +} + +// FindAccountIncotermsId finds record id by querying it with criteria. +func (c *Client) FindAccountIncotermsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountIncotermsModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_invoice_report.go b/account_invoice_report.go new file mode 100644 index 0000000..a8dbbd2 --- /dev/null +++ b/account_invoice_report.go @@ -0,0 +1,139 @@ +package odoo + +// AccountInvoiceReport represents account.invoice.report model. +type AccountInvoiceReport struct { + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + CommercialPartnerId *Many2One `xmlrpc:"commercial_partner_id,omitempty"` + CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FiscalPositionId *Many2One `xmlrpc:"fiscal_position_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InventoryValue *Float `xmlrpc:"inventory_value,omitempty"` + InvoiceDate *Time `xmlrpc:"invoice_date,omitempty"` + InvoiceDateDue *Time `xmlrpc:"invoice_date_due,omitempty"` + InvoiceUserId *Many2One `xmlrpc:"invoice_user_id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + MoveId *Many2One `xmlrpc:"move_id,omitempty"` + MoveType *Selection `xmlrpc:"move_type,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PaymentState *Selection `xmlrpc:"payment_state,omitempty"` + PriceAverage *Float `xmlrpc:"price_average,omitempty"` + PriceMargin *Float `xmlrpc:"price_margin,omitempty"` + PriceSubtotal *Float `xmlrpc:"price_subtotal,omitempty"` + PriceSubtotalCurrency *Float `xmlrpc:"price_subtotal_currency,omitempty"` + PriceTotal *Float `xmlrpc:"price_total,omitempty"` + ProductCategId *Many2One `xmlrpc:"product_categ_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductUomId *Many2One `xmlrpc:"product_uom_id,omitempty"` + Quantity *Float `xmlrpc:"quantity,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` +} + +// AccountInvoiceReports represents array of account.invoice.report model. +type AccountInvoiceReports []AccountInvoiceReport + +// AccountInvoiceReportModel is the odoo model name. +const AccountInvoiceReportModel = "account.invoice.report" + +// Many2One convert AccountInvoiceReport to *Many2One. +func (air *AccountInvoiceReport) Many2One() *Many2One { + return NewMany2One(air.Id.Get(), "") +} + +// CreateAccountInvoiceReport creates a new account.invoice.report model and returns its id. +func (c *Client) CreateAccountInvoiceReport(air *AccountInvoiceReport) (int64, error) { + ids, err := c.CreateAccountInvoiceReports([]*AccountInvoiceReport{air}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountInvoiceReport creates a new account.invoice.report model and returns its id. +func (c *Client) CreateAccountInvoiceReports(airs []*AccountInvoiceReport) ([]int64, error) { + var vv []interface{} + for _, v := range airs { + vv = append(vv, v) + } + return c.Create(AccountInvoiceReportModel, vv, nil) +} + +// UpdateAccountInvoiceReport updates an existing account.invoice.report record. +func (c *Client) UpdateAccountInvoiceReport(air *AccountInvoiceReport) error { + return c.UpdateAccountInvoiceReports([]int64{air.Id.Get()}, air) +} + +// UpdateAccountInvoiceReports updates existing account.invoice.report records. +// All records (represented by ids) will be updated by air values. +func (c *Client) UpdateAccountInvoiceReports(ids []int64, air *AccountInvoiceReport) error { + return c.Update(AccountInvoiceReportModel, ids, air, nil) +} + +// DeleteAccountInvoiceReport deletes an existing account.invoice.report record. +func (c *Client) DeleteAccountInvoiceReport(id int64) error { + return c.DeleteAccountInvoiceReports([]int64{id}) +} + +// DeleteAccountInvoiceReports deletes existing account.invoice.report records. +func (c *Client) DeleteAccountInvoiceReports(ids []int64) error { + return c.Delete(AccountInvoiceReportModel, ids) +} + +// GetAccountInvoiceReport gets account.invoice.report existing record. +func (c *Client) GetAccountInvoiceReport(id int64) (*AccountInvoiceReport, error) { + airs, err := c.GetAccountInvoiceReports([]int64{id}) + if err != nil { + return nil, err + } + return &((*airs)[0]), nil +} + +// GetAccountInvoiceReports gets account.invoice.report existing records. +func (c *Client) GetAccountInvoiceReports(ids []int64) (*AccountInvoiceReports, error) { + airs := &AccountInvoiceReports{} + if err := c.Read(AccountInvoiceReportModel, ids, nil, airs); err != nil { + return nil, err + } + return airs, nil +} + +// FindAccountInvoiceReport finds account.invoice.report record by querying it with criteria. +func (c *Client) FindAccountInvoiceReport(criteria *Criteria) (*AccountInvoiceReport, error) { + airs := &AccountInvoiceReports{} + if err := c.SearchRead(AccountInvoiceReportModel, criteria, NewOptions().Limit(1), airs); err != nil { + return nil, err + } + return &((*airs)[0]), nil +} + +// FindAccountInvoiceReports finds account.invoice.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountInvoiceReports(criteria *Criteria, options *Options) (*AccountInvoiceReports, error) { + airs := &AccountInvoiceReports{} + if err := c.SearchRead(AccountInvoiceReportModel, criteria, options, airs); err != nil { + return nil, err + } + return airs, nil +} + +// FindAccountInvoiceReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountInvoiceReportIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountInvoiceReportModel, criteria, options) +} + +// FindAccountInvoiceReportId finds record id by querying it with criteria. +func (c *Client) FindAccountInvoiceReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountInvoiceReportModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_journal.go b/account_journal.go new file mode 100644 index 0000000..8dc4d8a --- /dev/null +++ b/account_journal.go @@ -0,0 +1,195 @@ +package odoo + +// AccountJournal represents account.journal model. +type AccountJournal struct { + AccessToken *String `xmlrpc:"access_token,omitempty"` + AccessUrl *String `xmlrpc:"access_url,omitempty"` + AccessWarning *String `xmlrpc:"access_warning,omitempty"` + AccountControlIds *Relation `xmlrpc:"account_control_ids,omitempty"` + AccountingDate *Time `xmlrpc:"accounting_date,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AliasDefaults *String `xmlrpc:"alias_defaults,omitempty"` + AliasDomain *String `xmlrpc:"alias_domain,omitempty"` + AliasDomainId *Many2One `xmlrpc:"alias_domain_id,omitempty"` + AliasEmail *String `xmlrpc:"alias_email,omitempty"` + AliasId *Many2One `xmlrpc:"alias_id,omitempty"` + AliasName *String `xmlrpc:"alias_name,omitempty"` + AutocheckOnPost *Bool `xmlrpc:"autocheck_on_post,omitempty"` + AvailablePaymentMethodIds *Relation `xmlrpc:"available_payment_method_ids,omitempty"` + BankAccNumber *String `xmlrpc:"bank_acc_number,omitempty"` + BankAccountId *Many2One `xmlrpc:"bank_account_id,omitempty"` + BankId *Many2One `xmlrpc:"bank_id,omitempty"` + BankStatementsSource *Selection `xmlrpc:"bank_statements_source,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanyPartnerId *Many2One `xmlrpc:"company_partner_id,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + CurrentStatementBalance *Float `xmlrpc:"current_statement_balance,omitempty"` + DefaultAccountId *Many2One `xmlrpc:"default_account_id,omitempty"` + DefaultAccountType *String `xmlrpc:"default_account_type,omitempty"` + DisplayAliasFields *Bool `xmlrpc:"display_alias_fields,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EntriesCount *Int `xmlrpc:"entries_count,omitempty"` + HasEntries *Bool `xmlrpc:"has_entries,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + HasPostedEntries *Bool `xmlrpc:"has_posted_entries,omitempty"` + HasSequenceHoles *Bool `xmlrpc:"has_sequence_holes,omitempty"` + HasStatementLines *Bool `xmlrpc:"has_statement_lines,omitempty"` + HasUnhashedEntries *Bool `xmlrpc:"has_unhashed_entries,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InboundPaymentMethodLineIds *Relation `xmlrpc:"inbound_payment_method_line_ids,omitempty"` + InvoiceReferenceModel *Selection `xmlrpc:"invoice_reference_model,omitempty"` + InvoiceReferenceType *Selection `xmlrpc:"invoice_reference_type,omitempty"` + JournalGroupIds *Relation `xmlrpc:"journal_group_ids,omitempty"` + JsonActivityData *String `xmlrpc:"json_activity_data,omitempty"` + KanbanDashboard *String `xmlrpc:"kanban_dashboard,omitempty"` + KanbanDashboardGraph *String `xmlrpc:"kanban_dashboard_graph,omitempty"` + LastStatementId *Many2One `xmlrpc:"last_statement_id,omitempty"` + LossAccountId *Many2One `xmlrpc:"loss_account_id,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OutboundPaymentMethodLineIds *Relation `xmlrpc:"outbound_payment_method_line_ids,omitempty"` + PaymentSequence *Bool `xmlrpc:"payment_sequence,omitempty"` + ProfitAccountId *Many2One `xmlrpc:"profit_account_id,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RefundSequence *Bool `xmlrpc:"refund_sequence,omitempty"` + RestrictModeHashTable *Bool `xmlrpc:"restrict_mode_hash_table,omitempty"` + SelectedPaymentMethodCodes *String `xmlrpc:"selected_payment_method_codes,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SequenceOverrideRegex *String `xmlrpc:"sequence_override_regex,omitempty"` + ShowOnDashboard *Bool `xmlrpc:"show_on_dashboard,omitempty"` + SuspenseAccountId *Many2One `xmlrpc:"suspense_account_id,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountJournals represents array of account.journal model. +type AccountJournals []AccountJournal + +// AccountJournalModel is the odoo model name. +const AccountJournalModel = "account.journal" + +// Many2One convert AccountJournal to *Many2One. +func (aj *AccountJournal) Many2One() *Many2One { + return NewMany2One(aj.Id.Get(), "") +} + +// CreateAccountJournal creates a new account.journal model and returns its id. +func (c *Client) CreateAccountJournal(aj *AccountJournal) (int64, error) { + ids, err := c.CreateAccountJournals([]*AccountJournal{aj}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountJournal creates a new account.journal model and returns its id. +func (c *Client) CreateAccountJournals(ajs []*AccountJournal) ([]int64, error) { + var vv []interface{} + for _, v := range ajs { + vv = append(vv, v) + } + return c.Create(AccountJournalModel, vv, nil) +} + +// UpdateAccountJournal updates an existing account.journal record. +func (c *Client) UpdateAccountJournal(aj *AccountJournal) error { + return c.UpdateAccountJournals([]int64{aj.Id.Get()}, aj) +} + +// UpdateAccountJournals updates existing account.journal records. +// All records (represented by ids) will be updated by aj values. +func (c *Client) UpdateAccountJournals(ids []int64, aj *AccountJournal) error { + return c.Update(AccountJournalModel, ids, aj, nil) +} + +// DeleteAccountJournal deletes an existing account.journal record. +func (c *Client) DeleteAccountJournal(id int64) error { + return c.DeleteAccountJournals([]int64{id}) +} + +// DeleteAccountJournals deletes existing account.journal records. +func (c *Client) DeleteAccountJournals(ids []int64) error { + return c.Delete(AccountJournalModel, ids) +} + +// GetAccountJournal gets account.journal existing record. +func (c *Client) GetAccountJournal(id int64) (*AccountJournal, error) { + ajs, err := c.GetAccountJournals([]int64{id}) + if err != nil { + return nil, err + } + return &((*ajs)[0]), nil +} + +// GetAccountJournals gets account.journal existing records. +func (c *Client) GetAccountJournals(ids []int64) (*AccountJournals, error) { + ajs := &AccountJournals{} + if err := c.Read(AccountJournalModel, ids, nil, ajs); err != nil { + return nil, err + } + return ajs, nil +} + +// FindAccountJournal finds account.journal record by querying it with criteria. +func (c *Client) FindAccountJournal(criteria *Criteria) (*AccountJournal, error) { + ajs := &AccountJournals{} + if err := c.SearchRead(AccountJournalModel, criteria, NewOptions().Limit(1), ajs); err != nil { + return nil, err + } + return &((*ajs)[0]), nil +} + +// FindAccountJournals finds account.journal records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountJournals(criteria *Criteria, options *Options) (*AccountJournals, error) { + ajs := &AccountJournals{} + if err := c.SearchRead(AccountJournalModel, criteria, options, ajs); err != nil { + return nil, err + } + return ajs, nil +} + +// FindAccountJournalIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountJournalIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountJournalModel, criteria, options) +} + +// FindAccountJournalId finds record id by querying it with criteria. +func (c *Client) FindAccountJournalId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountJournalModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_journal_group.go b/account_journal_group.go new file mode 100644 index 0000000..c751c56 --- /dev/null +++ b/account_journal_group.go @@ -0,0 +1,120 @@ +package odoo + +// AccountJournalGroup represents account.journal.group model. +type AccountJournalGroup struct { + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExcludedJournalIds *Relation `xmlrpc:"excluded_journal_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountJournalGroups represents array of account.journal.group model. +type AccountJournalGroups []AccountJournalGroup + +// AccountJournalGroupModel is the odoo model name. +const AccountJournalGroupModel = "account.journal.group" + +// Many2One convert AccountJournalGroup to *Many2One. +func (ajg *AccountJournalGroup) Many2One() *Many2One { + return NewMany2One(ajg.Id.Get(), "") +} + +// CreateAccountJournalGroup creates a new account.journal.group model and returns its id. +func (c *Client) CreateAccountJournalGroup(ajg *AccountJournalGroup) (int64, error) { + ids, err := c.CreateAccountJournalGroups([]*AccountJournalGroup{ajg}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountJournalGroup creates a new account.journal.group model and returns its id. +func (c *Client) CreateAccountJournalGroups(ajgs []*AccountJournalGroup) ([]int64, error) { + var vv []interface{} + for _, v := range ajgs { + vv = append(vv, v) + } + return c.Create(AccountJournalGroupModel, vv, nil) +} + +// UpdateAccountJournalGroup updates an existing account.journal.group record. +func (c *Client) UpdateAccountJournalGroup(ajg *AccountJournalGroup) error { + return c.UpdateAccountJournalGroups([]int64{ajg.Id.Get()}, ajg) +} + +// UpdateAccountJournalGroups updates existing account.journal.group records. +// All records (represented by ids) will be updated by ajg values. +func (c *Client) UpdateAccountJournalGroups(ids []int64, ajg *AccountJournalGroup) error { + return c.Update(AccountJournalGroupModel, ids, ajg, nil) +} + +// DeleteAccountJournalGroup deletes an existing account.journal.group record. +func (c *Client) DeleteAccountJournalGroup(id int64) error { + return c.DeleteAccountJournalGroups([]int64{id}) +} + +// DeleteAccountJournalGroups deletes existing account.journal.group records. +func (c *Client) DeleteAccountJournalGroups(ids []int64) error { + return c.Delete(AccountJournalGroupModel, ids) +} + +// GetAccountJournalGroup gets account.journal.group existing record. +func (c *Client) GetAccountJournalGroup(id int64) (*AccountJournalGroup, error) { + ajgs, err := c.GetAccountJournalGroups([]int64{id}) + if err != nil { + return nil, err + } + return &((*ajgs)[0]), nil +} + +// GetAccountJournalGroups gets account.journal.group existing records. +func (c *Client) GetAccountJournalGroups(ids []int64) (*AccountJournalGroups, error) { + ajgs := &AccountJournalGroups{} + if err := c.Read(AccountJournalGroupModel, ids, nil, ajgs); err != nil { + return nil, err + } + return ajgs, nil +} + +// FindAccountJournalGroup finds account.journal.group record by querying it with criteria. +func (c *Client) FindAccountJournalGroup(criteria *Criteria) (*AccountJournalGroup, error) { + ajgs := &AccountJournalGroups{} + if err := c.SearchRead(AccountJournalGroupModel, criteria, NewOptions().Limit(1), ajgs); err != nil { + return nil, err + } + return &((*ajgs)[0]), nil +} + +// FindAccountJournalGroups finds account.journal.group records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountJournalGroups(criteria *Criteria, options *Options) (*AccountJournalGroups, error) { + ajgs := &AccountJournalGroups{} + if err := c.SearchRead(AccountJournalGroupModel, criteria, options, ajgs); err != nil { + return nil, err + } + return ajgs, nil +} + +// FindAccountJournalGroupIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountJournalGroupIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountJournalGroupModel, criteria, options) +} + +// FindAccountJournalGroupId finds record id by querying it with criteria. +func (c *Client) FindAccountJournalGroupId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountJournalGroupModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_lock_exception.go b/account_lock_exception.go new file mode 100644 index 0000000..e2b2b9d --- /dev/null +++ b/account_lock_exception.go @@ -0,0 +1,129 @@ +package odoo + +// AccountLockException represents account.lock_exception model. +type AccountLockException struct { + Active *Bool `xmlrpc:"active,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanyLockDate *Time `xmlrpc:"company_lock_date,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EndDatetime *Time `xmlrpc:"end_datetime,omitempty"` + FiscalyearLockDate *Time `xmlrpc:"fiscalyear_lock_date,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LockDate *Time `xmlrpc:"lock_date,omitempty"` + LockDateField *Selection `xmlrpc:"lock_date_field,omitempty"` + PurchaseLockDate *Time `xmlrpc:"purchase_lock_date,omitempty"` + Reason *String `xmlrpc:"reason,omitempty"` + SaleLockDate *Time `xmlrpc:"sale_lock_date,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TaxLockDate *Time `xmlrpc:"tax_lock_date,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountLockExceptions represents array of account.lock_exception model. +type AccountLockExceptions []AccountLockException + +// AccountLockExceptionModel is the odoo model name. +const AccountLockExceptionModel = "account.lock_exception" + +// Many2One convert AccountLockException to *Many2One. +func (al *AccountLockException) Many2One() *Many2One { + return NewMany2One(al.Id.Get(), "") +} + +// CreateAccountLockException creates a new account.lock_exception model and returns its id. +func (c *Client) CreateAccountLockException(al *AccountLockException) (int64, error) { + ids, err := c.CreateAccountLockExceptions([]*AccountLockException{al}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountLockException creates a new account.lock_exception model and returns its id. +func (c *Client) CreateAccountLockExceptions(als []*AccountLockException) ([]int64, error) { + var vv []interface{} + for _, v := range als { + vv = append(vv, v) + } + return c.Create(AccountLockExceptionModel, vv, nil) +} + +// UpdateAccountLockException updates an existing account.lock_exception record. +func (c *Client) UpdateAccountLockException(al *AccountLockException) error { + return c.UpdateAccountLockExceptions([]int64{al.Id.Get()}, al) +} + +// UpdateAccountLockExceptions updates existing account.lock_exception records. +// All records (represented by ids) will be updated by al values. +func (c *Client) UpdateAccountLockExceptions(ids []int64, al *AccountLockException) error { + return c.Update(AccountLockExceptionModel, ids, al, nil) +} + +// DeleteAccountLockException deletes an existing account.lock_exception record. +func (c *Client) DeleteAccountLockException(id int64) error { + return c.DeleteAccountLockExceptions([]int64{id}) +} + +// DeleteAccountLockExceptions deletes existing account.lock_exception records. +func (c *Client) DeleteAccountLockExceptions(ids []int64) error { + return c.Delete(AccountLockExceptionModel, ids) +} + +// GetAccountLockException gets account.lock_exception existing record. +func (c *Client) GetAccountLockException(id int64) (*AccountLockException, error) { + als, err := c.GetAccountLockExceptions([]int64{id}) + if err != nil { + return nil, err + } + return &((*als)[0]), nil +} + +// GetAccountLockExceptions gets account.lock_exception existing records. +func (c *Client) GetAccountLockExceptions(ids []int64) (*AccountLockExceptions, error) { + als := &AccountLockExceptions{} + if err := c.Read(AccountLockExceptionModel, ids, nil, als); err != nil { + return nil, err + } + return als, nil +} + +// FindAccountLockException finds account.lock_exception record by querying it with criteria. +func (c *Client) FindAccountLockException(criteria *Criteria) (*AccountLockException, error) { + als := &AccountLockExceptions{} + if err := c.SearchRead(AccountLockExceptionModel, criteria, NewOptions().Limit(1), als); err != nil { + return nil, err + } + return &((*als)[0]), nil +} + +// FindAccountLockExceptions finds account.lock_exception records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountLockExceptions(criteria *Criteria, options *Options) (*AccountLockExceptions, error) { + als := &AccountLockExceptions{} + if err := c.SearchRead(AccountLockExceptionModel, criteria, options, als); err != nil { + return nil, err + } + return als, nil +} + +// FindAccountLockExceptionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountLockExceptionIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountLockExceptionModel, criteria, options) +} + +// FindAccountLockExceptionId finds record id by querying it with criteria. +func (c *Client) FindAccountLockExceptionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountLockExceptionModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_merge_wizard.go b/account_merge_wizard.go new file mode 100644 index 0000000..010ef9a --- /dev/null +++ b/account_merge_wizard.go @@ -0,0 +1,120 @@ +package odoo + +// AccountMergeWizard represents account.merge.wizard model. +type AccountMergeWizard struct { + AccountIds *Relation `xmlrpc:"account_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisableMergeButton *Bool `xmlrpc:"disable_merge_button,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsGroupByName *Bool `xmlrpc:"is_group_by_name,omitempty"` + WizardLineIds *Relation `xmlrpc:"wizard_line_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountMergeWizards represents array of account.merge.wizard model. +type AccountMergeWizards []AccountMergeWizard + +// AccountMergeWizardModel is the odoo model name. +const AccountMergeWizardModel = "account.merge.wizard" + +// Many2One convert AccountMergeWizard to *Many2One. +func (amw *AccountMergeWizard) Many2One() *Many2One { + return NewMany2One(amw.Id.Get(), "") +} + +// CreateAccountMergeWizard creates a new account.merge.wizard model and returns its id. +func (c *Client) CreateAccountMergeWizard(amw *AccountMergeWizard) (int64, error) { + ids, err := c.CreateAccountMergeWizards([]*AccountMergeWizard{amw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountMergeWizard creates a new account.merge.wizard model and returns its id. +func (c *Client) CreateAccountMergeWizards(amws []*AccountMergeWizard) ([]int64, error) { + var vv []interface{} + for _, v := range amws { + vv = append(vv, v) + } + return c.Create(AccountMergeWizardModel, vv, nil) +} + +// UpdateAccountMergeWizard updates an existing account.merge.wizard record. +func (c *Client) UpdateAccountMergeWizard(amw *AccountMergeWizard) error { + return c.UpdateAccountMergeWizards([]int64{amw.Id.Get()}, amw) +} + +// UpdateAccountMergeWizards updates existing account.merge.wizard records. +// All records (represented by ids) will be updated by amw values. +func (c *Client) UpdateAccountMergeWizards(ids []int64, amw *AccountMergeWizard) error { + return c.Update(AccountMergeWizardModel, ids, amw, nil) +} + +// DeleteAccountMergeWizard deletes an existing account.merge.wizard record. +func (c *Client) DeleteAccountMergeWizard(id int64) error { + return c.DeleteAccountMergeWizards([]int64{id}) +} + +// DeleteAccountMergeWizards deletes existing account.merge.wizard records. +func (c *Client) DeleteAccountMergeWizards(ids []int64) error { + return c.Delete(AccountMergeWizardModel, ids) +} + +// GetAccountMergeWizard gets account.merge.wizard existing record. +func (c *Client) GetAccountMergeWizard(id int64) (*AccountMergeWizard, error) { + amws, err := c.GetAccountMergeWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*amws)[0]), nil +} + +// GetAccountMergeWizards gets account.merge.wizard existing records. +func (c *Client) GetAccountMergeWizards(ids []int64) (*AccountMergeWizards, error) { + amws := &AccountMergeWizards{} + if err := c.Read(AccountMergeWizardModel, ids, nil, amws); err != nil { + return nil, err + } + return amws, nil +} + +// FindAccountMergeWizard finds account.merge.wizard record by querying it with criteria. +func (c *Client) FindAccountMergeWizard(criteria *Criteria) (*AccountMergeWizard, error) { + amws := &AccountMergeWizards{} + if err := c.SearchRead(AccountMergeWizardModel, criteria, NewOptions().Limit(1), amws); err != nil { + return nil, err + } + return &((*amws)[0]), nil +} + +// FindAccountMergeWizards finds account.merge.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMergeWizards(criteria *Criteria, options *Options) (*AccountMergeWizards, error) { + amws := &AccountMergeWizards{} + if err := c.SearchRead(AccountMergeWizardModel, criteria, options, amws); err != nil { + return nil, err + } + return amws, nil +} + +// FindAccountMergeWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMergeWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountMergeWizardModel, criteria, options) +} + +// FindAccountMergeWizardId finds record id by querying it with criteria. +func (c *Client) FindAccountMergeWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountMergeWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_merge_wizard_line.go b/account_merge_wizard_line.go new file mode 100644 index 0000000..50ee014 --- /dev/null +++ b/account_merge_wizard_line.go @@ -0,0 +1,125 @@ +package odoo + +// AccountMergeWizardLine represents account.merge.wizard.line model. +type AccountMergeWizardLine struct { + AccountHasHashedEntries *Bool `xmlrpc:"account_has_hashed_entries,omitempty"` + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + CompanyIds *Relation `xmlrpc:"company_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayType *Selection `xmlrpc:"display_type,omitempty"` + GroupingKey *String `xmlrpc:"grouping_key,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Info *String `xmlrpc:"info,omitempty"` + IsSelected *Bool `xmlrpc:"is_selected,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WizardId *Many2One `xmlrpc:"wizard_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountMergeWizardLines represents array of account.merge.wizard.line model. +type AccountMergeWizardLines []AccountMergeWizardLine + +// AccountMergeWizardLineModel is the odoo model name. +const AccountMergeWizardLineModel = "account.merge.wizard.line" + +// Many2One convert AccountMergeWizardLine to *Many2One. +func (amwl *AccountMergeWizardLine) Many2One() *Many2One { + return NewMany2One(amwl.Id.Get(), "") +} + +// CreateAccountMergeWizardLine creates a new account.merge.wizard.line model and returns its id. +func (c *Client) CreateAccountMergeWizardLine(amwl *AccountMergeWizardLine) (int64, error) { + ids, err := c.CreateAccountMergeWizardLines([]*AccountMergeWizardLine{amwl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountMergeWizardLine creates a new account.merge.wizard.line model and returns its id. +func (c *Client) CreateAccountMergeWizardLines(amwls []*AccountMergeWizardLine) ([]int64, error) { + var vv []interface{} + for _, v := range amwls { + vv = append(vv, v) + } + return c.Create(AccountMergeWizardLineModel, vv, nil) +} + +// UpdateAccountMergeWizardLine updates an existing account.merge.wizard.line record. +func (c *Client) UpdateAccountMergeWizardLine(amwl *AccountMergeWizardLine) error { + return c.UpdateAccountMergeWizardLines([]int64{amwl.Id.Get()}, amwl) +} + +// UpdateAccountMergeWizardLines updates existing account.merge.wizard.line records. +// All records (represented by ids) will be updated by amwl values. +func (c *Client) UpdateAccountMergeWizardLines(ids []int64, amwl *AccountMergeWizardLine) error { + return c.Update(AccountMergeWizardLineModel, ids, amwl, nil) +} + +// DeleteAccountMergeWizardLine deletes an existing account.merge.wizard.line record. +func (c *Client) DeleteAccountMergeWizardLine(id int64) error { + return c.DeleteAccountMergeWizardLines([]int64{id}) +} + +// DeleteAccountMergeWizardLines deletes existing account.merge.wizard.line records. +func (c *Client) DeleteAccountMergeWizardLines(ids []int64) error { + return c.Delete(AccountMergeWizardLineModel, ids) +} + +// GetAccountMergeWizardLine gets account.merge.wizard.line existing record. +func (c *Client) GetAccountMergeWizardLine(id int64) (*AccountMergeWizardLine, error) { + amwls, err := c.GetAccountMergeWizardLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*amwls)[0]), nil +} + +// GetAccountMergeWizardLines gets account.merge.wizard.line existing records. +func (c *Client) GetAccountMergeWizardLines(ids []int64) (*AccountMergeWizardLines, error) { + amwls := &AccountMergeWizardLines{} + if err := c.Read(AccountMergeWizardLineModel, ids, nil, amwls); err != nil { + return nil, err + } + return amwls, nil +} + +// FindAccountMergeWizardLine finds account.merge.wizard.line record by querying it with criteria. +func (c *Client) FindAccountMergeWizardLine(criteria *Criteria) (*AccountMergeWizardLine, error) { + amwls := &AccountMergeWizardLines{} + if err := c.SearchRead(AccountMergeWizardLineModel, criteria, NewOptions().Limit(1), amwls); err != nil { + return nil, err + } + return &((*amwls)[0]), nil +} + +// FindAccountMergeWizardLines finds account.merge.wizard.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMergeWizardLines(criteria *Criteria, options *Options) (*AccountMergeWizardLines, error) { + amwls := &AccountMergeWizardLines{} + if err := c.SearchRead(AccountMergeWizardLineModel, criteria, options, amwls); err != nil { + return nil, err + } + return amwls, nil +} + +// FindAccountMergeWizardLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMergeWizardLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountMergeWizardLineModel, criteria, options) +} + +// FindAccountMergeWizardLineId finds record id by querying it with criteria. +func (c *Client) FindAccountMergeWizardLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountMergeWizardLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_move.go b/account_move.go new file mode 100644 index 0000000..cfa66e4 --- /dev/null +++ b/account_move.go @@ -0,0 +1,290 @@ +package odoo + +// AccountMove represents account.move model. +type AccountMove struct { + AbnormalAmountWarning *String `xmlrpc:"abnormal_amount_warning,omitempty"` + AbnormalDateWarning *String `xmlrpc:"abnormal_date_warning,omitempty"` + AccessToken *String `xmlrpc:"access_token,omitempty"` + AccessUrl *String `xmlrpc:"access_url,omitempty"` + AccessWarning *String `xmlrpc:"access_warning,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AlwaysTaxExigible *Bool `xmlrpc:"always_tax_exigible,omitempty"` + AmountPaid *Float `xmlrpc:"amount_paid,omitempty"` + AmountResidual *Float `xmlrpc:"amount_residual,omitempty"` + AmountResidualSigned *Float `xmlrpc:"amount_residual_signed,omitempty"` + AmountTax *Float `xmlrpc:"amount_tax,omitempty"` + AmountTaxSigned *Float `xmlrpc:"amount_tax_signed,omitempty"` + AmountTotal *Float `xmlrpc:"amount_total,omitempty"` + AmountTotalInCurrencySigned *Float `xmlrpc:"amount_total_in_currency_signed,omitempty"` + AmountTotalSigned *Float `xmlrpc:"amount_total_signed,omitempty"` + AmountTotalWords *String `xmlrpc:"amount_total_words,omitempty"` + AmountUntaxed *Float `xmlrpc:"amount_untaxed,omitempty"` + AmountUntaxedInCurrencySigned *Float `xmlrpc:"amount_untaxed_in_currency_signed,omitempty"` + AmountUntaxedSigned *Float `xmlrpc:"amount_untaxed_signed,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + AuditTrailMessageIds *Relation `xmlrpc:"audit_trail_message_ids,omitempty"` + AuthorizedTransactionIds *Relation `xmlrpc:"authorized_transaction_ids,omitempty"` + AutoPost *Selection `xmlrpc:"auto_post,omitempty"` + AutoPostOriginId *Many2One `xmlrpc:"auto_post_origin_id,omitempty"` + AutoPostUntil *Time `xmlrpc:"auto_post_until,omitempty"` + BankPartnerId *Many2One `xmlrpc:"bank_partner_id,omitempty"` + CampaignId *Many2One `xmlrpc:"campaign_id,omitempty"` + Checked *Bool `xmlrpc:"checked,omitempty"` + CommercialPartnerId *Many2One `xmlrpc:"commercial_partner_id,omitempty"` + CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanyPriceInclude *Selection `xmlrpc:"company_price_include,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DeliveryDate *Time `xmlrpc:"delivery_date,omitempty"` + DirectionSign *Int `xmlrpc:"direction_sign,omitempty"` + DisplayInactiveCurrencyWarning *Bool `xmlrpc:"display_inactive_currency_warning,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayQrCode *Bool `xmlrpc:"display_qr_code,omitempty"` + DuplicatedRefIds *Relation `xmlrpc:"duplicated_ref_ids,omitempty"` + ExpenseSheetId *Many2One `xmlrpc:"expense_sheet_id,omitempty"` + FiscalPositionId *Many2One `xmlrpc:"fiscal_position_id,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + HasReconciledEntries *Bool `xmlrpc:"has_reconciled_entries,omitempty"` + HidePostButton *Bool `xmlrpc:"hide_post_button,omitempty"` + HighestName *String `xmlrpc:"highest_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InalterableHash *String `xmlrpc:"inalterable_hash,omitempty"` + IncotermLocation *String `xmlrpc:"incoterm_location,omitempty"` + InvoiceCashRoundingId *Many2One `xmlrpc:"invoice_cash_rounding_id,omitempty"` + InvoiceCurrencyRate *Float `xmlrpc:"invoice_currency_rate,omitempty"` + InvoiceDate *Time `xmlrpc:"invoice_date,omitempty"` + InvoiceDateDue *Time `xmlrpc:"invoice_date_due,omitempty"` + InvoiceFilterTypeDomain *String `xmlrpc:"invoice_filter_type_domain,omitempty"` + InvoiceHasOutstanding *Bool `xmlrpc:"invoice_has_outstanding,omitempty"` + InvoiceIncotermId *Many2One `xmlrpc:"invoice_incoterm_id,omitempty"` + InvoiceLineIds *Relation `xmlrpc:"invoice_line_ids,omitempty"` + InvoiceOrigin *String `xmlrpc:"invoice_origin,omitempty"` + InvoiceOutstandingCreditsDebitsWidget *String `xmlrpc:"invoice_outstanding_credits_debits_widget,omitempty"` + InvoicePartnerDisplayName *String `xmlrpc:"invoice_partner_display_name,omitempty"` + InvoicePaymentTermId *Many2One `xmlrpc:"invoice_payment_term_id,omitempty"` + InvoicePaymentsWidget *String `xmlrpc:"invoice_payments_widget,omitempty"` + InvoicePdfReportFile *String `xmlrpc:"invoice_pdf_report_file,omitempty"` + InvoicePdfReportId *Many2One `xmlrpc:"invoice_pdf_report_id,omitempty"` + InvoiceSourceEmail *String `xmlrpc:"invoice_source_email,omitempty"` + InvoiceUserId *Many2One `xmlrpc:"invoice_user_id,omitempty"` + InvoiceVendorBillId *Many2One `xmlrpc:"invoice_vendor_bill_id,omitempty"` + IsBeingSent *Bool `xmlrpc:"is_being_sent,omitempty"` + IsManuallyModified *Bool `xmlrpc:"is_manually_modified,omitempty"` + IsMoveSent *Bool `xmlrpc:"is_move_sent,omitempty"` + IsPurchaseMatched *Bool `xmlrpc:"is_purchase_matched,omitempty"` + IsStorno *Bool `xmlrpc:"is_storno,omitempty"` + JournalGroupId *Many2One `xmlrpc:"journal_group_id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + L10NChIsQrValid *Bool `xmlrpc:"l10n_ch_is_qr_valid,omitempty"` + LineIds *Relation `xmlrpc:"line_ids,omitempty"` + MadeSequenceGap *Bool `xmlrpc:"made_sequence_gap,omitempty"` + MatchedPaymentIds *Relation `xmlrpc:"matched_payment_ids,omitempty"` + MediumId *Many2One `xmlrpc:"medium_id,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageMainAttachmentId *Many2One `xmlrpc:"message_main_attachment_id,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MoveSentValues *Selection `xmlrpc:"move_sent_values,omitempty"` + MoveType *Selection `xmlrpc:"move_type,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Narration *String `xmlrpc:"narration,omitempty"` + NeedCancelRequest *Bool `xmlrpc:"need_cancel_request,omitempty"` + NeededTerms *String `xmlrpc:"needed_terms,omitempty"` + NeededTermsDirty *Bool `xmlrpc:"needed_terms_dirty,omitempty"` + NextPaymentDate *Time `xmlrpc:"next_payment_date,omitempty"` + OriginPaymentId *Many2One `xmlrpc:"origin_payment_id,omitempty"` + PartnerBankId *Many2One `xmlrpc:"partner_bank_id,omitempty"` + PartnerCredit *Float `xmlrpc:"partner_credit,omitempty"` + PartnerCreditWarning *String `xmlrpc:"partner_credit_warning,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerShippingId *Many2One `xmlrpc:"partner_shipping_id,omitempty"` + PaymentCount *Int `xmlrpc:"payment_count,omitempty"` + PaymentIds *Relation `xmlrpc:"payment_ids,omitempty"` + PaymentReference *String `xmlrpc:"payment_reference,omitempty"` + PaymentState *Selection `xmlrpc:"payment_state,omitempty"` + PaymentTermDetails *String `xmlrpc:"payment_term_details,omitempty"` + PostedBefore *Bool `xmlrpc:"posted_before,omitempty"` + PreferredPaymentMethodLineId *Many2One `xmlrpc:"preferred_payment_method_line_id,omitempty"` + PurchaseId *Many2One `xmlrpc:"purchase_id,omitempty"` + PurchaseOrderCount *Int `xmlrpc:"purchase_order_count,omitempty"` + PurchaseOrderName *String `xmlrpc:"purchase_order_name,omitempty"` + PurchaseVendorBillId *Many2One `xmlrpc:"purchase_vendor_bill_id,omitempty"` + QrCodeMethod *Selection `xmlrpc:"qr_code_method,omitempty"` + QuickEditMode *Bool `xmlrpc:"quick_edit_mode,omitempty"` + QuickEditTotalAmount *Float `xmlrpc:"quick_edit_total_amount,omitempty"` + QuickEncodingVals *String `xmlrpc:"quick_encoding_vals,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + Ref *String `xmlrpc:"ref,omitempty"` + RestrictModeHashTable *Bool `xmlrpc:"restrict_mode_hash_table,omitempty"` + ReversalMoveIds *Relation `xmlrpc:"reversal_move_ids,omitempty"` + ReversedEntryId *Many2One `xmlrpc:"reversed_entry_id,omitempty"` + SaleOrderCount *Int `xmlrpc:"sale_order_count,omitempty"` + SecureSequenceNumber *Int `xmlrpc:"secure_sequence_number,omitempty"` + Secured *Bool `xmlrpc:"secured,omitempty"` + SendingData *String `xmlrpc:"sending_data,omitempty"` + SequenceNumber *Int `xmlrpc:"sequence_number,omitempty"` + SequencePrefix *String `xmlrpc:"sequence_prefix,omitempty"` + ShowCommercialPartnerWarning *Bool `xmlrpc:"show_commercial_partner_warning,omitempty"` + ShowDeliveryDate *Bool `xmlrpc:"show_delivery_date,omitempty"` + ShowDiscountDetails *Bool `xmlrpc:"show_discount_details,omitempty"` + ShowNameWarning *Bool `xmlrpc:"show_name_warning,omitempty"` + ShowPaymentTermDetails *Bool `xmlrpc:"show_payment_term_details,omitempty"` + ShowResetToDraftButton *Bool `xmlrpc:"show_reset_to_draft_button,omitempty"` + ShowUpdateFpos *Bool `xmlrpc:"show_update_fpos,omitempty"` + SourceId *Many2One `xmlrpc:"source_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StatementId *Many2One `xmlrpc:"statement_id,omitempty"` + StatementLineId *Many2One `xmlrpc:"statement_line_id,omitempty"` + StatementLineIds *Relation `xmlrpc:"statement_line_ids,omitempty"` + StatusInPayment *Selection `xmlrpc:"status_in_payment,omitempty"` + SuitableJournalIds *Relation `xmlrpc:"suitable_journal_ids,omitempty"` + TaxCalculationRoundingMethod *Selection `xmlrpc:"tax_calculation_rounding_method,omitempty"` + TaxCashBasisCreatedMoveIds *Relation `xmlrpc:"tax_cash_basis_created_move_ids,omitempty"` + TaxCashBasisOriginMoveId *Many2One `xmlrpc:"tax_cash_basis_origin_move_id,omitempty"` + TaxCashBasisRecId *Many2One `xmlrpc:"tax_cash_basis_rec_id,omitempty"` + TaxCountryCode *String `xmlrpc:"tax_country_code,omitempty"` + TaxCountryId *Many2One `xmlrpc:"tax_country_id,omitempty"` + TaxLockDateMessage *String `xmlrpc:"tax_lock_date_message,omitempty"` + TaxTotals *String `xmlrpc:"tax_totals,omitempty"` + TaxesLegalNotes *String `xmlrpc:"taxes_legal_notes,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + TimesheetCount *Int `xmlrpc:"timesheet_count,omitempty"` + TimesheetEncodeUomId *Many2One `xmlrpc:"timesheet_encode_uom_id,omitempty"` + TimesheetIds *Relation `xmlrpc:"timesheet_ids,omitempty"` + TimesheetTotalDuration *Int `xmlrpc:"timesheet_total_duration,omitempty"` + TransactionCount *Int `xmlrpc:"transaction_count,omitempty"` + TransactionIds *Relation `xmlrpc:"transaction_ids,omitempty"` + TypeName *String `xmlrpc:"type_name,omitempty"` + UblCiiXmlFile *String `xmlrpc:"ubl_cii_xml_file,omitempty"` + UblCiiXmlId *Many2One `xmlrpc:"ubl_cii_xml_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountMoves represents array of account.move model. +type AccountMoves []AccountMove + +// AccountMoveModel is the odoo model name. +const AccountMoveModel = "account.move" + +// Many2One convert AccountMove to *Many2One. +func (am *AccountMove) Many2One() *Many2One { + return NewMany2One(am.Id.Get(), "") +} + +// CreateAccountMove creates a new account.move model and returns its id. +func (c *Client) CreateAccountMove(am *AccountMove) (int64, error) { + ids, err := c.CreateAccountMoves([]*AccountMove{am}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountMove creates a new account.move model and returns its id. +func (c *Client) CreateAccountMoves(ams []*AccountMove) ([]int64, error) { + var vv []interface{} + for _, v := range ams { + vv = append(vv, v) + } + return c.Create(AccountMoveModel, vv, nil) +} + +// UpdateAccountMove updates an existing account.move record. +func (c *Client) UpdateAccountMove(am *AccountMove) error { + return c.UpdateAccountMoves([]int64{am.Id.Get()}, am) +} + +// UpdateAccountMoves updates existing account.move records. +// All records (represented by ids) will be updated by am values. +func (c *Client) UpdateAccountMoves(ids []int64, am *AccountMove) error { + return c.Update(AccountMoveModel, ids, am, nil) +} + +// DeleteAccountMove deletes an existing account.move record. +func (c *Client) DeleteAccountMove(id int64) error { + return c.DeleteAccountMoves([]int64{id}) +} + +// DeleteAccountMoves deletes existing account.move records. +func (c *Client) DeleteAccountMoves(ids []int64) error { + return c.Delete(AccountMoveModel, ids) +} + +// GetAccountMove gets account.move existing record. +func (c *Client) GetAccountMove(id int64) (*AccountMove, error) { + ams, err := c.GetAccountMoves([]int64{id}) + if err != nil { + return nil, err + } + return &((*ams)[0]), nil +} + +// GetAccountMoves gets account.move existing records. +func (c *Client) GetAccountMoves(ids []int64) (*AccountMoves, error) { + ams := &AccountMoves{} + if err := c.Read(AccountMoveModel, ids, nil, ams); err != nil { + return nil, err + } + return ams, nil +} + +// FindAccountMove finds account.move record by querying it with criteria. +func (c *Client) FindAccountMove(criteria *Criteria) (*AccountMove, error) { + ams := &AccountMoves{} + if err := c.SearchRead(AccountMoveModel, criteria, NewOptions().Limit(1), ams); err != nil { + return nil, err + } + return &((*ams)[0]), nil +} + +// FindAccountMoves finds account.move records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMoves(criteria *Criteria, options *Options) (*AccountMoves, error) { + ams := &AccountMoves{} + if err := c.SearchRead(AccountMoveModel, criteria, options, ams); err != nil { + return nil, err + } + return ams, nil +} + +// FindAccountMoveIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMoveIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountMoveModel, criteria, options) +} + +// FindAccountMoveId finds record id by querying it with criteria. +func (c *Client) FindAccountMoveId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountMoveModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_move_line.go b/account_move_line.go new file mode 100644 index 0000000..ddd2aa7 --- /dev/null +++ b/account_move_line.go @@ -0,0 +1,197 @@ +package odoo + +// AccountMoveLine represents account.move.line model. +type AccountMoveLine struct { + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + AccountInternalGroup *Selection `xmlrpc:"account_internal_group,omitempty"` + AccountRootId *Many2One `xmlrpc:"account_root_id,omitempty"` + AccountType *Selection `xmlrpc:"account_type,omitempty"` + AmountCurrency *Float `xmlrpc:"amount_currency,omitempty"` + AmountResidual *Float `xmlrpc:"amount_residual,omitempty"` + AmountResidualCurrency *Float `xmlrpc:"amount_residual_currency,omitempty"` + AnalyticDistribution *String `xmlrpc:"analytic_distribution,omitempty"` + AnalyticLineIds *Relation `xmlrpc:"analytic_line_ids,omitempty"` + AnalyticPrecision *Int `xmlrpc:"analytic_precision,omitempty"` + Balance *Float `xmlrpc:"balance,omitempty"` + CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Credit *Float `xmlrpc:"credit,omitempty"` + CumulatedBalance *Float `xmlrpc:"cumulated_balance,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + CurrencyRate *Float `xmlrpc:"currency_rate,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DateMaturity *Time `xmlrpc:"date_maturity,omitempty"` + Debit *Float `xmlrpc:"debit,omitempty"` + Discount *Float `xmlrpc:"discount,omitempty"` + DiscountAllocationDirty *Bool `xmlrpc:"discount_allocation_dirty,omitempty"` + DiscountAllocationKey *String `xmlrpc:"discount_allocation_key,omitempty"` + DiscountAllocationNeeded *String `xmlrpc:"discount_allocation_needed,omitempty"` + DiscountAmountCurrency *Float `xmlrpc:"discount_amount_currency,omitempty"` + DiscountBalance *Float `xmlrpc:"discount_balance,omitempty"` + DiscountDate *Time `xmlrpc:"discount_date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayType *Selection `xmlrpc:"display_type,omitempty"` + DistributionAnalyticAccountIds *Relation `xmlrpc:"distribution_analytic_account_ids,omitempty"` + EpdDirty *Bool `xmlrpc:"epd_dirty,omitempty"` + EpdKey *String `xmlrpc:"epd_key,omitempty"` + EpdNeeded *String `xmlrpc:"epd_needed,omitempty"` + ExpenseId *Many2One `xmlrpc:"expense_id,omitempty"` + FullReconcileId *Many2One `xmlrpc:"full_reconcile_id,omitempty"` + GroupTaxId *Many2One `xmlrpc:"group_tax_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceDate *Time `xmlrpc:"invoice_date,omitempty"` + IsAccountReconcile *Bool `xmlrpc:"is_account_reconcile,omitempty"` + IsDownpayment *Bool `xmlrpc:"is_downpayment,omitempty"` + IsImported *Bool `xmlrpc:"is_imported,omitempty"` + IsRefund *Bool `xmlrpc:"is_refund,omitempty"` + IsSameCurrency *Bool `xmlrpc:"is_same_currency,omitempty"` + IsStorno *Bool `xmlrpc:"is_storno,omitempty"` + JournalGroupId *Many2One `xmlrpc:"journal_group_id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + MatchedCreditIds *Relation `xmlrpc:"matched_credit_ids,omitempty"` + MatchedDebitIds *Relation `xmlrpc:"matched_debit_ids,omitempty"` + MatchingNumber *String `xmlrpc:"matching_number,omitempty"` + MoveId *Many2One `xmlrpc:"move_id,omitempty"` + MoveName *String `xmlrpc:"move_name,omitempty"` + MoveType *Selection `xmlrpc:"move_type,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentState *Selection `xmlrpc:"parent_state,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PaymentDate *Time `xmlrpc:"payment_date,omitempty"` + PaymentId *Many2One `xmlrpc:"payment_id,omitempty"` + PriceSubtotal *Float `xmlrpc:"price_subtotal,omitempty"` + PriceTotal *Float `xmlrpc:"price_total,omitempty"` + PriceUnit *Float `xmlrpc:"price_unit,omitempty"` + ProductCategoryId *Many2One `xmlrpc:"product_category_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductUomCategoryId *Many2One `xmlrpc:"product_uom_category_id,omitempty"` + ProductUomId *Many2One `xmlrpc:"product_uom_id,omitempty"` + PurchaseLineId *Many2One `xmlrpc:"purchase_line_id,omitempty"` + PurchaseOrderId *Many2One `xmlrpc:"purchase_order_id,omitempty"` + Quantity *Float `xmlrpc:"quantity,omitempty"` + ReconcileModelId *Many2One `xmlrpc:"reconcile_model_id,omitempty"` + Reconciled *Bool `xmlrpc:"reconciled,omitempty"` + Ref *String `xmlrpc:"ref,omitempty"` + SaleLineIds *Relation `xmlrpc:"sale_line_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + StatementId *Many2One `xmlrpc:"statement_id,omitempty"` + StatementLineId *Many2One `xmlrpc:"statement_line_id,omitempty"` + TaxBaseAmount *Float `xmlrpc:"tax_base_amount,omitempty"` + TaxCalculationRoundingMethod *Selection `xmlrpc:"tax_calculation_rounding_method,omitempty"` + TaxGroupId *Many2One `xmlrpc:"tax_group_id,omitempty"` + TaxIds *Relation `xmlrpc:"tax_ids,omitempty"` + TaxLineId *Many2One `xmlrpc:"tax_line_id,omitempty"` + TaxRepartitionLineId *Many2One `xmlrpc:"tax_repartition_line_id,omitempty"` + TaxTagIds *Relation `xmlrpc:"tax_tag_ids,omitempty"` + TaxTagInvert *Bool `xmlrpc:"tax_tag_invert,omitempty"` + TermKey *String `xmlrpc:"term_key,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountMoveLines represents array of account.move.line model. +type AccountMoveLines []AccountMoveLine + +// AccountMoveLineModel is the odoo model name. +const AccountMoveLineModel = "account.move.line" + +// Many2One convert AccountMoveLine to *Many2One. +func (aml *AccountMoveLine) Many2One() *Many2One { + return NewMany2One(aml.Id.Get(), "") +} + +// CreateAccountMoveLine creates a new account.move.line model and returns its id. +func (c *Client) CreateAccountMoveLine(aml *AccountMoveLine) (int64, error) { + ids, err := c.CreateAccountMoveLines([]*AccountMoveLine{aml}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountMoveLine creates a new account.move.line model and returns its id. +func (c *Client) CreateAccountMoveLines(amls []*AccountMoveLine) ([]int64, error) { + var vv []interface{} + for _, v := range amls { + vv = append(vv, v) + } + return c.Create(AccountMoveLineModel, vv, nil) +} + +// UpdateAccountMoveLine updates an existing account.move.line record. +func (c *Client) UpdateAccountMoveLine(aml *AccountMoveLine) error { + return c.UpdateAccountMoveLines([]int64{aml.Id.Get()}, aml) +} + +// UpdateAccountMoveLines updates existing account.move.line records. +// All records (represented by ids) will be updated by aml values. +func (c *Client) UpdateAccountMoveLines(ids []int64, aml *AccountMoveLine) error { + return c.Update(AccountMoveLineModel, ids, aml, nil) +} + +// DeleteAccountMoveLine deletes an existing account.move.line record. +func (c *Client) DeleteAccountMoveLine(id int64) error { + return c.DeleteAccountMoveLines([]int64{id}) +} + +// DeleteAccountMoveLines deletes existing account.move.line records. +func (c *Client) DeleteAccountMoveLines(ids []int64) error { + return c.Delete(AccountMoveLineModel, ids) +} + +// GetAccountMoveLine gets account.move.line existing record. +func (c *Client) GetAccountMoveLine(id int64) (*AccountMoveLine, error) { + amls, err := c.GetAccountMoveLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*amls)[0]), nil +} + +// GetAccountMoveLines gets account.move.line existing records. +func (c *Client) GetAccountMoveLines(ids []int64) (*AccountMoveLines, error) { + amls := &AccountMoveLines{} + if err := c.Read(AccountMoveLineModel, ids, nil, amls); err != nil { + return nil, err + } + return amls, nil +} + +// FindAccountMoveLine finds account.move.line record by querying it with criteria. +func (c *Client) FindAccountMoveLine(criteria *Criteria) (*AccountMoveLine, error) { + amls := &AccountMoveLines{} + if err := c.SearchRead(AccountMoveLineModel, criteria, NewOptions().Limit(1), amls); err != nil { + return nil, err + } + return &((*amls)[0]), nil +} + +// FindAccountMoveLines finds account.move.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMoveLines(criteria *Criteria, options *Options) (*AccountMoveLines, error) { + amls := &AccountMoveLines{} + if err := c.SearchRead(AccountMoveLineModel, criteria, options, amls); err != nil { + return nil, err + } + return amls, nil +} + +// FindAccountMoveLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMoveLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountMoveLineModel, criteria, options) +} + +// FindAccountMoveLineId finds record id by querying it with criteria. +func (c *Client) FindAccountMoveLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountMoveLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_move_reversal.go b/account_move_reversal.go new file mode 100644 index 0000000..857aa75 --- /dev/null +++ b/account_move_reversal.go @@ -0,0 +1,127 @@ +package odoo + +// AccountMoveReversal represents account.move.reversal model. +type AccountMoveReversal struct { + AvailableJournalIds *Relation `xmlrpc:"available_journal_ids,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + MoveIds *Relation `xmlrpc:"move_ids,omitempty"` + MoveType *String `xmlrpc:"move_type,omitempty"` + NewMoveIds *Relation `xmlrpc:"new_move_ids,omitempty"` + Reason *String `xmlrpc:"reason,omitempty"` + Residual *Float `xmlrpc:"residual,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountMoveReversals represents array of account.move.reversal model. +type AccountMoveReversals []AccountMoveReversal + +// AccountMoveReversalModel is the odoo model name. +const AccountMoveReversalModel = "account.move.reversal" + +// Many2One convert AccountMoveReversal to *Many2One. +func (amr *AccountMoveReversal) Many2One() *Many2One { + return NewMany2One(amr.Id.Get(), "") +} + +// CreateAccountMoveReversal creates a new account.move.reversal model and returns its id. +func (c *Client) CreateAccountMoveReversal(amr *AccountMoveReversal) (int64, error) { + ids, err := c.CreateAccountMoveReversals([]*AccountMoveReversal{amr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountMoveReversal creates a new account.move.reversal model and returns its id. +func (c *Client) CreateAccountMoveReversals(amrs []*AccountMoveReversal) ([]int64, error) { + var vv []interface{} + for _, v := range amrs { + vv = append(vv, v) + } + return c.Create(AccountMoveReversalModel, vv, nil) +} + +// UpdateAccountMoveReversal updates an existing account.move.reversal record. +func (c *Client) UpdateAccountMoveReversal(amr *AccountMoveReversal) error { + return c.UpdateAccountMoveReversals([]int64{amr.Id.Get()}, amr) +} + +// UpdateAccountMoveReversals updates existing account.move.reversal records. +// All records (represented by ids) will be updated by amr values. +func (c *Client) UpdateAccountMoveReversals(ids []int64, amr *AccountMoveReversal) error { + return c.Update(AccountMoveReversalModel, ids, amr, nil) +} + +// DeleteAccountMoveReversal deletes an existing account.move.reversal record. +func (c *Client) DeleteAccountMoveReversal(id int64) error { + return c.DeleteAccountMoveReversals([]int64{id}) +} + +// DeleteAccountMoveReversals deletes existing account.move.reversal records. +func (c *Client) DeleteAccountMoveReversals(ids []int64) error { + return c.Delete(AccountMoveReversalModel, ids) +} + +// GetAccountMoveReversal gets account.move.reversal existing record. +func (c *Client) GetAccountMoveReversal(id int64) (*AccountMoveReversal, error) { + amrs, err := c.GetAccountMoveReversals([]int64{id}) + if err != nil { + return nil, err + } + return &((*amrs)[0]), nil +} + +// GetAccountMoveReversals gets account.move.reversal existing records. +func (c *Client) GetAccountMoveReversals(ids []int64) (*AccountMoveReversals, error) { + amrs := &AccountMoveReversals{} + if err := c.Read(AccountMoveReversalModel, ids, nil, amrs); err != nil { + return nil, err + } + return amrs, nil +} + +// FindAccountMoveReversal finds account.move.reversal record by querying it with criteria. +func (c *Client) FindAccountMoveReversal(criteria *Criteria) (*AccountMoveReversal, error) { + amrs := &AccountMoveReversals{} + if err := c.SearchRead(AccountMoveReversalModel, criteria, NewOptions().Limit(1), amrs); err != nil { + return nil, err + } + return &((*amrs)[0]), nil +} + +// FindAccountMoveReversals finds account.move.reversal records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMoveReversals(criteria *Criteria, options *Options) (*AccountMoveReversals, error) { + amrs := &AccountMoveReversals{} + if err := c.SearchRead(AccountMoveReversalModel, criteria, options, amrs); err != nil { + return nil, err + } + return amrs, nil +} + +// FindAccountMoveReversalIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMoveReversalIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountMoveReversalModel, criteria, options) +} + +// FindAccountMoveReversalId finds record id by querying it with criteria. +func (c *Client) FindAccountMoveReversalId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountMoveReversalModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_move_send_batch_wizard.go b/account_move_send_batch_wizard.go new file mode 100644 index 0000000..60fbf82 --- /dev/null +++ b/account_move_send_batch_wizard.go @@ -0,0 +1,120 @@ +package odoo + +// AccountMoveSendBatchWizard represents account.move.send.batch.wizard model. +type AccountMoveSendBatchWizard struct { + Alerts *String `xmlrpc:"alerts,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MoveIds *Relation `xmlrpc:"move_ids,omitempty"` + SendByPostStamps *Int `xmlrpc:"send_by_post_stamps,omitempty"` + SummaryData *String `xmlrpc:"summary_data,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountMoveSendBatchWizards represents array of account.move.send.batch.wizard model. +type AccountMoveSendBatchWizards []AccountMoveSendBatchWizard + +// AccountMoveSendBatchWizardModel is the odoo model name. +const AccountMoveSendBatchWizardModel = "account.move.send.batch.wizard" + +// Many2One convert AccountMoveSendBatchWizard to *Many2One. +func (amsbw *AccountMoveSendBatchWizard) Many2One() *Many2One { + return NewMany2One(amsbw.Id.Get(), "") +} + +// CreateAccountMoveSendBatchWizard creates a new account.move.send.batch.wizard model and returns its id. +func (c *Client) CreateAccountMoveSendBatchWizard(amsbw *AccountMoveSendBatchWizard) (int64, error) { + ids, err := c.CreateAccountMoveSendBatchWizards([]*AccountMoveSendBatchWizard{amsbw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountMoveSendBatchWizard creates a new account.move.send.batch.wizard model and returns its id. +func (c *Client) CreateAccountMoveSendBatchWizards(amsbws []*AccountMoveSendBatchWizard) ([]int64, error) { + var vv []interface{} + for _, v := range amsbws { + vv = append(vv, v) + } + return c.Create(AccountMoveSendBatchWizardModel, vv, nil) +} + +// UpdateAccountMoveSendBatchWizard updates an existing account.move.send.batch.wizard record. +func (c *Client) UpdateAccountMoveSendBatchWizard(amsbw *AccountMoveSendBatchWizard) error { + return c.UpdateAccountMoveSendBatchWizards([]int64{amsbw.Id.Get()}, amsbw) +} + +// UpdateAccountMoveSendBatchWizards updates existing account.move.send.batch.wizard records. +// All records (represented by ids) will be updated by amsbw values. +func (c *Client) UpdateAccountMoveSendBatchWizards(ids []int64, amsbw *AccountMoveSendBatchWizard) error { + return c.Update(AccountMoveSendBatchWizardModel, ids, amsbw, nil) +} + +// DeleteAccountMoveSendBatchWizard deletes an existing account.move.send.batch.wizard record. +func (c *Client) DeleteAccountMoveSendBatchWizard(id int64) error { + return c.DeleteAccountMoveSendBatchWizards([]int64{id}) +} + +// DeleteAccountMoveSendBatchWizards deletes existing account.move.send.batch.wizard records. +func (c *Client) DeleteAccountMoveSendBatchWizards(ids []int64) error { + return c.Delete(AccountMoveSendBatchWizardModel, ids) +} + +// GetAccountMoveSendBatchWizard gets account.move.send.batch.wizard existing record. +func (c *Client) GetAccountMoveSendBatchWizard(id int64) (*AccountMoveSendBatchWizard, error) { + amsbws, err := c.GetAccountMoveSendBatchWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*amsbws)[0]), nil +} + +// GetAccountMoveSendBatchWizards gets account.move.send.batch.wizard existing records. +func (c *Client) GetAccountMoveSendBatchWizards(ids []int64) (*AccountMoveSendBatchWizards, error) { + amsbws := &AccountMoveSendBatchWizards{} + if err := c.Read(AccountMoveSendBatchWizardModel, ids, nil, amsbws); err != nil { + return nil, err + } + return amsbws, nil +} + +// FindAccountMoveSendBatchWizard finds account.move.send.batch.wizard record by querying it with criteria. +func (c *Client) FindAccountMoveSendBatchWizard(criteria *Criteria) (*AccountMoveSendBatchWizard, error) { + amsbws := &AccountMoveSendBatchWizards{} + if err := c.SearchRead(AccountMoveSendBatchWizardModel, criteria, NewOptions().Limit(1), amsbws); err != nil { + return nil, err + } + return &((*amsbws)[0]), nil +} + +// FindAccountMoveSendBatchWizards finds account.move.send.batch.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMoveSendBatchWizards(criteria *Criteria, options *Options) (*AccountMoveSendBatchWizards, error) { + amsbws := &AccountMoveSendBatchWizards{} + if err := c.SearchRead(AccountMoveSendBatchWizardModel, criteria, options, amsbws); err != nil { + return nil, err + } + return amsbws, nil +} + +// FindAccountMoveSendBatchWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMoveSendBatchWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountMoveSendBatchWizardModel, criteria, options) +} + +// FindAccountMoveSendBatchWizardId finds record id by querying it with criteria. +func (c *Client) FindAccountMoveSendBatchWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountMoveSendBatchWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_move_send_wizard.go b/account_move_send_wizard.go new file mode 100644 index 0000000..60d42a3 --- /dev/null +++ b/account_move_send_wizard.go @@ -0,0 +1,133 @@ +package odoo + +// AccountMoveSendWizard represents account.move.send.wizard model. +type AccountMoveSendWizard struct { + Alerts *String `xmlrpc:"alerts,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayPdfReportId *Bool `xmlrpc:"display_pdf_report_id,omitempty"` + ExtraEdiCheckboxes *String `xmlrpc:"extra_edi_checkboxes,omitempty"` + ExtraEdis *String `xmlrpc:"extra_edis,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceEdiFormat *Selection `xmlrpc:"invoice_edi_format,omitempty"` + IsDownloadOnly *Bool `xmlrpc:"is_download_only,omitempty"` + MailAttachmentsWidget *String `xmlrpc:"mail_attachments_widget,omitempty"` + MailBody *String `xmlrpc:"mail_body,omitempty"` + MailLang *String `xmlrpc:"mail_lang,omitempty"` + MailPartnerIds *Relation `xmlrpc:"mail_partner_ids,omitempty"` + MailSubject *String `xmlrpc:"mail_subject,omitempty"` + MailTemplateId *Many2One `xmlrpc:"mail_template_id,omitempty"` + MoveId *Many2One `xmlrpc:"move_id,omitempty"` + PdfReportId *Many2One `xmlrpc:"pdf_report_id,omitempty"` + SendingMethodCheckboxes *String `xmlrpc:"sending_method_checkboxes,omitempty"` + SendingMethods *String `xmlrpc:"sending_methods,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountMoveSendWizards represents array of account.move.send.wizard model. +type AccountMoveSendWizards []AccountMoveSendWizard + +// AccountMoveSendWizardModel is the odoo model name. +const AccountMoveSendWizardModel = "account.move.send.wizard" + +// Many2One convert AccountMoveSendWizard to *Many2One. +func (amsw *AccountMoveSendWizard) Many2One() *Many2One { + return NewMany2One(amsw.Id.Get(), "") +} + +// CreateAccountMoveSendWizard creates a new account.move.send.wizard model and returns its id. +func (c *Client) CreateAccountMoveSendWizard(amsw *AccountMoveSendWizard) (int64, error) { + ids, err := c.CreateAccountMoveSendWizards([]*AccountMoveSendWizard{amsw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountMoveSendWizard creates a new account.move.send.wizard model and returns its id. +func (c *Client) CreateAccountMoveSendWizards(amsws []*AccountMoveSendWizard) ([]int64, error) { + var vv []interface{} + for _, v := range amsws { + vv = append(vv, v) + } + return c.Create(AccountMoveSendWizardModel, vv, nil) +} + +// UpdateAccountMoveSendWizard updates an existing account.move.send.wizard record. +func (c *Client) UpdateAccountMoveSendWizard(amsw *AccountMoveSendWizard) error { + return c.UpdateAccountMoveSendWizards([]int64{amsw.Id.Get()}, amsw) +} + +// UpdateAccountMoveSendWizards updates existing account.move.send.wizard records. +// All records (represented by ids) will be updated by amsw values. +func (c *Client) UpdateAccountMoveSendWizards(ids []int64, amsw *AccountMoveSendWizard) error { + return c.Update(AccountMoveSendWizardModel, ids, amsw, nil) +} + +// DeleteAccountMoveSendWizard deletes an existing account.move.send.wizard record. +func (c *Client) DeleteAccountMoveSendWizard(id int64) error { + return c.DeleteAccountMoveSendWizards([]int64{id}) +} + +// DeleteAccountMoveSendWizards deletes existing account.move.send.wizard records. +func (c *Client) DeleteAccountMoveSendWizards(ids []int64) error { + return c.Delete(AccountMoveSendWizardModel, ids) +} + +// GetAccountMoveSendWizard gets account.move.send.wizard existing record. +func (c *Client) GetAccountMoveSendWizard(id int64) (*AccountMoveSendWizard, error) { + amsws, err := c.GetAccountMoveSendWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*amsws)[0]), nil +} + +// GetAccountMoveSendWizards gets account.move.send.wizard existing records. +func (c *Client) GetAccountMoveSendWizards(ids []int64) (*AccountMoveSendWizards, error) { + amsws := &AccountMoveSendWizards{} + if err := c.Read(AccountMoveSendWizardModel, ids, nil, amsws); err != nil { + return nil, err + } + return amsws, nil +} + +// FindAccountMoveSendWizard finds account.move.send.wizard record by querying it with criteria. +func (c *Client) FindAccountMoveSendWizard(criteria *Criteria) (*AccountMoveSendWizard, error) { + amsws := &AccountMoveSendWizards{} + if err := c.SearchRead(AccountMoveSendWizardModel, criteria, NewOptions().Limit(1), amsws); err != nil { + return nil, err + } + return &((*amsws)[0]), nil +} + +// FindAccountMoveSendWizards finds account.move.send.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMoveSendWizards(criteria *Criteria, options *Options) (*AccountMoveSendWizards, error) { + amsws := &AccountMoveSendWizards{} + if err := c.SearchRead(AccountMoveSendWizardModel, criteria, options, amsws); err != nil { + return nil, err + } + return amsws, nil +} + +// FindAccountMoveSendWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountMoveSendWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountMoveSendWizardModel, criteria, options) +} + +// FindAccountMoveSendWizardId finds record id by querying it with criteria. +func (c *Client) FindAccountMoveSendWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountMoveSendWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_partial_reconcile.go b/account_partial_reconcile.go new file mode 100644 index 0000000..05df61b --- /dev/null +++ b/account_partial_reconcile.go @@ -0,0 +1,128 @@ +package odoo + +// AccountPartialReconcile represents account.partial.reconcile model. +type AccountPartialReconcile struct { + Amount *Float `xmlrpc:"amount,omitempty"` + CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CreditAmountCurrency *Float `xmlrpc:"credit_amount_currency,omitempty"` + CreditCurrencyId *Many2One `xmlrpc:"credit_currency_id,omitempty"` + CreditMoveId *Many2One `xmlrpc:"credit_move_id,omitempty"` + DebitAmountCurrency *Float `xmlrpc:"debit_amount_currency,omitempty"` + DebitCurrencyId *Many2One `xmlrpc:"debit_currency_id,omitempty"` + DebitMoveId *Many2One `xmlrpc:"debit_move_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExchangeMoveId *Many2One `xmlrpc:"exchange_move_id,omitempty"` + FullReconcileId *Many2One `xmlrpc:"full_reconcile_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MaxDate *Time `xmlrpc:"max_date,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountPartialReconciles represents array of account.partial.reconcile model. +type AccountPartialReconciles []AccountPartialReconcile + +// AccountPartialReconcileModel is the odoo model name. +const AccountPartialReconcileModel = "account.partial.reconcile" + +// Many2One convert AccountPartialReconcile to *Many2One. +func (apr *AccountPartialReconcile) Many2One() *Many2One { + return NewMany2One(apr.Id.Get(), "") +} + +// CreateAccountPartialReconcile creates a new account.partial.reconcile model and returns its id. +func (c *Client) CreateAccountPartialReconcile(apr *AccountPartialReconcile) (int64, error) { + ids, err := c.CreateAccountPartialReconciles([]*AccountPartialReconcile{apr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountPartialReconcile creates a new account.partial.reconcile model and returns its id. +func (c *Client) CreateAccountPartialReconciles(aprs []*AccountPartialReconcile) ([]int64, error) { + var vv []interface{} + for _, v := range aprs { + vv = append(vv, v) + } + return c.Create(AccountPartialReconcileModel, vv, nil) +} + +// UpdateAccountPartialReconcile updates an existing account.partial.reconcile record. +func (c *Client) UpdateAccountPartialReconcile(apr *AccountPartialReconcile) error { + return c.UpdateAccountPartialReconciles([]int64{apr.Id.Get()}, apr) +} + +// UpdateAccountPartialReconciles updates existing account.partial.reconcile records. +// All records (represented by ids) will be updated by apr values. +func (c *Client) UpdateAccountPartialReconciles(ids []int64, apr *AccountPartialReconcile) error { + return c.Update(AccountPartialReconcileModel, ids, apr, nil) +} + +// DeleteAccountPartialReconcile deletes an existing account.partial.reconcile record. +func (c *Client) DeleteAccountPartialReconcile(id int64) error { + return c.DeleteAccountPartialReconciles([]int64{id}) +} + +// DeleteAccountPartialReconciles deletes existing account.partial.reconcile records. +func (c *Client) DeleteAccountPartialReconciles(ids []int64) error { + return c.Delete(AccountPartialReconcileModel, ids) +} + +// GetAccountPartialReconcile gets account.partial.reconcile existing record. +func (c *Client) GetAccountPartialReconcile(id int64) (*AccountPartialReconcile, error) { + aprs, err := c.GetAccountPartialReconciles([]int64{id}) + if err != nil { + return nil, err + } + return &((*aprs)[0]), nil +} + +// GetAccountPartialReconciles gets account.partial.reconcile existing records. +func (c *Client) GetAccountPartialReconciles(ids []int64) (*AccountPartialReconciles, error) { + aprs := &AccountPartialReconciles{} + if err := c.Read(AccountPartialReconcileModel, ids, nil, aprs); err != nil { + return nil, err + } + return aprs, nil +} + +// FindAccountPartialReconcile finds account.partial.reconcile record by querying it with criteria. +func (c *Client) FindAccountPartialReconcile(criteria *Criteria) (*AccountPartialReconcile, error) { + aprs := &AccountPartialReconciles{} + if err := c.SearchRead(AccountPartialReconcileModel, criteria, NewOptions().Limit(1), aprs); err != nil { + return nil, err + } + return &((*aprs)[0]), nil +} + +// FindAccountPartialReconciles finds account.partial.reconcile records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountPartialReconciles(criteria *Criteria, options *Options) (*AccountPartialReconciles, error) { + aprs := &AccountPartialReconciles{} + if err := c.SearchRead(AccountPartialReconcileModel, criteria, options, aprs); err != nil { + return nil, err + } + return aprs, nil +} + +// FindAccountPartialReconcileIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountPartialReconcileIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountPartialReconcileModel, criteria, options) +} + +// FindAccountPartialReconcileId finds record id by querying it with criteria. +func (c *Client) FindAccountPartialReconcileId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountPartialReconcileModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_payment.go b/account_payment.go new file mode 100644 index 0000000..445f2f6 --- /dev/null +++ b/account_payment.go @@ -0,0 +1,195 @@ +package odoo + +// AccountPayment represents account.payment model. +type AccountPayment struct { + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + AmountAvailableForRefund *Float `xmlrpc:"amount_available_for_refund,omitempty"` + AmountCompanyCurrencySigned *Float `xmlrpc:"amount_company_currency_signed,omitempty"` + AmountSigned *Float `xmlrpc:"amount_signed,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + AvailableJournalIds *Relation `xmlrpc:"available_journal_ids,omitempty"` + AvailablePartnerBankIds *Relation `xmlrpc:"available_partner_bank_ids,omitempty"` + AvailablePaymentMethodLineIds *Relation `xmlrpc:"available_payment_method_line_ids,omitempty"` + CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DestinationAccountId *Many2One `xmlrpc:"destination_account_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DuplicatePaymentIds *Relation `xmlrpc:"duplicate_payment_ids,omitempty"` + ExpenseSheetId *Many2One `xmlrpc:"expense_sheet_id,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceIds *Relation `xmlrpc:"invoice_ids,omitempty"` + IsMatched *Bool `xmlrpc:"is_matched,omitempty"` + IsReconciled *Bool `xmlrpc:"is_reconciled,omitempty"` + IsSent *Bool `xmlrpc:"is_sent,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + L10NChReferenceWarningMsg *String `xmlrpc:"l10n_ch_reference_warning_msg,omitempty"` + Memo *String `xmlrpc:"memo,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageMainAttachmentId *Many2One `xmlrpc:"message_main_attachment_id,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MoveId *Many2One `xmlrpc:"move_id,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NeedCancelRequest *Bool `xmlrpc:"need_cancel_request,omitempty"` + OutstandingAccountId *Many2One `xmlrpc:"outstanding_account_id,omitempty"` + PairedInternalTransferPaymentId *Many2One `xmlrpc:"paired_internal_transfer_payment_id,omitempty"` + PartnerBankId *Many2One `xmlrpc:"partner_bank_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerType *Selection `xmlrpc:"partner_type,omitempty"` + PaymentMethodCode *String `xmlrpc:"payment_method_code,omitempty"` + PaymentMethodId *Many2One `xmlrpc:"payment_method_id,omitempty"` + PaymentMethodLineId *Many2One `xmlrpc:"payment_method_line_id,omitempty"` + PaymentReceiptTitle *String `xmlrpc:"payment_receipt_title,omitempty"` + PaymentReference *String `xmlrpc:"payment_reference,omitempty"` + PaymentTokenId *Many2One `xmlrpc:"payment_token_id,omitempty"` + PaymentTransactionId *Many2One `xmlrpc:"payment_transaction_id,omitempty"` + PaymentType *Selection `xmlrpc:"payment_type,omitempty"` + QrCode *String `xmlrpc:"qr_code,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + ReconciledBillIds *Relation `xmlrpc:"reconciled_bill_ids,omitempty"` + ReconciledBillsCount *Int `xmlrpc:"reconciled_bills_count,omitempty"` + ReconciledInvoiceIds *Relation `xmlrpc:"reconciled_invoice_ids,omitempty"` + ReconciledInvoicesCount *Int `xmlrpc:"reconciled_invoices_count,omitempty"` + ReconciledInvoicesType *Selection `xmlrpc:"reconciled_invoices_type,omitempty"` + ReconciledStatementLineIds *Relation `xmlrpc:"reconciled_statement_line_ids,omitempty"` + ReconciledStatementLinesCount *Int `xmlrpc:"reconciled_statement_lines_count,omitempty"` + RefundsCount *Int `xmlrpc:"refunds_count,omitempty"` + RequirePartnerBankAccount *Bool `xmlrpc:"require_partner_bank_account,omitempty"` + ShowPartnerBankAccount *Bool `xmlrpc:"show_partner_bank_account,omitempty"` + SourcePaymentId *Many2One `xmlrpc:"source_payment_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + SuitablePaymentTokenIds *Relation `xmlrpc:"suitable_payment_token_ids,omitempty"` + UseElectronicPaymentMethod *Bool `xmlrpc:"use_electronic_payment_method,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountPayments represents array of account.payment model. +type AccountPayments []AccountPayment + +// AccountPaymentModel is the odoo model name. +const AccountPaymentModel = "account.payment" + +// Many2One convert AccountPayment to *Many2One. +func (ap *AccountPayment) Many2One() *Many2One { + return NewMany2One(ap.Id.Get(), "") +} + +// CreateAccountPayment creates a new account.payment model and returns its id. +func (c *Client) CreateAccountPayment(ap *AccountPayment) (int64, error) { + ids, err := c.CreateAccountPayments([]*AccountPayment{ap}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountPayment creates a new account.payment model and returns its id. +func (c *Client) CreateAccountPayments(aps []*AccountPayment) ([]int64, error) { + var vv []interface{} + for _, v := range aps { + vv = append(vv, v) + } + return c.Create(AccountPaymentModel, vv, nil) +} + +// UpdateAccountPayment updates an existing account.payment record. +func (c *Client) UpdateAccountPayment(ap *AccountPayment) error { + return c.UpdateAccountPayments([]int64{ap.Id.Get()}, ap) +} + +// UpdateAccountPayments updates existing account.payment records. +// All records (represented by ids) will be updated by ap values. +func (c *Client) UpdateAccountPayments(ids []int64, ap *AccountPayment) error { + return c.Update(AccountPaymentModel, ids, ap, nil) +} + +// DeleteAccountPayment deletes an existing account.payment record. +func (c *Client) DeleteAccountPayment(id int64) error { + return c.DeleteAccountPayments([]int64{id}) +} + +// DeleteAccountPayments deletes existing account.payment records. +func (c *Client) DeleteAccountPayments(ids []int64) error { + return c.Delete(AccountPaymentModel, ids) +} + +// GetAccountPayment gets account.payment existing record. +func (c *Client) GetAccountPayment(id int64) (*AccountPayment, error) { + aps, err := c.GetAccountPayments([]int64{id}) + if err != nil { + return nil, err + } + return &((*aps)[0]), nil +} + +// GetAccountPayments gets account.payment existing records. +func (c *Client) GetAccountPayments(ids []int64) (*AccountPayments, error) { + aps := &AccountPayments{} + if err := c.Read(AccountPaymentModel, ids, nil, aps); err != nil { + return nil, err + } + return aps, nil +} + +// FindAccountPayment finds account.payment record by querying it with criteria. +func (c *Client) FindAccountPayment(criteria *Criteria) (*AccountPayment, error) { + aps := &AccountPayments{} + if err := c.SearchRead(AccountPaymentModel, criteria, NewOptions().Limit(1), aps); err != nil { + return nil, err + } + return &((*aps)[0]), nil +} + +// FindAccountPayments finds account.payment records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountPayments(criteria *Criteria, options *Options) (*AccountPayments, error) { + aps := &AccountPayments{} + if err := c.SearchRead(AccountPaymentModel, criteria, options, aps); err != nil { + return nil, err + } + return aps, nil +} + +// FindAccountPaymentIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountPaymentIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountPaymentModel, criteria, options) +} + +// FindAccountPaymentId finds record id by querying it with criteria. +func (c *Client) FindAccountPaymentId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountPaymentModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_payment_method.go b/account_payment_method.go new file mode 100644 index 0000000..320b0cd --- /dev/null +++ b/account_payment_method.go @@ -0,0 +1,119 @@ +package odoo + +// AccountPaymentMethod represents account.payment.method model. +type AccountPaymentMethod struct { + Code *String `xmlrpc:"code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PaymentType *Selection `xmlrpc:"payment_type,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountPaymentMethods represents array of account.payment.method model. +type AccountPaymentMethods []AccountPaymentMethod + +// AccountPaymentMethodModel is the odoo model name. +const AccountPaymentMethodModel = "account.payment.method" + +// Many2One convert AccountPaymentMethod to *Many2One. +func (apm *AccountPaymentMethod) Many2One() *Many2One { + return NewMany2One(apm.Id.Get(), "") +} + +// CreateAccountPaymentMethod creates a new account.payment.method model and returns its id. +func (c *Client) CreateAccountPaymentMethod(apm *AccountPaymentMethod) (int64, error) { + ids, err := c.CreateAccountPaymentMethods([]*AccountPaymentMethod{apm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountPaymentMethod creates a new account.payment.method model and returns its id. +func (c *Client) CreateAccountPaymentMethods(apms []*AccountPaymentMethod) ([]int64, error) { + var vv []interface{} + for _, v := range apms { + vv = append(vv, v) + } + return c.Create(AccountPaymentMethodModel, vv, nil) +} + +// UpdateAccountPaymentMethod updates an existing account.payment.method record. +func (c *Client) UpdateAccountPaymentMethod(apm *AccountPaymentMethod) error { + return c.UpdateAccountPaymentMethods([]int64{apm.Id.Get()}, apm) +} + +// UpdateAccountPaymentMethods updates existing account.payment.method records. +// All records (represented by ids) will be updated by apm values. +func (c *Client) UpdateAccountPaymentMethods(ids []int64, apm *AccountPaymentMethod) error { + return c.Update(AccountPaymentMethodModel, ids, apm, nil) +} + +// DeleteAccountPaymentMethod deletes an existing account.payment.method record. +func (c *Client) DeleteAccountPaymentMethod(id int64) error { + return c.DeleteAccountPaymentMethods([]int64{id}) +} + +// DeleteAccountPaymentMethods deletes existing account.payment.method records. +func (c *Client) DeleteAccountPaymentMethods(ids []int64) error { + return c.Delete(AccountPaymentMethodModel, ids) +} + +// GetAccountPaymentMethod gets account.payment.method existing record. +func (c *Client) GetAccountPaymentMethod(id int64) (*AccountPaymentMethod, error) { + apms, err := c.GetAccountPaymentMethods([]int64{id}) + if err != nil { + return nil, err + } + return &((*apms)[0]), nil +} + +// GetAccountPaymentMethods gets account.payment.method existing records. +func (c *Client) GetAccountPaymentMethods(ids []int64) (*AccountPaymentMethods, error) { + apms := &AccountPaymentMethods{} + if err := c.Read(AccountPaymentMethodModel, ids, nil, apms); err != nil { + return nil, err + } + return apms, nil +} + +// FindAccountPaymentMethod finds account.payment.method record by querying it with criteria. +func (c *Client) FindAccountPaymentMethod(criteria *Criteria) (*AccountPaymentMethod, error) { + apms := &AccountPaymentMethods{} + if err := c.SearchRead(AccountPaymentMethodModel, criteria, NewOptions().Limit(1), apms); err != nil { + return nil, err + } + return &((*apms)[0]), nil +} + +// FindAccountPaymentMethods finds account.payment.method records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountPaymentMethods(criteria *Criteria, options *Options) (*AccountPaymentMethods, error) { + apms := &AccountPaymentMethods{} + if err := c.SearchRead(AccountPaymentMethodModel, criteria, options, apms); err != nil { + return nil, err + } + return apms, nil +} + +// FindAccountPaymentMethodIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountPaymentMethodIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountPaymentMethodModel, criteria, options) +} + +// FindAccountPaymentMethodId finds record id by querying it with criteria. +func (c *Client) FindAccountPaymentMethodId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountPaymentMethodModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_payment_method_line.go b/account_payment_method_line.go new file mode 100644 index 0000000..c0c7d4c --- /dev/null +++ b/account_payment_method_line.go @@ -0,0 +1,127 @@ +package odoo + +// AccountPaymentMethodLine represents account.payment.method.line model. +type AccountPaymentMethodLine struct { + AvailablePaymentMethodIds *Relation `xmlrpc:"available_payment_method_ids,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PaymentAccountId *Many2One `xmlrpc:"payment_account_id,omitempty"` + PaymentMethodId *Many2One `xmlrpc:"payment_method_id,omitempty"` + PaymentProviderId *Many2One `xmlrpc:"payment_provider_id,omitempty"` + PaymentProviderState *Selection `xmlrpc:"payment_provider_state,omitempty"` + PaymentType *Selection `xmlrpc:"payment_type,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountPaymentMethodLines represents array of account.payment.method.line model. +type AccountPaymentMethodLines []AccountPaymentMethodLine + +// AccountPaymentMethodLineModel is the odoo model name. +const AccountPaymentMethodLineModel = "account.payment.method.line" + +// Many2One convert AccountPaymentMethodLine to *Many2One. +func (apml *AccountPaymentMethodLine) Many2One() *Many2One { + return NewMany2One(apml.Id.Get(), "") +} + +// CreateAccountPaymentMethodLine creates a new account.payment.method.line model and returns its id. +func (c *Client) CreateAccountPaymentMethodLine(apml *AccountPaymentMethodLine) (int64, error) { + ids, err := c.CreateAccountPaymentMethodLines([]*AccountPaymentMethodLine{apml}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountPaymentMethodLine creates a new account.payment.method.line model and returns its id. +func (c *Client) CreateAccountPaymentMethodLines(apmls []*AccountPaymentMethodLine) ([]int64, error) { + var vv []interface{} + for _, v := range apmls { + vv = append(vv, v) + } + return c.Create(AccountPaymentMethodLineModel, vv, nil) +} + +// UpdateAccountPaymentMethodLine updates an existing account.payment.method.line record. +func (c *Client) UpdateAccountPaymentMethodLine(apml *AccountPaymentMethodLine) error { + return c.UpdateAccountPaymentMethodLines([]int64{apml.Id.Get()}, apml) +} + +// UpdateAccountPaymentMethodLines updates existing account.payment.method.line records. +// All records (represented by ids) will be updated by apml values. +func (c *Client) UpdateAccountPaymentMethodLines(ids []int64, apml *AccountPaymentMethodLine) error { + return c.Update(AccountPaymentMethodLineModel, ids, apml, nil) +} + +// DeleteAccountPaymentMethodLine deletes an existing account.payment.method.line record. +func (c *Client) DeleteAccountPaymentMethodLine(id int64) error { + return c.DeleteAccountPaymentMethodLines([]int64{id}) +} + +// DeleteAccountPaymentMethodLines deletes existing account.payment.method.line records. +func (c *Client) DeleteAccountPaymentMethodLines(ids []int64) error { + return c.Delete(AccountPaymentMethodLineModel, ids) +} + +// GetAccountPaymentMethodLine gets account.payment.method.line existing record. +func (c *Client) GetAccountPaymentMethodLine(id int64) (*AccountPaymentMethodLine, error) { + apmls, err := c.GetAccountPaymentMethodLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*apmls)[0]), nil +} + +// GetAccountPaymentMethodLines gets account.payment.method.line existing records. +func (c *Client) GetAccountPaymentMethodLines(ids []int64) (*AccountPaymentMethodLines, error) { + apmls := &AccountPaymentMethodLines{} + if err := c.Read(AccountPaymentMethodLineModel, ids, nil, apmls); err != nil { + return nil, err + } + return apmls, nil +} + +// FindAccountPaymentMethodLine finds account.payment.method.line record by querying it with criteria. +func (c *Client) FindAccountPaymentMethodLine(criteria *Criteria) (*AccountPaymentMethodLine, error) { + apmls := &AccountPaymentMethodLines{} + if err := c.SearchRead(AccountPaymentMethodLineModel, criteria, NewOptions().Limit(1), apmls); err != nil { + return nil, err + } + return &((*apmls)[0]), nil +} + +// FindAccountPaymentMethodLines finds account.payment.method.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountPaymentMethodLines(criteria *Criteria, options *Options) (*AccountPaymentMethodLines, error) { + apmls := &AccountPaymentMethodLines{} + if err := c.SearchRead(AccountPaymentMethodLineModel, criteria, options, apmls); err != nil { + return nil, err + } + return apmls, nil +} + +// FindAccountPaymentMethodLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountPaymentMethodLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountPaymentMethodLineModel, criteria, options) +} + +// FindAccountPaymentMethodLineId finds record id by querying it with criteria. +func (c *Client) FindAccountPaymentMethodLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountPaymentMethodLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_payment_register.go b/account_payment_register.go new file mode 100644 index 0000000..dd2cf75 --- /dev/null +++ b/account_payment_register.go @@ -0,0 +1,167 @@ +package odoo + +// AccountPaymentRegister represents account.payment.register model. +type AccountPaymentRegister struct { + ActionableErrors *String `xmlrpc:"actionable_errors,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + AvailableJournalIds *Relation `xmlrpc:"available_journal_ids,omitempty"` + AvailablePartnerBankIds *Relation `xmlrpc:"available_partner_bank_ids,omitempty"` + AvailablePaymentMethodLineIds *Relation `xmlrpc:"available_payment_method_line_ids,omitempty"` + Batches *String `xmlrpc:"batches,omitempty"` + CanEditWizard *Bool `xmlrpc:"can_edit_wizard,omitempty"` + CanGroupPayments *Bool `xmlrpc:"can_group_payments,omitempty"` + Communication *String `xmlrpc:"communication,omitempty"` + CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + CustomUserAmount *Float `xmlrpc:"custom_user_amount,omitempty"` + CustomUserCurrencyId *Many2One `xmlrpc:"custom_user_currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DuplicatePaymentIds *Relation `xmlrpc:"duplicate_payment_ids,omitempty"` + EarlyPaymentDiscountMode *Bool `xmlrpc:"early_payment_discount_mode,omitempty"` + GroupPayment *Bool `xmlrpc:"group_payment,omitempty"` + HideWriteoffSection *Bool `xmlrpc:"hide_writeoff_section,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InstallmentsMode *Selection `xmlrpc:"installments_mode,omitempty"` + InstallmentsSwitchAmount *Float `xmlrpc:"installments_switch_amount,omitempty"` + InstallmentsSwitchHtml *String `xmlrpc:"installments_switch_html,omitempty"` + IsRegisterPaymentOnDraft *Bool `xmlrpc:"is_register_payment_on_draft,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + LineIds *Relation `xmlrpc:"line_ids,omitempty"` + MissingAccountPartners *Relation `xmlrpc:"missing_account_partners,omitempty"` + PartnerBankId *Many2One `xmlrpc:"partner_bank_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerType *Selection `xmlrpc:"partner_type,omitempty"` + PaymentDate *Time `xmlrpc:"payment_date,omitempty"` + PaymentDifference *Float `xmlrpc:"payment_difference,omitempty"` + PaymentDifferenceHandling *Selection `xmlrpc:"payment_difference_handling,omitempty"` + PaymentMethodCode *String `xmlrpc:"payment_method_code,omitempty"` + PaymentMethodLineId *Many2One `xmlrpc:"payment_method_line_id,omitempty"` + PaymentTokenId *Many2One `xmlrpc:"payment_token_id,omitempty"` + PaymentType *Selection `xmlrpc:"payment_type,omitempty"` + QrCode *String `xmlrpc:"qr_code,omitempty"` + RequirePartnerBankAccount *Bool `xmlrpc:"require_partner_bank_account,omitempty"` + ShowPartnerBankAccount *Bool `xmlrpc:"show_partner_bank_account,omitempty"` + ShowPaymentDifference *Bool `xmlrpc:"show_payment_difference,omitempty"` + SourceAmount *Float `xmlrpc:"source_amount,omitempty"` + SourceAmountCurrency *Float `xmlrpc:"source_amount_currency,omitempty"` + SourceCurrencyId *Many2One `xmlrpc:"source_currency_id,omitempty"` + SuitablePaymentTokenIds *Relation `xmlrpc:"suitable_payment_token_ids,omitempty"` + TotalPaymentsAmount *Int `xmlrpc:"total_payments_amount,omitempty"` + UntrustedBankIds *Relation `xmlrpc:"untrusted_bank_ids,omitempty"` + UntrustedPaymentsCount *Int `xmlrpc:"untrusted_payments_count,omitempty"` + UseElectronicPaymentMethod *Bool `xmlrpc:"use_electronic_payment_method,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + WriteoffAccountId *Many2One `xmlrpc:"writeoff_account_id,omitempty"` + WriteoffIsExchangeAccount *Bool `xmlrpc:"writeoff_is_exchange_account,omitempty"` + WriteoffLabel *String `xmlrpc:"writeoff_label,omitempty"` +} + +// AccountPaymentRegisters represents array of account.payment.register model. +type AccountPaymentRegisters []AccountPaymentRegister + +// AccountPaymentRegisterModel is the odoo model name. +const AccountPaymentRegisterModel = "account.payment.register" + +// Many2One convert AccountPaymentRegister to *Many2One. +func (apr *AccountPaymentRegister) Many2One() *Many2One { + return NewMany2One(apr.Id.Get(), "") +} + +// CreateAccountPaymentRegister creates a new account.payment.register model and returns its id. +func (c *Client) CreateAccountPaymentRegister(apr *AccountPaymentRegister) (int64, error) { + ids, err := c.CreateAccountPaymentRegisters([]*AccountPaymentRegister{apr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountPaymentRegister creates a new account.payment.register model and returns its id. +func (c *Client) CreateAccountPaymentRegisters(aprs []*AccountPaymentRegister) ([]int64, error) { + var vv []interface{} + for _, v := range aprs { + vv = append(vv, v) + } + return c.Create(AccountPaymentRegisterModel, vv, nil) +} + +// UpdateAccountPaymentRegister updates an existing account.payment.register record. +func (c *Client) UpdateAccountPaymentRegister(apr *AccountPaymentRegister) error { + return c.UpdateAccountPaymentRegisters([]int64{apr.Id.Get()}, apr) +} + +// UpdateAccountPaymentRegisters updates existing account.payment.register records. +// All records (represented by ids) will be updated by apr values. +func (c *Client) UpdateAccountPaymentRegisters(ids []int64, apr *AccountPaymentRegister) error { + return c.Update(AccountPaymentRegisterModel, ids, apr, nil) +} + +// DeleteAccountPaymentRegister deletes an existing account.payment.register record. +func (c *Client) DeleteAccountPaymentRegister(id int64) error { + return c.DeleteAccountPaymentRegisters([]int64{id}) +} + +// DeleteAccountPaymentRegisters deletes existing account.payment.register records. +func (c *Client) DeleteAccountPaymentRegisters(ids []int64) error { + return c.Delete(AccountPaymentRegisterModel, ids) +} + +// GetAccountPaymentRegister gets account.payment.register existing record. +func (c *Client) GetAccountPaymentRegister(id int64) (*AccountPaymentRegister, error) { + aprs, err := c.GetAccountPaymentRegisters([]int64{id}) + if err != nil { + return nil, err + } + return &((*aprs)[0]), nil +} + +// GetAccountPaymentRegisters gets account.payment.register existing records. +func (c *Client) GetAccountPaymentRegisters(ids []int64) (*AccountPaymentRegisters, error) { + aprs := &AccountPaymentRegisters{} + if err := c.Read(AccountPaymentRegisterModel, ids, nil, aprs); err != nil { + return nil, err + } + return aprs, nil +} + +// FindAccountPaymentRegister finds account.payment.register record by querying it with criteria. +func (c *Client) FindAccountPaymentRegister(criteria *Criteria) (*AccountPaymentRegister, error) { + aprs := &AccountPaymentRegisters{} + if err := c.SearchRead(AccountPaymentRegisterModel, criteria, NewOptions().Limit(1), aprs); err != nil { + return nil, err + } + return &((*aprs)[0]), nil +} + +// FindAccountPaymentRegisters finds account.payment.register records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountPaymentRegisters(criteria *Criteria, options *Options) (*AccountPaymentRegisters, error) { + aprs := &AccountPaymentRegisters{} + if err := c.SearchRead(AccountPaymentRegisterModel, criteria, options, aprs); err != nil { + return nil, err + } + return aprs, nil +} + +// FindAccountPaymentRegisterIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountPaymentRegisterIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountPaymentRegisterModel, criteria, options) +} + +// FindAccountPaymentRegisterId finds record id by querying it with criteria. +func (c *Client) FindAccountPaymentRegisterId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountPaymentRegisterModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_payment_term.go b/account_payment_term.go new file mode 100644 index 0000000..50f4a19 --- /dev/null +++ b/account_payment_term.go @@ -0,0 +1,134 @@ +package odoo + +// AccountPaymentTerm represents account.payment.term model. +type AccountPaymentTerm struct { + Active *Bool `xmlrpc:"active,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DiscountDays *Int `xmlrpc:"discount_days,omitempty"` + DiscountPercentage *Float `xmlrpc:"discount_percentage,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayOnInvoice *Bool `xmlrpc:"display_on_invoice,omitempty"` + EarlyDiscount *Bool `xmlrpc:"early_discount,omitempty"` + EarlyPayDiscountComputation *Selection `xmlrpc:"early_pay_discount_computation,omitempty"` + ExampleAmount *Float `xmlrpc:"example_amount,omitempty"` + ExampleDate *Time `xmlrpc:"example_date,omitempty"` + ExampleInvalid *Bool `xmlrpc:"example_invalid,omitempty"` + ExamplePreview *String `xmlrpc:"example_preview,omitempty"` + ExamplePreviewDiscount *String `xmlrpc:"example_preview_discount,omitempty"` + FiscalCountryCodes *String `xmlrpc:"fiscal_country_codes,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LineIds *Relation `xmlrpc:"line_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountPaymentTerms represents array of account.payment.term model. +type AccountPaymentTerms []AccountPaymentTerm + +// AccountPaymentTermModel is the odoo model name. +const AccountPaymentTermModel = "account.payment.term" + +// Many2One convert AccountPaymentTerm to *Many2One. +func (apt *AccountPaymentTerm) Many2One() *Many2One { + return NewMany2One(apt.Id.Get(), "") +} + +// CreateAccountPaymentTerm creates a new account.payment.term model and returns its id. +func (c *Client) CreateAccountPaymentTerm(apt *AccountPaymentTerm) (int64, error) { + ids, err := c.CreateAccountPaymentTerms([]*AccountPaymentTerm{apt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountPaymentTerm creates a new account.payment.term model and returns its id. +func (c *Client) CreateAccountPaymentTerms(apts []*AccountPaymentTerm) ([]int64, error) { + var vv []interface{} + for _, v := range apts { + vv = append(vv, v) + } + return c.Create(AccountPaymentTermModel, vv, nil) +} + +// UpdateAccountPaymentTerm updates an existing account.payment.term record. +func (c *Client) UpdateAccountPaymentTerm(apt *AccountPaymentTerm) error { + return c.UpdateAccountPaymentTerms([]int64{apt.Id.Get()}, apt) +} + +// UpdateAccountPaymentTerms updates existing account.payment.term records. +// All records (represented by ids) will be updated by apt values. +func (c *Client) UpdateAccountPaymentTerms(ids []int64, apt *AccountPaymentTerm) error { + return c.Update(AccountPaymentTermModel, ids, apt, nil) +} + +// DeleteAccountPaymentTerm deletes an existing account.payment.term record. +func (c *Client) DeleteAccountPaymentTerm(id int64) error { + return c.DeleteAccountPaymentTerms([]int64{id}) +} + +// DeleteAccountPaymentTerms deletes existing account.payment.term records. +func (c *Client) DeleteAccountPaymentTerms(ids []int64) error { + return c.Delete(AccountPaymentTermModel, ids) +} + +// GetAccountPaymentTerm gets account.payment.term existing record. +func (c *Client) GetAccountPaymentTerm(id int64) (*AccountPaymentTerm, error) { + apts, err := c.GetAccountPaymentTerms([]int64{id}) + if err != nil { + return nil, err + } + return &((*apts)[0]), nil +} + +// GetAccountPaymentTerms gets account.payment.term existing records. +func (c *Client) GetAccountPaymentTerms(ids []int64) (*AccountPaymentTerms, error) { + apts := &AccountPaymentTerms{} + if err := c.Read(AccountPaymentTermModel, ids, nil, apts); err != nil { + return nil, err + } + return apts, nil +} + +// FindAccountPaymentTerm finds account.payment.term record by querying it with criteria. +func (c *Client) FindAccountPaymentTerm(criteria *Criteria) (*AccountPaymentTerm, error) { + apts := &AccountPaymentTerms{} + if err := c.SearchRead(AccountPaymentTermModel, criteria, NewOptions().Limit(1), apts); err != nil { + return nil, err + } + return &((*apts)[0]), nil +} + +// FindAccountPaymentTerms finds account.payment.term records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountPaymentTerms(criteria *Criteria, options *Options) (*AccountPaymentTerms, error) { + apts := &AccountPaymentTerms{} + if err := c.SearchRead(AccountPaymentTermModel, criteria, options, apts); err != nil { + return nil, err + } + return apts, nil +} + +// FindAccountPaymentTermIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountPaymentTermIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountPaymentTermModel, criteria, options) +} + +// FindAccountPaymentTermId finds record id by querying it with criteria. +func (c *Client) FindAccountPaymentTermId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountPaymentTermModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_payment_term_line.go b/account_payment_term_line.go new file mode 100644 index 0000000..6e26d69 --- /dev/null +++ b/account_payment_term_line.go @@ -0,0 +1,123 @@ +package odoo + +// AccountPaymentTermLine represents account.payment.term.line model. +type AccountPaymentTermLine struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DaysNextMonth *String `xmlrpc:"days_next_month,omitempty"` + DelayType *Selection `xmlrpc:"delay_type,omitempty"` + DisplayDaysNextMonth *Bool `xmlrpc:"display_days_next_month,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + NbDays *Int `xmlrpc:"nb_days,omitempty"` + PaymentId *Many2One `xmlrpc:"payment_id,omitempty"` + Value *Selection `xmlrpc:"value,omitempty"` + ValueAmount *Float `xmlrpc:"value_amount,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountPaymentTermLines represents array of account.payment.term.line model. +type AccountPaymentTermLines []AccountPaymentTermLine + +// AccountPaymentTermLineModel is the odoo model name. +const AccountPaymentTermLineModel = "account.payment.term.line" + +// Many2One convert AccountPaymentTermLine to *Many2One. +func (aptl *AccountPaymentTermLine) Many2One() *Many2One { + return NewMany2One(aptl.Id.Get(), "") +} + +// CreateAccountPaymentTermLine creates a new account.payment.term.line model and returns its id. +func (c *Client) CreateAccountPaymentTermLine(aptl *AccountPaymentTermLine) (int64, error) { + ids, err := c.CreateAccountPaymentTermLines([]*AccountPaymentTermLine{aptl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountPaymentTermLine creates a new account.payment.term.line model and returns its id. +func (c *Client) CreateAccountPaymentTermLines(aptls []*AccountPaymentTermLine) ([]int64, error) { + var vv []interface{} + for _, v := range aptls { + vv = append(vv, v) + } + return c.Create(AccountPaymentTermLineModel, vv, nil) +} + +// UpdateAccountPaymentTermLine updates an existing account.payment.term.line record. +func (c *Client) UpdateAccountPaymentTermLine(aptl *AccountPaymentTermLine) error { + return c.UpdateAccountPaymentTermLines([]int64{aptl.Id.Get()}, aptl) +} + +// UpdateAccountPaymentTermLines updates existing account.payment.term.line records. +// All records (represented by ids) will be updated by aptl values. +func (c *Client) UpdateAccountPaymentTermLines(ids []int64, aptl *AccountPaymentTermLine) error { + return c.Update(AccountPaymentTermLineModel, ids, aptl, nil) +} + +// DeleteAccountPaymentTermLine deletes an existing account.payment.term.line record. +func (c *Client) DeleteAccountPaymentTermLine(id int64) error { + return c.DeleteAccountPaymentTermLines([]int64{id}) +} + +// DeleteAccountPaymentTermLines deletes existing account.payment.term.line records. +func (c *Client) DeleteAccountPaymentTermLines(ids []int64) error { + return c.Delete(AccountPaymentTermLineModel, ids) +} + +// GetAccountPaymentTermLine gets account.payment.term.line existing record. +func (c *Client) GetAccountPaymentTermLine(id int64) (*AccountPaymentTermLine, error) { + aptls, err := c.GetAccountPaymentTermLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*aptls)[0]), nil +} + +// GetAccountPaymentTermLines gets account.payment.term.line existing records. +func (c *Client) GetAccountPaymentTermLines(ids []int64) (*AccountPaymentTermLines, error) { + aptls := &AccountPaymentTermLines{} + if err := c.Read(AccountPaymentTermLineModel, ids, nil, aptls); err != nil { + return nil, err + } + return aptls, nil +} + +// FindAccountPaymentTermLine finds account.payment.term.line record by querying it with criteria. +func (c *Client) FindAccountPaymentTermLine(criteria *Criteria) (*AccountPaymentTermLine, error) { + aptls := &AccountPaymentTermLines{} + if err := c.SearchRead(AccountPaymentTermLineModel, criteria, NewOptions().Limit(1), aptls); err != nil { + return nil, err + } + return &((*aptls)[0]), nil +} + +// FindAccountPaymentTermLines finds account.payment.term.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountPaymentTermLines(criteria *Criteria, options *Options) (*AccountPaymentTermLines, error) { + aptls := &AccountPaymentTermLines{} + if err := c.SearchRead(AccountPaymentTermLineModel, criteria, options, aptls); err != nil { + return nil, err + } + return aptls, nil +} + +// FindAccountPaymentTermLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountPaymentTermLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountPaymentTermLineModel, criteria, options) +} + +// FindAccountPaymentTermLineId finds record id by querying it with criteria. +func (c *Client) FindAccountPaymentTermLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountPaymentTermLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_reconcile_model.go b/account_reconcile_model.go new file mode 100644 index 0000000..3867418 --- /dev/null +++ b/account_reconcile_model.go @@ -0,0 +1,165 @@ +package odoo + +// AccountReconcileModel represents account.reconcile.model model. +type AccountReconcileModel struct { + Active *Bool `xmlrpc:"active,omitempty"` + AllowPaymentTolerance *Bool `xmlrpc:"allow_payment_tolerance,omitempty"` + AutoReconcile *Bool `xmlrpc:"auto_reconcile,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CounterpartType *Selection `xmlrpc:"counterpart_type,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DecimalSeparator *String `xmlrpc:"decimal_separator,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LineIds *Relation `xmlrpc:"line_ids,omitempty"` + MatchAmount *Selection `xmlrpc:"match_amount,omitempty"` + MatchAmountMax *Float `xmlrpc:"match_amount_max,omitempty"` + MatchAmountMin *Float `xmlrpc:"match_amount_min,omitempty"` + MatchJournalIds *Relation `xmlrpc:"match_journal_ids,omitempty"` + MatchLabel *Selection `xmlrpc:"match_label,omitempty"` + MatchLabelParam *String `xmlrpc:"match_label_param,omitempty"` + MatchNature *Selection `xmlrpc:"match_nature,omitempty"` + MatchNote *Selection `xmlrpc:"match_note,omitempty"` + MatchNoteParam *String `xmlrpc:"match_note_param,omitempty"` + MatchPartner *Bool `xmlrpc:"match_partner,omitempty"` + MatchPartnerCategoryIds *Relation `xmlrpc:"match_partner_category_ids,omitempty"` + MatchPartnerIds *Relation `xmlrpc:"match_partner_ids,omitempty"` + MatchSameCurrency *Bool `xmlrpc:"match_same_currency,omitempty"` + MatchTextLocationLabel *Bool `xmlrpc:"match_text_location_label,omitempty"` + MatchTextLocationNote *Bool `xmlrpc:"match_text_location_note,omitempty"` + MatchTextLocationReference *Bool `xmlrpc:"match_text_location_reference,omitempty"` + MatchTransactionType *Selection `xmlrpc:"match_transaction_type,omitempty"` + MatchTransactionTypeParam *String `xmlrpc:"match_transaction_type_param,omitempty"` + MatchingOrder *Selection `xmlrpc:"matching_order,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NumberEntries *Int `xmlrpc:"number_entries,omitempty"` + PartnerMappingLineIds *Relation `xmlrpc:"partner_mapping_line_ids,omitempty"` + PastMonthsLimit *Int `xmlrpc:"past_months_limit,omitempty"` + PaymentToleranceParam *Float `xmlrpc:"payment_tolerance_param,omitempty"` + PaymentToleranceType *Selection `xmlrpc:"payment_tolerance_type,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RuleType *Selection `xmlrpc:"rule_type,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + ShowDecimalSeparator *Bool `xmlrpc:"show_decimal_separator,omitempty"` + ToCheck *Bool `xmlrpc:"to_check,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountReconcileModels represents array of account.reconcile.model model. +type AccountReconcileModels []AccountReconcileModel + +// AccountReconcileModelModel is the odoo model name. +const AccountReconcileModelModel = "account.reconcile.model" + +// Many2One convert AccountReconcileModel to *Many2One. +func (arm *AccountReconcileModel) Many2One() *Many2One { + return NewMany2One(arm.Id.Get(), "") +} + +// CreateAccountReconcileModel creates a new account.reconcile.model model and returns its id. +func (c *Client) CreateAccountReconcileModel(arm *AccountReconcileModel) (int64, error) { + ids, err := c.CreateAccountReconcileModels([]*AccountReconcileModel{arm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountReconcileModel creates a new account.reconcile.model model and returns its id. +func (c *Client) CreateAccountReconcileModels(arms []*AccountReconcileModel) ([]int64, error) { + var vv []interface{} + for _, v := range arms { + vv = append(vv, v) + } + return c.Create(AccountReconcileModelModel, vv, nil) +} + +// UpdateAccountReconcileModel updates an existing account.reconcile.model record. +func (c *Client) UpdateAccountReconcileModel(arm *AccountReconcileModel) error { + return c.UpdateAccountReconcileModels([]int64{arm.Id.Get()}, arm) +} + +// UpdateAccountReconcileModels updates existing account.reconcile.model records. +// All records (represented by ids) will be updated by arm values. +func (c *Client) UpdateAccountReconcileModels(ids []int64, arm *AccountReconcileModel) error { + return c.Update(AccountReconcileModelModel, ids, arm, nil) +} + +// DeleteAccountReconcileModel deletes an existing account.reconcile.model record. +func (c *Client) DeleteAccountReconcileModel(id int64) error { + return c.DeleteAccountReconcileModels([]int64{id}) +} + +// DeleteAccountReconcileModels deletes existing account.reconcile.model records. +func (c *Client) DeleteAccountReconcileModels(ids []int64) error { + return c.Delete(AccountReconcileModelModel, ids) +} + +// GetAccountReconcileModel gets account.reconcile.model existing record. +func (c *Client) GetAccountReconcileModel(id int64) (*AccountReconcileModel, error) { + arms, err := c.GetAccountReconcileModels([]int64{id}) + if err != nil { + return nil, err + } + return &((*arms)[0]), nil +} + +// GetAccountReconcileModels gets account.reconcile.model existing records. +func (c *Client) GetAccountReconcileModels(ids []int64) (*AccountReconcileModels, error) { + arms := &AccountReconcileModels{} + if err := c.Read(AccountReconcileModelModel, ids, nil, arms); err != nil { + return nil, err + } + return arms, nil +} + +// FindAccountReconcileModel finds account.reconcile.model record by querying it with criteria. +func (c *Client) FindAccountReconcileModel(criteria *Criteria) (*AccountReconcileModel, error) { + arms := &AccountReconcileModels{} + if err := c.SearchRead(AccountReconcileModelModel, criteria, NewOptions().Limit(1), arms); err != nil { + return nil, err + } + return &((*arms)[0]), nil +} + +// FindAccountReconcileModels finds account.reconcile.model records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReconcileModels(criteria *Criteria, options *Options) (*AccountReconcileModels, error) { + arms := &AccountReconcileModels{} + if err := c.SearchRead(AccountReconcileModelModel, criteria, options, arms); err != nil { + return nil, err + } + return arms, nil +} + +// FindAccountReconcileModelIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReconcileModelIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountReconcileModelModel, criteria, options) +} + +// FindAccountReconcileModelId finds record id by querying it with criteria. +func (c *Client) FindAccountReconcileModelId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountReconcileModelModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_reconcile_model_line.go b/account_reconcile_model_line.go new file mode 100644 index 0000000..39ede6b --- /dev/null +++ b/account_reconcile_model_line.go @@ -0,0 +1,134 @@ +package odoo + +// AccountReconcileModelLine represents account.reconcile.model.line model. +type AccountReconcileModelLine struct { + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + AllowPaymentTolerance *Bool `xmlrpc:"allow_payment_tolerance,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + AmountString *String `xmlrpc:"amount_string,omitempty"` + AmountType *Selection `xmlrpc:"amount_type,omitempty"` + AnalyticDistribution *String `xmlrpc:"analytic_distribution,omitempty"` + AnalyticPrecision *Int `xmlrpc:"analytic_precision,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DistributionAnalyticAccountIds *Relation `xmlrpc:"distribution_analytic_account_ids,omitempty"` + ForceTaxIncluded *Bool `xmlrpc:"force_tax_included,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + Label *String `xmlrpc:"label,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + PaymentToleranceParam *Float `xmlrpc:"payment_tolerance_param,omitempty"` + RuleType *Selection `xmlrpc:"rule_type,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + ShowForceTaxIncluded *Bool `xmlrpc:"show_force_tax_included,omitempty"` + TaxIds *Relation `xmlrpc:"tax_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountReconcileModelLines represents array of account.reconcile.model.line model. +type AccountReconcileModelLines []AccountReconcileModelLine + +// AccountReconcileModelLineModel is the odoo model name. +const AccountReconcileModelLineModel = "account.reconcile.model.line" + +// Many2One convert AccountReconcileModelLine to *Many2One. +func (arml *AccountReconcileModelLine) Many2One() *Many2One { + return NewMany2One(arml.Id.Get(), "") +} + +// CreateAccountReconcileModelLine creates a new account.reconcile.model.line model and returns its id. +func (c *Client) CreateAccountReconcileModelLine(arml *AccountReconcileModelLine) (int64, error) { + ids, err := c.CreateAccountReconcileModelLines([]*AccountReconcileModelLine{arml}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountReconcileModelLine creates a new account.reconcile.model.line model and returns its id. +func (c *Client) CreateAccountReconcileModelLines(armls []*AccountReconcileModelLine) ([]int64, error) { + var vv []interface{} + for _, v := range armls { + vv = append(vv, v) + } + return c.Create(AccountReconcileModelLineModel, vv, nil) +} + +// UpdateAccountReconcileModelLine updates an existing account.reconcile.model.line record. +func (c *Client) UpdateAccountReconcileModelLine(arml *AccountReconcileModelLine) error { + return c.UpdateAccountReconcileModelLines([]int64{arml.Id.Get()}, arml) +} + +// UpdateAccountReconcileModelLines updates existing account.reconcile.model.line records. +// All records (represented by ids) will be updated by arml values. +func (c *Client) UpdateAccountReconcileModelLines(ids []int64, arml *AccountReconcileModelLine) error { + return c.Update(AccountReconcileModelLineModel, ids, arml, nil) +} + +// DeleteAccountReconcileModelLine deletes an existing account.reconcile.model.line record. +func (c *Client) DeleteAccountReconcileModelLine(id int64) error { + return c.DeleteAccountReconcileModelLines([]int64{id}) +} + +// DeleteAccountReconcileModelLines deletes existing account.reconcile.model.line records. +func (c *Client) DeleteAccountReconcileModelLines(ids []int64) error { + return c.Delete(AccountReconcileModelLineModel, ids) +} + +// GetAccountReconcileModelLine gets account.reconcile.model.line existing record. +func (c *Client) GetAccountReconcileModelLine(id int64) (*AccountReconcileModelLine, error) { + armls, err := c.GetAccountReconcileModelLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*armls)[0]), nil +} + +// GetAccountReconcileModelLines gets account.reconcile.model.line existing records. +func (c *Client) GetAccountReconcileModelLines(ids []int64) (*AccountReconcileModelLines, error) { + armls := &AccountReconcileModelLines{} + if err := c.Read(AccountReconcileModelLineModel, ids, nil, armls); err != nil { + return nil, err + } + return armls, nil +} + +// FindAccountReconcileModelLine finds account.reconcile.model.line record by querying it with criteria. +func (c *Client) FindAccountReconcileModelLine(criteria *Criteria) (*AccountReconcileModelLine, error) { + armls := &AccountReconcileModelLines{} + if err := c.SearchRead(AccountReconcileModelLineModel, criteria, NewOptions().Limit(1), armls); err != nil { + return nil, err + } + return &((*armls)[0]), nil +} + +// FindAccountReconcileModelLines finds account.reconcile.model.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReconcileModelLines(criteria *Criteria, options *Options) (*AccountReconcileModelLines, error) { + armls := &AccountReconcileModelLines{} + if err := c.SearchRead(AccountReconcileModelLineModel, criteria, options, armls); err != nil { + return nil, err + } + return armls, nil +} + +// FindAccountReconcileModelLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReconcileModelLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountReconcileModelLineModel, criteria, options) +} + +// FindAccountReconcileModelLineId finds record id by querying it with criteria. +func (c *Client) FindAccountReconcileModelLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountReconcileModelLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_reconcile_model_partner_mapping.go b/account_reconcile_model_partner_mapping.go new file mode 100644 index 0000000..d1f99ee --- /dev/null +++ b/account_reconcile_model_partner_mapping.go @@ -0,0 +1,121 @@ +package odoo + +// AccountReconcileModelPartnerMapping represents account.reconcile.model.partner.mapping model. +type AccountReconcileModelPartnerMapping struct { + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + NarrationRegex *String `xmlrpc:"narration_regex,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PaymentRefRegex *String `xmlrpc:"payment_ref_regex,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountReconcileModelPartnerMappings represents array of account.reconcile.model.partner.mapping model. +type AccountReconcileModelPartnerMappings []AccountReconcileModelPartnerMapping + +// AccountReconcileModelPartnerMappingModel is the odoo model name. +const AccountReconcileModelPartnerMappingModel = "account.reconcile.model.partner.mapping" + +// Many2One convert AccountReconcileModelPartnerMapping to *Many2One. +func (armpm *AccountReconcileModelPartnerMapping) Many2One() *Many2One { + return NewMany2One(armpm.Id.Get(), "") +} + +// CreateAccountReconcileModelPartnerMapping creates a new account.reconcile.model.partner.mapping model and returns its id. +func (c *Client) CreateAccountReconcileModelPartnerMapping(armpm *AccountReconcileModelPartnerMapping) (int64, error) { + ids, err := c.CreateAccountReconcileModelPartnerMappings([]*AccountReconcileModelPartnerMapping{armpm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountReconcileModelPartnerMapping creates a new account.reconcile.model.partner.mapping model and returns its id. +func (c *Client) CreateAccountReconcileModelPartnerMappings(armpms []*AccountReconcileModelPartnerMapping) ([]int64, error) { + var vv []interface{} + for _, v := range armpms { + vv = append(vv, v) + } + return c.Create(AccountReconcileModelPartnerMappingModel, vv, nil) +} + +// UpdateAccountReconcileModelPartnerMapping updates an existing account.reconcile.model.partner.mapping record. +func (c *Client) UpdateAccountReconcileModelPartnerMapping(armpm *AccountReconcileModelPartnerMapping) error { + return c.UpdateAccountReconcileModelPartnerMappings([]int64{armpm.Id.Get()}, armpm) +} + +// UpdateAccountReconcileModelPartnerMappings updates existing account.reconcile.model.partner.mapping records. +// All records (represented by ids) will be updated by armpm values. +func (c *Client) UpdateAccountReconcileModelPartnerMappings(ids []int64, armpm *AccountReconcileModelPartnerMapping) error { + return c.Update(AccountReconcileModelPartnerMappingModel, ids, armpm, nil) +} + +// DeleteAccountReconcileModelPartnerMapping deletes an existing account.reconcile.model.partner.mapping record. +func (c *Client) DeleteAccountReconcileModelPartnerMapping(id int64) error { + return c.DeleteAccountReconcileModelPartnerMappings([]int64{id}) +} + +// DeleteAccountReconcileModelPartnerMappings deletes existing account.reconcile.model.partner.mapping records. +func (c *Client) DeleteAccountReconcileModelPartnerMappings(ids []int64) error { + return c.Delete(AccountReconcileModelPartnerMappingModel, ids) +} + +// GetAccountReconcileModelPartnerMapping gets account.reconcile.model.partner.mapping existing record. +func (c *Client) GetAccountReconcileModelPartnerMapping(id int64) (*AccountReconcileModelPartnerMapping, error) { + armpms, err := c.GetAccountReconcileModelPartnerMappings([]int64{id}) + if err != nil { + return nil, err + } + return &((*armpms)[0]), nil +} + +// GetAccountReconcileModelPartnerMappings gets account.reconcile.model.partner.mapping existing records. +func (c *Client) GetAccountReconcileModelPartnerMappings(ids []int64) (*AccountReconcileModelPartnerMappings, error) { + armpms := &AccountReconcileModelPartnerMappings{} + if err := c.Read(AccountReconcileModelPartnerMappingModel, ids, nil, armpms); err != nil { + return nil, err + } + return armpms, nil +} + +// FindAccountReconcileModelPartnerMapping finds account.reconcile.model.partner.mapping record by querying it with criteria. +func (c *Client) FindAccountReconcileModelPartnerMapping(criteria *Criteria) (*AccountReconcileModelPartnerMapping, error) { + armpms := &AccountReconcileModelPartnerMappings{} + if err := c.SearchRead(AccountReconcileModelPartnerMappingModel, criteria, NewOptions().Limit(1), armpms); err != nil { + return nil, err + } + return &((*armpms)[0]), nil +} + +// FindAccountReconcileModelPartnerMappings finds account.reconcile.model.partner.mapping records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReconcileModelPartnerMappings(criteria *Criteria, options *Options) (*AccountReconcileModelPartnerMappings, error) { + armpms := &AccountReconcileModelPartnerMappings{} + if err := c.SearchRead(AccountReconcileModelPartnerMappingModel, criteria, options, armpms); err != nil { + return nil, err + } + return armpms, nil +} + +// FindAccountReconcileModelPartnerMappingIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReconcileModelPartnerMappingIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountReconcileModelPartnerMappingModel, criteria, options) +} + +// FindAccountReconcileModelPartnerMappingId finds record id by querying it with criteria. +func (c *Client) FindAccountReconcileModelPartnerMappingId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountReconcileModelPartnerMappingModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_report.go b/account_report.go new file mode 100644 index 0000000..702898d --- /dev/null +++ b/account_report.go @@ -0,0 +1,152 @@ +package odoo + +// AccountReport represents account.report model. +type AccountReport struct { + Active *Bool `xmlrpc:"active,omitempty"` + AvailabilityCondition *Selection `xmlrpc:"availability_condition,omitempty"` + ChartTemplate *Selection `xmlrpc:"chart_template,omitempty"` + ColumnIds *Relation `xmlrpc:"column_ids,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyTranslation *Selection `xmlrpc:"currency_translation,omitempty"` + DefaultOpeningDateFilter *Selection `xmlrpc:"default_opening_date_filter,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FilterAccountType *Selection `xmlrpc:"filter_account_type,omitempty"` + FilterAmlIrFilters *Bool `xmlrpc:"filter_aml_ir_filters,omitempty"` + FilterAnalytic *Bool `xmlrpc:"filter_analytic,omitempty"` + FilterBudgets *Bool `xmlrpc:"filter_budgets,omitempty"` + FilterDateRange *Bool `xmlrpc:"filter_date_range,omitempty"` + FilterFiscalPosition *Bool `xmlrpc:"filter_fiscal_position,omitempty"` + FilterGrowthComparison *Bool `xmlrpc:"filter_growth_comparison,omitempty"` + FilterHide0Lines *Selection `xmlrpc:"filter_hide_0_lines,omitempty"` + FilterHierarchy *Selection `xmlrpc:"filter_hierarchy,omitempty"` + FilterJournals *Bool `xmlrpc:"filter_journals,omitempty"` + FilterMultiCompany *Selection `xmlrpc:"filter_multi_company,omitempty"` + FilterPartner *Bool `xmlrpc:"filter_partner,omitempty"` + FilterPeriodComparison *Bool `xmlrpc:"filter_period_comparison,omitempty"` + FilterShowDraft *Bool `xmlrpc:"filter_show_draft,omitempty"` + FilterUnfoldAll *Bool `xmlrpc:"filter_unfold_all,omitempty"` + FilterUnreconciled *Bool `xmlrpc:"filter_unreconciled,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IntegerRounding *Selection `xmlrpc:"integer_rounding,omitempty"` + LineIds *Relation `xmlrpc:"line_ids,omitempty"` + LoadMoreLimit *Int `xmlrpc:"load_more_limit,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OnlyTaxExigible *Bool `xmlrpc:"only_tax_exigible,omitempty"` + PrefixGroupsThreshold *Int `xmlrpc:"prefix_groups_threshold,omitempty"` + RootReportId *Many2One `xmlrpc:"root_report_id,omitempty"` + SearchBar *Bool `xmlrpc:"search_bar,omitempty"` + SectionMainReportIds *Relation `xmlrpc:"section_main_report_ids,omitempty"` + SectionReportIds *Relation `xmlrpc:"section_report_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + UseSections *Bool `xmlrpc:"use_sections,omitempty"` + VariantReportIds *Relation `xmlrpc:"variant_report_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountReports represents array of account.report model. +type AccountReports []AccountReport + +// AccountReportModel is the odoo model name. +const AccountReportModel = "account.report" + +// Many2One convert AccountReport to *Many2One. +func (ar *AccountReport) Many2One() *Many2One { + return NewMany2One(ar.Id.Get(), "") +} + +// CreateAccountReport creates a new account.report model and returns its id. +func (c *Client) CreateAccountReport(ar *AccountReport) (int64, error) { + ids, err := c.CreateAccountReports([]*AccountReport{ar}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountReport creates a new account.report model and returns its id. +func (c *Client) CreateAccountReports(ars []*AccountReport) ([]int64, error) { + var vv []interface{} + for _, v := range ars { + vv = append(vv, v) + } + return c.Create(AccountReportModel, vv, nil) +} + +// UpdateAccountReport updates an existing account.report record. +func (c *Client) UpdateAccountReport(ar *AccountReport) error { + return c.UpdateAccountReports([]int64{ar.Id.Get()}, ar) +} + +// UpdateAccountReports updates existing account.report records. +// All records (represented by ids) will be updated by ar values. +func (c *Client) UpdateAccountReports(ids []int64, ar *AccountReport) error { + return c.Update(AccountReportModel, ids, ar, nil) +} + +// DeleteAccountReport deletes an existing account.report record. +func (c *Client) DeleteAccountReport(id int64) error { + return c.DeleteAccountReports([]int64{id}) +} + +// DeleteAccountReports deletes existing account.report records. +func (c *Client) DeleteAccountReports(ids []int64) error { + return c.Delete(AccountReportModel, ids) +} + +// GetAccountReport gets account.report existing record. +func (c *Client) GetAccountReport(id int64) (*AccountReport, error) { + ars, err := c.GetAccountReports([]int64{id}) + if err != nil { + return nil, err + } + return &((*ars)[0]), nil +} + +// GetAccountReports gets account.report existing records. +func (c *Client) GetAccountReports(ids []int64) (*AccountReports, error) { + ars := &AccountReports{} + if err := c.Read(AccountReportModel, ids, nil, ars); err != nil { + return nil, err + } + return ars, nil +} + +// FindAccountReport finds account.report record by querying it with criteria. +func (c *Client) FindAccountReport(criteria *Criteria) (*AccountReport, error) { + ars := &AccountReports{} + if err := c.SearchRead(AccountReportModel, criteria, NewOptions().Limit(1), ars); err != nil { + return nil, err + } + return &((*ars)[0]), nil +} + +// FindAccountReports finds account.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReports(criteria *Criteria, options *Options) (*AccountReports, error) { + ars := &AccountReports{} + if err := c.SearchRead(AccountReportModel, criteria, options, ars); err != nil { + return nil, err + } + return ars, nil +} + +// FindAccountReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReportIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountReportModel, criteria, options) +} + +// FindAccountReportId finds record id by querying it with criteria. +func (c *Client) FindAccountReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountReportModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_report_column.go b/account_report_column.go new file mode 100644 index 0000000..4800c28 --- /dev/null +++ b/account_report_column.go @@ -0,0 +1,124 @@ +package odoo + +// AccountReportColumn represents account.report.column model. +type AccountReportColumn struct { + BlankIfZero *Bool `xmlrpc:"blank_if_zero,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CustomAuditActionId *Many2One `xmlrpc:"custom_audit_action_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExpressionLabel *String `xmlrpc:"expression_label,omitempty"` + FigureType *Selection `xmlrpc:"figure_type,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ReportId *Many2One `xmlrpc:"report_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + Sortable *Bool `xmlrpc:"sortable,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountReportColumns represents array of account.report.column model. +type AccountReportColumns []AccountReportColumn + +// AccountReportColumnModel is the odoo model name. +const AccountReportColumnModel = "account.report.column" + +// Many2One convert AccountReportColumn to *Many2One. +func (arc *AccountReportColumn) Many2One() *Many2One { + return NewMany2One(arc.Id.Get(), "") +} + +// CreateAccountReportColumn creates a new account.report.column model and returns its id. +func (c *Client) CreateAccountReportColumn(arc *AccountReportColumn) (int64, error) { + ids, err := c.CreateAccountReportColumns([]*AccountReportColumn{arc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountReportColumn creates a new account.report.column model and returns its id. +func (c *Client) CreateAccountReportColumns(arcs []*AccountReportColumn) ([]int64, error) { + var vv []interface{} + for _, v := range arcs { + vv = append(vv, v) + } + return c.Create(AccountReportColumnModel, vv, nil) +} + +// UpdateAccountReportColumn updates an existing account.report.column record. +func (c *Client) UpdateAccountReportColumn(arc *AccountReportColumn) error { + return c.UpdateAccountReportColumns([]int64{arc.Id.Get()}, arc) +} + +// UpdateAccountReportColumns updates existing account.report.column records. +// All records (represented by ids) will be updated by arc values. +func (c *Client) UpdateAccountReportColumns(ids []int64, arc *AccountReportColumn) error { + return c.Update(AccountReportColumnModel, ids, arc, nil) +} + +// DeleteAccountReportColumn deletes an existing account.report.column record. +func (c *Client) DeleteAccountReportColumn(id int64) error { + return c.DeleteAccountReportColumns([]int64{id}) +} + +// DeleteAccountReportColumns deletes existing account.report.column records. +func (c *Client) DeleteAccountReportColumns(ids []int64) error { + return c.Delete(AccountReportColumnModel, ids) +} + +// GetAccountReportColumn gets account.report.column existing record. +func (c *Client) GetAccountReportColumn(id int64) (*AccountReportColumn, error) { + arcs, err := c.GetAccountReportColumns([]int64{id}) + if err != nil { + return nil, err + } + return &((*arcs)[0]), nil +} + +// GetAccountReportColumns gets account.report.column existing records. +func (c *Client) GetAccountReportColumns(ids []int64) (*AccountReportColumns, error) { + arcs := &AccountReportColumns{} + if err := c.Read(AccountReportColumnModel, ids, nil, arcs); err != nil { + return nil, err + } + return arcs, nil +} + +// FindAccountReportColumn finds account.report.column record by querying it with criteria. +func (c *Client) FindAccountReportColumn(criteria *Criteria) (*AccountReportColumn, error) { + arcs := &AccountReportColumns{} + if err := c.SearchRead(AccountReportColumnModel, criteria, NewOptions().Limit(1), arcs); err != nil { + return nil, err + } + return &((*arcs)[0]), nil +} + +// FindAccountReportColumns finds account.report.column records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReportColumns(criteria *Criteria, options *Options) (*AccountReportColumns, error) { + arcs := &AccountReportColumns{} + if err := c.SearchRead(AccountReportColumnModel, criteria, options, arcs); err != nil { + return nil, err + } + return arcs, nil +} + +// FindAccountReportColumnIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReportColumnIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountReportColumnModel, criteria, options) +} + +// FindAccountReportColumnId finds record id by querying it with criteria. +func (c *Client) FindAccountReportColumnId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountReportColumnModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_report_expression.go b/account_report_expression.go new file mode 100644 index 0000000..582385a --- /dev/null +++ b/account_report_expression.go @@ -0,0 +1,128 @@ +package odoo + +// AccountReportExpression represents account.report.expression model. +type AccountReportExpression struct { + Auditable *Bool `xmlrpc:"auditable,omitempty"` + BlankIfZero *Bool `xmlrpc:"blank_if_zero,omitempty"` + CarryoverTarget *String `xmlrpc:"carryover_target,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateScope *Selection `xmlrpc:"date_scope,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Engine *Selection `xmlrpc:"engine,omitempty"` + FigureType *Selection `xmlrpc:"figure_type,omitempty"` + Formula *String `xmlrpc:"formula,omitempty"` + GreenOnPositive *Bool `xmlrpc:"green_on_positive,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Label *String `xmlrpc:"label,omitempty"` + ReportLineId *Many2One `xmlrpc:"report_line_id,omitempty"` + ReportLineName *String `xmlrpc:"report_line_name,omitempty"` + Subformula *String `xmlrpc:"subformula,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountReportExpressions represents array of account.report.expression model. +type AccountReportExpressions []AccountReportExpression + +// AccountReportExpressionModel is the odoo model name. +const AccountReportExpressionModel = "account.report.expression" + +// Many2One convert AccountReportExpression to *Many2One. +func (are *AccountReportExpression) Many2One() *Many2One { + return NewMany2One(are.Id.Get(), "") +} + +// CreateAccountReportExpression creates a new account.report.expression model and returns its id. +func (c *Client) CreateAccountReportExpression(are *AccountReportExpression) (int64, error) { + ids, err := c.CreateAccountReportExpressions([]*AccountReportExpression{are}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountReportExpression creates a new account.report.expression model and returns its id. +func (c *Client) CreateAccountReportExpressions(ares []*AccountReportExpression) ([]int64, error) { + var vv []interface{} + for _, v := range ares { + vv = append(vv, v) + } + return c.Create(AccountReportExpressionModel, vv, nil) +} + +// UpdateAccountReportExpression updates an existing account.report.expression record. +func (c *Client) UpdateAccountReportExpression(are *AccountReportExpression) error { + return c.UpdateAccountReportExpressions([]int64{are.Id.Get()}, are) +} + +// UpdateAccountReportExpressions updates existing account.report.expression records. +// All records (represented by ids) will be updated by are values. +func (c *Client) UpdateAccountReportExpressions(ids []int64, are *AccountReportExpression) error { + return c.Update(AccountReportExpressionModel, ids, are, nil) +} + +// DeleteAccountReportExpression deletes an existing account.report.expression record. +func (c *Client) DeleteAccountReportExpression(id int64) error { + return c.DeleteAccountReportExpressions([]int64{id}) +} + +// DeleteAccountReportExpressions deletes existing account.report.expression records. +func (c *Client) DeleteAccountReportExpressions(ids []int64) error { + return c.Delete(AccountReportExpressionModel, ids) +} + +// GetAccountReportExpression gets account.report.expression existing record. +func (c *Client) GetAccountReportExpression(id int64) (*AccountReportExpression, error) { + ares, err := c.GetAccountReportExpressions([]int64{id}) + if err != nil { + return nil, err + } + return &((*ares)[0]), nil +} + +// GetAccountReportExpressions gets account.report.expression existing records. +func (c *Client) GetAccountReportExpressions(ids []int64) (*AccountReportExpressions, error) { + ares := &AccountReportExpressions{} + if err := c.Read(AccountReportExpressionModel, ids, nil, ares); err != nil { + return nil, err + } + return ares, nil +} + +// FindAccountReportExpression finds account.report.expression record by querying it with criteria. +func (c *Client) FindAccountReportExpression(criteria *Criteria) (*AccountReportExpression, error) { + ares := &AccountReportExpressions{} + if err := c.SearchRead(AccountReportExpressionModel, criteria, NewOptions().Limit(1), ares); err != nil { + return nil, err + } + return &((*ares)[0]), nil +} + +// FindAccountReportExpressions finds account.report.expression records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReportExpressions(criteria *Criteria, options *Options) (*AccountReportExpressions, error) { + ares := &AccountReportExpressions{} + if err := c.SearchRead(AccountReportExpressionModel, criteria, options, ares); err != nil { + return nil, err + } + return ares, nil +} + +// FindAccountReportExpressionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReportExpressionIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountReportExpressionModel, criteria, options) +} + +// FindAccountReportExpressionId finds record id by querying it with criteria. +func (c *Client) FindAccountReportExpressionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountReportExpressionModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_report_external_value.go b/account_report_external_value.go new file mode 100644 index 0000000..50e4fdc --- /dev/null +++ b/account_report_external_value.go @@ -0,0 +1,128 @@ +package odoo + +// AccountReportExternalValue represents account.report.external.value model. +type AccountReportExternalValue struct { + CarryoverOriginExpressionLabel *String `xmlrpc:"carryover_origin_expression_label,omitempty"` + CarryoverOriginReportLineId *Many2One `xmlrpc:"carryover_origin_report_line_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ForeignVatFiscalPositionId *Many2One `xmlrpc:"foreign_vat_fiscal_position_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ReportCountryId *Many2One `xmlrpc:"report_country_id,omitempty"` + TargetReportExpressionId *Many2One `xmlrpc:"target_report_expression_id,omitempty"` + TargetReportExpressionLabel *String `xmlrpc:"target_report_expression_label,omitempty"` + TargetReportLineId *Many2One `xmlrpc:"target_report_line_id,omitempty"` + TextValue *String `xmlrpc:"text_value,omitempty"` + Value *Float `xmlrpc:"value,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountReportExternalValues represents array of account.report.external.value model. +type AccountReportExternalValues []AccountReportExternalValue + +// AccountReportExternalValueModel is the odoo model name. +const AccountReportExternalValueModel = "account.report.external.value" + +// Many2One convert AccountReportExternalValue to *Many2One. +func (arev *AccountReportExternalValue) Many2One() *Many2One { + return NewMany2One(arev.Id.Get(), "") +} + +// CreateAccountReportExternalValue creates a new account.report.external.value model and returns its id. +func (c *Client) CreateAccountReportExternalValue(arev *AccountReportExternalValue) (int64, error) { + ids, err := c.CreateAccountReportExternalValues([]*AccountReportExternalValue{arev}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountReportExternalValue creates a new account.report.external.value model and returns its id. +func (c *Client) CreateAccountReportExternalValues(arevs []*AccountReportExternalValue) ([]int64, error) { + var vv []interface{} + for _, v := range arevs { + vv = append(vv, v) + } + return c.Create(AccountReportExternalValueModel, vv, nil) +} + +// UpdateAccountReportExternalValue updates an existing account.report.external.value record. +func (c *Client) UpdateAccountReportExternalValue(arev *AccountReportExternalValue) error { + return c.UpdateAccountReportExternalValues([]int64{arev.Id.Get()}, arev) +} + +// UpdateAccountReportExternalValues updates existing account.report.external.value records. +// All records (represented by ids) will be updated by arev values. +func (c *Client) UpdateAccountReportExternalValues(ids []int64, arev *AccountReportExternalValue) error { + return c.Update(AccountReportExternalValueModel, ids, arev, nil) +} + +// DeleteAccountReportExternalValue deletes an existing account.report.external.value record. +func (c *Client) DeleteAccountReportExternalValue(id int64) error { + return c.DeleteAccountReportExternalValues([]int64{id}) +} + +// DeleteAccountReportExternalValues deletes existing account.report.external.value records. +func (c *Client) DeleteAccountReportExternalValues(ids []int64) error { + return c.Delete(AccountReportExternalValueModel, ids) +} + +// GetAccountReportExternalValue gets account.report.external.value existing record. +func (c *Client) GetAccountReportExternalValue(id int64) (*AccountReportExternalValue, error) { + arevs, err := c.GetAccountReportExternalValues([]int64{id}) + if err != nil { + return nil, err + } + return &((*arevs)[0]), nil +} + +// GetAccountReportExternalValues gets account.report.external.value existing records. +func (c *Client) GetAccountReportExternalValues(ids []int64) (*AccountReportExternalValues, error) { + arevs := &AccountReportExternalValues{} + if err := c.Read(AccountReportExternalValueModel, ids, nil, arevs); err != nil { + return nil, err + } + return arevs, nil +} + +// FindAccountReportExternalValue finds account.report.external.value record by querying it with criteria. +func (c *Client) FindAccountReportExternalValue(criteria *Criteria) (*AccountReportExternalValue, error) { + arevs := &AccountReportExternalValues{} + if err := c.SearchRead(AccountReportExternalValueModel, criteria, NewOptions().Limit(1), arevs); err != nil { + return nil, err + } + return &((*arevs)[0]), nil +} + +// FindAccountReportExternalValues finds account.report.external.value records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReportExternalValues(criteria *Criteria, options *Options) (*AccountReportExternalValues, error) { + arevs := &AccountReportExternalValues{} + if err := c.SearchRead(AccountReportExternalValueModel, criteria, options, arevs); err != nil { + return nil, err + } + return arevs, nil +} + +// FindAccountReportExternalValueIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReportExternalValueIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountReportExternalValueModel, criteria, options) +} + +// FindAccountReportExternalValueId finds record id by querying it with criteria. +func (c *Client) FindAccountReportExternalValueId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountReportExternalValueModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_report_line.go b/account_report_line.go new file mode 100644 index 0000000..fdfbe94 --- /dev/null +++ b/account_report_line.go @@ -0,0 +1,136 @@ +package odoo + +// AccountReportLine represents account.report.line model. +type AccountReportLine struct { + AccountCodesFormula *String `xmlrpc:"account_codes_formula,omitempty"` + ActionId *Many2One `xmlrpc:"action_id,omitempty"` + AggregationFormula *String `xmlrpc:"aggregation_formula,omitempty"` + ChildrenIds *Relation `xmlrpc:"children_ids,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DomainFormula *String `xmlrpc:"domain_formula,omitempty"` + ExpressionIds *Relation `xmlrpc:"expression_ids,omitempty"` + ExternalFormula *String `xmlrpc:"external_formula,omitempty"` + Foldable *Bool `xmlrpc:"foldable,omitempty"` + Groupby *String `xmlrpc:"groupby,omitempty"` + HideIfZero *Bool `xmlrpc:"hide_if_zero,omitempty"` + HierarchyLevel *Int `xmlrpc:"hierarchy_level,omitempty"` + HorizontalSplitSide *Selection `xmlrpc:"horizontal_split_side,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + PrintOnNewPage *Bool `xmlrpc:"print_on_new_page,omitempty"` + ReportId *Many2One `xmlrpc:"report_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TaxTagsFormula *String `xmlrpc:"tax_tags_formula,omitempty"` + UserGroupby *String `xmlrpc:"user_groupby,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountReportLines represents array of account.report.line model. +type AccountReportLines []AccountReportLine + +// AccountReportLineModel is the odoo model name. +const AccountReportLineModel = "account.report.line" + +// Many2One convert AccountReportLine to *Many2One. +func (arl *AccountReportLine) Many2One() *Many2One { + return NewMany2One(arl.Id.Get(), "") +} + +// CreateAccountReportLine creates a new account.report.line model and returns its id. +func (c *Client) CreateAccountReportLine(arl *AccountReportLine) (int64, error) { + ids, err := c.CreateAccountReportLines([]*AccountReportLine{arl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountReportLine creates a new account.report.line model and returns its id. +func (c *Client) CreateAccountReportLines(arls []*AccountReportLine) ([]int64, error) { + var vv []interface{} + for _, v := range arls { + vv = append(vv, v) + } + return c.Create(AccountReportLineModel, vv, nil) +} + +// UpdateAccountReportLine updates an existing account.report.line record. +func (c *Client) UpdateAccountReportLine(arl *AccountReportLine) error { + return c.UpdateAccountReportLines([]int64{arl.Id.Get()}, arl) +} + +// UpdateAccountReportLines updates existing account.report.line records. +// All records (represented by ids) will be updated by arl values. +func (c *Client) UpdateAccountReportLines(ids []int64, arl *AccountReportLine) error { + return c.Update(AccountReportLineModel, ids, arl, nil) +} + +// DeleteAccountReportLine deletes an existing account.report.line record. +func (c *Client) DeleteAccountReportLine(id int64) error { + return c.DeleteAccountReportLines([]int64{id}) +} + +// DeleteAccountReportLines deletes existing account.report.line records. +func (c *Client) DeleteAccountReportLines(ids []int64) error { + return c.Delete(AccountReportLineModel, ids) +} + +// GetAccountReportLine gets account.report.line existing record. +func (c *Client) GetAccountReportLine(id int64) (*AccountReportLine, error) { + arls, err := c.GetAccountReportLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*arls)[0]), nil +} + +// GetAccountReportLines gets account.report.line existing records. +func (c *Client) GetAccountReportLines(ids []int64) (*AccountReportLines, error) { + arls := &AccountReportLines{} + if err := c.Read(AccountReportLineModel, ids, nil, arls); err != nil { + return nil, err + } + return arls, nil +} + +// FindAccountReportLine finds account.report.line record by querying it with criteria. +func (c *Client) FindAccountReportLine(criteria *Criteria) (*AccountReportLine, error) { + arls := &AccountReportLines{} + if err := c.SearchRead(AccountReportLineModel, criteria, NewOptions().Limit(1), arls); err != nil { + return nil, err + } + return &((*arls)[0]), nil +} + +// FindAccountReportLines finds account.report.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReportLines(criteria *Criteria, options *Options) (*AccountReportLines, error) { + arls := &AccountReportLines{} + if err := c.SearchRead(AccountReportLineModel, criteria, options, arls); err != nil { + return nil, err + } + return arls, nil +} + +// FindAccountReportLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountReportLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountReportLineModel, criteria, options) +} + +// FindAccountReportLineId finds record id by querying it with criteria. +func (c *Client) FindAccountReportLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountReportLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_resequence_wizard.go b/account_resequence_wizard.go new file mode 100644 index 0000000..c0101db --- /dev/null +++ b/account_resequence_wizard.go @@ -0,0 +1,124 @@ +package odoo + +// AccountResequenceWizard represents account.resequence.wizard model. +type AccountResequenceWizard struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EndDate *Time `xmlrpc:"end_date,omitempty"` + FirstDate *Time `xmlrpc:"first_date,omitempty"` + FirstName *String `xmlrpc:"first_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MoveIds *Relation `xmlrpc:"move_ids,omitempty"` + NewValues *String `xmlrpc:"new_values,omitempty"` + Ordering *Selection `xmlrpc:"ordering,omitempty"` + PreviewMoves *String `xmlrpc:"preview_moves,omitempty"` + SequenceNumberReset *String `xmlrpc:"sequence_number_reset,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountResequenceWizards represents array of account.resequence.wizard model. +type AccountResequenceWizards []AccountResequenceWizard + +// AccountResequenceWizardModel is the odoo model name. +const AccountResequenceWizardModel = "account.resequence.wizard" + +// Many2One convert AccountResequenceWizard to *Many2One. +func (arw *AccountResequenceWizard) Many2One() *Many2One { + return NewMany2One(arw.Id.Get(), "") +} + +// CreateAccountResequenceWizard creates a new account.resequence.wizard model and returns its id. +func (c *Client) CreateAccountResequenceWizard(arw *AccountResequenceWizard) (int64, error) { + ids, err := c.CreateAccountResequenceWizards([]*AccountResequenceWizard{arw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountResequenceWizard creates a new account.resequence.wizard model and returns its id. +func (c *Client) CreateAccountResequenceWizards(arws []*AccountResequenceWizard) ([]int64, error) { + var vv []interface{} + for _, v := range arws { + vv = append(vv, v) + } + return c.Create(AccountResequenceWizardModel, vv, nil) +} + +// UpdateAccountResequenceWizard updates an existing account.resequence.wizard record. +func (c *Client) UpdateAccountResequenceWizard(arw *AccountResequenceWizard) error { + return c.UpdateAccountResequenceWizards([]int64{arw.Id.Get()}, arw) +} + +// UpdateAccountResequenceWizards updates existing account.resequence.wizard records. +// All records (represented by ids) will be updated by arw values. +func (c *Client) UpdateAccountResequenceWizards(ids []int64, arw *AccountResequenceWizard) error { + return c.Update(AccountResequenceWizardModel, ids, arw, nil) +} + +// DeleteAccountResequenceWizard deletes an existing account.resequence.wizard record. +func (c *Client) DeleteAccountResequenceWizard(id int64) error { + return c.DeleteAccountResequenceWizards([]int64{id}) +} + +// DeleteAccountResequenceWizards deletes existing account.resequence.wizard records. +func (c *Client) DeleteAccountResequenceWizards(ids []int64) error { + return c.Delete(AccountResequenceWizardModel, ids) +} + +// GetAccountResequenceWizard gets account.resequence.wizard existing record. +func (c *Client) GetAccountResequenceWizard(id int64) (*AccountResequenceWizard, error) { + arws, err := c.GetAccountResequenceWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*arws)[0]), nil +} + +// GetAccountResequenceWizards gets account.resequence.wizard existing records. +func (c *Client) GetAccountResequenceWizards(ids []int64) (*AccountResequenceWizards, error) { + arws := &AccountResequenceWizards{} + if err := c.Read(AccountResequenceWizardModel, ids, nil, arws); err != nil { + return nil, err + } + return arws, nil +} + +// FindAccountResequenceWizard finds account.resequence.wizard record by querying it with criteria. +func (c *Client) FindAccountResequenceWizard(criteria *Criteria) (*AccountResequenceWizard, error) { + arws := &AccountResequenceWizards{} + if err := c.SearchRead(AccountResequenceWizardModel, criteria, NewOptions().Limit(1), arws); err != nil { + return nil, err + } + return &((*arws)[0]), nil +} + +// FindAccountResequenceWizards finds account.resequence.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountResequenceWizards(criteria *Criteria, options *Options) (*AccountResequenceWizards, error) { + arws := &AccountResequenceWizards{} + if err := c.SearchRead(AccountResequenceWizardModel, criteria, options, arws); err != nil { + return nil, err + } + return arws, nil +} + +// FindAccountResequenceWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountResequenceWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountResequenceWizardModel, criteria, options) +} + +// FindAccountResequenceWizardId finds record id by querying it with criteria. +func (c *Client) FindAccountResequenceWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountResequenceWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_root.go b/account_root.go new file mode 100644 index 0000000..9f325bf --- /dev/null +++ b/account_root.go @@ -0,0 +1,114 @@ +package odoo + +// AccountRoot represents account.root model. +type AccountRoot struct { + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` +} + +// AccountRoots represents array of account.root model. +type AccountRoots []AccountRoot + +// AccountRootModel is the odoo model name. +const AccountRootModel = "account.root" + +// Many2One convert AccountRoot to *Many2One. +func (ar *AccountRoot) Many2One() *Many2One { + return NewMany2One(ar.Id.Get(), "") +} + +// CreateAccountRoot creates a new account.root model and returns its id. +func (c *Client) CreateAccountRoot(ar *AccountRoot) (int64, error) { + ids, err := c.CreateAccountRoots([]*AccountRoot{ar}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountRoot creates a new account.root model and returns its id. +func (c *Client) CreateAccountRoots(ars []*AccountRoot) ([]int64, error) { + var vv []interface{} + for _, v := range ars { + vv = append(vv, v) + } + return c.Create(AccountRootModel, vv, nil) +} + +// UpdateAccountRoot updates an existing account.root record. +func (c *Client) UpdateAccountRoot(ar *AccountRoot) error { + return c.UpdateAccountRoots([]int64{ar.Id.Get()}, ar) +} + +// UpdateAccountRoots updates existing account.root records. +// All records (represented by ids) will be updated by ar values. +func (c *Client) UpdateAccountRoots(ids []int64, ar *AccountRoot) error { + return c.Update(AccountRootModel, ids, ar, nil) +} + +// DeleteAccountRoot deletes an existing account.root record. +func (c *Client) DeleteAccountRoot(id int64) error { + return c.DeleteAccountRoots([]int64{id}) +} + +// DeleteAccountRoots deletes existing account.root records. +func (c *Client) DeleteAccountRoots(ids []int64) error { + return c.Delete(AccountRootModel, ids) +} + +// GetAccountRoot gets account.root existing record. +func (c *Client) GetAccountRoot(id int64) (*AccountRoot, error) { + ars, err := c.GetAccountRoots([]int64{id}) + if err != nil { + return nil, err + } + return &((*ars)[0]), nil +} + +// GetAccountRoots gets account.root existing records. +func (c *Client) GetAccountRoots(ids []int64) (*AccountRoots, error) { + ars := &AccountRoots{} + if err := c.Read(AccountRootModel, ids, nil, ars); err != nil { + return nil, err + } + return ars, nil +} + +// FindAccountRoot finds account.root record by querying it with criteria. +func (c *Client) FindAccountRoot(criteria *Criteria) (*AccountRoot, error) { + ars := &AccountRoots{} + if err := c.SearchRead(AccountRootModel, criteria, NewOptions().Limit(1), ars); err != nil { + return nil, err + } + return &((*ars)[0]), nil +} + +// FindAccountRoots finds account.root records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountRoots(criteria *Criteria, options *Options) (*AccountRoots, error) { + ars := &AccountRoots{} + if err := c.SearchRead(AccountRootModel, criteria, options, ars); err != nil { + return nil, err + } + return ars, nil +} + +// FindAccountRootIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountRootIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountRootModel, criteria, options) +} + +// FindAccountRootId finds record id by querying it with criteria. +func (c *Client) FindAccountRootId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountRootModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_secure_entries_wizard.go b/account_secure_entries_wizard.go new file mode 100644 index 0000000..9ccec65 --- /dev/null +++ b/account_secure_entries_wizard.go @@ -0,0 +1,125 @@ +package odoo + +// AccountSecureEntriesWizard represents account.secure.entries.wizard model. +type AccountSecureEntriesWizard struct { + ChainsToHashWithGaps *String `xmlrpc:"chains_to_hash_with_gaps,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HashDate *Time `xmlrpc:"hash_date,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MaxHashDate *Time `xmlrpc:"max_hash_date,omitempty"` + MoveToHashIds *Relation `xmlrpc:"move_to_hash_ids,omitempty"` + NotHashableUnlockedMoveIds *Relation `xmlrpc:"not_hashable_unlocked_move_ids,omitempty"` + UnreconciledBankStatementLineIds *Relation `xmlrpc:"unreconciled_bank_statement_line_ids,omitempty"` + Warnings *String `xmlrpc:"warnings,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountSecureEntriesWizards represents array of account.secure.entries.wizard model. +type AccountSecureEntriesWizards []AccountSecureEntriesWizard + +// AccountSecureEntriesWizardModel is the odoo model name. +const AccountSecureEntriesWizardModel = "account.secure.entries.wizard" + +// Many2One convert AccountSecureEntriesWizard to *Many2One. +func (asew *AccountSecureEntriesWizard) Many2One() *Many2One { + return NewMany2One(asew.Id.Get(), "") +} + +// CreateAccountSecureEntriesWizard creates a new account.secure.entries.wizard model and returns its id. +func (c *Client) CreateAccountSecureEntriesWizard(asew *AccountSecureEntriesWizard) (int64, error) { + ids, err := c.CreateAccountSecureEntriesWizards([]*AccountSecureEntriesWizard{asew}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountSecureEntriesWizard creates a new account.secure.entries.wizard model and returns its id. +func (c *Client) CreateAccountSecureEntriesWizards(asews []*AccountSecureEntriesWizard) ([]int64, error) { + var vv []interface{} + for _, v := range asews { + vv = append(vv, v) + } + return c.Create(AccountSecureEntriesWizardModel, vv, nil) +} + +// UpdateAccountSecureEntriesWizard updates an existing account.secure.entries.wizard record. +func (c *Client) UpdateAccountSecureEntriesWizard(asew *AccountSecureEntriesWizard) error { + return c.UpdateAccountSecureEntriesWizards([]int64{asew.Id.Get()}, asew) +} + +// UpdateAccountSecureEntriesWizards updates existing account.secure.entries.wizard records. +// All records (represented by ids) will be updated by asew values. +func (c *Client) UpdateAccountSecureEntriesWizards(ids []int64, asew *AccountSecureEntriesWizard) error { + return c.Update(AccountSecureEntriesWizardModel, ids, asew, nil) +} + +// DeleteAccountSecureEntriesWizard deletes an existing account.secure.entries.wizard record. +func (c *Client) DeleteAccountSecureEntriesWizard(id int64) error { + return c.DeleteAccountSecureEntriesWizards([]int64{id}) +} + +// DeleteAccountSecureEntriesWizards deletes existing account.secure.entries.wizard records. +func (c *Client) DeleteAccountSecureEntriesWizards(ids []int64) error { + return c.Delete(AccountSecureEntriesWizardModel, ids) +} + +// GetAccountSecureEntriesWizard gets account.secure.entries.wizard existing record. +func (c *Client) GetAccountSecureEntriesWizard(id int64) (*AccountSecureEntriesWizard, error) { + asews, err := c.GetAccountSecureEntriesWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*asews)[0]), nil +} + +// GetAccountSecureEntriesWizards gets account.secure.entries.wizard existing records. +func (c *Client) GetAccountSecureEntriesWizards(ids []int64) (*AccountSecureEntriesWizards, error) { + asews := &AccountSecureEntriesWizards{} + if err := c.Read(AccountSecureEntriesWizardModel, ids, nil, asews); err != nil { + return nil, err + } + return asews, nil +} + +// FindAccountSecureEntriesWizard finds account.secure.entries.wizard record by querying it with criteria. +func (c *Client) FindAccountSecureEntriesWizard(criteria *Criteria) (*AccountSecureEntriesWizard, error) { + asews := &AccountSecureEntriesWizards{} + if err := c.SearchRead(AccountSecureEntriesWizardModel, criteria, NewOptions().Limit(1), asews); err != nil { + return nil, err + } + return &((*asews)[0]), nil +} + +// FindAccountSecureEntriesWizards finds account.secure.entries.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountSecureEntriesWizards(criteria *Criteria, options *Options) (*AccountSecureEntriesWizards, error) { + asews := &AccountSecureEntriesWizards{} + if err := c.SearchRead(AccountSecureEntriesWizardModel, criteria, options, asews); err != nil { + return nil, err + } + return asews, nil +} + +// FindAccountSecureEntriesWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountSecureEntriesWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountSecureEntriesWizardModel, criteria, options) +} + +// FindAccountSecureEntriesWizardId finds record id by querying it with criteria. +func (c *Client) FindAccountSecureEntriesWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountSecureEntriesWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_setup_bank_manual_config.go b/account_setup_bank_manual_config.go new file mode 100644 index 0000000..89a6296 --- /dev/null +++ b/account_setup_bank_manual_config.go @@ -0,0 +1,170 @@ +package odoo + +// AccountSetupBankManualConfig represents account.setup.bank.manual.config model. +type AccountSetupBankManualConfig struct { + AccHolderName *String `xmlrpc:"acc_holder_name,omitempty"` + AccNumber *String `xmlrpc:"acc_number,omitempty"` + AccType *Selection `xmlrpc:"acc_type,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AllowOutPayment *Bool `xmlrpc:"allow_out_payment,omitempty"` + BankBic *String `xmlrpc:"bank_bic,omitempty"` + BankId *Many2One `xmlrpc:"bank_id,omitempty"` + BankName *String `xmlrpc:"bank_name,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasIbanWarning *Bool `xmlrpc:"has_iban_warning,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + HasMoneyTransferWarning *Bool `xmlrpc:"has_money_transfer_warning,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalId *Relation `xmlrpc:"journal_id,omitempty"` + L10NChDisplayQrBankOptions *Bool `xmlrpc:"l10n_ch_display_qr_bank_options,omitempty"` + L10NChQrIban *String `xmlrpc:"l10n_ch_qr_iban,omitempty"` + LinkedJournalId *Many2One `xmlrpc:"linked_journal_id,omitempty"` + LockTrustFields *Bool `xmlrpc:"lock_trust_fields,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MoneyTransferService *String `xmlrpc:"money_transfer_service,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + NewJournalName *String `xmlrpc:"new_journal_name,omitempty"` + NumJournalsWithoutAccount *Int `xmlrpc:"num_journals_without_account,omitempty"` + PartnerCountryName *String `xmlrpc:"partner_country_name,omitempty"` + PartnerCustomerRank *Int `xmlrpc:"partner_customer_rank,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerSupplierRank *Int `xmlrpc:"partner_supplier_rank,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RelatedMoves *Relation `xmlrpc:"related_moves,omitempty"` + ResPartnerBankId *Many2One `xmlrpc:"res_partner_bank_id,omitempty"` + SanitizedAccNumber *String `xmlrpc:"sanitized_acc_number,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + UserHasGroupValidateBankAccount *Bool `xmlrpc:"user_has_group_validate_bank_account,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountSetupBankManualConfigs represents array of account.setup.bank.manual.config model. +type AccountSetupBankManualConfigs []AccountSetupBankManualConfig + +// AccountSetupBankManualConfigModel is the odoo model name. +const AccountSetupBankManualConfigModel = "account.setup.bank.manual.config" + +// Many2One convert AccountSetupBankManualConfig to *Many2One. +func (asbmc *AccountSetupBankManualConfig) Many2One() *Many2One { + return NewMany2One(asbmc.Id.Get(), "") +} + +// CreateAccountSetupBankManualConfig creates a new account.setup.bank.manual.config model and returns its id. +func (c *Client) CreateAccountSetupBankManualConfig(asbmc *AccountSetupBankManualConfig) (int64, error) { + ids, err := c.CreateAccountSetupBankManualConfigs([]*AccountSetupBankManualConfig{asbmc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountSetupBankManualConfig creates a new account.setup.bank.manual.config model and returns its id. +func (c *Client) CreateAccountSetupBankManualConfigs(asbmcs []*AccountSetupBankManualConfig) ([]int64, error) { + var vv []interface{} + for _, v := range asbmcs { + vv = append(vv, v) + } + return c.Create(AccountSetupBankManualConfigModel, vv, nil) +} + +// UpdateAccountSetupBankManualConfig updates an existing account.setup.bank.manual.config record. +func (c *Client) UpdateAccountSetupBankManualConfig(asbmc *AccountSetupBankManualConfig) error { + return c.UpdateAccountSetupBankManualConfigs([]int64{asbmc.Id.Get()}, asbmc) +} + +// UpdateAccountSetupBankManualConfigs updates existing account.setup.bank.manual.config records. +// All records (represented by ids) will be updated by asbmc values. +func (c *Client) UpdateAccountSetupBankManualConfigs(ids []int64, asbmc *AccountSetupBankManualConfig) error { + return c.Update(AccountSetupBankManualConfigModel, ids, asbmc, nil) +} + +// DeleteAccountSetupBankManualConfig deletes an existing account.setup.bank.manual.config record. +func (c *Client) DeleteAccountSetupBankManualConfig(id int64) error { + return c.DeleteAccountSetupBankManualConfigs([]int64{id}) +} + +// DeleteAccountSetupBankManualConfigs deletes existing account.setup.bank.manual.config records. +func (c *Client) DeleteAccountSetupBankManualConfigs(ids []int64) error { + return c.Delete(AccountSetupBankManualConfigModel, ids) +} + +// GetAccountSetupBankManualConfig gets account.setup.bank.manual.config existing record. +func (c *Client) GetAccountSetupBankManualConfig(id int64) (*AccountSetupBankManualConfig, error) { + asbmcs, err := c.GetAccountSetupBankManualConfigs([]int64{id}) + if err != nil { + return nil, err + } + return &((*asbmcs)[0]), nil +} + +// GetAccountSetupBankManualConfigs gets account.setup.bank.manual.config existing records. +func (c *Client) GetAccountSetupBankManualConfigs(ids []int64) (*AccountSetupBankManualConfigs, error) { + asbmcs := &AccountSetupBankManualConfigs{} + if err := c.Read(AccountSetupBankManualConfigModel, ids, nil, asbmcs); err != nil { + return nil, err + } + return asbmcs, nil +} + +// FindAccountSetupBankManualConfig finds account.setup.bank.manual.config record by querying it with criteria. +func (c *Client) FindAccountSetupBankManualConfig(criteria *Criteria) (*AccountSetupBankManualConfig, error) { + asbmcs := &AccountSetupBankManualConfigs{} + if err := c.SearchRead(AccountSetupBankManualConfigModel, criteria, NewOptions().Limit(1), asbmcs); err != nil { + return nil, err + } + return &((*asbmcs)[0]), nil +} + +// FindAccountSetupBankManualConfigs finds account.setup.bank.manual.config records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountSetupBankManualConfigs(criteria *Criteria, options *Options) (*AccountSetupBankManualConfigs, error) { + asbmcs := &AccountSetupBankManualConfigs{} + if err := c.SearchRead(AccountSetupBankManualConfigModel, criteria, options, asbmcs); err != nil { + return nil, err + } + return asbmcs, nil +} + +// FindAccountSetupBankManualConfigIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountSetupBankManualConfigIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountSetupBankManualConfigModel, criteria, options) +} + +// FindAccountSetupBankManualConfigId finds record id by querying it with criteria. +func (c *Client) FindAccountSetupBankManualConfigId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountSetupBankManualConfigModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_tax.go b/account_tax.go new file mode 100644 index 0000000..fed31ef --- /dev/null +++ b/account_tax.go @@ -0,0 +1,160 @@ +package odoo + +// AccountTax represents account.tax model. +type AccountTax struct { + Active *Bool `xmlrpc:"active,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + AmountType *Selection `xmlrpc:"amount_type,omitempty"` + Analytic *Bool `xmlrpc:"analytic,omitempty"` + CashBasisTransitionAccountId *Many2One `xmlrpc:"cash_basis_transition_account_id,omitempty"` + ChildrenTaxIds *Relation `xmlrpc:"children_tax_ids,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanyPriceInclude *Selection `xmlrpc:"company_price_include,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + HasNegativeFactor *Bool `xmlrpc:"has_negative_factor,omitempty"` + HideTaxExigibility *Bool `xmlrpc:"hide_tax_exigibility,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IncludeBaseAmount *Bool `xmlrpc:"include_base_amount,omitempty"` + InvoiceLabel *String `xmlrpc:"invoice_label,omitempty"` + InvoiceLegalNotes *String `xmlrpc:"invoice_legal_notes,omitempty"` + InvoiceRepartitionLineIds *Relation `xmlrpc:"invoice_repartition_line_ids,omitempty"` + IsBaseAffected *Bool `xmlrpc:"is_base_affected,omitempty"` + IsUsed *Bool `xmlrpc:"is_used,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NameSearchable *String `xmlrpc:"name_searchable,omitempty"` + PriceInclude *Bool `xmlrpc:"price_include,omitempty"` + PriceIncludeOverride *Selection `xmlrpc:"price_include_override,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RefundRepartitionLineIds *Relation `xmlrpc:"refund_repartition_line_ids,omitempty"` + RepartitionLineIds *Relation `xmlrpc:"repartition_line_ids,omitempty"` + RepartitionLinesStr *String `xmlrpc:"repartition_lines_str,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TaxExigibility *Selection `xmlrpc:"tax_exigibility,omitempty"` + TaxGroupId *Many2One `xmlrpc:"tax_group_id,omitempty"` + TaxScope *Selection `xmlrpc:"tax_scope,omitempty"` + TypeTaxUse *Selection `xmlrpc:"type_tax_use,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountTaxs represents array of account.tax model. +type AccountTaxs []AccountTax + +// AccountTaxModel is the odoo model name. +const AccountTaxModel = "account.tax" + +// Many2One convert AccountTax to *Many2One. +func (at *AccountTax) Many2One() *Many2One { + return NewMany2One(at.Id.Get(), "") +} + +// CreateAccountTax creates a new account.tax model and returns its id. +func (c *Client) CreateAccountTax(at *AccountTax) (int64, error) { + ids, err := c.CreateAccountTaxs([]*AccountTax{at}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountTax creates a new account.tax model and returns its id. +func (c *Client) CreateAccountTaxs(ats []*AccountTax) ([]int64, error) { + var vv []interface{} + for _, v := range ats { + vv = append(vv, v) + } + return c.Create(AccountTaxModel, vv, nil) +} + +// UpdateAccountTax updates an existing account.tax record. +func (c *Client) UpdateAccountTax(at *AccountTax) error { + return c.UpdateAccountTaxs([]int64{at.Id.Get()}, at) +} + +// UpdateAccountTaxs updates existing account.tax records. +// All records (represented by ids) will be updated by at values. +func (c *Client) UpdateAccountTaxs(ids []int64, at *AccountTax) error { + return c.Update(AccountTaxModel, ids, at, nil) +} + +// DeleteAccountTax deletes an existing account.tax record. +func (c *Client) DeleteAccountTax(id int64) error { + return c.DeleteAccountTaxs([]int64{id}) +} + +// DeleteAccountTaxs deletes existing account.tax records. +func (c *Client) DeleteAccountTaxs(ids []int64) error { + return c.Delete(AccountTaxModel, ids) +} + +// GetAccountTax gets account.tax existing record. +func (c *Client) GetAccountTax(id int64) (*AccountTax, error) { + ats, err := c.GetAccountTaxs([]int64{id}) + if err != nil { + return nil, err + } + return &((*ats)[0]), nil +} + +// GetAccountTaxs gets account.tax existing records. +func (c *Client) GetAccountTaxs(ids []int64) (*AccountTaxs, error) { + ats := &AccountTaxs{} + if err := c.Read(AccountTaxModel, ids, nil, ats); err != nil { + return nil, err + } + return ats, nil +} + +// FindAccountTax finds account.tax record by querying it with criteria. +func (c *Client) FindAccountTax(criteria *Criteria) (*AccountTax, error) { + ats := &AccountTaxs{} + if err := c.SearchRead(AccountTaxModel, criteria, NewOptions().Limit(1), ats); err != nil { + return nil, err + } + return &((*ats)[0]), nil +} + +// FindAccountTaxs finds account.tax records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountTaxs(criteria *Criteria, options *Options) (*AccountTaxs, error) { + ats := &AccountTaxs{} + if err := c.SearchRead(AccountTaxModel, criteria, options, ats); err != nil { + return nil, err + } + return ats, nil +} + +// FindAccountTaxIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountTaxIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountTaxModel, criteria, options) +} + +// FindAccountTaxId finds record id by querying it with criteria. +func (c *Client) FindAccountTaxId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountTaxModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_tax_group.go b/account_tax_group.go new file mode 100644 index 0000000..dada37b --- /dev/null +++ b/account_tax_group.go @@ -0,0 +1,126 @@ +package odoo + +// AccountTaxGroup represents account.tax.group model. +type AccountTaxGroup struct { + AdvanceTaxPaymentAccountId *Many2One `xmlrpc:"advance_tax_payment_account_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PosReceiptLabel *String `xmlrpc:"pos_receipt_label,omitempty"` + PrecedingSubtotal *String `xmlrpc:"preceding_subtotal,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TaxPayableAccountId *Many2One `xmlrpc:"tax_payable_account_id,omitempty"` + TaxReceivableAccountId *Many2One `xmlrpc:"tax_receivable_account_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountTaxGroups represents array of account.tax.group model. +type AccountTaxGroups []AccountTaxGroup + +// AccountTaxGroupModel is the odoo model name. +const AccountTaxGroupModel = "account.tax.group" + +// Many2One convert AccountTaxGroup to *Many2One. +func (atg *AccountTaxGroup) Many2One() *Many2One { + return NewMany2One(atg.Id.Get(), "") +} + +// CreateAccountTaxGroup creates a new account.tax.group model and returns its id. +func (c *Client) CreateAccountTaxGroup(atg *AccountTaxGroup) (int64, error) { + ids, err := c.CreateAccountTaxGroups([]*AccountTaxGroup{atg}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountTaxGroup creates a new account.tax.group model and returns its id. +func (c *Client) CreateAccountTaxGroups(atgs []*AccountTaxGroup) ([]int64, error) { + var vv []interface{} + for _, v := range atgs { + vv = append(vv, v) + } + return c.Create(AccountTaxGroupModel, vv, nil) +} + +// UpdateAccountTaxGroup updates an existing account.tax.group record. +func (c *Client) UpdateAccountTaxGroup(atg *AccountTaxGroup) error { + return c.UpdateAccountTaxGroups([]int64{atg.Id.Get()}, atg) +} + +// UpdateAccountTaxGroups updates existing account.tax.group records. +// All records (represented by ids) will be updated by atg values. +func (c *Client) UpdateAccountTaxGroups(ids []int64, atg *AccountTaxGroup) error { + return c.Update(AccountTaxGroupModel, ids, atg, nil) +} + +// DeleteAccountTaxGroup deletes an existing account.tax.group record. +func (c *Client) DeleteAccountTaxGroup(id int64) error { + return c.DeleteAccountTaxGroups([]int64{id}) +} + +// DeleteAccountTaxGroups deletes existing account.tax.group records. +func (c *Client) DeleteAccountTaxGroups(ids []int64) error { + return c.Delete(AccountTaxGroupModel, ids) +} + +// GetAccountTaxGroup gets account.tax.group existing record. +func (c *Client) GetAccountTaxGroup(id int64) (*AccountTaxGroup, error) { + atgs, err := c.GetAccountTaxGroups([]int64{id}) + if err != nil { + return nil, err + } + return &((*atgs)[0]), nil +} + +// GetAccountTaxGroups gets account.tax.group existing records. +func (c *Client) GetAccountTaxGroups(ids []int64) (*AccountTaxGroups, error) { + atgs := &AccountTaxGroups{} + if err := c.Read(AccountTaxGroupModel, ids, nil, atgs); err != nil { + return nil, err + } + return atgs, nil +} + +// FindAccountTaxGroup finds account.tax.group record by querying it with criteria. +func (c *Client) FindAccountTaxGroup(criteria *Criteria) (*AccountTaxGroup, error) { + atgs := &AccountTaxGroups{} + if err := c.SearchRead(AccountTaxGroupModel, criteria, NewOptions().Limit(1), atgs); err != nil { + return nil, err + } + return &((*atgs)[0]), nil +} + +// FindAccountTaxGroups finds account.tax.group records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountTaxGroups(criteria *Criteria, options *Options) (*AccountTaxGroups, error) { + atgs := &AccountTaxGroups{} + if err := c.SearchRead(AccountTaxGroupModel, criteria, options, atgs); err != nil { + return nil, err + } + return atgs, nil +} + +// FindAccountTaxGroupIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountTaxGroupIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountTaxGroupModel, criteria, options) +} + +// FindAccountTaxGroupId finds record id by querying it with criteria. +func (c *Client) FindAccountTaxGroupId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountTaxGroupModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/account_tax_repartition_line.go b/account_tax_repartition_line.go new file mode 100644 index 0000000..e5c9d62 --- /dev/null +++ b/account_tax_repartition_line.go @@ -0,0 +1,127 @@ +package odoo + +// AccountTaxRepartitionLine represents account.tax.repartition.line model. +type AccountTaxRepartitionLine struct { + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DocumentType *Selection `xmlrpc:"document_type,omitempty"` + Factor *Float `xmlrpc:"factor,omitempty"` + FactorPercent *Float `xmlrpc:"factor_percent,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + RepartitionType *Selection `xmlrpc:"repartition_type,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TagIdsDomain *String `xmlrpc:"tag_ids_domain,omitempty"` + TaxId *Many2One `xmlrpc:"tax_id,omitempty"` + UseInTaxClosing *Bool `xmlrpc:"use_in_tax_closing,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AccountTaxRepartitionLines represents array of account.tax.repartition.line model. +type AccountTaxRepartitionLines []AccountTaxRepartitionLine + +// AccountTaxRepartitionLineModel is the odoo model name. +const AccountTaxRepartitionLineModel = "account.tax.repartition.line" + +// Many2One convert AccountTaxRepartitionLine to *Many2One. +func (atrl *AccountTaxRepartitionLine) Many2One() *Many2One { + return NewMany2One(atrl.Id.Get(), "") +} + +// CreateAccountTaxRepartitionLine creates a new account.tax.repartition.line model and returns its id. +func (c *Client) CreateAccountTaxRepartitionLine(atrl *AccountTaxRepartitionLine) (int64, error) { + ids, err := c.CreateAccountTaxRepartitionLines([]*AccountTaxRepartitionLine{atrl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAccountTaxRepartitionLine creates a new account.tax.repartition.line model and returns its id. +func (c *Client) CreateAccountTaxRepartitionLines(atrls []*AccountTaxRepartitionLine) ([]int64, error) { + var vv []interface{} + for _, v := range atrls { + vv = append(vv, v) + } + return c.Create(AccountTaxRepartitionLineModel, vv, nil) +} + +// UpdateAccountTaxRepartitionLine updates an existing account.tax.repartition.line record. +func (c *Client) UpdateAccountTaxRepartitionLine(atrl *AccountTaxRepartitionLine) error { + return c.UpdateAccountTaxRepartitionLines([]int64{atrl.Id.Get()}, atrl) +} + +// UpdateAccountTaxRepartitionLines updates existing account.tax.repartition.line records. +// All records (represented by ids) will be updated by atrl values. +func (c *Client) UpdateAccountTaxRepartitionLines(ids []int64, atrl *AccountTaxRepartitionLine) error { + return c.Update(AccountTaxRepartitionLineModel, ids, atrl, nil) +} + +// DeleteAccountTaxRepartitionLine deletes an existing account.tax.repartition.line record. +func (c *Client) DeleteAccountTaxRepartitionLine(id int64) error { + return c.DeleteAccountTaxRepartitionLines([]int64{id}) +} + +// DeleteAccountTaxRepartitionLines deletes existing account.tax.repartition.line records. +func (c *Client) DeleteAccountTaxRepartitionLines(ids []int64) error { + return c.Delete(AccountTaxRepartitionLineModel, ids) +} + +// GetAccountTaxRepartitionLine gets account.tax.repartition.line existing record. +func (c *Client) GetAccountTaxRepartitionLine(id int64) (*AccountTaxRepartitionLine, error) { + atrls, err := c.GetAccountTaxRepartitionLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*atrls)[0]), nil +} + +// GetAccountTaxRepartitionLines gets account.tax.repartition.line existing records. +func (c *Client) GetAccountTaxRepartitionLines(ids []int64) (*AccountTaxRepartitionLines, error) { + atrls := &AccountTaxRepartitionLines{} + if err := c.Read(AccountTaxRepartitionLineModel, ids, nil, atrls); err != nil { + return nil, err + } + return atrls, nil +} + +// FindAccountTaxRepartitionLine finds account.tax.repartition.line record by querying it with criteria. +func (c *Client) FindAccountTaxRepartitionLine(criteria *Criteria) (*AccountTaxRepartitionLine, error) { + atrls := &AccountTaxRepartitionLines{} + if err := c.SearchRead(AccountTaxRepartitionLineModel, criteria, NewOptions().Limit(1), atrls); err != nil { + return nil, err + } + return &((*atrls)[0]), nil +} + +// FindAccountTaxRepartitionLines finds account.tax.repartition.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountTaxRepartitionLines(criteria *Criteria, options *Options) (*AccountTaxRepartitionLines, error) { + atrls := &AccountTaxRepartitionLines{} + if err := c.SearchRead(AccountTaxRepartitionLineModel, criteria, options, atrls); err != nil { + return nil, err + } + return atrls, nil +} + +// FindAccountTaxRepartitionLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAccountTaxRepartitionLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AccountTaxRepartitionLineModel, criteria, options) +} + +// FindAccountTaxRepartitionLineId finds record id by querying it with criteria. +func (c *Client) FindAccountTaxRepartitionLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AccountTaxRepartitionLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/applicant_get_refuse_reason.go b/applicant_get_refuse_reason.go new file mode 100644 index 0000000..d4dac1c --- /dev/null +++ b/applicant_get_refuse_reason.go @@ -0,0 +1,125 @@ +package odoo + +// ApplicantGetRefuseReason represents applicant.get.refuse.reason model. +type ApplicantGetRefuseReason struct { + ApplicantEmails *String `xmlrpc:"applicant_emails,omitempty"` + ApplicantIds *Relation `xmlrpc:"applicant_ids,omitempty"` + ApplicantWithoutEmail *String `xmlrpc:"applicant_without_email,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Duplicates *Bool `xmlrpc:"duplicates,omitempty"` + DuplicatesCount *Int `xmlrpc:"duplicates_count,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + RefuseReasonId *Many2One `xmlrpc:"refuse_reason_id,omitempty"` + SendMail *Bool `xmlrpc:"send_mail,omitempty"` + SingleApplicantEmail *String `xmlrpc:"single_applicant_email,omitempty"` + TemplateId *Many2One `xmlrpc:"template_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ApplicantGetRefuseReasons represents array of applicant.get.refuse.reason model. +type ApplicantGetRefuseReasons []ApplicantGetRefuseReason + +// ApplicantGetRefuseReasonModel is the odoo model name. +const ApplicantGetRefuseReasonModel = "applicant.get.refuse.reason" + +// Many2One convert ApplicantGetRefuseReason to *Many2One. +func (agrr *ApplicantGetRefuseReason) Many2One() *Many2One { + return NewMany2One(agrr.Id.Get(), "") +} + +// CreateApplicantGetRefuseReason creates a new applicant.get.refuse.reason model and returns its id. +func (c *Client) CreateApplicantGetRefuseReason(agrr *ApplicantGetRefuseReason) (int64, error) { + ids, err := c.CreateApplicantGetRefuseReasons([]*ApplicantGetRefuseReason{agrr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateApplicantGetRefuseReason creates a new applicant.get.refuse.reason model and returns its id. +func (c *Client) CreateApplicantGetRefuseReasons(agrrs []*ApplicantGetRefuseReason) ([]int64, error) { + var vv []interface{} + for _, v := range agrrs { + vv = append(vv, v) + } + return c.Create(ApplicantGetRefuseReasonModel, vv, nil) +} + +// UpdateApplicantGetRefuseReason updates an existing applicant.get.refuse.reason record. +func (c *Client) UpdateApplicantGetRefuseReason(agrr *ApplicantGetRefuseReason) error { + return c.UpdateApplicantGetRefuseReasons([]int64{agrr.Id.Get()}, agrr) +} + +// UpdateApplicantGetRefuseReasons updates existing applicant.get.refuse.reason records. +// All records (represented by ids) will be updated by agrr values. +func (c *Client) UpdateApplicantGetRefuseReasons(ids []int64, agrr *ApplicantGetRefuseReason) error { + return c.Update(ApplicantGetRefuseReasonModel, ids, agrr, nil) +} + +// DeleteApplicantGetRefuseReason deletes an existing applicant.get.refuse.reason record. +func (c *Client) DeleteApplicantGetRefuseReason(id int64) error { + return c.DeleteApplicantGetRefuseReasons([]int64{id}) +} + +// DeleteApplicantGetRefuseReasons deletes existing applicant.get.refuse.reason records. +func (c *Client) DeleteApplicantGetRefuseReasons(ids []int64) error { + return c.Delete(ApplicantGetRefuseReasonModel, ids) +} + +// GetApplicantGetRefuseReason gets applicant.get.refuse.reason existing record. +func (c *Client) GetApplicantGetRefuseReason(id int64) (*ApplicantGetRefuseReason, error) { + agrrs, err := c.GetApplicantGetRefuseReasons([]int64{id}) + if err != nil { + return nil, err + } + return &((*agrrs)[0]), nil +} + +// GetApplicantGetRefuseReasons gets applicant.get.refuse.reason existing records. +func (c *Client) GetApplicantGetRefuseReasons(ids []int64) (*ApplicantGetRefuseReasons, error) { + agrrs := &ApplicantGetRefuseReasons{} + if err := c.Read(ApplicantGetRefuseReasonModel, ids, nil, agrrs); err != nil { + return nil, err + } + return agrrs, nil +} + +// FindApplicantGetRefuseReason finds applicant.get.refuse.reason record by querying it with criteria. +func (c *Client) FindApplicantGetRefuseReason(criteria *Criteria) (*ApplicantGetRefuseReason, error) { + agrrs := &ApplicantGetRefuseReasons{} + if err := c.SearchRead(ApplicantGetRefuseReasonModel, criteria, NewOptions().Limit(1), agrrs); err != nil { + return nil, err + } + return &((*agrrs)[0]), nil +} + +// FindApplicantGetRefuseReasons finds applicant.get.refuse.reason records by querying it +// and filtering it with criteria and options. +func (c *Client) FindApplicantGetRefuseReasons(criteria *Criteria, options *Options) (*ApplicantGetRefuseReasons, error) { + agrrs := &ApplicantGetRefuseReasons{} + if err := c.SearchRead(ApplicantGetRefuseReasonModel, criteria, options, agrrs); err != nil { + return nil, err + } + return agrrs, nil +} + +// FindApplicantGetRefuseReasonIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindApplicantGetRefuseReasonIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ApplicantGetRefuseReasonModel, criteria, options) +} + +// FindApplicantGetRefuseReasonId finds record id by querying it with criteria. +func (c *Client) FindApplicantGetRefuseReasonId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ApplicantGetRefuseReasonModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/applicant_send_mail.go b/applicant_send_mail.go new file mode 100644 index 0000000..dea4c64 --- /dev/null +++ b/applicant_send_mail.go @@ -0,0 +1,127 @@ +package odoo + +// ApplicantSendMail represents applicant.send.mail model. +type ApplicantSendMail struct { + ApplicantIds *Relation `xmlrpc:"applicant_ids,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + AuthorId *Many2One `xmlrpc:"author_id,omitempty"` + Body *String `xmlrpc:"body,omitempty"` + BodyHasTemplateValue *Bool `xmlrpc:"body_has_template_value,omitempty"` + CanEditBody *Bool `xmlrpc:"can_edit_body,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsMailTemplateEditor *Bool `xmlrpc:"is_mail_template_editor,omitempty"` + Lang *String `xmlrpc:"lang,omitempty"` + RenderModel *String `xmlrpc:"render_model,omitempty"` + Subject *String `xmlrpc:"subject,omitempty"` + TemplateId *Many2One `xmlrpc:"template_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ApplicantSendMails represents array of applicant.send.mail model. +type ApplicantSendMails []ApplicantSendMail + +// ApplicantSendMailModel is the odoo model name. +const ApplicantSendMailModel = "applicant.send.mail" + +// Many2One convert ApplicantSendMail to *Many2One. +func (asm *ApplicantSendMail) Many2One() *Many2One { + return NewMany2One(asm.Id.Get(), "") +} + +// CreateApplicantSendMail creates a new applicant.send.mail model and returns its id. +func (c *Client) CreateApplicantSendMail(asm *ApplicantSendMail) (int64, error) { + ids, err := c.CreateApplicantSendMails([]*ApplicantSendMail{asm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateApplicantSendMail creates a new applicant.send.mail model and returns its id. +func (c *Client) CreateApplicantSendMails(asms []*ApplicantSendMail) ([]int64, error) { + var vv []interface{} + for _, v := range asms { + vv = append(vv, v) + } + return c.Create(ApplicantSendMailModel, vv, nil) +} + +// UpdateApplicantSendMail updates an existing applicant.send.mail record. +func (c *Client) UpdateApplicantSendMail(asm *ApplicantSendMail) error { + return c.UpdateApplicantSendMails([]int64{asm.Id.Get()}, asm) +} + +// UpdateApplicantSendMails updates existing applicant.send.mail records. +// All records (represented by ids) will be updated by asm values. +func (c *Client) UpdateApplicantSendMails(ids []int64, asm *ApplicantSendMail) error { + return c.Update(ApplicantSendMailModel, ids, asm, nil) +} + +// DeleteApplicantSendMail deletes an existing applicant.send.mail record. +func (c *Client) DeleteApplicantSendMail(id int64) error { + return c.DeleteApplicantSendMails([]int64{id}) +} + +// DeleteApplicantSendMails deletes existing applicant.send.mail records. +func (c *Client) DeleteApplicantSendMails(ids []int64) error { + return c.Delete(ApplicantSendMailModel, ids) +} + +// GetApplicantSendMail gets applicant.send.mail existing record. +func (c *Client) GetApplicantSendMail(id int64) (*ApplicantSendMail, error) { + asms, err := c.GetApplicantSendMails([]int64{id}) + if err != nil { + return nil, err + } + return &((*asms)[0]), nil +} + +// GetApplicantSendMails gets applicant.send.mail existing records. +func (c *Client) GetApplicantSendMails(ids []int64) (*ApplicantSendMails, error) { + asms := &ApplicantSendMails{} + if err := c.Read(ApplicantSendMailModel, ids, nil, asms); err != nil { + return nil, err + } + return asms, nil +} + +// FindApplicantSendMail finds applicant.send.mail record by querying it with criteria. +func (c *Client) FindApplicantSendMail(criteria *Criteria) (*ApplicantSendMail, error) { + asms := &ApplicantSendMails{} + if err := c.SearchRead(ApplicantSendMailModel, criteria, NewOptions().Limit(1), asms); err != nil { + return nil, err + } + return &((*asms)[0]), nil +} + +// FindApplicantSendMails finds applicant.send.mail records by querying it +// and filtering it with criteria and options. +func (c *Client) FindApplicantSendMails(criteria *Criteria, options *Options) (*ApplicantSendMails, error) { + asms := &ApplicantSendMails{} + if err := c.SearchRead(ApplicantSendMailModel, criteria, options, asms); err != nil { + return nil, err + } + return asms, nil +} + +// FindApplicantSendMailIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindApplicantSendMailIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ApplicantSendMailModel, criteria, options) +} + +// FindApplicantSendMailId finds record id by querying it with criteria. +func (c *Client) FindApplicantSendMailId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ApplicantSendMailModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/auth_totp_device.go b/auth_totp_device.go new file mode 100644 index 0000000..8536a0c --- /dev/null +++ b/auth_totp_device.go @@ -0,0 +1,117 @@ +package odoo + +// AuthTotpDevice represents auth_totp.device model. +type AuthTotpDevice struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExpirationDate *Time `xmlrpc:"expiration_date,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Scope *String `xmlrpc:"scope,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` +} + +// AuthTotpDevices represents array of auth_totp.device model. +type AuthTotpDevices []AuthTotpDevice + +// AuthTotpDeviceModel is the odoo model name. +const AuthTotpDeviceModel = "auth_totp.device" + +// Many2One convert AuthTotpDevice to *Many2One. +func (ad *AuthTotpDevice) Many2One() *Many2One { + return NewMany2One(ad.Id.Get(), "") +} + +// CreateAuthTotpDevice creates a new auth_totp.device model and returns its id. +func (c *Client) CreateAuthTotpDevice(ad *AuthTotpDevice) (int64, error) { + ids, err := c.CreateAuthTotpDevices([]*AuthTotpDevice{ad}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAuthTotpDevice creates a new auth_totp.device model and returns its id. +func (c *Client) CreateAuthTotpDevices(ads []*AuthTotpDevice) ([]int64, error) { + var vv []interface{} + for _, v := range ads { + vv = append(vv, v) + } + return c.Create(AuthTotpDeviceModel, vv, nil) +} + +// UpdateAuthTotpDevice updates an existing auth_totp.device record. +func (c *Client) UpdateAuthTotpDevice(ad *AuthTotpDevice) error { + return c.UpdateAuthTotpDevices([]int64{ad.Id.Get()}, ad) +} + +// UpdateAuthTotpDevices updates existing auth_totp.device records. +// All records (represented by ids) will be updated by ad values. +func (c *Client) UpdateAuthTotpDevices(ids []int64, ad *AuthTotpDevice) error { + return c.Update(AuthTotpDeviceModel, ids, ad, nil) +} + +// DeleteAuthTotpDevice deletes an existing auth_totp.device record. +func (c *Client) DeleteAuthTotpDevice(id int64) error { + return c.DeleteAuthTotpDevices([]int64{id}) +} + +// DeleteAuthTotpDevices deletes existing auth_totp.device records. +func (c *Client) DeleteAuthTotpDevices(ids []int64) error { + return c.Delete(AuthTotpDeviceModel, ids) +} + +// GetAuthTotpDevice gets auth_totp.device existing record. +func (c *Client) GetAuthTotpDevice(id int64) (*AuthTotpDevice, error) { + ads, err := c.GetAuthTotpDevices([]int64{id}) + if err != nil { + return nil, err + } + return &((*ads)[0]), nil +} + +// GetAuthTotpDevices gets auth_totp.device existing records. +func (c *Client) GetAuthTotpDevices(ids []int64) (*AuthTotpDevices, error) { + ads := &AuthTotpDevices{} + if err := c.Read(AuthTotpDeviceModel, ids, nil, ads); err != nil { + return nil, err + } + return ads, nil +} + +// FindAuthTotpDevice finds auth_totp.device record by querying it with criteria. +func (c *Client) FindAuthTotpDevice(criteria *Criteria) (*AuthTotpDevice, error) { + ads := &AuthTotpDevices{} + if err := c.SearchRead(AuthTotpDeviceModel, criteria, NewOptions().Limit(1), ads); err != nil { + return nil, err + } + return &((*ads)[0]), nil +} + +// FindAuthTotpDevices finds auth_totp.device records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAuthTotpDevices(criteria *Criteria, options *Options) (*AuthTotpDevices, error) { + ads := &AuthTotpDevices{} + if err := c.SearchRead(AuthTotpDeviceModel, criteria, options, ads); err != nil { + return nil, err + } + return ads, nil +} + +// FindAuthTotpDeviceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAuthTotpDeviceIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AuthTotpDeviceModel, criteria, options) +} + +// FindAuthTotpDeviceId finds record id by querying it with criteria. +func (c *Client) FindAuthTotpDeviceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AuthTotpDeviceModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/auth_totp_wizard.go b/auth_totp_wizard.go new file mode 100644 index 0000000..56c6bff --- /dev/null +++ b/auth_totp_wizard.go @@ -0,0 +1,121 @@ +package odoo + +// AuthTotpWizard represents auth_totp.wizard model. +type AuthTotpWizard struct { + Code *String `xmlrpc:"code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Qrcode *String `xmlrpc:"qrcode,omitempty"` + Secret *String `xmlrpc:"secret,omitempty"` + Url *String `xmlrpc:"url,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// AuthTotpWizards represents array of auth_totp.wizard model. +type AuthTotpWizards []AuthTotpWizard + +// AuthTotpWizardModel is the odoo model name. +const AuthTotpWizardModel = "auth_totp.wizard" + +// Many2One convert AuthTotpWizard to *Many2One. +func (aw *AuthTotpWizard) Many2One() *Many2One { + return NewMany2One(aw.Id.Get(), "") +} + +// CreateAuthTotpWizard creates a new auth_totp.wizard model and returns its id. +func (c *Client) CreateAuthTotpWizard(aw *AuthTotpWizard) (int64, error) { + ids, err := c.CreateAuthTotpWizards([]*AuthTotpWizard{aw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateAuthTotpWizard creates a new auth_totp.wizard model and returns its id. +func (c *Client) CreateAuthTotpWizards(aws []*AuthTotpWizard) ([]int64, error) { + var vv []interface{} + for _, v := range aws { + vv = append(vv, v) + } + return c.Create(AuthTotpWizardModel, vv, nil) +} + +// UpdateAuthTotpWizard updates an existing auth_totp.wizard record. +func (c *Client) UpdateAuthTotpWizard(aw *AuthTotpWizard) error { + return c.UpdateAuthTotpWizards([]int64{aw.Id.Get()}, aw) +} + +// UpdateAuthTotpWizards updates existing auth_totp.wizard records. +// All records (represented by ids) will be updated by aw values. +func (c *Client) UpdateAuthTotpWizards(ids []int64, aw *AuthTotpWizard) error { + return c.Update(AuthTotpWizardModel, ids, aw, nil) +} + +// DeleteAuthTotpWizard deletes an existing auth_totp.wizard record. +func (c *Client) DeleteAuthTotpWizard(id int64) error { + return c.DeleteAuthTotpWizards([]int64{id}) +} + +// DeleteAuthTotpWizards deletes existing auth_totp.wizard records. +func (c *Client) DeleteAuthTotpWizards(ids []int64) error { + return c.Delete(AuthTotpWizardModel, ids) +} + +// GetAuthTotpWizard gets auth_totp.wizard existing record. +func (c *Client) GetAuthTotpWizard(id int64) (*AuthTotpWizard, error) { + aws, err := c.GetAuthTotpWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*aws)[0]), nil +} + +// GetAuthTotpWizards gets auth_totp.wizard existing records. +func (c *Client) GetAuthTotpWizards(ids []int64) (*AuthTotpWizards, error) { + aws := &AuthTotpWizards{} + if err := c.Read(AuthTotpWizardModel, ids, nil, aws); err != nil { + return nil, err + } + return aws, nil +} + +// FindAuthTotpWizard finds auth_totp.wizard record by querying it with criteria. +func (c *Client) FindAuthTotpWizard(criteria *Criteria) (*AuthTotpWizard, error) { + aws := &AuthTotpWizards{} + if err := c.SearchRead(AuthTotpWizardModel, criteria, NewOptions().Limit(1), aws); err != nil { + return nil, err + } + return &((*aws)[0]), nil +} + +// FindAuthTotpWizards finds auth_totp.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindAuthTotpWizards(criteria *Criteria, options *Options) (*AuthTotpWizards, error) { + aws := &AuthTotpWizards{} + if err := c.SearchRead(AuthTotpWizardModel, criteria, options, aws); err != nil { + return nil, err + } + return aws, nil +} + +// FindAuthTotpWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindAuthTotpWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(AuthTotpWizardModel, criteria, options) +} + +// FindAuthTotpWizardId finds record id by querying it with criteria. +func (c *Client) FindAuthTotpWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(AuthTotpWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/base_document_layout.go b/base_document_layout.go new file mode 100644 index 0000000..16b63d3 --- /dev/null +++ b/base_document_layout.go @@ -0,0 +1,155 @@ +package odoo + +// BaseDocumentLayout represents base.document.layout model. +type BaseDocumentLayout struct { + AccountFiscalCountryId *Many2One `xmlrpc:"account_fiscal_country_id,omitempty"` + AccountNumber *String `xmlrpc:"account_number,omitempty"` + BankIds *Relation `xmlrpc:"bank_ids,omitempty"` + City *String `xmlrpc:"city,omitempty"` + CompanyDetails *String `xmlrpc:"company_details,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanyRegistry *String `xmlrpc:"company_registry,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CustomColors *Bool `xmlrpc:"custom_colors,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + ExternalReportLayoutId *Many2One `xmlrpc:"external_report_layout_id,omitempty"` + Font *Selection `xmlrpc:"font,omitempty"` + FromInvoice *Bool `xmlrpc:"from_invoice,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsCompanyDetailsEmpty *Bool `xmlrpc:"is_company_details_empty,omitempty"` + L10NDin5008DeliveryDate *Time `xmlrpc:"l10n_din5008_delivery_date,omitempty"` + L10NDin5008DueDate *Time `xmlrpc:"l10n_din5008_due_date,omitempty"` + L10NDin5008InvoiceDate *Time `xmlrpc:"l10n_din5008_invoice_date,omitempty"` + LayoutBackground *Selection `xmlrpc:"layout_background,omitempty"` + LayoutBackgroundImage *String `xmlrpc:"layout_background_image,omitempty"` + Logo *String `xmlrpc:"logo,omitempty"` + LogoPrimaryColor *String `xmlrpc:"logo_primary_color,omitempty"` + LogoSecondaryColor *String `xmlrpc:"logo_secondary_color,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PaperformatId *Many2One `xmlrpc:"paperformat_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + Phone *String `xmlrpc:"phone,omitempty"` + Preview *String `xmlrpc:"preview,omitempty"` + PreviewLogo *String `xmlrpc:"preview_logo,omitempty"` + PrimaryColor *String `xmlrpc:"primary_color,omitempty"` + QrCode *Bool `xmlrpc:"qr_code,omitempty"` + ReportFooter *String `xmlrpc:"report_footer,omitempty"` + ReportHeader *String `xmlrpc:"report_header,omitempty"` + ReportLayoutId *Many2One `xmlrpc:"report_layout_id,omitempty"` + SecondaryColor *String `xmlrpc:"secondary_color,omitempty"` + Street *String `xmlrpc:"street,omitempty"` + Street2 *String `xmlrpc:"street2,omitempty"` + Vat *String `xmlrpc:"vat,omitempty"` + Website *String `xmlrpc:"website,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + Zip *String `xmlrpc:"zip,omitempty"` +} + +// BaseDocumentLayouts represents array of base.document.layout model. +type BaseDocumentLayouts []BaseDocumentLayout + +// BaseDocumentLayoutModel is the odoo model name. +const BaseDocumentLayoutModel = "base.document.layout" + +// Many2One convert BaseDocumentLayout to *Many2One. +func (bdl *BaseDocumentLayout) Many2One() *Many2One { + return NewMany2One(bdl.Id.Get(), "") +} + +// CreateBaseDocumentLayout creates a new base.document.layout model and returns its id. +func (c *Client) CreateBaseDocumentLayout(bdl *BaseDocumentLayout) (int64, error) { + ids, err := c.CreateBaseDocumentLayouts([]*BaseDocumentLayout{bdl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBaseDocumentLayout creates a new base.document.layout model and returns its id. +func (c *Client) CreateBaseDocumentLayouts(bdls []*BaseDocumentLayout) ([]int64, error) { + var vv []interface{} + for _, v := range bdls { + vv = append(vv, v) + } + return c.Create(BaseDocumentLayoutModel, vv, nil) +} + +// UpdateBaseDocumentLayout updates an existing base.document.layout record. +func (c *Client) UpdateBaseDocumentLayout(bdl *BaseDocumentLayout) error { + return c.UpdateBaseDocumentLayouts([]int64{bdl.Id.Get()}, bdl) +} + +// UpdateBaseDocumentLayouts updates existing base.document.layout records. +// All records (represented by ids) will be updated by bdl values. +func (c *Client) UpdateBaseDocumentLayouts(ids []int64, bdl *BaseDocumentLayout) error { + return c.Update(BaseDocumentLayoutModel, ids, bdl, nil) +} + +// DeleteBaseDocumentLayout deletes an existing base.document.layout record. +func (c *Client) DeleteBaseDocumentLayout(id int64) error { + return c.DeleteBaseDocumentLayouts([]int64{id}) +} + +// DeleteBaseDocumentLayouts deletes existing base.document.layout records. +func (c *Client) DeleteBaseDocumentLayouts(ids []int64) error { + return c.Delete(BaseDocumentLayoutModel, ids) +} + +// GetBaseDocumentLayout gets base.document.layout existing record. +func (c *Client) GetBaseDocumentLayout(id int64) (*BaseDocumentLayout, error) { + bdls, err := c.GetBaseDocumentLayouts([]int64{id}) + if err != nil { + return nil, err + } + return &((*bdls)[0]), nil +} + +// GetBaseDocumentLayouts gets base.document.layout existing records. +func (c *Client) GetBaseDocumentLayouts(ids []int64) (*BaseDocumentLayouts, error) { + bdls := &BaseDocumentLayouts{} + if err := c.Read(BaseDocumentLayoutModel, ids, nil, bdls); err != nil { + return nil, err + } + return bdls, nil +} + +// FindBaseDocumentLayout finds base.document.layout record by querying it with criteria. +func (c *Client) FindBaseDocumentLayout(criteria *Criteria) (*BaseDocumentLayout, error) { + bdls := &BaseDocumentLayouts{} + if err := c.SearchRead(BaseDocumentLayoutModel, criteria, NewOptions().Limit(1), bdls); err != nil { + return nil, err + } + return &((*bdls)[0]), nil +} + +// FindBaseDocumentLayouts finds base.document.layout records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseDocumentLayouts(criteria *Criteria, options *Options) (*BaseDocumentLayouts, error) { + bdls := &BaseDocumentLayouts{} + if err := c.SearchRead(BaseDocumentLayoutModel, criteria, options, bdls); err != nil { + return nil, err + } + return bdls, nil +} + +// FindBaseDocumentLayoutIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseDocumentLayoutIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BaseDocumentLayoutModel, criteria, options) +} + +// FindBaseDocumentLayoutId finds record id by querying it with criteria. +func (c *Client) FindBaseDocumentLayoutId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseDocumentLayoutModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/base_enable_profiling_wizard.go b/base_enable_profiling_wizard.go new file mode 100644 index 0000000..afa4c30 --- /dev/null +++ b/base_enable_profiling_wizard.go @@ -0,0 +1,118 @@ +package odoo + +// BaseEnableProfilingWizard represents base.enable.profiling.wizard model. +type BaseEnableProfilingWizard struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Duration *Selection `xmlrpc:"duration,omitempty"` + Expiration *Time `xmlrpc:"expiration,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseEnableProfilingWizards represents array of base.enable.profiling.wizard model. +type BaseEnableProfilingWizards []BaseEnableProfilingWizard + +// BaseEnableProfilingWizardModel is the odoo model name. +const BaseEnableProfilingWizardModel = "base.enable.profiling.wizard" + +// Many2One convert BaseEnableProfilingWizard to *Many2One. +func (bepw *BaseEnableProfilingWizard) Many2One() *Many2One { + return NewMany2One(bepw.Id.Get(), "") +} + +// CreateBaseEnableProfilingWizard creates a new base.enable.profiling.wizard model and returns its id. +func (c *Client) CreateBaseEnableProfilingWizard(bepw *BaseEnableProfilingWizard) (int64, error) { + ids, err := c.CreateBaseEnableProfilingWizards([]*BaseEnableProfilingWizard{bepw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBaseEnableProfilingWizard creates a new base.enable.profiling.wizard model and returns its id. +func (c *Client) CreateBaseEnableProfilingWizards(bepws []*BaseEnableProfilingWizard) ([]int64, error) { + var vv []interface{} + for _, v := range bepws { + vv = append(vv, v) + } + return c.Create(BaseEnableProfilingWizardModel, vv, nil) +} + +// UpdateBaseEnableProfilingWizard updates an existing base.enable.profiling.wizard record. +func (c *Client) UpdateBaseEnableProfilingWizard(bepw *BaseEnableProfilingWizard) error { + return c.UpdateBaseEnableProfilingWizards([]int64{bepw.Id.Get()}, bepw) +} + +// UpdateBaseEnableProfilingWizards updates existing base.enable.profiling.wizard records. +// All records (represented by ids) will be updated by bepw values. +func (c *Client) UpdateBaseEnableProfilingWizards(ids []int64, bepw *BaseEnableProfilingWizard) error { + return c.Update(BaseEnableProfilingWizardModel, ids, bepw, nil) +} + +// DeleteBaseEnableProfilingWizard deletes an existing base.enable.profiling.wizard record. +func (c *Client) DeleteBaseEnableProfilingWizard(id int64) error { + return c.DeleteBaseEnableProfilingWizards([]int64{id}) +} + +// DeleteBaseEnableProfilingWizards deletes existing base.enable.profiling.wizard records. +func (c *Client) DeleteBaseEnableProfilingWizards(ids []int64) error { + return c.Delete(BaseEnableProfilingWizardModel, ids) +} + +// GetBaseEnableProfilingWizard gets base.enable.profiling.wizard existing record. +func (c *Client) GetBaseEnableProfilingWizard(id int64) (*BaseEnableProfilingWizard, error) { + bepws, err := c.GetBaseEnableProfilingWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*bepws)[0]), nil +} + +// GetBaseEnableProfilingWizards gets base.enable.profiling.wizard existing records. +func (c *Client) GetBaseEnableProfilingWizards(ids []int64) (*BaseEnableProfilingWizards, error) { + bepws := &BaseEnableProfilingWizards{} + if err := c.Read(BaseEnableProfilingWizardModel, ids, nil, bepws); err != nil { + return nil, err + } + return bepws, nil +} + +// FindBaseEnableProfilingWizard finds base.enable.profiling.wizard record by querying it with criteria. +func (c *Client) FindBaseEnableProfilingWizard(criteria *Criteria) (*BaseEnableProfilingWizard, error) { + bepws := &BaseEnableProfilingWizards{} + if err := c.SearchRead(BaseEnableProfilingWizardModel, criteria, NewOptions().Limit(1), bepws); err != nil { + return nil, err + } + return &((*bepws)[0]), nil +} + +// FindBaseEnableProfilingWizards finds base.enable.profiling.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseEnableProfilingWizards(criteria *Criteria, options *Options) (*BaseEnableProfilingWizards, error) { + bepws := &BaseEnableProfilingWizards{} + if err := c.SearchRead(BaseEnableProfilingWizardModel, criteria, options, bepws); err != nil { + return nil, err + } + return bepws, nil +} + +// FindBaseEnableProfilingWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseEnableProfilingWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BaseEnableProfilingWizardModel, criteria, options) +} + +// FindBaseEnableProfilingWizardId finds record id by querying it with criteria. +func (c *Client) FindBaseEnableProfilingWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseEnableProfilingWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/base_import_import.go b/base_import_import.go new file mode 100644 index 0000000..d4f172e --- /dev/null +++ b/base_import_import.go @@ -0,0 +1,120 @@ +package odoo + +// BaseImportImport represents base_import.import model. +type BaseImportImport struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + File *String `xmlrpc:"file,omitempty"` + FileName *String `xmlrpc:"file_name,omitempty"` + FileType *String `xmlrpc:"file_type,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseImportImports represents array of base_import.import model. +type BaseImportImports []BaseImportImport + +// BaseImportImportModel is the odoo model name. +const BaseImportImportModel = "base_import.import" + +// Many2One convert BaseImportImport to *Many2One. +func (bi *BaseImportImport) Many2One() *Many2One { + return NewMany2One(bi.Id.Get(), "") +} + +// CreateBaseImportImport creates a new base_import.import model and returns its id. +func (c *Client) CreateBaseImportImport(bi *BaseImportImport) (int64, error) { + ids, err := c.CreateBaseImportImports([]*BaseImportImport{bi}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBaseImportImport creates a new base_import.import model and returns its id. +func (c *Client) CreateBaseImportImports(bis []*BaseImportImport) ([]int64, error) { + var vv []interface{} + for _, v := range bis { + vv = append(vv, v) + } + return c.Create(BaseImportImportModel, vv, nil) +} + +// UpdateBaseImportImport updates an existing base_import.import record. +func (c *Client) UpdateBaseImportImport(bi *BaseImportImport) error { + return c.UpdateBaseImportImports([]int64{bi.Id.Get()}, bi) +} + +// UpdateBaseImportImports updates existing base_import.import records. +// All records (represented by ids) will be updated by bi values. +func (c *Client) UpdateBaseImportImports(ids []int64, bi *BaseImportImport) error { + return c.Update(BaseImportImportModel, ids, bi, nil) +} + +// DeleteBaseImportImport deletes an existing base_import.import record. +func (c *Client) DeleteBaseImportImport(id int64) error { + return c.DeleteBaseImportImports([]int64{id}) +} + +// DeleteBaseImportImports deletes existing base_import.import records. +func (c *Client) DeleteBaseImportImports(ids []int64) error { + return c.Delete(BaseImportImportModel, ids) +} + +// GetBaseImportImport gets base_import.import existing record. +func (c *Client) GetBaseImportImport(id int64) (*BaseImportImport, error) { + bis, err := c.GetBaseImportImports([]int64{id}) + if err != nil { + return nil, err + } + return &((*bis)[0]), nil +} + +// GetBaseImportImports gets base_import.import existing records. +func (c *Client) GetBaseImportImports(ids []int64) (*BaseImportImports, error) { + bis := &BaseImportImports{} + if err := c.Read(BaseImportImportModel, ids, nil, bis); err != nil { + return nil, err + } + return bis, nil +} + +// FindBaseImportImport finds base_import.import record by querying it with criteria. +func (c *Client) FindBaseImportImport(criteria *Criteria) (*BaseImportImport, error) { + bis := &BaseImportImports{} + if err := c.SearchRead(BaseImportImportModel, criteria, NewOptions().Limit(1), bis); err != nil { + return nil, err + } + return &((*bis)[0]), nil +} + +// FindBaseImportImports finds base_import.import records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportImports(criteria *Criteria, options *Options) (*BaseImportImports, error) { + bis := &BaseImportImports{} + if err := c.SearchRead(BaseImportImportModel, criteria, options, bis); err != nil { + return nil, err + } + return bis, nil +} + +// FindBaseImportImportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportImportIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BaseImportImportModel, criteria, options) +} + +// FindBaseImportImportId finds record id by querying it with criteria. +func (c *Client) FindBaseImportImportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseImportImportModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/base_import_mapping.go b/base_import_mapping.go new file mode 100644 index 0000000..ead2a2f --- /dev/null +++ b/base_import_mapping.go @@ -0,0 +1,119 @@ +package odoo + +// BaseImportMapping represents base_import.mapping model. +type BaseImportMapping struct { + ColumnName *String `xmlrpc:"column_name,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FieldName *String `xmlrpc:"field_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseImportMappings represents array of base_import.mapping model. +type BaseImportMappings []BaseImportMapping + +// BaseImportMappingModel is the odoo model name. +const BaseImportMappingModel = "base_import.mapping" + +// Many2One convert BaseImportMapping to *Many2One. +func (bm *BaseImportMapping) Many2One() *Many2One { + return NewMany2One(bm.Id.Get(), "") +} + +// CreateBaseImportMapping creates a new base_import.mapping model and returns its id. +func (c *Client) CreateBaseImportMapping(bm *BaseImportMapping) (int64, error) { + ids, err := c.CreateBaseImportMappings([]*BaseImportMapping{bm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBaseImportMapping creates a new base_import.mapping model and returns its id. +func (c *Client) CreateBaseImportMappings(bms []*BaseImportMapping) ([]int64, error) { + var vv []interface{} + for _, v := range bms { + vv = append(vv, v) + } + return c.Create(BaseImportMappingModel, vv, nil) +} + +// UpdateBaseImportMapping updates an existing base_import.mapping record. +func (c *Client) UpdateBaseImportMapping(bm *BaseImportMapping) error { + return c.UpdateBaseImportMappings([]int64{bm.Id.Get()}, bm) +} + +// UpdateBaseImportMappings updates existing base_import.mapping records. +// All records (represented by ids) will be updated by bm values. +func (c *Client) UpdateBaseImportMappings(ids []int64, bm *BaseImportMapping) error { + return c.Update(BaseImportMappingModel, ids, bm, nil) +} + +// DeleteBaseImportMapping deletes an existing base_import.mapping record. +func (c *Client) DeleteBaseImportMapping(id int64) error { + return c.DeleteBaseImportMappings([]int64{id}) +} + +// DeleteBaseImportMappings deletes existing base_import.mapping records. +func (c *Client) DeleteBaseImportMappings(ids []int64) error { + return c.Delete(BaseImportMappingModel, ids) +} + +// GetBaseImportMapping gets base_import.mapping existing record. +func (c *Client) GetBaseImportMapping(id int64) (*BaseImportMapping, error) { + bms, err := c.GetBaseImportMappings([]int64{id}) + if err != nil { + return nil, err + } + return &((*bms)[0]), nil +} + +// GetBaseImportMappings gets base_import.mapping existing records. +func (c *Client) GetBaseImportMappings(ids []int64) (*BaseImportMappings, error) { + bms := &BaseImportMappings{} + if err := c.Read(BaseImportMappingModel, ids, nil, bms); err != nil { + return nil, err + } + return bms, nil +} + +// FindBaseImportMapping finds base_import.mapping record by querying it with criteria. +func (c *Client) FindBaseImportMapping(criteria *Criteria) (*BaseImportMapping, error) { + bms := &BaseImportMappings{} + if err := c.SearchRead(BaseImportMappingModel, criteria, NewOptions().Limit(1), bms); err != nil { + return nil, err + } + return &((*bms)[0]), nil +} + +// FindBaseImportMappings finds base_import.mapping records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportMappings(criteria *Criteria, options *Options) (*BaseImportMappings, error) { + bms := &BaseImportMappings{} + if err := c.SearchRead(BaseImportMappingModel, criteria, options, bms); err != nil { + return nil, err + } + return bms, nil +} + +// FindBaseImportMappingIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportMappingIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BaseImportMappingModel, criteria, options) +} + +// FindBaseImportMappingId finds record id by querying it with criteria. +func (c *Client) FindBaseImportMappingId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseImportMappingModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/base_import_module.go b/base_import_module.go new file mode 100644 index 0000000..424101e --- /dev/null +++ b/base_import_module.go @@ -0,0 +1,122 @@ +package odoo + +// BaseImportModule represents base.import.module model. +type BaseImportModule struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Force *Bool `xmlrpc:"force,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ImportMessage *String `xmlrpc:"import_message,omitempty"` + ModuleFile *String `xmlrpc:"module_file,omitempty"` + ModulesDependencies *String `xmlrpc:"modules_dependencies,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + WithDemo *Bool `xmlrpc:"with_demo,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseImportModules represents array of base.import.module model. +type BaseImportModules []BaseImportModule + +// BaseImportModuleModel is the odoo model name. +const BaseImportModuleModel = "base.import.module" + +// Many2One convert BaseImportModule to *Many2One. +func (bim *BaseImportModule) Many2One() *Many2One { + return NewMany2One(bim.Id.Get(), "") +} + +// CreateBaseImportModule creates a new base.import.module model and returns its id. +func (c *Client) CreateBaseImportModule(bim *BaseImportModule) (int64, error) { + ids, err := c.CreateBaseImportModules([]*BaseImportModule{bim}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBaseImportModule creates a new base.import.module model and returns its id. +func (c *Client) CreateBaseImportModules(bims []*BaseImportModule) ([]int64, error) { + var vv []interface{} + for _, v := range bims { + vv = append(vv, v) + } + return c.Create(BaseImportModuleModel, vv, nil) +} + +// UpdateBaseImportModule updates an existing base.import.module record. +func (c *Client) UpdateBaseImportModule(bim *BaseImportModule) error { + return c.UpdateBaseImportModules([]int64{bim.Id.Get()}, bim) +} + +// UpdateBaseImportModules updates existing base.import.module records. +// All records (represented by ids) will be updated by bim values. +func (c *Client) UpdateBaseImportModules(ids []int64, bim *BaseImportModule) error { + return c.Update(BaseImportModuleModel, ids, bim, nil) +} + +// DeleteBaseImportModule deletes an existing base.import.module record. +func (c *Client) DeleteBaseImportModule(id int64) error { + return c.DeleteBaseImportModules([]int64{id}) +} + +// DeleteBaseImportModules deletes existing base.import.module records. +func (c *Client) DeleteBaseImportModules(ids []int64) error { + return c.Delete(BaseImportModuleModel, ids) +} + +// GetBaseImportModule gets base.import.module existing record. +func (c *Client) GetBaseImportModule(id int64) (*BaseImportModule, error) { + bims, err := c.GetBaseImportModules([]int64{id}) + if err != nil { + return nil, err + } + return &((*bims)[0]), nil +} + +// GetBaseImportModules gets base.import.module existing records. +func (c *Client) GetBaseImportModules(ids []int64) (*BaseImportModules, error) { + bims := &BaseImportModules{} + if err := c.Read(BaseImportModuleModel, ids, nil, bims); err != nil { + return nil, err + } + return bims, nil +} + +// FindBaseImportModule finds base.import.module record by querying it with criteria. +func (c *Client) FindBaseImportModule(criteria *Criteria) (*BaseImportModule, error) { + bims := &BaseImportModules{} + if err := c.SearchRead(BaseImportModuleModel, criteria, NewOptions().Limit(1), bims); err != nil { + return nil, err + } + return &((*bims)[0]), nil +} + +// FindBaseImportModules finds base.import.module records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportModules(criteria *Criteria, options *Options) (*BaseImportModules, error) { + bims := &BaseImportModules{} + if err := c.SearchRead(BaseImportModuleModel, criteria, options, bims); err != nil { + return nil, err + } + return bims, nil +} + +// FindBaseImportModuleIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseImportModuleIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BaseImportModuleModel, criteria, options) +} + +// FindBaseImportModuleId finds record id by querying it with criteria. +func (c *Client) FindBaseImportModuleId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseImportModuleModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/base_language_export.go b/base_language_export.go new file mode 100644 index 0000000..4b0c806 --- /dev/null +++ b/base_language_export.go @@ -0,0 +1,126 @@ +package odoo + +// BaseLanguageExport represents base.language.export model. +type BaseLanguageExport struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Data *String `xmlrpc:"data,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Domain *String `xmlrpc:"domain,omitempty"` + ExportType *Selection `xmlrpc:"export_type,omitempty"` + Format *Selection `xmlrpc:"format,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Lang *Selection `xmlrpc:"lang,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + ModelName *String `xmlrpc:"model_name,omitempty"` + Modules *Relation `xmlrpc:"modules,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseLanguageExports represents array of base.language.export model. +type BaseLanguageExports []BaseLanguageExport + +// BaseLanguageExportModel is the odoo model name. +const BaseLanguageExportModel = "base.language.export" + +// Many2One convert BaseLanguageExport to *Many2One. +func (ble *BaseLanguageExport) Many2One() *Many2One { + return NewMany2One(ble.Id.Get(), "") +} + +// CreateBaseLanguageExport creates a new base.language.export model and returns its id. +func (c *Client) CreateBaseLanguageExport(ble *BaseLanguageExport) (int64, error) { + ids, err := c.CreateBaseLanguageExports([]*BaseLanguageExport{ble}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBaseLanguageExport creates a new base.language.export model and returns its id. +func (c *Client) CreateBaseLanguageExports(bles []*BaseLanguageExport) ([]int64, error) { + var vv []interface{} + for _, v := range bles { + vv = append(vv, v) + } + return c.Create(BaseLanguageExportModel, vv, nil) +} + +// UpdateBaseLanguageExport updates an existing base.language.export record. +func (c *Client) UpdateBaseLanguageExport(ble *BaseLanguageExport) error { + return c.UpdateBaseLanguageExports([]int64{ble.Id.Get()}, ble) +} + +// UpdateBaseLanguageExports updates existing base.language.export records. +// All records (represented by ids) will be updated by ble values. +func (c *Client) UpdateBaseLanguageExports(ids []int64, ble *BaseLanguageExport) error { + return c.Update(BaseLanguageExportModel, ids, ble, nil) +} + +// DeleteBaseLanguageExport deletes an existing base.language.export record. +func (c *Client) DeleteBaseLanguageExport(id int64) error { + return c.DeleteBaseLanguageExports([]int64{id}) +} + +// DeleteBaseLanguageExports deletes existing base.language.export records. +func (c *Client) DeleteBaseLanguageExports(ids []int64) error { + return c.Delete(BaseLanguageExportModel, ids) +} + +// GetBaseLanguageExport gets base.language.export existing record. +func (c *Client) GetBaseLanguageExport(id int64) (*BaseLanguageExport, error) { + bles, err := c.GetBaseLanguageExports([]int64{id}) + if err != nil { + return nil, err + } + return &((*bles)[0]), nil +} + +// GetBaseLanguageExports gets base.language.export existing records. +func (c *Client) GetBaseLanguageExports(ids []int64) (*BaseLanguageExports, error) { + bles := &BaseLanguageExports{} + if err := c.Read(BaseLanguageExportModel, ids, nil, bles); err != nil { + return nil, err + } + return bles, nil +} + +// FindBaseLanguageExport finds base.language.export record by querying it with criteria. +func (c *Client) FindBaseLanguageExport(criteria *Criteria) (*BaseLanguageExport, error) { + bles := &BaseLanguageExports{} + if err := c.SearchRead(BaseLanguageExportModel, criteria, NewOptions().Limit(1), bles); err != nil { + return nil, err + } + return &((*bles)[0]), nil +} + +// FindBaseLanguageExports finds base.language.export records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseLanguageExports(criteria *Criteria, options *Options) (*BaseLanguageExports, error) { + bles := &BaseLanguageExports{} + if err := c.SearchRead(BaseLanguageExportModel, criteria, options, bles); err != nil { + return nil, err + } + return bles, nil +} + +// FindBaseLanguageExportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseLanguageExportIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BaseLanguageExportModel, criteria, options) +} + +// FindBaseLanguageExportId finds record id by querying it with criteria. +func (c *Client) FindBaseLanguageExportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseLanguageExportModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/base_language_import.go b/base_language_import.go new file mode 100644 index 0000000..401b405 --- /dev/null +++ b/base_language_import.go @@ -0,0 +1,121 @@ +package odoo + +// BaseLanguageImport represents base.language.import model. +type BaseLanguageImport struct { + Code *String `xmlrpc:"code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Data *String `xmlrpc:"data,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Filename *String `xmlrpc:"filename,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Overwrite *Bool `xmlrpc:"overwrite,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseLanguageImports represents array of base.language.import model. +type BaseLanguageImports []BaseLanguageImport + +// BaseLanguageImportModel is the odoo model name. +const BaseLanguageImportModel = "base.language.import" + +// Many2One convert BaseLanguageImport to *Many2One. +func (bli *BaseLanguageImport) Many2One() *Many2One { + return NewMany2One(bli.Id.Get(), "") +} + +// CreateBaseLanguageImport creates a new base.language.import model and returns its id. +func (c *Client) CreateBaseLanguageImport(bli *BaseLanguageImport) (int64, error) { + ids, err := c.CreateBaseLanguageImports([]*BaseLanguageImport{bli}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBaseLanguageImport creates a new base.language.import model and returns its id. +func (c *Client) CreateBaseLanguageImports(blis []*BaseLanguageImport) ([]int64, error) { + var vv []interface{} + for _, v := range blis { + vv = append(vv, v) + } + return c.Create(BaseLanguageImportModel, vv, nil) +} + +// UpdateBaseLanguageImport updates an existing base.language.import record. +func (c *Client) UpdateBaseLanguageImport(bli *BaseLanguageImport) error { + return c.UpdateBaseLanguageImports([]int64{bli.Id.Get()}, bli) +} + +// UpdateBaseLanguageImports updates existing base.language.import records. +// All records (represented by ids) will be updated by bli values. +func (c *Client) UpdateBaseLanguageImports(ids []int64, bli *BaseLanguageImport) error { + return c.Update(BaseLanguageImportModel, ids, bli, nil) +} + +// DeleteBaseLanguageImport deletes an existing base.language.import record. +func (c *Client) DeleteBaseLanguageImport(id int64) error { + return c.DeleteBaseLanguageImports([]int64{id}) +} + +// DeleteBaseLanguageImports deletes existing base.language.import records. +func (c *Client) DeleteBaseLanguageImports(ids []int64) error { + return c.Delete(BaseLanguageImportModel, ids) +} + +// GetBaseLanguageImport gets base.language.import existing record. +func (c *Client) GetBaseLanguageImport(id int64) (*BaseLanguageImport, error) { + blis, err := c.GetBaseLanguageImports([]int64{id}) + if err != nil { + return nil, err + } + return &((*blis)[0]), nil +} + +// GetBaseLanguageImports gets base.language.import existing records. +func (c *Client) GetBaseLanguageImports(ids []int64) (*BaseLanguageImports, error) { + blis := &BaseLanguageImports{} + if err := c.Read(BaseLanguageImportModel, ids, nil, blis); err != nil { + return nil, err + } + return blis, nil +} + +// FindBaseLanguageImport finds base.language.import record by querying it with criteria. +func (c *Client) FindBaseLanguageImport(criteria *Criteria) (*BaseLanguageImport, error) { + blis := &BaseLanguageImports{} + if err := c.SearchRead(BaseLanguageImportModel, criteria, NewOptions().Limit(1), blis); err != nil { + return nil, err + } + return &((*blis)[0]), nil +} + +// FindBaseLanguageImports finds base.language.import records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseLanguageImports(criteria *Criteria, options *Options) (*BaseLanguageImports, error) { + blis := &BaseLanguageImports{} + if err := c.SearchRead(BaseLanguageImportModel, criteria, options, blis); err != nil { + return nil, err + } + return blis, nil +} + +// FindBaseLanguageImportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseLanguageImportIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BaseLanguageImportModel, criteria, options) +} + +// FindBaseLanguageImportId finds record id by querying it with criteria. +func (c *Client) FindBaseLanguageImportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseLanguageImportModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/base_language_install.go b/base_language_install.go new file mode 100644 index 0000000..e03a170 --- /dev/null +++ b/base_language_install.go @@ -0,0 +1,119 @@ +package odoo + +// BaseLanguageInstall represents base.language.install model. +type BaseLanguageInstall struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FirstLangId *Many2One `xmlrpc:"first_lang_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LangIds *Relation `xmlrpc:"lang_ids,omitempty"` + Overwrite *Bool `xmlrpc:"overwrite,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseLanguageInstalls represents array of base.language.install model. +type BaseLanguageInstalls []BaseLanguageInstall + +// BaseLanguageInstallModel is the odoo model name. +const BaseLanguageInstallModel = "base.language.install" + +// Many2One convert BaseLanguageInstall to *Many2One. +func (bli *BaseLanguageInstall) Many2One() *Many2One { + return NewMany2One(bli.Id.Get(), "") +} + +// CreateBaseLanguageInstall creates a new base.language.install model and returns its id. +func (c *Client) CreateBaseLanguageInstall(bli *BaseLanguageInstall) (int64, error) { + ids, err := c.CreateBaseLanguageInstalls([]*BaseLanguageInstall{bli}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBaseLanguageInstall creates a new base.language.install model and returns its id. +func (c *Client) CreateBaseLanguageInstalls(blis []*BaseLanguageInstall) ([]int64, error) { + var vv []interface{} + for _, v := range blis { + vv = append(vv, v) + } + return c.Create(BaseLanguageInstallModel, vv, nil) +} + +// UpdateBaseLanguageInstall updates an existing base.language.install record. +func (c *Client) UpdateBaseLanguageInstall(bli *BaseLanguageInstall) error { + return c.UpdateBaseLanguageInstalls([]int64{bli.Id.Get()}, bli) +} + +// UpdateBaseLanguageInstalls updates existing base.language.install records. +// All records (represented by ids) will be updated by bli values. +func (c *Client) UpdateBaseLanguageInstalls(ids []int64, bli *BaseLanguageInstall) error { + return c.Update(BaseLanguageInstallModel, ids, bli, nil) +} + +// DeleteBaseLanguageInstall deletes an existing base.language.install record. +func (c *Client) DeleteBaseLanguageInstall(id int64) error { + return c.DeleteBaseLanguageInstalls([]int64{id}) +} + +// DeleteBaseLanguageInstalls deletes existing base.language.install records. +func (c *Client) DeleteBaseLanguageInstalls(ids []int64) error { + return c.Delete(BaseLanguageInstallModel, ids) +} + +// GetBaseLanguageInstall gets base.language.install existing record. +func (c *Client) GetBaseLanguageInstall(id int64) (*BaseLanguageInstall, error) { + blis, err := c.GetBaseLanguageInstalls([]int64{id}) + if err != nil { + return nil, err + } + return &((*blis)[0]), nil +} + +// GetBaseLanguageInstalls gets base.language.install existing records. +func (c *Client) GetBaseLanguageInstalls(ids []int64) (*BaseLanguageInstalls, error) { + blis := &BaseLanguageInstalls{} + if err := c.Read(BaseLanguageInstallModel, ids, nil, blis); err != nil { + return nil, err + } + return blis, nil +} + +// FindBaseLanguageInstall finds base.language.install record by querying it with criteria. +func (c *Client) FindBaseLanguageInstall(criteria *Criteria) (*BaseLanguageInstall, error) { + blis := &BaseLanguageInstalls{} + if err := c.SearchRead(BaseLanguageInstallModel, criteria, NewOptions().Limit(1), blis); err != nil { + return nil, err + } + return &((*blis)[0]), nil +} + +// FindBaseLanguageInstalls finds base.language.install records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseLanguageInstalls(criteria *Criteria, options *Options) (*BaseLanguageInstalls, error) { + blis := &BaseLanguageInstalls{} + if err := c.SearchRead(BaseLanguageInstallModel, criteria, options, blis); err != nil { + return nil, err + } + return blis, nil +} + +// FindBaseLanguageInstallIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseLanguageInstallIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BaseLanguageInstallModel, criteria, options) +} + +// FindBaseLanguageInstallId finds record id by querying it with criteria. +func (c *Client) FindBaseLanguageInstallId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseLanguageInstallModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/base_module_install_request.go b/base_module_install_request.go new file mode 100644 index 0000000..ccc8225 --- /dev/null +++ b/base_module_install_request.go @@ -0,0 +1,120 @@ +package odoo + +// BaseModuleInstallRequest represents base.module.install.request model. +type BaseModuleInstallRequest struct { + BodyHtml *String `xmlrpc:"body_html,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ModuleId *Many2One `xmlrpc:"module_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + UserIds *Relation `xmlrpc:"user_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseModuleInstallRequests represents array of base.module.install.request model. +type BaseModuleInstallRequests []BaseModuleInstallRequest + +// BaseModuleInstallRequestModel is the odoo model name. +const BaseModuleInstallRequestModel = "base.module.install.request" + +// Many2One convert BaseModuleInstallRequest to *Many2One. +func (bmir *BaseModuleInstallRequest) Many2One() *Many2One { + return NewMany2One(bmir.Id.Get(), "") +} + +// CreateBaseModuleInstallRequest creates a new base.module.install.request model and returns its id. +func (c *Client) CreateBaseModuleInstallRequest(bmir *BaseModuleInstallRequest) (int64, error) { + ids, err := c.CreateBaseModuleInstallRequests([]*BaseModuleInstallRequest{bmir}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBaseModuleInstallRequest creates a new base.module.install.request model and returns its id. +func (c *Client) CreateBaseModuleInstallRequests(bmirs []*BaseModuleInstallRequest) ([]int64, error) { + var vv []interface{} + for _, v := range bmirs { + vv = append(vv, v) + } + return c.Create(BaseModuleInstallRequestModel, vv, nil) +} + +// UpdateBaseModuleInstallRequest updates an existing base.module.install.request record. +func (c *Client) UpdateBaseModuleInstallRequest(bmir *BaseModuleInstallRequest) error { + return c.UpdateBaseModuleInstallRequests([]int64{bmir.Id.Get()}, bmir) +} + +// UpdateBaseModuleInstallRequests updates existing base.module.install.request records. +// All records (represented by ids) will be updated by bmir values. +func (c *Client) UpdateBaseModuleInstallRequests(ids []int64, bmir *BaseModuleInstallRequest) error { + return c.Update(BaseModuleInstallRequestModel, ids, bmir, nil) +} + +// DeleteBaseModuleInstallRequest deletes an existing base.module.install.request record. +func (c *Client) DeleteBaseModuleInstallRequest(id int64) error { + return c.DeleteBaseModuleInstallRequests([]int64{id}) +} + +// DeleteBaseModuleInstallRequests deletes existing base.module.install.request records. +func (c *Client) DeleteBaseModuleInstallRequests(ids []int64) error { + return c.Delete(BaseModuleInstallRequestModel, ids) +} + +// GetBaseModuleInstallRequest gets base.module.install.request existing record. +func (c *Client) GetBaseModuleInstallRequest(id int64) (*BaseModuleInstallRequest, error) { + bmirs, err := c.GetBaseModuleInstallRequests([]int64{id}) + if err != nil { + return nil, err + } + return &((*bmirs)[0]), nil +} + +// GetBaseModuleInstallRequests gets base.module.install.request existing records. +func (c *Client) GetBaseModuleInstallRequests(ids []int64) (*BaseModuleInstallRequests, error) { + bmirs := &BaseModuleInstallRequests{} + if err := c.Read(BaseModuleInstallRequestModel, ids, nil, bmirs); err != nil { + return nil, err + } + return bmirs, nil +} + +// FindBaseModuleInstallRequest finds base.module.install.request record by querying it with criteria. +func (c *Client) FindBaseModuleInstallRequest(criteria *Criteria) (*BaseModuleInstallRequest, error) { + bmirs := &BaseModuleInstallRequests{} + if err := c.SearchRead(BaseModuleInstallRequestModel, criteria, NewOptions().Limit(1), bmirs); err != nil { + return nil, err + } + return &((*bmirs)[0]), nil +} + +// FindBaseModuleInstallRequests finds base.module.install.request records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseModuleInstallRequests(criteria *Criteria, options *Options) (*BaseModuleInstallRequests, error) { + bmirs := &BaseModuleInstallRequests{} + if err := c.SearchRead(BaseModuleInstallRequestModel, criteria, options, bmirs); err != nil { + return nil, err + } + return bmirs, nil +} + +// FindBaseModuleInstallRequestIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseModuleInstallRequestIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BaseModuleInstallRequestModel, criteria, options) +} + +// FindBaseModuleInstallRequestId finds record id by querying it with criteria. +func (c *Client) FindBaseModuleInstallRequestId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseModuleInstallRequestModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/base_module_install_review.go b/base_module_install_review.go new file mode 100644 index 0000000..77a869f --- /dev/null +++ b/base_module_install_review.go @@ -0,0 +1,119 @@ +package odoo + +// BaseModuleInstallReview represents base.module.install.review model. +type BaseModuleInstallReview struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ModuleId *Many2One `xmlrpc:"module_id,omitempty"` + ModuleIds *Relation `xmlrpc:"module_ids,omitempty"` + ModulesDescription *String `xmlrpc:"modules_description,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseModuleInstallReviews represents array of base.module.install.review model. +type BaseModuleInstallReviews []BaseModuleInstallReview + +// BaseModuleInstallReviewModel is the odoo model name. +const BaseModuleInstallReviewModel = "base.module.install.review" + +// Many2One convert BaseModuleInstallReview to *Many2One. +func (bmir *BaseModuleInstallReview) Many2One() *Many2One { + return NewMany2One(bmir.Id.Get(), "") +} + +// CreateBaseModuleInstallReview creates a new base.module.install.review model and returns its id. +func (c *Client) CreateBaseModuleInstallReview(bmir *BaseModuleInstallReview) (int64, error) { + ids, err := c.CreateBaseModuleInstallReviews([]*BaseModuleInstallReview{bmir}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBaseModuleInstallReview creates a new base.module.install.review model and returns its id. +func (c *Client) CreateBaseModuleInstallReviews(bmirs []*BaseModuleInstallReview) ([]int64, error) { + var vv []interface{} + for _, v := range bmirs { + vv = append(vv, v) + } + return c.Create(BaseModuleInstallReviewModel, vv, nil) +} + +// UpdateBaseModuleInstallReview updates an existing base.module.install.review record. +func (c *Client) UpdateBaseModuleInstallReview(bmir *BaseModuleInstallReview) error { + return c.UpdateBaseModuleInstallReviews([]int64{bmir.Id.Get()}, bmir) +} + +// UpdateBaseModuleInstallReviews updates existing base.module.install.review records. +// All records (represented by ids) will be updated by bmir values. +func (c *Client) UpdateBaseModuleInstallReviews(ids []int64, bmir *BaseModuleInstallReview) error { + return c.Update(BaseModuleInstallReviewModel, ids, bmir, nil) +} + +// DeleteBaseModuleInstallReview deletes an existing base.module.install.review record. +func (c *Client) DeleteBaseModuleInstallReview(id int64) error { + return c.DeleteBaseModuleInstallReviews([]int64{id}) +} + +// DeleteBaseModuleInstallReviews deletes existing base.module.install.review records. +func (c *Client) DeleteBaseModuleInstallReviews(ids []int64) error { + return c.Delete(BaseModuleInstallReviewModel, ids) +} + +// GetBaseModuleInstallReview gets base.module.install.review existing record. +func (c *Client) GetBaseModuleInstallReview(id int64) (*BaseModuleInstallReview, error) { + bmirs, err := c.GetBaseModuleInstallReviews([]int64{id}) + if err != nil { + return nil, err + } + return &((*bmirs)[0]), nil +} + +// GetBaseModuleInstallReviews gets base.module.install.review existing records. +func (c *Client) GetBaseModuleInstallReviews(ids []int64) (*BaseModuleInstallReviews, error) { + bmirs := &BaseModuleInstallReviews{} + if err := c.Read(BaseModuleInstallReviewModel, ids, nil, bmirs); err != nil { + return nil, err + } + return bmirs, nil +} + +// FindBaseModuleInstallReview finds base.module.install.review record by querying it with criteria. +func (c *Client) FindBaseModuleInstallReview(criteria *Criteria) (*BaseModuleInstallReview, error) { + bmirs := &BaseModuleInstallReviews{} + if err := c.SearchRead(BaseModuleInstallReviewModel, criteria, NewOptions().Limit(1), bmirs); err != nil { + return nil, err + } + return &((*bmirs)[0]), nil +} + +// FindBaseModuleInstallReviews finds base.module.install.review records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseModuleInstallReviews(criteria *Criteria, options *Options) (*BaseModuleInstallReviews, error) { + bmirs := &BaseModuleInstallReviews{} + if err := c.SearchRead(BaseModuleInstallReviewModel, criteria, options, bmirs); err != nil { + return nil, err + } + return bmirs, nil +} + +// FindBaseModuleInstallReviewIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseModuleInstallReviewIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BaseModuleInstallReviewModel, criteria, options) +} + +// FindBaseModuleInstallReviewId finds record id by querying it with criteria. +func (c *Client) FindBaseModuleInstallReviewId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseModuleInstallReviewModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/base_module_uninstall.go b/base_module_uninstall.go new file mode 100644 index 0000000..7d52e41 --- /dev/null +++ b/base_module_uninstall.go @@ -0,0 +1,120 @@ +package odoo + +// BaseModuleUninstall represents base.module.uninstall model. +type BaseModuleUninstall struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ModelIds *Relation `xmlrpc:"model_ids,omitempty"` + ModuleId *Many2One `xmlrpc:"module_id,omitempty"` + ModuleIds *Relation `xmlrpc:"module_ids,omitempty"` + ShowAll *Bool `xmlrpc:"show_all,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseModuleUninstalls represents array of base.module.uninstall model. +type BaseModuleUninstalls []BaseModuleUninstall + +// BaseModuleUninstallModel is the odoo model name. +const BaseModuleUninstallModel = "base.module.uninstall" + +// Many2One convert BaseModuleUninstall to *Many2One. +func (bmu *BaseModuleUninstall) Many2One() *Many2One { + return NewMany2One(bmu.Id.Get(), "") +} + +// CreateBaseModuleUninstall creates a new base.module.uninstall model and returns its id. +func (c *Client) CreateBaseModuleUninstall(bmu *BaseModuleUninstall) (int64, error) { + ids, err := c.CreateBaseModuleUninstalls([]*BaseModuleUninstall{bmu}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBaseModuleUninstall creates a new base.module.uninstall model and returns its id. +func (c *Client) CreateBaseModuleUninstalls(bmus []*BaseModuleUninstall) ([]int64, error) { + var vv []interface{} + for _, v := range bmus { + vv = append(vv, v) + } + return c.Create(BaseModuleUninstallModel, vv, nil) +} + +// UpdateBaseModuleUninstall updates an existing base.module.uninstall record. +func (c *Client) UpdateBaseModuleUninstall(bmu *BaseModuleUninstall) error { + return c.UpdateBaseModuleUninstalls([]int64{bmu.Id.Get()}, bmu) +} + +// UpdateBaseModuleUninstalls updates existing base.module.uninstall records. +// All records (represented by ids) will be updated by bmu values. +func (c *Client) UpdateBaseModuleUninstalls(ids []int64, bmu *BaseModuleUninstall) error { + return c.Update(BaseModuleUninstallModel, ids, bmu, nil) +} + +// DeleteBaseModuleUninstall deletes an existing base.module.uninstall record. +func (c *Client) DeleteBaseModuleUninstall(id int64) error { + return c.DeleteBaseModuleUninstalls([]int64{id}) +} + +// DeleteBaseModuleUninstalls deletes existing base.module.uninstall records. +func (c *Client) DeleteBaseModuleUninstalls(ids []int64) error { + return c.Delete(BaseModuleUninstallModel, ids) +} + +// GetBaseModuleUninstall gets base.module.uninstall existing record. +func (c *Client) GetBaseModuleUninstall(id int64) (*BaseModuleUninstall, error) { + bmus, err := c.GetBaseModuleUninstalls([]int64{id}) + if err != nil { + return nil, err + } + return &((*bmus)[0]), nil +} + +// GetBaseModuleUninstalls gets base.module.uninstall existing records. +func (c *Client) GetBaseModuleUninstalls(ids []int64) (*BaseModuleUninstalls, error) { + bmus := &BaseModuleUninstalls{} + if err := c.Read(BaseModuleUninstallModel, ids, nil, bmus); err != nil { + return nil, err + } + return bmus, nil +} + +// FindBaseModuleUninstall finds base.module.uninstall record by querying it with criteria. +func (c *Client) FindBaseModuleUninstall(criteria *Criteria) (*BaseModuleUninstall, error) { + bmus := &BaseModuleUninstalls{} + if err := c.SearchRead(BaseModuleUninstallModel, criteria, NewOptions().Limit(1), bmus); err != nil { + return nil, err + } + return &((*bmus)[0]), nil +} + +// FindBaseModuleUninstalls finds base.module.uninstall records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseModuleUninstalls(criteria *Criteria, options *Options) (*BaseModuleUninstalls, error) { + bmus := &BaseModuleUninstalls{} + if err := c.SearchRead(BaseModuleUninstallModel, criteria, options, bmus); err != nil { + return nil, err + } + return bmus, nil +} + +// FindBaseModuleUninstallIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseModuleUninstallIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BaseModuleUninstallModel, criteria, options) +} + +// FindBaseModuleUninstallId finds record id by querying it with criteria. +func (c *Client) FindBaseModuleUninstallId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseModuleUninstallModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/base_module_update.go b/base_module_update.go new file mode 100644 index 0000000..5ea2487 --- /dev/null +++ b/base_module_update.go @@ -0,0 +1,119 @@ +package odoo + +// BaseModuleUpdate represents base.module.update model. +type BaseModuleUpdate struct { + Added *Int `xmlrpc:"added,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + Updated *Int `xmlrpc:"updated,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseModuleUpdates represents array of base.module.update model. +type BaseModuleUpdates []BaseModuleUpdate + +// BaseModuleUpdateModel is the odoo model name. +const BaseModuleUpdateModel = "base.module.update" + +// Many2One convert BaseModuleUpdate to *Many2One. +func (bmu *BaseModuleUpdate) Many2One() *Many2One { + return NewMany2One(bmu.Id.Get(), "") +} + +// CreateBaseModuleUpdate creates a new base.module.update model and returns its id. +func (c *Client) CreateBaseModuleUpdate(bmu *BaseModuleUpdate) (int64, error) { + ids, err := c.CreateBaseModuleUpdates([]*BaseModuleUpdate{bmu}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBaseModuleUpdate creates a new base.module.update model and returns its id. +func (c *Client) CreateBaseModuleUpdates(bmus []*BaseModuleUpdate) ([]int64, error) { + var vv []interface{} + for _, v := range bmus { + vv = append(vv, v) + } + return c.Create(BaseModuleUpdateModel, vv, nil) +} + +// UpdateBaseModuleUpdate updates an existing base.module.update record. +func (c *Client) UpdateBaseModuleUpdate(bmu *BaseModuleUpdate) error { + return c.UpdateBaseModuleUpdates([]int64{bmu.Id.Get()}, bmu) +} + +// UpdateBaseModuleUpdates updates existing base.module.update records. +// All records (represented by ids) will be updated by bmu values. +func (c *Client) UpdateBaseModuleUpdates(ids []int64, bmu *BaseModuleUpdate) error { + return c.Update(BaseModuleUpdateModel, ids, bmu, nil) +} + +// DeleteBaseModuleUpdate deletes an existing base.module.update record. +func (c *Client) DeleteBaseModuleUpdate(id int64) error { + return c.DeleteBaseModuleUpdates([]int64{id}) +} + +// DeleteBaseModuleUpdates deletes existing base.module.update records. +func (c *Client) DeleteBaseModuleUpdates(ids []int64) error { + return c.Delete(BaseModuleUpdateModel, ids) +} + +// GetBaseModuleUpdate gets base.module.update existing record. +func (c *Client) GetBaseModuleUpdate(id int64) (*BaseModuleUpdate, error) { + bmus, err := c.GetBaseModuleUpdates([]int64{id}) + if err != nil { + return nil, err + } + return &((*bmus)[0]), nil +} + +// GetBaseModuleUpdates gets base.module.update existing records. +func (c *Client) GetBaseModuleUpdates(ids []int64) (*BaseModuleUpdates, error) { + bmus := &BaseModuleUpdates{} + if err := c.Read(BaseModuleUpdateModel, ids, nil, bmus); err != nil { + return nil, err + } + return bmus, nil +} + +// FindBaseModuleUpdate finds base.module.update record by querying it with criteria. +func (c *Client) FindBaseModuleUpdate(criteria *Criteria) (*BaseModuleUpdate, error) { + bmus := &BaseModuleUpdates{} + if err := c.SearchRead(BaseModuleUpdateModel, criteria, NewOptions().Limit(1), bmus); err != nil { + return nil, err + } + return &((*bmus)[0]), nil +} + +// FindBaseModuleUpdates finds base.module.update records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseModuleUpdates(criteria *Criteria, options *Options) (*BaseModuleUpdates, error) { + bmus := &BaseModuleUpdates{} + if err := c.SearchRead(BaseModuleUpdateModel, criteria, options, bmus); err != nil { + return nil, err + } + return bmus, nil +} + +// FindBaseModuleUpdateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseModuleUpdateIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BaseModuleUpdateModel, criteria, options) +} + +// FindBaseModuleUpdateId finds record id by querying it with criteria. +func (c *Client) FindBaseModuleUpdateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseModuleUpdateModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/base_module_upgrade.go b/base_module_upgrade.go new file mode 100644 index 0000000..550d6d0 --- /dev/null +++ b/base_module_upgrade.go @@ -0,0 +1,117 @@ +package odoo + +// BaseModuleUpgrade represents base.module.upgrade model. +type BaseModuleUpgrade struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ModuleInfo *String `xmlrpc:"module_info,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BaseModuleUpgrades represents array of base.module.upgrade model. +type BaseModuleUpgrades []BaseModuleUpgrade + +// BaseModuleUpgradeModel is the odoo model name. +const BaseModuleUpgradeModel = "base.module.upgrade" + +// Many2One convert BaseModuleUpgrade to *Many2One. +func (bmu *BaseModuleUpgrade) Many2One() *Many2One { + return NewMany2One(bmu.Id.Get(), "") +} + +// CreateBaseModuleUpgrade creates a new base.module.upgrade model and returns its id. +func (c *Client) CreateBaseModuleUpgrade(bmu *BaseModuleUpgrade) (int64, error) { + ids, err := c.CreateBaseModuleUpgrades([]*BaseModuleUpgrade{bmu}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBaseModuleUpgrade creates a new base.module.upgrade model and returns its id. +func (c *Client) CreateBaseModuleUpgrades(bmus []*BaseModuleUpgrade) ([]int64, error) { + var vv []interface{} + for _, v := range bmus { + vv = append(vv, v) + } + return c.Create(BaseModuleUpgradeModel, vv, nil) +} + +// UpdateBaseModuleUpgrade updates an existing base.module.upgrade record. +func (c *Client) UpdateBaseModuleUpgrade(bmu *BaseModuleUpgrade) error { + return c.UpdateBaseModuleUpgrades([]int64{bmu.Id.Get()}, bmu) +} + +// UpdateBaseModuleUpgrades updates existing base.module.upgrade records. +// All records (represented by ids) will be updated by bmu values. +func (c *Client) UpdateBaseModuleUpgrades(ids []int64, bmu *BaseModuleUpgrade) error { + return c.Update(BaseModuleUpgradeModel, ids, bmu, nil) +} + +// DeleteBaseModuleUpgrade deletes an existing base.module.upgrade record. +func (c *Client) DeleteBaseModuleUpgrade(id int64) error { + return c.DeleteBaseModuleUpgrades([]int64{id}) +} + +// DeleteBaseModuleUpgrades deletes existing base.module.upgrade records. +func (c *Client) DeleteBaseModuleUpgrades(ids []int64) error { + return c.Delete(BaseModuleUpgradeModel, ids) +} + +// GetBaseModuleUpgrade gets base.module.upgrade existing record. +func (c *Client) GetBaseModuleUpgrade(id int64) (*BaseModuleUpgrade, error) { + bmus, err := c.GetBaseModuleUpgrades([]int64{id}) + if err != nil { + return nil, err + } + return &((*bmus)[0]), nil +} + +// GetBaseModuleUpgrades gets base.module.upgrade existing records. +func (c *Client) GetBaseModuleUpgrades(ids []int64) (*BaseModuleUpgrades, error) { + bmus := &BaseModuleUpgrades{} + if err := c.Read(BaseModuleUpgradeModel, ids, nil, bmus); err != nil { + return nil, err + } + return bmus, nil +} + +// FindBaseModuleUpgrade finds base.module.upgrade record by querying it with criteria. +func (c *Client) FindBaseModuleUpgrade(criteria *Criteria) (*BaseModuleUpgrade, error) { + bmus := &BaseModuleUpgrades{} + if err := c.SearchRead(BaseModuleUpgradeModel, criteria, NewOptions().Limit(1), bmus); err != nil { + return nil, err + } + return &((*bmus)[0]), nil +} + +// FindBaseModuleUpgrades finds base.module.upgrade records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseModuleUpgrades(criteria *Criteria, options *Options) (*BaseModuleUpgrades, error) { + bmus := &BaseModuleUpgrades{} + if err := c.SearchRead(BaseModuleUpgradeModel, criteria, options, bmus); err != nil { + return nil, err + } + return bmus, nil +} + +// FindBaseModuleUpgradeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBaseModuleUpgradeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BaseModuleUpgradeModel, criteria, options) +} + +// FindBaseModuleUpgradeId finds record id by querying it with criteria. +func (c *Client) FindBaseModuleUpgradeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BaseModuleUpgradeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/base_partner_merge_automatic_wizard.go b/base_partner_merge_automatic_wizard.go new file mode 100644 index 0000000..53ce157 --- /dev/null +++ b/base_partner_merge_automatic_wizard.go @@ -0,0 +1,130 @@ +package odoo + +// BasePartnerMergeAutomaticWizard represents base.partner.merge.automatic.wizard model. +type BasePartnerMergeAutomaticWizard struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrentLineId *Many2One `xmlrpc:"current_line_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DstPartnerId *Many2One `xmlrpc:"dst_partner_id,omitempty"` + ExcludeContact *Bool `xmlrpc:"exclude_contact,omitempty"` + ExcludeJournalItem *Bool `xmlrpc:"exclude_journal_item,omitempty"` + GroupByEmail *Bool `xmlrpc:"group_by_email,omitempty"` + GroupByIsCompany *Bool `xmlrpc:"group_by_is_company,omitempty"` + GroupByName *Bool `xmlrpc:"group_by_name,omitempty"` + GroupByParentId *Bool `xmlrpc:"group_by_parent_id,omitempty"` + GroupByVat *Bool `xmlrpc:"group_by_vat,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LineIds *Relation `xmlrpc:"line_ids,omitempty"` + MaximumGroup *Int `xmlrpc:"maximum_group,omitempty"` + NumberGroup *Int `xmlrpc:"number_group,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BasePartnerMergeAutomaticWizards represents array of base.partner.merge.automatic.wizard model. +type BasePartnerMergeAutomaticWizards []BasePartnerMergeAutomaticWizard + +// BasePartnerMergeAutomaticWizardModel is the odoo model name. +const BasePartnerMergeAutomaticWizardModel = "base.partner.merge.automatic.wizard" + +// Many2One convert BasePartnerMergeAutomaticWizard to *Many2One. +func (bpmaw *BasePartnerMergeAutomaticWizard) Many2One() *Many2One { + return NewMany2One(bpmaw.Id.Get(), "") +} + +// CreateBasePartnerMergeAutomaticWizard creates a new base.partner.merge.automatic.wizard model and returns its id. +func (c *Client) CreateBasePartnerMergeAutomaticWizard(bpmaw *BasePartnerMergeAutomaticWizard) (int64, error) { + ids, err := c.CreateBasePartnerMergeAutomaticWizards([]*BasePartnerMergeAutomaticWizard{bpmaw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBasePartnerMergeAutomaticWizard creates a new base.partner.merge.automatic.wizard model and returns its id. +func (c *Client) CreateBasePartnerMergeAutomaticWizards(bpmaws []*BasePartnerMergeAutomaticWizard) ([]int64, error) { + var vv []interface{} + for _, v := range bpmaws { + vv = append(vv, v) + } + return c.Create(BasePartnerMergeAutomaticWizardModel, vv, nil) +} + +// UpdateBasePartnerMergeAutomaticWizard updates an existing base.partner.merge.automatic.wizard record. +func (c *Client) UpdateBasePartnerMergeAutomaticWizard(bpmaw *BasePartnerMergeAutomaticWizard) error { + return c.UpdateBasePartnerMergeAutomaticWizards([]int64{bpmaw.Id.Get()}, bpmaw) +} + +// UpdateBasePartnerMergeAutomaticWizards updates existing base.partner.merge.automatic.wizard records. +// All records (represented by ids) will be updated by bpmaw values. +func (c *Client) UpdateBasePartnerMergeAutomaticWizards(ids []int64, bpmaw *BasePartnerMergeAutomaticWizard) error { + return c.Update(BasePartnerMergeAutomaticWizardModel, ids, bpmaw, nil) +} + +// DeleteBasePartnerMergeAutomaticWizard deletes an existing base.partner.merge.automatic.wizard record. +func (c *Client) DeleteBasePartnerMergeAutomaticWizard(id int64) error { + return c.DeleteBasePartnerMergeAutomaticWizards([]int64{id}) +} + +// DeleteBasePartnerMergeAutomaticWizards deletes existing base.partner.merge.automatic.wizard records. +func (c *Client) DeleteBasePartnerMergeAutomaticWizards(ids []int64) error { + return c.Delete(BasePartnerMergeAutomaticWizardModel, ids) +} + +// GetBasePartnerMergeAutomaticWizard gets base.partner.merge.automatic.wizard existing record. +func (c *Client) GetBasePartnerMergeAutomaticWizard(id int64) (*BasePartnerMergeAutomaticWizard, error) { + bpmaws, err := c.GetBasePartnerMergeAutomaticWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*bpmaws)[0]), nil +} + +// GetBasePartnerMergeAutomaticWizards gets base.partner.merge.automatic.wizard existing records. +func (c *Client) GetBasePartnerMergeAutomaticWizards(ids []int64) (*BasePartnerMergeAutomaticWizards, error) { + bpmaws := &BasePartnerMergeAutomaticWizards{} + if err := c.Read(BasePartnerMergeAutomaticWizardModel, ids, nil, bpmaws); err != nil { + return nil, err + } + return bpmaws, nil +} + +// FindBasePartnerMergeAutomaticWizard finds base.partner.merge.automatic.wizard record by querying it with criteria. +func (c *Client) FindBasePartnerMergeAutomaticWizard(criteria *Criteria) (*BasePartnerMergeAutomaticWizard, error) { + bpmaws := &BasePartnerMergeAutomaticWizards{} + if err := c.SearchRead(BasePartnerMergeAutomaticWizardModel, criteria, NewOptions().Limit(1), bpmaws); err != nil { + return nil, err + } + return &((*bpmaws)[0]), nil +} + +// FindBasePartnerMergeAutomaticWizards finds base.partner.merge.automatic.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBasePartnerMergeAutomaticWizards(criteria *Criteria, options *Options) (*BasePartnerMergeAutomaticWizards, error) { + bpmaws := &BasePartnerMergeAutomaticWizards{} + if err := c.SearchRead(BasePartnerMergeAutomaticWizardModel, criteria, options, bpmaws); err != nil { + return nil, err + } + return bpmaws, nil +} + +// FindBasePartnerMergeAutomaticWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBasePartnerMergeAutomaticWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BasePartnerMergeAutomaticWizardModel, criteria, options) +} + +// FindBasePartnerMergeAutomaticWizardId finds record id by querying it with criteria. +func (c *Client) FindBasePartnerMergeAutomaticWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BasePartnerMergeAutomaticWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/base_partner_merge_line.go b/base_partner_merge_line.go new file mode 100644 index 0000000..76708e9 --- /dev/null +++ b/base_partner_merge_line.go @@ -0,0 +1,119 @@ +package odoo + +// BasePartnerMergeLine represents base.partner.merge.line model. +type BasePartnerMergeLine struct { + AggrIds *String `xmlrpc:"aggr_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MinId *Int `xmlrpc:"min_id,omitempty"` + WizardId *Many2One `xmlrpc:"wizard_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BasePartnerMergeLines represents array of base.partner.merge.line model. +type BasePartnerMergeLines []BasePartnerMergeLine + +// BasePartnerMergeLineModel is the odoo model name. +const BasePartnerMergeLineModel = "base.partner.merge.line" + +// Many2One convert BasePartnerMergeLine to *Many2One. +func (bpml *BasePartnerMergeLine) Many2One() *Many2One { + return NewMany2One(bpml.Id.Get(), "") +} + +// CreateBasePartnerMergeLine creates a new base.partner.merge.line model and returns its id. +func (c *Client) CreateBasePartnerMergeLine(bpml *BasePartnerMergeLine) (int64, error) { + ids, err := c.CreateBasePartnerMergeLines([]*BasePartnerMergeLine{bpml}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBasePartnerMergeLine creates a new base.partner.merge.line model and returns its id. +func (c *Client) CreateBasePartnerMergeLines(bpmls []*BasePartnerMergeLine) ([]int64, error) { + var vv []interface{} + for _, v := range bpmls { + vv = append(vv, v) + } + return c.Create(BasePartnerMergeLineModel, vv, nil) +} + +// UpdateBasePartnerMergeLine updates an existing base.partner.merge.line record. +func (c *Client) UpdateBasePartnerMergeLine(bpml *BasePartnerMergeLine) error { + return c.UpdateBasePartnerMergeLines([]int64{bpml.Id.Get()}, bpml) +} + +// UpdateBasePartnerMergeLines updates existing base.partner.merge.line records. +// All records (represented by ids) will be updated by bpml values. +func (c *Client) UpdateBasePartnerMergeLines(ids []int64, bpml *BasePartnerMergeLine) error { + return c.Update(BasePartnerMergeLineModel, ids, bpml, nil) +} + +// DeleteBasePartnerMergeLine deletes an existing base.partner.merge.line record. +func (c *Client) DeleteBasePartnerMergeLine(id int64) error { + return c.DeleteBasePartnerMergeLines([]int64{id}) +} + +// DeleteBasePartnerMergeLines deletes existing base.partner.merge.line records. +func (c *Client) DeleteBasePartnerMergeLines(ids []int64) error { + return c.Delete(BasePartnerMergeLineModel, ids) +} + +// GetBasePartnerMergeLine gets base.partner.merge.line existing record. +func (c *Client) GetBasePartnerMergeLine(id int64) (*BasePartnerMergeLine, error) { + bpmls, err := c.GetBasePartnerMergeLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*bpmls)[0]), nil +} + +// GetBasePartnerMergeLines gets base.partner.merge.line existing records. +func (c *Client) GetBasePartnerMergeLines(ids []int64) (*BasePartnerMergeLines, error) { + bpmls := &BasePartnerMergeLines{} + if err := c.Read(BasePartnerMergeLineModel, ids, nil, bpmls); err != nil { + return nil, err + } + return bpmls, nil +} + +// FindBasePartnerMergeLine finds base.partner.merge.line record by querying it with criteria. +func (c *Client) FindBasePartnerMergeLine(criteria *Criteria) (*BasePartnerMergeLine, error) { + bpmls := &BasePartnerMergeLines{} + if err := c.SearchRead(BasePartnerMergeLineModel, criteria, NewOptions().Limit(1), bpmls); err != nil { + return nil, err + } + return &((*bpmls)[0]), nil +} + +// FindBasePartnerMergeLines finds base.partner.merge.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBasePartnerMergeLines(criteria *Criteria, options *Options) (*BasePartnerMergeLines, error) { + bpmls := &BasePartnerMergeLines{} + if err := c.SearchRead(BasePartnerMergeLineModel, criteria, options, bpmls); err != nil { + return nil, err + } + return bpmls, nil +} + +// FindBasePartnerMergeLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBasePartnerMergeLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BasePartnerMergeLineModel, criteria, options) +} + +// FindBasePartnerMergeLineId finds record id by querying it with criteria. +func (c *Client) FindBasePartnerMergeLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BasePartnerMergeLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/bill_to_po_wizard.go b/bill_to_po_wizard.go new file mode 100644 index 0000000..1c1a711 --- /dev/null +++ b/bill_to_po_wizard.go @@ -0,0 +1,118 @@ +package odoo + +// BillToPoWizard represents bill.to.po.wizard model. +type BillToPoWizard struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PurchaseOrderId *Many2One `xmlrpc:"purchase_order_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BillToPoWizards represents array of bill.to.po.wizard model. +type BillToPoWizards []BillToPoWizard + +// BillToPoWizardModel is the odoo model name. +const BillToPoWizardModel = "bill.to.po.wizard" + +// Many2One convert BillToPoWizard to *Many2One. +func (btpw *BillToPoWizard) Many2One() *Many2One { + return NewMany2One(btpw.Id.Get(), "") +} + +// CreateBillToPoWizard creates a new bill.to.po.wizard model and returns its id. +func (c *Client) CreateBillToPoWizard(btpw *BillToPoWizard) (int64, error) { + ids, err := c.CreateBillToPoWizards([]*BillToPoWizard{btpw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBillToPoWizard creates a new bill.to.po.wizard model and returns its id. +func (c *Client) CreateBillToPoWizards(btpws []*BillToPoWizard) ([]int64, error) { + var vv []interface{} + for _, v := range btpws { + vv = append(vv, v) + } + return c.Create(BillToPoWizardModel, vv, nil) +} + +// UpdateBillToPoWizard updates an existing bill.to.po.wizard record. +func (c *Client) UpdateBillToPoWizard(btpw *BillToPoWizard) error { + return c.UpdateBillToPoWizards([]int64{btpw.Id.Get()}, btpw) +} + +// UpdateBillToPoWizards updates existing bill.to.po.wizard records. +// All records (represented by ids) will be updated by btpw values. +func (c *Client) UpdateBillToPoWizards(ids []int64, btpw *BillToPoWizard) error { + return c.Update(BillToPoWizardModel, ids, btpw, nil) +} + +// DeleteBillToPoWizard deletes an existing bill.to.po.wizard record. +func (c *Client) DeleteBillToPoWizard(id int64) error { + return c.DeleteBillToPoWizards([]int64{id}) +} + +// DeleteBillToPoWizards deletes existing bill.to.po.wizard records. +func (c *Client) DeleteBillToPoWizards(ids []int64) error { + return c.Delete(BillToPoWizardModel, ids) +} + +// GetBillToPoWizard gets bill.to.po.wizard existing record. +func (c *Client) GetBillToPoWizard(id int64) (*BillToPoWizard, error) { + btpws, err := c.GetBillToPoWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*btpws)[0]), nil +} + +// GetBillToPoWizards gets bill.to.po.wizard existing records. +func (c *Client) GetBillToPoWizards(ids []int64) (*BillToPoWizards, error) { + btpws := &BillToPoWizards{} + if err := c.Read(BillToPoWizardModel, ids, nil, btpws); err != nil { + return nil, err + } + return btpws, nil +} + +// FindBillToPoWizard finds bill.to.po.wizard record by querying it with criteria. +func (c *Client) FindBillToPoWizard(criteria *Criteria) (*BillToPoWizard, error) { + btpws := &BillToPoWizards{} + if err := c.SearchRead(BillToPoWizardModel, criteria, NewOptions().Limit(1), btpws); err != nil { + return nil, err + } + return &((*btpws)[0]), nil +} + +// FindBillToPoWizards finds bill.to.po.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBillToPoWizards(criteria *Criteria, options *Options) (*BillToPoWizards, error) { + btpws := &BillToPoWizards{} + if err := c.SearchRead(BillToPoWizardModel, criteria, options, btpws); err != nil { + return nil, err + } + return btpws, nil +} + +// FindBillToPoWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBillToPoWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BillToPoWizardModel, criteria, options) +} + +// FindBillToPoWizardId finds record id by querying it with criteria. +func (c *Client) FindBillToPoWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BillToPoWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/bus_bus.go b/bus_bus.go new file mode 100644 index 0000000..e00f666 --- /dev/null +++ b/bus_bus.go @@ -0,0 +1,118 @@ +package odoo + +// BusBus represents bus.bus model. +type BusBus struct { + Channel *String `xmlrpc:"channel,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Message *String `xmlrpc:"message,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// BusBuss represents array of bus.bus model. +type BusBuss []BusBus + +// BusBusModel is the odoo model name. +const BusBusModel = "bus.bus" + +// Many2One convert BusBus to *Many2One. +func (bb *BusBus) Many2One() *Many2One { + return NewMany2One(bb.Id.Get(), "") +} + +// CreateBusBus creates a new bus.bus model and returns its id. +func (c *Client) CreateBusBus(bb *BusBus) (int64, error) { + ids, err := c.CreateBusBuss([]*BusBus{bb}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBusBus creates a new bus.bus model and returns its id. +func (c *Client) CreateBusBuss(bbs []*BusBus) ([]int64, error) { + var vv []interface{} + for _, v := range bbs { + vv = append(vv, v) + } + return c.Create(BusBusModel, vv, nil) +} + +// UpdateBusBus updates an existing bus.bus record. +func (c *Client) UpdateBusBus(bb *BusBus) error { + return c.UpdateBusBuss([]int64{bb.Id.Get()}, bb) +} + +// UpdateBusBuss updates existing bus.bus records. +// All records (represented by ids) will be updated by bb values. +func (c *Client) UpdateBusBuss(ids []int64, bb *BusBus) error { + return c.Update(BusBusModel, ids, bb, nil) +} + +// DeleteBusBus deletes an existing bus.bus record. +func (c *Client) DeleteBusBus(id int64) error { + return c.DeleteBusBuss([]int64{id}) +} + +// DeleteBusBuss deletes existing bus.bus records. +func (c *Client) DeleteBusBuss(ids []int64) error { + return c.Delete(BusBusModel, ids) +} + +// GetBusBus gets bus.bus existing record. +func (c *Client) GetBusBus(id int64) (*BusBus, error) { + bbs, err := c.GetBusBuss([]int64{id}) + if err != nil { + return nil, err + } + return &((*bbs)[0]), nil +} + +// GetBusBuss gets bus.bus existing records. +func (c *Client) GetBusBuss(ids []int64) (*BusBuss, error) { + bbs := &BusBuss{} + if err := c.Read(BusBusModel, ids, nil, bbs); err != nil { + return nil, err + } + return bbs, nil +} + +// FindBusBus finds bus.bus record by querying it with criteria. +func (c *Client) FindBusBus(criteria *Criteria) (*BusBus, error) { + bbs := &BusBuss{} + if err := c.SearchRead(BusBusModel, criteria, NewOptions().Limit(1), bbs); err != nil { + return nil, err + } + return &((*bbs)[0]), nil +} + +// FindBusBuss finds bus.bus records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBusBuss(criteria *Criteria, options *Options) (*BusBuss, error) { + bbs := &BusBuss{} + if err := c.SearchRead(BusBusModel, criteria, options, bbs); err != nil { + return nil, err + } + return bbs, nil +} + +// FindBusBusIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBusBusIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BusBusModel, criteria, options) +} + +// FindBusBusId finds record id by querying it with criteria. +func (c *Client) FindBusBusId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BusBusModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/bus_presence.go b/bus_presence.go new file mode 100644 index 0000000..0dae755 --- /dev/null +++ b/bus_presence.go @@ -0,0 +1,117 @@ +package odoo + +// BusPresence represents bus.presence model. +type BusPresence struct { + DisplayName *String `xmlrpc:"display_name,omitempty"` + GuestId *Many2One `xmlrpc:"guest_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LastPoll *Time `xmlrpc:"last_poll,omitempty"` + LastPresence *Time `xmlrpc:"last_presence,omitempty"` + Status *Selection `xmlrpc:"status,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` +} + +// BusPresences represents array of bus.presence model. +type BusPresences []BusPresence + +// BusPresenceModel is the odoo model name. +const BusPresenceModel = "bus.presence" + +// Many2One convert BusPresence to *Many2One. +func (bp *BusPresence) Many2One() *Many2One { + return NewMany2One(bp.Id.Get(), "") +} + +// CreateBusPresence creates a new bus.presence model and returns its id. +func (c *Client) CreateBusPresence(bp *BusPresence) (int64, error) { + ids, err := c.CreateBusPresences([]*BusPresence{bp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateBusPresence creates a new bus.presence model and returns its id. +func (c *Client) CreateBusPresences(bps []*BusPresence) ([]int64, error) { + var vv []interface{} + for _, v := range bps { + vv = append(vv, v) + } + return c.Create(BusPresenceModel, vv, nil) +} + +// UpdateBusPresence updates an existing bus.presence record. +func (c *Client) UpdateBusPresence(bp *BusPresence) error { + return c.UpdateBusPresences([]int64{bp.Id.Get()}, bp) +} + +// UpdateBusPresences updates existing bus.presence records. +// All records (represented by ids) will be updated by bp values. +func (c *Client) UpdateBusPresences(ids []int64, bp *BusPresence) error { + return c.Update(BusPresenceModel, ids, bp, nil) +} + +// DeleteBusPresence deletes an existing bus.presence record. +func (c *Client) DeleteBusPresence(id int64) error { + return c.DeleteBusPresences([]int64{id}) +} + +// DeleteBusPresences deletes existing bus.presence records. +func (c *Client) DeleteBusPresences(ids []int64) error { + return c.Delete(BusPresenceModel, ids) +} + +// GetBusPresence gets bus.presence existing record. +func (c *Client) GetBusPresence(id int64) (*BusPresence, error) { + bps, err := c.GetBusPresences([]int64{id}) + if err != nil { + return nil, err + } + return &((*bps)[0]), nil +} + +// GetBusPresences gets bus.presence existing records. +func (c *Client) GetBusPresences(ids []int64) (*BusPresences, error) { + bps := &BusPresences{} + if err := c.Read(BusPresenceModel, ids, nil, bps); err != nil { + return nil, err + } + return bps, nil +} + +// FindBusPresence finds bus.presence record by querying it with criteria. +func (c *Client) FindBusPresence(criteria *Criteria) (*BusPresence, error) { + bps := &BusPresences{} + if err := c.SearchRead(BusPresenceModel, criteria, NewOptions().Limit(1), bps); err != nil { + return nil, err + } + return &((*bps)[0]), nil +} + +// FindBusPresences finds bus.presence records by querying it +// and filtering it with criteria and options. +func (c *Client) FindBusPresences(criteria *Criteria, options *Options) (*BusPresences, error) { + bps := &BusPresences{} + if err := c.SearchRead(BusPresenceModel, criteria, options, bps); err != nil { + return nil, err + } + return bps, nil +} + +// FindBusPresenceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindBusPresenceIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(BusPresenceModel, criteria, options) +} + +// FindBusPresenceId finds record id by querying it with criteria. +func (c *Client) FindBusPresenceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(BusPresenceModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/calendar_alarm.go b/calendar_alarm.go new file mode 100644 index 0000000..0f5b413 --- /dev/null +++ b/calendar_alarm.go @@ -0,0 +1,125 @@ +package odoo + +// CalendarAlarm represents calendar.alarm model. +type CalendarAlarm struct { + AlarmType *Selection `xmlrpc:"alarm_type,omitempty"` + Body *String `xmlrpc:"body,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Duration *Int `xmlrpc:"duration,omitempty"` + DurationMinutes *Int `xmlrpc:"duration_minutes,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Interval *Selection `xmlrpc:"interval,omitempty"` + MailTemplateId *Many2One `xmlrpc:"mail_template_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + SmsNotifyResponsible *Bool `xmlrpc:"sms_notify_responsible,omitempty"` + SmsTemplateId *Many2One `xmlrpc:"sms_template_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CalendarAlarms represents array of calendar.alarm model. +type CalendarAlarms []CalendarAlarm + +// CalendarAlarmModel is the odoo model name. +const CalendarAlarmModel = "calendar.alarm" + +// Many2One convert CalendarAlarm to *Many2One. +func (ca *CalendarAlarm) Many2One() *Many2One { + return NewMany2One(ca.Id.Get(), "") +} + +// CreateCalendarAlarm creates a new calendar.alarm model and returns its id. +func (c *Client) CreateCalendarAlarm(ca *CalendarAlarm) (int64, error) { + ids, err := c.CreateCalendarAlarms([]*CalendarAlarm{ca}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCalendarAlarm creates a new calendar.alarm model and returns its id. +func (c *Client) CreateCalendarAlarms(cas []*CalendarAlarm) ([]int64, error) { + var vv []interface{} + for _, v := range cas { + vv = append(vv, v) + } + return c.Create(CalendarAlarmModel, vv, nil) +} + +// UpdateCalendarAlarm updates an existing calendar.alarm record. +func (c *Client) UpdateCalendarAlarm(ca *CalendarAlarm) error { + return c.UpdateCalendarAlarms([]int64{ca.Id.Get()}, ca) +} + +// UpdateCalendarAlarms updates existing calendar.alarm records. +// All records (represented by ids) will be updated by ca values. +func (c *Client) UpdateCalendarAlarms(ids []int64, ca *CalendarAlarm) error { + return c.Update(CalendarAlarmModel, ids, ca, nil) +} + +// DeleteCalendarAlarm deletes an existing calendar.alarm record. +func (c *Client) DeleteCalendarAlarm(id int64) error { + return c.DeleteCalendarAlarms([]int64{id}) +} + +// DeleteCalendarAlarms deletes existing calendar.alarm records. +func (c *Client) DeleteCalendarAlarms(ids []int64) error { + return c.Delete(CalendarAlarmModel, ids) +} + +// GetCalendarAlarm gets calendar.alarm existing record. +func (c *Client) GetCalendarAlarm(id int64) (*CalendarAlarm, error) { + cas, err := c.GetCalendarAlarms([]int64{id}) + if err != nil { + return nil, err + } + return &((*cas)[0]), nil +} + +// GetCalendarAlarms gets calendar.alarm existing records. +func (c *Client) GetCalendarAlarms(ids []int64) (*CalendarAlarms, error) { + cas := &CalendarAlarms{} + if err := c.Read(CalendarAlarmModel, ids, nil, cas); err != nil { + return nil, err + } + return cas, nil +} + +// FindCalendarAlarm finds calendar.alarm record by querying it with criteria. +func (c *Client) FindCalendarAlarm(criteria *Criteria) (*CalendarAlarm, error) { + cas := &CalendarAlarms{} + if err := c.SearchRead(CalendarAlarmModel, criteria, NewOptions().Limit(1), cas); err != nil { + return nil, err + } + return &((*cas)[0]), nil +} + +// FindCalendarAlarms finds calendar.alarm records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarAlarms(criteria *Criteria, options *Options) (*CalendarAlarms, error) { + cas := &CalendarAlarms{} + if err := c.SearchRead(CalendarAlarmModel, criteria, options, cas); err != nil { + return nil, err + } + return cas, nil +} + +// FindCalendarAlarmIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarAlarmIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CalendarAlarmModel, criteria, options) +} + +// FindCalendarAlarmId finds record id by querying it with criteria. +func (c *Client) FindCalendarAlarmId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CalendarAlarmModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/calendar_attendee.go b/calendar_attendee.go new file mode 100644 index 0000000..02409e1 --- /dev/null +++ b/calendar_attendee.go @@ -0,0 +1,126 @@ +package odoo + +// CalendarAttendee represents calendar.attendee model. +type CalendarAttendee struct { + AccessToken *String `xmlrpc:"access_token,omitempty"` + Availability *Selection `xmlrpc:"availability,omitempty"` + CommonName *String `xmlrpc:"common_name,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + EventId *Many2One `xmlrpc:"event_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MailTz *Selection `xmlrpc:"mail_tz,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + Phone *String `xmlrpc:"phone,omitempty"` + RecurrenceId *Many2One `xmlrpc:"recurrence_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CalendarAttendees represents array of calendar.attendee model. +type CalendarAttendees []CalendarAttendee + +// CalendarAttendeeModel is the odoo model name. +const CalendarAttendeeModel = "calendar.attendee" + +// Many2One convert CalendarAttendee to *Many2One. +func (ca *CalendarAttendee) Many2One() *Many2One { + return NewMany2One(ca.Id.Get(), "") +} + +// CreateCalendarAttendee creates a new calendar.attendee model and returns its id. +func (c *Client) CreateCalendarAttendee(ca *CalendarAttendee) (int64, error) { + ids, err := c.CreateCalendarAttendees([]*CalendarAttendee{ca}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCalendarAttendee creates a new calendar.attendee model and returns its id. +func (c *Client) CreateCalendarAttendees(cas []*CalendarAttendee) ([]int64, error) { + var vv []interface{} + for _, v := range cas { + vv = append(vv, v) + } + return c.Create(CalendarAttendeeModel, vv, nil) +} + +// UpdateCalendarAttendee updates an existing calendar.attendee record. +func (c *Client) UpdateCalendarAttendee(ca *CalendarAttendee) error { + return c.UpdateCalendarAttendees([]int64{ca.Id.Get()}, ca) +} + +// UpdateCalendarAttendees updates existing calendar.attendee records. +// All records (represented by ids) will be updated by ca values. +func (c *Client) UpdateCalendarAttendees(ids []int64, ca *CalendarAttendee) error { + return c.Update(CalendarAttendeeModel, ids, ca, nil) +} + +// DeleteCalendarAttendee deletes an existing calendar.attendee record. +func (c *Client) DeleteCalendarAttendee(id int64) error { + return c.DeleteCalendarAttendees([]int64{id}) +} + +// DeleteCalendarAttendees deletes existing calendar.attendee records. +func (c *Client) DeleteCalendarAttendees(ids []int64) error { + return c.Delete(CalendarAttendeeModel, ids) +} + +// GetCalendarAttendee gets calendar.attendee existing record. +func (c *Client) GetCalendarAttendee(id int64) (*CalendarAttendee, error) { + cas, err := c.GetCalendarAttendees([]int64{id}) + if err != nil { + return nil, err + } + return &((*cas)[0]), nil +} + +// GetCalendarAttendees gets calendar.attendee existing records. +func (c *Client) GetCalendarAttendees(ids []int64) (*CalendarAttendees, error) { + cas := &CalendarAttendees{} + if err := c.Read(CalendarAttendeeModel, ids, nil, cas); err != nil { + return nil, err + } + return cas, nil +} + +// FindCalendarAttendee finds calendar.attendee record by querying it with criteria. +func (c *Client) FindCalendarAttendee(criteria *Criteria) (*CalendarAttendee, error) { + cas := &CalendarAttendees{} + if err := c.SearchRead(CalendarAttendeeModel, criteria, NewOptions().Limit(1), cas); err != nil { + return nil, err + } + return &((*cas)[0]), nil +} + +// FindCalendarAttendees finds calendar.attendee records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarAttendees(criteria *Criteria, options *Options) (*CalendarAttendees, error) { + cas := &CalendarAttendees{} + if err := c.SearchRead(CalendarAttendeeModel, criteria, options, cas); err != nil { + return nil, err + } + return cas, nil +} + +// FindCalendarAttendeeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarAttendeeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CalendarAttendeeModel, criteria, options) +} + +// FindCalendarAttendeeId finds record id by querying it with criteria. +func (c *Client) FindCalendarAttendeeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CalendarAttendeeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/calendar_event.go b/calendar_event.go new file mode 100644 index 0000000..dad3d30 --- /dev/null +++ b/calendar_event.go @@ -0,0 +1,197 @@ +package odoo + +// CalendarEvent represents calendar.event model. +type CalendarEvent struct { + AcceptedCount *Int `xmlrpc:"accepted_count,omitempty"` + AccessToken *String `xmlrpc:"access_token,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + AlarmIds *Relation `xmlrpc:"alarm_ids,omitempty"` + Allday *Bool `xmlrpc:"allday,omitempty"` + ApplicantId *Many2One `xmlrpc:"applicant_id,omitempty"` + AttendeeIds *Relation `xmlrpc:"attendee_ids,omitempty"` + AttendeesCount *Int `xmlrpc:"attendees_count,omitempty"` + AwaitingCount *Int `xmlrpc:"awaiting_count,omitempty"` + Byday *Selection `xmlrpc:"byday,omitempty"` + CandidateId *Many2One `xmlrpc:"candidate_id,omitempty"` + CategIds *Relation `xmlrpc:"categ_ids,omitempty"` + Count *Int `xmlrpc:"count,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrentAttendee *Many2One `xmlrpc:"current_attendee,omitempty"` + CurrentStatus *Selection `xmlrpc:"current_status,omitempty"` + Day *Int `xmlrpc:"day,omitempty"` + DeclinedCount *Int `xmlrpc:"declined_count,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayDescription *Bool `xmlrpc:"display_description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayTime *String `xmlrpc:"display_time,omitempty"` + Duration *Float `xmlrpc:"duration,omitempty"` + EndType *Selection `xmlrpc:"end_type,omitempty"` + EventTz *Selection `xmlrpc:"event_tz,omitempty"` + FollowRecurrence *Bool `xmlrpc:"follow_recurrence,omitempty"` + Fri *Bool `xmlrpc:"fri,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Interval *Int `xmlrpc:"interval,omitempty"` + InvalidEmailPartnerIds *Relation `xmlrpc:"invalid_email_partner_ids,omitempty"` + IsHighlighted *Bool `xmlrpc:"is_highlighted,omitempty"` + IsOrganizerAlone *Bool `xmlrpc:"is_organizer_alone,omitempty"` + Location *String `xmlrpc:"location,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Mon *Bool `xmlrpc:"mon,omitempty"` + MonthBy *Selection `xmlrpc:"month_by,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OpportunityId *Many2One `xmlrpc:"opportunity_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + Privacy *Selection `xmlrpc:"privacy,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RecurrenceId *Many2One `xmlrpc:"recurrence_id,omitempty"` + RecurrenceUpdate *Selection `xmlrpc:"recurrence_update,omitempty"` + Recurrency *Bool `xmlrpc:"recurrency,omitempty"` + ResId *Many2One `xmlrpc:"res_id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + ResModelId *Many2One `xmlrpc:"res_model_id,omitempty"` + ResModelName *String `xmlrpc:"res_model_name,omitempty"` + Rrule *String `xmlrpc:"rrule,omitempty"` + RruleType *Selection `xmlrpc:"rrule_type,omitempty"` + RruleTypeUi *Selection `xmlrpc:"rrule_type_ui,omitempty"` + Sat *Bool `xmlrpc:"sat,omitempty"` + ShouldShowStatus *Bool `xmlrpc:"should_show_status,omitempty"` + ShowAs *Selection `xmlrpc:"show_as,omitempty"` + Start *Time `xmlrpc:"start,omitempty"` + StartDate *Time `xmlrpc:"start_date,omitempty"` + Stop *Time `xmlrpc:"stop,omitempty"` + StopDate *Time `xmlrpc:"stop_date,omitempty"` + Sun *Bool `xmlrpc:"sun,omitempty"` + TentativeCount *Int `xmlrpc:"tentative_count,omitempty"` + Thu *Bool `xmlrpc:"thu,omitempty"` + Tue *Bool `xmlrpc:"tue,omitempty"` + UnavailablePartnerIds *Relation `xmlrpc:"unavailable_partner_ids,omitempty"` + Until *Time `xmlrpc:"until,omitempty"` + UserCanEdit *Bool `xmlrpc:"user_can_edit,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + VideocallChannelId *Many2One `xmlrpc:"videocall_channel_id,omitempty"` + VideocallLocation *String `xmlrpc:"videocall_location,omitempty"` + VideocallSource *Selection `xmlrpc:"videocall_source,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + Wed *Bool `xmlrpc:"wed,omitempty"` + Weekday *Selection `xmlrpc:"weekday,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CalendarEvents represents array of calendar.event model. +type CalendarEvents []CalendarEvent + +// CalendarEventModel is the odoo model name. +const CalendarEventModel = "calendar.event" + +// Many2One convert CalendarEvent to *Many2One. +func (ce *CalendarEvent) Many2One() *Many2One { + return NewMany2One(ce.Id.Get(), "") +} + +// CreateCalendarEvent creates a new calendar.event model and returns its id. +func (c *Client) CreateCalendarEvent(ce *CalendarEvent) (int64, error) { + ids, err := c.CreateCalendarEvents([]*CalendarEvent{ce}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCalendarEvent creates a new calendar.event model and returns its id. +func (c *Client) CreateCalendarEvents(ces []*CalendarEvent) ([]int64, error) { + var vv []interface{} + for _, v := range ces { + vv = append(vv, v) + } + return c.Create(CalendarEventModel, vv, nil) +} + +// UpdateCalendarEvent updates an existing calendar.event record. +func (c *Client) UpdateCalendarEvent(ce *CalendarEvent) error { + return c.UpdateCalendarEvents([]int64{ce.Id.Get()}, ce) +} + +// UpdateCalendarEvents updates existing calendar.event records. +// All records (represented by ids) will be updated by ce values. +func (c *Client) UpdateCalendarEvents(ids []int64, ce *CalendarEvent) error { + return c.Update(CalendarEventModel, ids, ce, nil) +} + +// DeleteCalendarEvent deletes an existing calendar.event record. +func (c *Client) DeleteCalendarEvent(id int64) error { + return c.DeleteCalendarEvents([]int64{id}) +} + +// DeleteCalendarEvents deletes existing calendar.event records. +func (c *Client) DeleteCalendarEvents(ids []int64) error { + return c.Delete(CalendarEventModel, ids) +} + +// GetCalendarEvent gets calendar.event existing record. +func (c *Client) GetCalendarEvent(id int64) (*CalendarEvent, error) { + ces, err := c.GetCalendarEvents([]int64{id}) + if err != nil { + return nil, err + } + return &((*ces)[0]), nil +} + +// GetCalendarEvents gets calendar.event existing records. +func (c *Client) GetCalendarEvents(ids []int64) (*CalendarEvents, error) { + ces := &CalendarEvents{} + if err := c.Read(CalendarEventModel, ids, nil, ces); err != nil { + return nil, err + } + return ces, nil +} + +// FindCalendarEvent finds calendar.event record by querying it with criteria. +func (c *Client) FindCalendarEvent(criteria *Criteria) (*CalendarEvent, error) { + ces := &CalendarEvents{} + if err := c.SearchRead(CalendarEventModel, criteria, NewOptions().Limit(1), ces); err != nil { + return nil, err + } + return &((*ces)[0]), nil +} + +// FindCalendarEvents finds calendar.event records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarEvents(criteria *Criteria, options *Options) (*CalendarEvents, error) { + ces := &CalendarEvents{} + if err := c.SearchRead(CalendarEventModel, criteria, options, ces); err != nil { + return nil, err + } + return ces, nil +} + +// FindCalendarEventIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarEventIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CalendarEventModel, criteria, options) +} + +// FindCalendarEventId finds record id by querying it with criteria. +func (c *Client) FindCalendarEventId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CalendarEventModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/calendar_event_type.go b/calendar_event_type.go new file mode 100644 index 0000000..f20df4f --- /dev/null +++ b/calendar_event_type.go @@ -0,0 +1,118 @@ +package odoo + +// CalendarEventType represents calendar.event.type model. +type CalendarEventType struct { + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CalendarEventTypes represents array of calendar.event.type model. +type CalendarEventTypes []CalendarEventType + +// CalendarEventTypeModel is the odoo model name. +const CalendarEventTypeModel = "calendar.event.type" + +// Many2One convert CalendarEventType to *Many2One. +func (cet *CalendarEventType) Many2One() *Many2One { + return NewMany2One(cet.Id.Get(), "") +} + +// CreateCalendarEventType creates a new calendar.event.type model and returns its id. +func (c *Client) CreateCalendarEventType(cet *CalendarEventType) (int64, error) { + ids, err := c.CreateCalendarEventTypes([]*CalendarEventType{cet}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCalendarEventType creates a new calendar.event.type model and returns its id. +func (c *Client) CreateCalendarEventTypes(cets []*CalendarEventType) ([]int64, error) { + var vv []interface{} + for _, v := range cets { + vv = append(vv, v) + } + return c.Create(CalendarEventTypeModel, vv, nil) +} + +// UpdateCalendarEventType updates an existing calendar.event.type record. +func (c *Client) UpdateCalendarEventType(cet *CalendarEventType) error { + return c.UpdateCalendarEventTypes([]int64{cet.Id.Get()}, cet) +} + +// UpdateCalendarEventTypes updates existing calendar.event.type records. +// All records (represented by ids) will be updated by cet values. +func (c *Client) UpdateCalendarEventTypes(ids []int64, cet *CalendarEventType) error { + return c.Update(CalendarEventTypeModel, ids, cet, nil) +} + +// DeleteCalendarEventType deletes an existing calendar.event.type record. +func (c *Client) DeleteCalendarEventType(id int64) error { + return c.DeleteCalendarEventTypes([]int64{id}) +} + +// DeleteCalendarEventTypes deletes existing calendar.event.type records. +func (c *Client) DeleteCalendarEventTypes(ids []int64) error { + return c.Delete(CalendarEventTypeModel, ids) +} + +// GetCalendarEventType gets calendar.event.type existing record. +func (c *Client) GetCalendarEventType(id int64) (*CalendarEventType, error) { + cets, err := c.GetCalendarEventTypes([]int64{id}) + if err != nil { + return nil, err + } + return &((*cets)[0]), nil +} + +// GetCalendarEventTypes gets calendar.event.type existing records. +func (c *Client) GetCalendarEventTypes(ids []int64) (*CalendarEventTypes, error) { + cets := &CalendarEventTypes{} + if err := c.Read(CalendarEventTypeModel, ids, nil, cets); err != nil { + return nil, err + } + return cets, nil +} + +// FindCalendarEventType finds calendar.event.type record by querying it with criteria. +func (c *Client) FindCalendarEventType(criteria *Criteria) (*CalendarEventType, error) { + cets := &CalendarEventTypes{} + if err := c.SearchRead(CalendarEventTypeModel, criteria, NewOptions().Limit(1), cets); err != nil { + return nil, err + } + return &((*cets)[0]), nil +} + +// FindCalendarEventTypes finds calendar.event.type records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarEventTypes(criteria *Criteria, options *Options) (*CalendarEventTypes, error) { + cets := &CalendarEventTypes{} + if err := c.SearchRead(CalendarEventTypeModel, criteria, options, cets); err != nil { + return nil, err + } + return cets, nil +} + +// FindCalendarEventTypeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarEventTypeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CalendarEventTypeModel, criteria, options) +} + +// FindCalendarEventTypeId finds record id by querying it with criteria. +func (c *Client) FindCalendarEventTypeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CalendarEventTypeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/calendar_filters.go b/calendar_filters.go new file mode 100644 index 0000000..69beb3c --- /dev/null +++ b/calendar_filters.go @@ -0,0 +1,120 @@ +package odoo + +// CalendarFilters represents calendar.filters model. +type CalendarFilters struct { + Active *Bool `xmlrpc:"active,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PartnerChecked *Bool `xmlrpc:"partner_checked,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CalendarFilterss represents array of calendar.filters model. +type CalendarFilterss []CalendarFilters + +// CalendarFiltersModel is the odoo model name. +const CalendarFiltersModel = "calendar.filters" + +// Many2One convert CalendarFilters to *Many2One. +func (cf *CalendarFilters) Many2One() *Many2One { + return NewMany2One(cf.Id.Get(), "") +} + +// CreateCalendarFilters creates a new calendar.filters model and returns its id. +func (c *Client) CreateCalendarFilters(cf *CalendarFilters) (int64, error) { + ids, err := c.CreateCalendarFilterss([]*CalendarFilters{cf}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCalendarFilters creates a new calendar.filters model and returns its id. +func (c *Client) CreateCalendarFilterss(cfs []*CalendarFilters) ([]int64, error) { + var vv []interface{} + for _, v := range cfs { + vv = append(vv, v) + } + return c.Create(CalendarFiltersModel, vv, nil) +} + +// UpdateCalendarFilters updates an existing calendar.filters record. +func (c *Client) UpdateCalendarFilters(cf *CalendarFilters) error { + return c.UpdateCalendarFilterss([]int64{cf.Id.Get()}, cf) +} + +// UpdateCalendarFilterss updates existing calendar.filters records. +// All records (represented by ids) will be updated by cf values. +func (c *Client) UpdateCalendarFilterss(ids []int64, cf *CalendarFilters) error { + return c.Update(CalendarFiltersModel, ids, cf, nil) +} + +// DeleteCalendarFilters deletes an existing calendar.filters record. +func (c *Client) DeleteCalendarFilters(id int64) error { + return c.DeleteCalendarFilterss([]int64{id}) +} + +// DeleteCalendarFilterss deletes existing calendar.filters records. +func (c *Client) DeleteCalendarFilterss(ids []int64) error { + return c.Delete(CalendarFiltersModel, ids) +} + +// GetCalendarFilters gets calendar.filters existing record. +func (c *Client) GetCalendarFilters(id int64) (*CalendarFilters, error) { + cfs, err := c.GetCalendarFilterss([]int64{id}) + if err != nil { + return nil, err + } + return &((*cfs)[0]), nil +} + +// GetCalendarFilterss gets calendar.filters existing records. +func (c *Client) GetCalendarFilterss(ids []int64) (*CalendarFilterss, error) { + cfs := &CalendarFilterss{} + if err := c.Read(CalendarFiltersModel, ids, nil, cfs); err != nil { + return nil, err + } + return cfs, nil +} + +// FindCalendarFilters finds calendar.filters record by querying it with criteria. +func (c *Client) FindCalendarFilters(criteria *Criteria) (*CalendarFilters, error) { + cfs := &CalendarFilterss{} + if err := c.SearchRead(CalendarFiltersModel, criteria, NewOptions().Limit(1), cfs); err != nil { + return nil, err + } + return &((*cfs)[0]), nil +} + +// FindCalendarFilterss finds calendar.filters records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarFilterss(criteria *Criteria, options *Options) (*CalendarFilterss, error) { + cfs := &CalendarFilterss{} + if err := c.SearchRead(CalendarFiltersModel, criteria, options, cfs); err != nil { + return nil, err + } + return cfs, nil +} + +// FindCalendarFiltersIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarFiltersIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CalendarFiltersModel, criteria, options) +} + +// FindCalendarFiltersId finds record id by querying it with criteria. +func (c *Client) FindCalendarFiltersId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CalendarFiltersModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/calendar_popover_delete_wizard.go b/calendar_popover_delete_wizard.go new file mode 100644 index 0000000..7249739 --- /dev/null +++ b/calendar_popover_delete_wizard.go @@ -0,0 +1,118 @@ +package odoo + +// CalendarPopoverDeleteWizard represents calendar.popover.delete.wizard model. +type CalendarPopoverDeleteWizard struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Delete *Selection `xmlrpc:"delete,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Record *Many2One `xmlrpc:"record,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CalendarPopoverDeleteWizards represents array of calendar.popover.delete.wizard model. +type CalendarPopoverDeleteWizards []CalendarPopoverDeleteWizard + +// CalendarPopoverDeleteWizardModel is the odoo model name. +const CalendarPopoverDeleteWizardModel = "calendar.popover.delete.wizard" + +// Many2One convert CalendarPopoverDeleteWizard to *Many2One. +func (cpdw *CalendarPopoverDeleteWizard) Many2One() *Many2One { + return NewMany2One(cpdw.Id.Get(), "") +} + +// CreateCalendarPopoverDeleteWizard creates a new calendar.popover.delete.wizard model and returns its id. +func (c *Client) CreateCalendarPopoverDeleteWizard(cpdw *CalendarPopoverDeleteWizard) (int64, error) { + ids, err := c.CreateCalendarPopoverDeleteWizards([]*CalendarPopoverDeleteWizard{cpdw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCalendarPopoverDeleteWizard creates a new calendar.popover.delete.wizard model and returns its id. +func (c *Client) CreateCalendarPopoverDeleteWizards(cpdws []*CalendarPopoverDeleteWizard) ([]int64, error) { + var vv []interface{} + for _, v := range cpdws { + vv = append(vv, v) + } + return c.Create(CalendarPopoverDeleteWizardModel, vv, nil) +} + +// UpdateCalendarPopoverDeleteWizard updates an existing calendar.popover.delete.wizard record. +func (c *Client) UpdateCalendarPopoverDeleteWizard(cpdw *CalendarPopoverDeleteWizard) error { + return c.UpdateCalendarPopoverDeleteWizards([]int64{cpdw.Id.Get()}, cpdw) +} + +// UpdateCalendarPopoverDeleteWizards updates existing calendar.popover.delete.wizard records. +// All records (represented by ids) will be updated by cpdw values. +func (c *Client) UpdateCalendarPopoverDeleteWizards(ids []int64, cpdw *CalendarPopoverDeleteWizard) error { + return c.Update(CalendarPopoverDeleteWizardModel, ids, cpdw, nil) +} + +// DeleteCalendarPopoverDeleteWizard deletes an existing calendar.popover.delete.wizard record. +func (c *Client) DeleteCalendarPopoverDeleteWizard(id int64) error { + return c.DeleteCalendarPopoverDeleteWizards([]int64{id}) +} + +// DeleteCalendarPopoverDeleteWizards deletes existing calendar.popover.delete.wizard records. +func (c *Client) DeleteCalendarPopoverDeleteWizards(ids []int64) error { + return c.Delete(CalendarPopoverDeleteWizardModel, ids) +} + +// GetCalendarPopoverDeleteWizard gets calendar.popover.delete.wizard existing record. +func (c *Client) GetCalendarPopoverDeleteWizard(id int64) (*CalendarPopoverDeleteWizard, error) { + cpdws, err := c.GetCalendarPopoverDeleteWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*cpdws)[0]), nil +} + +// GetCalendarPopoverDeleteWizards gets calendar.popover.delete.wizard existing records. +func (c *Client) GetCalendarPopoverDeleteWizards(ids []int64) (*CalendarPopoverDeleteWizards, error) { + cpdws := &CalendarPopoverDeleteWizards{} + if err := c.Read(CalendarPopoverDeleteWizardModel, ids, nil, cpdws); err != nil { + return nil, err + } + return cpdws, nil +} + +// FindCalendarPopoverDeleteWizard finds calendar.popover.delete.wizard record by querying it with criteria. +func (c *Client) FindCalendarPopoverDeleteWizard(criteria *Criteria) (*CalendarPopoverDeleteWizard, error) { + cpdws := &CalendarPopoverDeleteWizards{} + if err := c.SearchRead(CalendarPopoverDeleteWizardModel, criteria, NewOptions().Limit(1), cpdws); err != nil { + return nil, err + } + return &((*cpdws)[0]), nil +} + +// FindCalendarPopoverDeleteWizards finds calendar.popover.delete.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarPopoverDeleteWizards(criteria *Criteria, options *Options) (*CalendarPopoverDeleteWizards, error) { + cpdws := &CalendarPopoverDeleteWizards{} + if err := c.SearchRead(CalendarPopoverDeleteWizardModel, criteria, options, cpdws); err != nil { + return nil, err + } + return cpdws, nil +} + +// FindCalendarPopoverDeleteWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarPopoverDeleteWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CalendarPopoverDeleteWizardModel, criteria, options) +} + +// FindCalendarPopoverDeleteWizardId finds record id by querying it with criteria. +func (c *Client) FindCalendarPopoverDeleteWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CalendarPopoverDeleteWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/calendar_provider_config.go b/calendar_provider_config.go new file mode 100644 index 0000000..a6258f8 --- /dev/null +++ b/calendar_provider_config.go @@ -0,0 +1,123 @@ +package odoo + +// CalendarProviderConfig represents calendar.provider.config model. +type CalendarProviderConfig struct { + CalClientId *String `xmlrpc:"cal_client_id,omitempty"` + CalClientSecret *String `xmlrpc:"cal_client_secret,omitempty"` + CalSyncPaused *Bool `xmlrpc:"cal_sync_paused,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExternalCalendarProvider *Selection `xmlrpc:"external_calendar_provider,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MicrosoftOutlookClientIdentifier *String `xmlrpc:"microsoft_outlook_client_identifier,omitempty"` + MicrosoftOutlookClientSecret *String `xmlrpc:"microsoft_outlook_client_secret,omitempty"` + MicrosoftOutlookSyncPaused *Bool `xmlrpc:"microsoft_outlook_sync_paused,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CalendarProviderConfigs represents array of calendar.provider.config model. +type CalendarProviderConfigs []CalendarProviderConfig + +// CalendarProviderConfigModel is the odoo model name. +const CalendarProviderConfigModel = "calendar.provider.config" + +// Many2One convert CalendarProviderConfig to *Many2One. +func (cpc *CalendarProviderConfig) Many2One() *Many2One { + return NewMany2One(cpc.Id.Get(), "") +} + +// CreateCalendarProviderConfig creates a new calendar.provider.config model and returns its id. +func (c *Client) CreateCalendarProviderConfig(cpc *CalendarProviderConfig) (int64, error) { + ids, err := c.CreateCalendarProviderConfigs([]*CalendarProviderConfig{cpc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCalendarProviderConfig creates a new calendar.provider.config model and returns its id. +func (c *Client) CreateCalendarProviderConfigs(cpcs []*CalendarProviderConfig) ([]int64, error) { + var vv []interface{} + for _, v := range cpcs { + vv = append(vv, v) + } + return c.Create(CalendarProviderConfigModel, vv, nil) +} + +// UpdateCalendarProviderConfig updates an existing calendar.provider.config record. +func (c *Client) UpdateCalendarProviderConfig(cpc *CalendarProviderConfig) error { + return c.UpdateCalendarProviderConfigs([]int64{cpc.Id.Get()}, cpc) +} + +// UpdateCalendarProviderConfigs updates existing calendar.provider.config records. +// All records (represented by ids) will be updated by cpc values. +func (c *Client) UpdateCalendarProviderConfigs(ids []int64, cpc *CalendarProviderConfig) error { + return c.Update(CalendarProviderConfigModel, ids, cpc, nil) +} + +// DeleteCalendarProviderConfig deletes an existing calendar.provider.config record. +func (c *Client) DeleteCalendarProviderConfig(id int64) error { + return c.DeleteCalendarProviderConfigs([]int64{id}) +} + +// DeleteCalendarProviderConfigs deletes existing calendar.provider.config records. +func (c *Client) DeleteCalendarProviderConfigs(ids []int64) error { + return c.Delete(CalendarProviderConfigModel, ids) +} + +// GetCalendarProviderConfig gets calendar.provider.config existing record. +func (c *Client) GetCalendarProviderConfig(id int64) (*CalendarProviderConfig, error) { + cpcs, err := c.GetCalendarProviderConfigs([]int64{id}) + if err != nil { + return nil, err + } + return &((*cpcs)[0]), nil +} + +// GetCalendarProviderConfigs gets calendar.provider.config existing records. +func (c *Client) GetCalendarProviderConfigs(ids []int64) (*CalendarProviderConfigs, error) { + cpcs := &CalendarProviderConfigs{} + if err := c.Read(CalendarProviderConfigModel, ids, nil, cpcs); err != nil { + return nil, err + } + return cpcs, nil +} + +// FindCalendarProviderConfig finds calendar.provider.config record by querying it with criteria. +func (c *Client) FindCalendarProviderConfig(criteria *Criteria) (*CalendarProviderConfig, error) { + cpcs := &CalendarProviderConfigs{} + if err := c.SearchRead(CalendarProviderConfigModel, criteria, NewOptions().Limit(1), cpcs); err != nil { + return nil, err + } + return &((*cpcs)[0]), nil +} + +// FindCalendarProviderConfigs finds calendar.provider.config records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarProviderConfigs(criteria *Criteria, options *Options) (*CalendarProviderConfigs, error) { + cpcs := &CalendarProviderConfigs{} + if err := c.SearchRead(CalendarProviderConfigModel, criteria, options, cpcs); err != nil { + return nil, err + } + return cpcs, nil +} + +// FindCalendarProviderConfigIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarProviderConfigIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CalendarProviderConfigModel, criteria, options) +} + +// FindCalendarProviderConfigId finds record id by querying it with criteria. +func (c *Client) FindCalendarProviderConfigId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CalendarProviderConfigModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/calendar_recurrence.go b/calendar_recurrence.go new file mode 100644 index 0000000..0c85329 --- /dev/null +++ b/calendar_recurrence.go @@ -0,0 +1,139 @@ +package odoo + +// CalendarRecurrence represents calendar.recurrence model. +type CalendarRecurrence struct { + BaseEventId *Many2One `xmlrpc:"base_event_id,omitempty"` + Byday *Selection `xmlrpc:"byday,omitempty"` + CalendarEventIds *Relation `xmlrpc:"calendar_event_ids,omitempty"` + Count *Int `xmlrpc:"count,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Day *Int `xmlrpc:"day,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Dtstart *Time `xmlrpc:"dtstart,omitempty"` + EndType *Selection `xmlrpc:"end_type,omitempty"` + EventTz *Selection `xmlrpc:"event_tz,omitempty"` + Fri *Bool `xmlrpc:"fri,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Interval *Int `xmlrpc:"interval,omitempty"` + Mon *Bool `xmlrpc:"mon,omitempty"` + MonthBy *Selection `xmlrpc:"month_by,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Rrule *String `xmlrpc:"rrule,omitempty"` + RruleType *Selection `xmlrpc:"rrule_type,omitempty"` + Sat *Bool `xmlrpc:"sat,omitempty"` + Sun *Bool `xmlrpc:"sun,omitempty"` + Thu *Bool `xmlrpc:"thu,omitempty"` + TriggerId *Many2One `xmlrpc:"trigger_id,omitempty"` + Tue *Bool `xmlrpc:"tue,omitempty"` + Until *Time `xmlrpc:"until,omitempty"` + Wed *Bool `xmlrpc:"wed,omitempty"` + Weekday *Selection `xmlrpc:"weekday,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CalendarRecurrences represents array of calendar.recurrence model. +type CalendarRecurrences []CalendarRecurrence + +// CalendarRecurrenceModel is the odoo model name. +const CalendarRecurrenceModel = "calendar.recurrence" + +// Many2One convert CalendarRecurrence to *Many2One. +func (cr *CalendarRecurrence) Many2One() *Many2One { + return NewMany2One(cr.Id.Get(), "") +} + +// CreateCalendarRecurrence creates a new calendar.recurrence model and returns its id. +func (c *Client) CreateCalendarRecurrence(cr *CalendarRecurrence) (int64, error) { + ids, err := c.CreateCalendarRecurrences([]*CalendarRecurrence{cr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCalendarRecurrence creates a new calendar.recurrence model and returns its id. +func (c *Client) CreateCalendarRecurrences(crs []*CalendarRecurrence) ([]int64, error) { + var vv []interface{} + for _, v := range crs { + vv = append(vv, v) + } + return c.Create(CalendarRecurrenceModel, vv, nil) +} + +// UpdateCalendarRecurrence updates an existing calendar.recurrence record. +func (c *Client) UpdateCalendarRecurrence(cr *CalendarRecurrence) error { + return c.UpdateCalendarRecurrences([]int64{cr.Id.Get()}, cr) +} + +// UpdateCalendarRecurrences updates existing calendar.recurrence records. +// All records (represented by ids) will be updated by cr values. +func (c *Client) UpdateCalendarRecurrences(ids []int64, cr *CalendarRecurrence) error { + return c.Update(CalendarRecurrenceModel, ids, cr, nil) +} + +// DeleteCalendarRecurrence deletes an existing calendar.recurrence record. +func (c *Client) DeleteCalendarRecurrence(id int64) error { + return c.DeleteCalendarRecurrences([]int64{id}) +} + +// DeleteCalendarRecurrences deletes existing calendar.recurrence records. +func (c *Client) DeleteCalendarRecurrences(ids []int64) error { + return c.Delete(CalendarRecurrenceModel, ids) +} + +// GetCalendarRecurrence gets calendar.recurrence existing record. +func (c *Client) GetCalendarRecurrence(id int64) (*CalendarRecurrence, error) { + crs, err := c.GetCalendarRecurrences([]int64{id}) + if err != nil { + return nil, err + } + return &((*crs)[0]), nil +} + +// GetCalendarRecurrences gets calendar.recurrence existing records. +func (c *Client) GetCalendarRecurrences(ids []int64) (*CalendarRecurrences, error) { + crs := &CalendarRecurrences{} + if err := c.Read(CalendarRecurrenceModel, ids, nil, crs); err != nil { + return nil, err + } + return crs, nil +} + +// FindCalendarRecurrence finds calendar.recurrence record by querying it with criteria. +func (c *Client) FindCalendarRecurrence(criteria *Criteria) (*CalendarRecurrence, error) { + crs := &CalendarRecurrences{} + if err := c.SearchRead(CalendarRecurrenceModel, criteria, NewOptions().Limit(1), crs); err != nil { + return nil, err + } + return &((*crs)[0]), nil +} + +// FindCalendarRecurrences finds calendar.recurrence records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarRecurrences(criteria *Criteria, options *Options) (*CalendarRecurrences, error) { + crs := &CalendarRecurrences{} + if err := c.SearchRead(CalendarRecurrenceModel, criteria, options, crs); err != nil { + return nil, err + } + return crs, nil +} + +// FindCalendarRecurrenceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCalendarRecurrenceIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CalendarRecurrenceModel, criteria, options) +} + +// FindCalendarRecurrenceId finds record id by querying it with criteria. +func (c *Client) FindCalendarRecurrenceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CalendarRecurrenceModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/candidate_send_mail.go b/candidate_send_mail.go new file mode 100644 index 0000000..ff4e33c --- /dev/null +++ b/candidate_send_mail.go @@ -0,0 +1,127 @@ +package odoo + +// CandidateSendMail represents candidate.send.mail model. +type CandidateSendMail struct { + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + AuthorId *Many2One `xmlrpc:"author_id,omitempty"` + Body *String `xmlrpc:"body,omitempty"` + BodyHasTemplateValue *Bool `xmlrpc:"body_has_template_value,omitempty"` + CanEditBody *Bool `xmlrpc:"can_edit_body,omitempty"` + CandidateIds *Relation `xmlrpc:"candidate_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsMailTemplateEditor *Bool `xmlrpc:"is_mail_template_editor,omitempty"` + Lang *String `xmlrpc:"lang,omitempty"` + RenderModel *String `xmlrpc:"render_model,omitempty"` + Subject *String `xmlrpc:"subject,omitempty"` + TemplateId *Many2One `xmlrpc:"template_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CandidateSendMails represents array of candidate.send.mail model. +type CandidateSendMails []CandidateSendMail + +// CandidateSendMailModel is the odoo model name. +const CandidateSendMailModel = "candidate.send.mail" + +// Many2One convert CandidateSendMail to *Many2One. +func (csm *CandidateSendMail) Many2One() *Many2One { + return NewMany2One(csm.Id.Get(), "") +} + +// CreateCandidateSendMail creates a new candidate.send.mail model and returns its id. +func (c *Client) CreateCandidateSendMail(csm *CandidateSendMail) (int64, error) { + ids, err := c.CreateCandidateSendMails([]*CandidateSendMail{csm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCandidateSendMail creates a new candidate.send.mail model and returns its id. +func (c *Client) CreateCandidateSendMails(csms []*CandidateSendMail) ([]int64, error) { + var vv []interface{} + for _, v := range csms { + vv = append(vv, v) + } + return c.Create(CandidateSendMailModel, vv, nil) +} + +// UpdateCandidateSendMail updates an existing candidate.send.mail record. +func (c *Client) UpdateCandidateSendMail(csm *CandidateSendMail) error { + return c.UpdateCandidateSendMails([]int64{csm.Id.Get()}, csm) +} + +// UpdateCandidateSendMails updates existing candidate.send.mail records. +// All records (represented by ids) will be updated by csm values. +func (c *Client) UpdateCandidateSendMails(ids []int64, csm *CandidateSendMail) error { + return c.Update(CandidateSendMailModel, ids, csm, nil) +} + +// DeleteCandidateSendMail deletes an existing candidate.send.mail record. +func (c *Client) DeleteCandidateSendMail(id int64) error { + return c.DeleteCandidateSendMails([]int64{id}) +} + +// DeleteCandidateSendMails deletes existing candidate.send.mail records. +func (c *Client) DeleteCandidateSendMails(ids []int64) error { + return c.Delete(CandidateSendMailModel, ids) +} + +// GetCandidateSendMail gets candidate.send.mail existing record. +func (c *Client) GetCandidateSendMail(id int64) (*CandidateSendMail, error) { + csms, err := c.GetCandidateSendMails([]int64{id}) + if err != nil { + return nil, err + } + return &((*csms)[0]), nil +} + +// GetCandidateSendMails gets candidate.send.mail existing records. +func (c *Client) GetCandidateSendMails(ids []int64) (*CandidateSendMails, error) { + csms := &CandidateSendMails{} + if err := c.Read(CandidateSendMailModel, ids, nil, csms); err != nil { + return nil, err + } + return csms, nil +} + +// FindCandidateSendMail finds candidate.send.mail record by querying it with criteria. +func (c *Client) FindCandidateSendMail(criteria *Criteria) (*CandidateSendMail, error) { + csms := &CandidateSendMails{} + if err := c.SearchRead(CandidateSendMailModel, criteria, NewOptions().Limit(1), csms); err != nil { + return nil, err + } + return &((*csms)[0]), nil +} + +// FindCandidateSendMails finds candidate.send.mail records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCandidateSendMails(criteria *Criteria, options *Options) (*CandidateSendMails, error) { + csms := &CandidateSendMails{} + if err := c.SearchRead(CandidateSendMailModel, criteria, options, csms); err != nil { + return nil, err + } + return csms, nil +} + +// FindCandidateSendMailIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCandidateSendMailIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CandidateSendMailModel, criteria, options) +} + +// FindCandidateSendMailId finds record id by querying it with criteria. +func (c *Client) FindCandidateSendMailId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CandidateSendMailModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/change_password_own.go b/change_password_own.go new file mode 100644 index 0000000..e4934d5 --- /dev/null +++ b/change_password_own.go @@ -0,0 +1,118 @@ +package odoo + +// ChangePasswordOwn represents change.password.own model. +type ChangePasswordOwn struct { + ConfirmPassword *String `xmlrpc:"confirm_password,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + NewPassword *String `xmlrpc:"new_password,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ChangePasswordOwns represents array of change.password.own model. +type ChangePasswordOwns []ChangePasswordOwn + +// ChangePasswordOwnModel is the odoo model name. +const ChangePasswordOwnModel = "change.password.own" + +// Many2One convert ChangePasswordOwn to *Many2One. +func (cpo *ChangePasswordOwn) Many2One() *Many2One { + return NewMany2One(cpo.Id.Get(), "") +} + +// CreateChangePasswordOwn creates a new change.password.own model and returns its id. +func (c *Client) CreateChangePasswordOwn(cpo *ChangePasswordOwn) (int64, error) { + ids, err := c.CreateChangePasswordOwns([]*ChangePasswordOwn{cpo}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateChangePasswordOwn creates a new change.password.own model and returns its id. +func (c *Client) CreateChangePasswordOwns(cpos []*ChangePasswordOwn) ([]int64, error) { + var vv []interface{} + for _, v := range cpos { + vv = append(vv, v) + } + return c.Create(ChangePasswordOwnModel, vv, nil) +} + +// UpdateChangePasswordOwn updates an existing change.password.own record. +func (c *Client) UpdateChangePasswordOwn(cpo *ChangePasswordOwn) error { + return c.UpdateChangePasswordOwns([]int64{cpo.Id.Get()}, cpo) +} + +// UpdateChangePasswordOwns updates existing change.password.own records. +// All records (represented by ids) will be updated by cpo values. +func (c *Client) UpdateChangePasswordOwns(ids []int64, cpo *ChangePasswordOwn) error { + return c.Update(ChangePasswordOwnModel, ids, cpo, nil) +} + +// DeleteChangePasswordOwn deletes an existing change.password.own record. +func (c *Client) DeleteChangePasswordOwn(id int64) error { + return c.DeleteChangePasswordOwns([]int64{id}) +} + +// DeleteChangePasswordOwns deletes existing change.password.own records. +func (c *Client) DeleteChangePasswordOwns(ids []int64) error { + return c.Delete(ChangePasswordOwnModel, ids) +} + +// GetChangePasswordOwn gets change.password.own existing record. +func (c *Client) GetChangePasswordOwn(id int64) (*ChangePasswordOwn, error) { + cpos, err := c.GetChangePasswordOwns([]int64{id}) + if err != nil { + return nil, err + } + return &((*cpos)[0]), nil +} + +// GetChangePasswordOwns gets change.password.own existing records. +func (c *Client) GetChangePasswordOwns(ids []int64) (*ChangePasswordOwns, error) { + cpos := &ChangePasswordOwns{} + if err := c.Read(ChangePasswordOwnModel, ids, nil, cpos); err != nil { + return nil, err + } + return cpos, nil +} + +// FindChangePasswordOwn finds change.password.own record by querying it with criteria. +func (c *Client) FindChangePasswordOwn(criteria *Criteria) (*ChangePasswordOwn, error) { + cpos := &ChangePasswordOwns{} + if err := c.SearchRead(ChangePasswordOwnModel, criteria, NewOptions().Limit(1), cpos); err != nil { + return nil, err + } + return &((*cpos)[0]), nil +} + +// FindChangePasswordOwns finds change.password.own records by querying it +// and filtering it with criteria and options. +func (c *Client) FindChangePasswordOwns(criteria *Criteria, options *Options) (*ChangePasswordOwns, error) { + cpos := &ChangePasswordOwns{} + if err := c.SearchRead(ChangePasswordOwnModel, criteria, options, cpos); err != nil { + return nil, err + } + return cpos, nil +} + +// FindChangePasswordOwnIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindChangePasswordOwnIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ChangePasswordOwnModel, criteria, options) +} + +// FindChangePasswordOwnId finds record id by querying it with criteria. +func (c *Client) FindChangePasswordOwnId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ChangePasswordOwnModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/change_password_user.go b/change_password_user.go new file mode 100644 index 0000000..7cf0f46 --- /dev/null +++ b/change_password_user.go @@ -0,0 +1,120 @@ +package odoo + +// ChangePasswordUser represents change.password.user model. +type ChangePasswordUser struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + NewPasswd *String `xmlrpc:"new_passwd,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + UserLogin *String `xmlrpc:"user_login,omitempty"` + WizardId *Many2One `xmlrpc:"wizard_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ChangePasswordUsers represents array of change.password.user model. +type ChangePasswordUsers []ChangePasswordUser + +// ChangePasswordUserModel is the odoo model name. +const ChangePasswordUserModel = "change.password.user" + +// Many2One convert ChangePasswordUser to *Many2One. +func (cpu *ChangePasswordUser) Many2One() *Many2One { + return NewMany2One(cpu.Id.Get(), "") +} + +// CreateChangePasswordUser creates a new change.password.user model and returns its id. +func (c *Client) CreateChangePasswordUser(cpu *ChangePasswordUser) (int64, error) { + ids, err := c.CreateChangePasswordUsers([]*ChangePasswordUser{cpu}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateChangePasswordUser creates a new change.password.user model and returns its id. +func (c *Client) CreateChangePasswordUsers(cpus []*ChangePasswordUser) ([]int64, error) { + var vv []interface{} + for _, v := range cpus { + vv = append(vv, v) + } + return c.Create(ChangePasswordUserModel, vv, nil) +} + +// UpdateChangePasswordUser updates an existing change.password.user record. +func (c *Client) UpdateChangePasswordUser(cpu *ChangePasswordUser) error { + return c.UpdateChangePasswordUsers([]int64{cpu.Id.Get()}, cpu) +} + +// UpdateChangePasswordUsers updates existing change.password.user records. +// All records (represented by ids) will be updated by cpu values. +func (c *Client) UpdateChangePasswordUsers(ids []int64, cpu *ChangePasswordUser) error { + return c.Update(ChangePasswordUserModel, ids, cpu, nil) +} + +// DeleteChangePasswordUser deletes an existing change.password.user record. +func (c *Client) DeleteChangePasswordUser(id int64) error { + return c.DeleteChangePasswordUsers([]int64{id}) +} + +// DeleteChangePasswordUsers deletes existing change.password.user records. +func (c *Client) DeleteChangePasswordUsers(ids []int64) error { + return c.Delete(ChangePasswordUserModel, ids) +} + +// GetChangePasswordUser gets change.password.user existing record. +func (c *Client) GetChangePasswordUser(id int64) (*ChangePasswordUser, error) { + cpus, err := c.GetChangePasswordUsers([]int64{id}) + if err != nil { + return nil, err + } + return &((*cpus)[0]), nil +} + +// GetChangePasswordUsers gets change.password.user existing records. +func (c *Client) GetChangePasswordUsers(ids []int64) (*ChangePasswordUsers, error) { + cpus := &ChangePasswordUsers{} + if err := c.Read(ChangePasswordUserModel, ids, nil, cpus); err != nil { + return nil, err + } + return cpus, nil +} + +// FindChangePasswordUser finds change.password.user record by querying it with criteria. +func (c *Client) FindChangePasswordUser(criteria *Criteria) (*ChangePasswordUser, error) { + cpus := &ChangePasswordUsers{} + if err := c.SearchRead(ChangePasswordUserModel, criteria, NewOptions().Limit(1), cpus); err != nil { + return nil, err + } + return &((*cpus)[0]), nil +} + +// FindChangePasswordUsers finds change.password.user records by querying it +// and filtering it with criteria and options. +func (c *Client) FindChangePasswordUsers(criteria *Criteria, options *Options) (*ChangePasswordUsers, error) { + cpus := &ChangePasswordUsers{} + if err := c.SearchRead(ChangePasswordUserModel, criteria, options, cpus); err != nil { + return nil, err + } + return cpus, nil +} + +// FindChangePasswordUserIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindChangePasswordUserIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ChangePasswordUserModel, criteria, options) +} + +// FindChangePasswordUserId finds record id by querying it with criteria. +func (c *Client) FindChangePasswordUserId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ChangePasswordUserModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/change_password_wizard.go b/change_password_wizard.go new file mode 100644 index 0000000..992b6cc --- /dev/null +++ b/change_password_wizard.go @@ -0,0 +1,117 @@ +package odoo + +// ChangePasswordWizard represents change.password.wizard model. +type ChangePasswordWizard struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + UserIds *Relation `xmlrpc:"user_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ChangePasswordWizards represents array of change.password.wizard model. +type ChangePasswordWizards []ChangePasswordWizard + +// ChangePasswordWizardModel is the odoo model name. +const ChangePasswordWizardModel = "change.password.wizard" + +// Many2One convert ChangePasswordWizard to *Many2One. +func (cpw *ChangePasswordWizard) Many2One() *Many2One { + return NewMany2One(cpw.Id.Get(), "") +} + +// CreateChangePasswordWizard creates a new change.password.wizard model and returns its id. +func (c *Client) CreateChangePasswordWizard(cpw *ChangePasswordWizard) (int64, error) { + ids, err := c.CreateChangePasswordWizards([]*ChangePasswordWizard{cpw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateChangePasswordWizard creates a new change.password.wizard model and returns its id. +func (c *Client) CreateChangePasswordWizards(cpws []*ChangePasswordWizard) ([]int64, error) { + var vv []interface{} + for _, v := range cpws { + vv = append(vv, v) + } + return c.Create(ChangePasswordWizardModel, vv, nil) +} + +// UpdateChangePasswordWizard updates an existing change.password.wizard record. +func (c *Client) UpdateChangePasswordWizard(cpw *ChangePasswordWizard) error { + return c.UpdateChangePasswordWizards([]int64{cpw.Id.Get()}, cpw) +} + +// UpdateChangePasswordWizards updates existing change.password.wizard records. +// All records (represented by ids) will be updated by cpw values. +func (c *Client) UpdateChangePasswordWizards(ids []int64, cpw *ChangePasswordWizard) error { + return c.Update(ChangePasswordWizardModel, ids, cpw, nil) +} + +// DeleteChangePasswordWizard deletes an existing change.password.wizard record. +func (c *Client) DeleteChangePasswordWizard(id int64) error { + return c.DeleteChangePasswordWizards([]int64{id}) +} + +// DeleteChangePasswordWizards deletes existing change.password.wizard records. +func (c *Client) DeleteChangePasswordWizards(ids []int64) error { + return c.Delete(ChangePasswordWizardModel, ids) +} + +// GetChangePasswordWizard gets change.password.wizard existing record. +func (c *Client) GetChangePasswordWizard(id int64) (*ChangePasswordWizard, error) { + cpws, err := c.GetChangePasswordWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*cpws)[0]), nil +} + +// GetChangePasswordWizards gets change.password.wizard existing records. +func (c *Client) GetChangePasswordWizards(ids []int64) (*ChangePasswordWizards, error) { + cpws := &ChangePasswordWizards{} + if err := c.Read(ChangePasswordWizardModel, ids, nil, cpws); err != nil { + return nil, err + } + return cpws, nil +} + +// FindChangePasswordWizard finds change.password.wizard record by querying it with criteria. +func (c *Client) FindChangePasswordWizard(criteria *Criteria) (*ChangePasswordWizard, error) { + cpws := &ChangePasswordWizards{} + if err := c.SearchRead(ChangePasswordWizardModel, criteria, NewOptions().Limit(1), cpws); err != nil { + return nil, err + } + return &((*cpws)[0]), nil +} + +// FindChangePasswordWizards finds change.password.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindChangePasswordWizards(criteria *Criteria, options *Options) (*ChangePasswordWizards, error) { + cpws := &ChangePasswordWizards{} + if err := c.SearchRead(ChangePasswordWizardModel, criteria, options, cpws); err != nil { + return nil, err + } + return cpws, nil +} + +// FindChangePasswordWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindChangePasswordWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ChangePasswordWizardModel, criteria, options) +} + +// FindChangePasswordWizardId finds record id by querying it with criteria. +func (c *Client) FindChangePasswordWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ChangePasswordWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_activity_report.go b/crm_activity_report.go new file mode 100644 index 0000000..1e7962e --- /dev/null +++ b/crm_activity_report.go @@ -0,0 +1,131 @@ +package odoo + +// CrmActivityReport represents crm.activity.report model. +type CrmActivityReport struct { + Active *Bool `xmlrpc:"active,omitempty"` + AuthorId *Many2One `xmlrpc:"author_id,omitempty"` + Body *String `xmlrpc:"body,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DateClosed *Time `xmlrpc:"date_closed,omitempty"` + DateConversion *Time `xmlrpc:"date_conversion,omitempty"` + DateDeadline *Time `xmlrpc:"date_deadline,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LeadCreateDate *Time `xmlrpc:"lead_create_date,omitempty"` + LeadId *Many2One `xmlrpc:"lead_id,omitempty"` + LeadType *Selection `xmlrpc:"lead_type,omitempty"` + MailActivityTypeId *Many2One `xmlrpc:"mail_activity_type_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + StageId *Many2One `xmlrpc:"stage_id,omitempty"` + SubtypeId *Many2One `xmlrpc:"subtype_id,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` +} + +// CrmActivityReports represents array of crm.activity.report model. +type CrmActivityReports []CrmActivityReport + +// CrmActivityReportModel is the odoo model name. +const CrmActivityReportModel = "crm.activity.report" + +// Many2One convert CrmActivityReport to *Many2One. +func (car *CrmActivityReport) Many2One() *Many2One { + return NewMany2One(car.Id.Get(), "") +} + +// CreateCrmActivityReport creates a new crm.activity.report model and returns its id. +func (c *Client) CreateCrmActivityReport(car *CrmActivityReport) (int64, error) { + ids, err := c.CreateCrmActivityReports([]*CrmActivityReport{car}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmActivityReport creates a new crm.activity.report model and returns its id. +func (c *Client) CreateCrmActivityReports(cars []*CrmActivityReport) ([]int64, error) { + var vv []interface{} + for _, v := range cars { + vv = append(vv, v) + } + return c.Create(CrmActivityReportModel, vv, nil) +} + +// UpdateCrmActivityReport updates an existing crm.activity.report record. +func (c *Client) UpdateCrmActivityReport(car *CrmActivityReport) error { + return c.UpdateCrmActivityReports([]int64{car.Id.Get()}, car) +} + +// UpdateCrmActivityReports updates existing crm.activity.report records. +// All records (represented by ids) will be updated by car values. +func (c *Client) UpdateCrmActivityReports(ids []int64, car *CrmActivityReport) error { + return c.Update(CrmActivityReportModel, ids, car, nil) +} + +// DeleteCrmActivityReport deletes an existing crm.activity.report record. +func (c *Client) DeleteCrmActivityReport(id int64) error { + return c.DeleteCrmActivityReports([]int64{id}) +} + +// DeleteCrmActivityReports deletes existing crm.activity.report records. +func (c *Client) DeleteCrmActivityReports(ids []int64) error { + return c.Delete(CrmActivityReportModel, ids) +} + +// GetCrmActivityReport gets crm.activity.report existing record. +func (c *Client) GetCrmActivityReport(id int64) (*CrmActivityReport, error) { + cars, err := c.GetCrmActivityReports([]int64{id}) + if err != nil { + return nil, err + } + return &((*cars)[0]), nil +} + +// GetCrmActivityReports gets crm.activity.report existing records. +func (c *Client) GetCrmActivityReports(ids []int64) (*CrmActivityReports, error) { + cars := &CrmActivityReports{} + if err := c.Read(CrmActivityReportModel, ids, nil, cars); err != nil { + return nil, err + } + return cars, nil +} + +// FindCrmActivityReport finds crm.activity.report record by querying it with criteria. +func (c *Client) FindCrmActivityReport(criteria *Criteria) (*CrmActivityReport, error) { + cars := &CrmActivityReports{} + if err := c.SearchRead(CrmActivityReportModel, criteria, NewOptions().Limit(1), cars); err != nil { + return nil, err + } + return &((*cars)[0]), nil +} + +// FindCrmActivityReports finds crm.activity.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmActivityReports(criteria *Criteria, options *Options) (*CrmActivityReports, error) { + cars := &CrmActivityReports{} + if err := c.SearchRead(CrmActivityReportModel, criteria, options, cars); err != nil { + return nil, err + } + return cars, nil +} + +// FindCrmActivityReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmActivityReportIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmActivityReportModel, criteria, options) +} + +// FindCrmActivityReportId finds record id by querying it with criteria. +func (c *Client) FindCrmActivityReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmActivityReportModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_iap_lead_helpers.go b/crm_iap_lead_helpers.go new file mode 100644 index 0000000..875bf9b --- /dev/null +++ b/crm_iap_lead_helpers.go @@ -0,0 +1,116 @@ +package odoo + +// CrmIapLeadHelpers represents crm.iap.lead.helpers model. +type CrmIapLeadHelpers struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmIapLeadHelperss represents array of crm.iap.lead.helpers model. +type CrmIapLeadHelperss []CrmIapLeadHelpers + +// CrmIapLeadHelpersModel is the odoo model name. +const CrmIapLeadHelpersModel = "crm.iap.lead.helpers" + +// Many2One convert CrmIapLeadHelpers to *Many2One. +func (cilh *CrmIapLeadHelpers) Many2One() *Many2One { + return NewMany2One(cilh.Id.Get(), "") +} + +// CreateCrmIapLeadHelpers creates a new crm.iap.lead.helpers model and returns its id. +func (c *Client) CreateCrmIapLeadHelpers(cilh *CrmIapLeadHelpers) (int64, error) { + ids, err := c.CreateCrmIapLeadHelperss([]*CrmIapLeadHelpers{cilh}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmIapLeadHelpers creates a new crm.iap.lead.helpers model and returns its id. +func (c *Client) CreateCrmIapLeadHelperss(cilhs []*CrmIapLeadHelpers) ([]int64, error) { + var vv []interface{} + for _, v := range cilhs { + vv = append(vv, v) + } + return c.Create(CrmIapLeadHelpersModel, vv, nil) +} + +// UpdateCrmIapLeadHelpers updates an existing crm.iap.lead.helpers record. +func (c *Client) UpdateCrmIapLeadHelpers(cilh *CrmIapLeadHelpers) error { + return c.UpdateCrmIapLeadHelperss([]int64{cilh.Id.Get()}, cilh) +} + +// UpdateCrmIapLeadHelperss updates existing crm.iap.lead.helpers records. +// All records (represented by ids) will be updated by cilh values. +func (c *Client) UpdateCrmIapLeadHelperss(ids []int64, cilh *CrmIapLeadHelpers) error { + return c.Update(CrmIapLeadHelpersModel, ids, cilh, nil) +} + +// DeleteCrmIapLeadHelpers deletes an existing crm.iap.lead.helpers record. +func (c *Client) DeleteCrmIapLeadHelpers(id int64) error { + return c.DeleteCrmIapLeadHelperss([]int64{id}) +} + +// DeleteCrmIapLeadHelperss deletes existing crm.iap.lead.helpers records. +func (c *Client) DeleteCrmIapLeadHelperss(ids []int64) error { + return c.Delete(CrmIapLeadHelpersModel, ids) +} + +// GetCrmIapLeadHelpers gets crm.iap.lead.helpers existing record. +func (c *Client) GetCrmIapLeadHelpers(id int64) (*CrmIapLeadHelpers, error) { + cilhs, err := c.GetCrmIapLeadHelperss([]int64{id}) + if err != nil { + return nil, err + } + return &((*cilhs)[0]), nil +} + +// GetCrmIapLeadHelperss gets crm.iap.lead.helpers existing records. +func (c *Client) GetCrmIapLeadHelperss(ids []int64) (*CrmIapLeadHelperss, error) { + cilhs := &CrmIapLeadHelperss{} + if err := c.Read(CrmIapLeadHelpersModel, ids, nil, cilhs); err != nil { + return nil, err + } + return cilhs, nil +} + +// FindCrmIapLeadHelpers finds crm.iap.lead.helpers record by querying it with criteria. +func (c *Client) FindCrmIapLeadHelpers(criteria *Criteria) (*CrmIapLeadHelpers, error) { + cilhs := &CrmIapLeadHelperss{} + if err := c.SearchRead(CrmIapLeadHelpersModel, criteria, NewOptions().Limit(1), cilhs); err != nil { + return nil, err + } + return &((*cilhs)[0]), nil +} + +// FindCrmIapLeadHelperss finds crm.iap.lead.helpers records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmIapLeadHelperss(criteria *Criteria, options *Options) (*CrmIapLeadHelperss, error) { + cilhs := &CrmIapLeadHelperss{} + if err := c.SearchRead(CrmIapLeadHelpersModel, criteria, options, cilhs); err != nil { + return nil, err + } + return cilhs, nil +} + +// FindCrmIapLeadHelpersIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmIapLeadHelpersIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmIapLeadHelpersModel, criteria, options) +} + +// FindCrmIapLeadHelpersId finds record id by querying it with criteria. +func (c *Client) FindCrmIapLeadHelpersId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmIapLeadHelpersModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_iap_lead_industry.go b/crm_iap_lead_industry.go new file mode 100644 index 0000000..455efb5 --- /dev/null +++ b/crm_iap_lead_industry.go @@ -0,0 +1,120 @@ +package odoo + +// CrmIapLeadIndustry represents crm.iap.lead.industry model. +type CrmIapLeadIndustry struct { + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + RevealIds *String `xmlrpc:"reveal_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmIapLeadIndustrys represents array of crm.iap.lead.industry model. +type CrmIapLeadIndustrys []CrmIapLeadIndustry + +// CrmIapLeadIndustryModel is the odoo model name. +const CrmIapLeadIndustryModel = "crm.iap.lead.industry" + +// Many2One convert CrmIapLeadIndustry to *Many2One. +func (cili *CrmIapLeadIndustry) Many2One() *Many2One { + return NewMany2One(cili.Id.Get(), "") +} + +// CreateCrmIapLeadIndustry creates a new crm.iap.lead.industry model and returns its id. +func (c *Client) CreateCrmIapLeadIndustry(cili *CrmIapLeadIndustry) (int64, error) { + ids, err := c.CreateCrmIapLeadIndustrys([]*CrmIapLeadIndustry{cili}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmIapLeadIndustry creates a new crm.iap.lead.industry model and returns its id. +func (c *Client) CreateCrmIapLeadIndustrys(cilis []*CrmIapLeadIndustry) ([]int64, error) { + var vv []interface{} + for _, v := range cilis { + vv = append(vv, v) + } + return c.Create(CrmIapLeadIndustryModel, vv, nil) +} + +// UpdateCrmIapLeadIndustry updates an existing crm.iap.lead.industry record. +func (c *Client) UpdateCrmIapLeadIndustry(cili *CrmIapLeadIndustry) error { + return c.UpdateCrmIapLeadIndustrys([]int64{cili.Id.Get()}, cili) +} + +// UpdateCrmIapLeadIndustrys updates existing crm.iap.lead.industry records. +// All records (represented by ids) will be updated by cili values. +func (c *Client) UpdateCrmIapLeadIndustrys(ids []int64, cili *CrmIapLeadIndustry) error { + return c.Update(CrmIapLeadIndustryModel, ids, cili, nil) +} + +// DeleteCrmIapLeadIndustry deletes an existing crm.iap.lead.industry record. +func (c *Client) DeleteCrmIapLeadIndustry(id int64) error { + return c.DeleteCrmIapLeadIndustrys([]int64{id}) +} + +// DeleteCrmIapLeadIndustrys deletes existing crm.iap.lead.industry records. +func (c *Client) DeleteCrmIapLeadIndustrys(ids []int64) error { + return c.Delete(CrmIapLeadIndustryModel, ids) +} + +// GetCrmIapLeadIndustry gets crm.iap.lead.industry existing record. +func (c *Client) GetCrmIapLeadIndustry(id int64) (*CrmIapLeadIndustry, error) { + cilis, err := c.GetCrmIapLeadIndustrys([]int64{id}) + if err != nil { + return nil, err + } + return &((*cilis)[0]), nil +} + +// GetCrmIapLeadIndustrys gets crm.iap.lead.industry existing records. +func (c *Client) GetCrmIapLeadIndustrys(ids []int64) (*CrmIapLeadIndustrys, error) { + cilis := &CrmIapLeadIndustrys{} + if err := c.Read(CrmIapLeadIndustryModel, ids, nil, cilis); err != nil { + return nil, err + } + return cilis, nil +} + +// FindCrmIapLeadIndustry finds crm.iap.lead.industry record by querying it with criteria. +func (c *Client) FindCrmIapLeadIndustry(criteria *Criteria) (*CrmIapLeadIndustry, error) { + cilis := &CrmIapLeadIndustrys{} + if err := c.SearchRead(CrmIapLeadIndustryModel, criteria, NewOptions().Limit(1), cilis); err != nil { + return nil, err + } + return &((*cilis)[0]), nil +} + +// FindCrmIapLeadIndustrys finds crm.iap.lead.industry records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmIapLeadIndustrys(criteria *Criteria, options *Options) (*CrmIapLeadIndustrys, error) { + cilis := &CrmIapLeadIndustrys{} + if err := c.SearchRead(CrmIapLeadIndustryModel, criteria, options, cilis); err != nil { + return nil, err + } + return cilis, nil +} + +// FindCrmIapLeadIndustryIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmIapLeadIndustryIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmIapLeadIndustryModel, criteria, options) +} + +// FindCrmIapLeadIndustryId finds record id by querying it with criteria. +func (c *Client) FindCrmIapLeadIndustryId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmIapLeadIndustryModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_iap_lead_mining_request.go b/crm_iap_lead_mining_request.go new file mode 100644 index 0000000..70148a2 --- /dev/null +++ b/crm_iap_lead_mining_request.go @@ -0,0 +1,142 @@ +package odoo + +// CrmIapLeadMiningRequest represents crm.iap.lead.mining.request model. +type CrmIapLeadMiningRequest struct { + AvailableStateIds *Relation `xmlrpc:"available_state_ids,omitempty"` + CompanySizeMax *Int `xmlrpc:"company_size_max,omitempty"` + CompanySizeMin *Int `xmlrpc:"company_size_min,omitempty"` + ContactFilterType *Selection `xmlrpc:"contact_filter_type,omitempty"` + ContactNumber *Int `xmlrpc:"contact_number,omitempty"` + CountryIds *Relation `xmlrpc:"country_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ErrorType *Selection `xmlrpc:"error_type,omitempty"` + FilterOnSize *Bool `xmlrpc:"filter_on_size,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IndustryIds *Relation `xmlrpc:"industry_ids,omitempty"` + LeadContactsCredits *String `xmlrpc:"lead_contacts_credits,omitempty"` + LeadCount *Int `xmlrpc:"lead_count,omitempty"` + LeadCredits *String `xmlrpc:"lead_credits,omitempty"` + LeadIds *Relation `xmlrpc:"lead_ids,omitempty"` + LeadNumber *Int `xmlrpc:"lead_number,omitempty"` + LeadTotalCredits *String `xmlrpc:"lead_total_credits,omitempty"` + LeadType *Selection `xmlrpc:"lead_type,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PreferredRoleId *Many2One `xmlrpc:"preferred_role_id,omitempty"` + RoleIds *Relation `xmlrpc:"role_ids,omitempty"` + SearchType *Selection `xmlrpc:"search_type,omitempty"` + SeniorityId *Many2One `xmlrpc:"seniority_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StateIds *Relation `xmlrpc:"state_ids,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmIapLeadMiningRequests represents array of crm.iap.lead.mining.request model. +type CrmIapLeadMiningRequests []CrmIapLeadMiningRequest + +// CrmIapLeadMiningRequestModel is the odoo model name. +const CrmIapLeadMiningRequestModel = "crm.iap.lead.mining.request" + +// Many2One convert CrmIapLeadMiningRequest to *Many2One. +func (cilmr *CrmIapLeadMiningRequest) Many2One() *Many2One { + return NewMany2One(cilmr.Id.Get(), "") +} + +// CreateCrmIapLeadMiningRequest creates a new crm.iap.lead.mining.request model and returns its id. +func (c *Client) CreateCrmIapLeadMiningRequest(cilmr *CrmIapLeadMiningRequest) (int64, error) { + ids, err := c.CreateCrmIapLeadMiningRequests([]*CrmIapLeadMiningRequest{cilmr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmIapLeadMiningRequest creates a new crm.iap.lead.mining.request model and returns its id. +func (c *Client) CreateCrmIapLeadMiningRequests(cilmrs []*CrmIapLeadMiningRequest) ([]int64, error) { + var vv []interface{} + for _, v := range cilmrs { + vv = append(vv, v) + } + return c.Create(CrmIapLeadMiningRequestModel, vv, nil) +} + +// UpdateCrmIapLeadMiningRequest updates an existing crm.iap.lead.mining.request record. +func (c *Client) UpdateCrmIapLeadMiningRequest(cilmr *CrmIapLeadMiningRequest) error { + return c.UpdateCrmIapLeadMiningRequests([]int64{cilmr.Id.Get()}, cilmr) +} + +// UpdateCrmIapLeadMiningRequests updates existing crm.iap.lead.mining.request records. +// All records (represented by ids) will be updated by cilmr values. +func (c *Client) UpdateCrmIapLeadMiningRequests(ids []int64, cilmr *CrmIapLeadMiningRequest) error { + return c.Update(CrmIapLeadMiningRequestModel, ids, cilmr, nil) +} + +// DeleteCrmIapLeadMiningRequest deletes an existing crm.iap.lead.mining.request record. +func (c *Client) DeleteCrmIapLeadMiningRequest(id int64) error { + return c.DeleteCrmIapLeadMiningRequests([]int64{id}) +} + +// DeleteCrmIapLeadMiningRequests deletes existing crm.iap.lead.mining.request records. +func (c *Client) DeleteCrmIapLeadMiningRequests(ids []int64) error { + return c.Delete(CrmIapLeadMiningRequestModel, ids) +} + +// GetCrmIapLeadMiningRequest gets crm.iap.lead.mining.request existing record. +func (c *Client) GetCrmIapLeadMiningRequest(id int64) (*CrmIapLeadMiningRequest, error) { + cilmrs, err := c.GetCrmIapLeadMiningRequests([]int64{id}) + if err != nil { + return nil, err + } + return &((*cilmrs)[0]), nil +} + +// GetCrmIapLeadMiningRequests gets crm.iap.lead.mining.request existing records. +func (c *Client) GetCrmIapLeadMiningRequests(ids []int64) (*CrmIapLeadMiningRequests, error) { + cilmrs := &CrmIapLeadMiningRequests{} + if err := c.Read(CrmIapLeadMiningRequestModel, ids, nil, cilmrs); err != nil { + return nil, err + } + return cilmrs, nil +} + +// FindCrmIapLeadMiningRequest finds crm.iap.lead.mining.request record by querying it with criteria. +func (c *Client) FindCrmIapLeadMiningRequest(criteria *Criteria) (*CrmIapLeadMiningRequest, error) { + cilmrs := &CrmIapLeadMiningRequests{} + if err := c.SearchRead(CrmIapLeadMiningRequestModel, criteria, NewOptions().Limit(1), cilmrs); err != nil { + return nil, err + } + return &((*cilmrs)[0]), nil +} + +// FindCrmIapLeadMiningRequests finds crm.iap.lead.mining.request records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmIapLeadMiningRequests(criteria *Criteria, options *Options) (*CrmIapLeadMiningRequests, error) { + cilmrs := &CrmIapLeadMiningRequests{} + if err := c.SearchRead(CrmIapLeadMiningRequestModel, criteria, options, cilmrs); err != nil { + return nil, err + } + return cilmrs, nil +} + +// FindCrmIapLeadMiningRequestIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmIapLeadMiningRequestIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmIapLeadMiningRequestModel, criteria, options) +} + +// FindCrmIapLeadMiningRequestId finds record id by querying it with criteria. +func (c *Client) FindCrmIapLeadMiningRequestId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmIapLeadMiningRequestModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_iap_lead_role.go b/crm_iap_lead_role.go new file mode 100644 index 0000000..58e420f --- /dev/null +++ b/crm_iap_lead_role.go @@ -0,0 +1,119 @@ +package odoo + +// CrmIapLeadRole represents crm.iap.lead.role model. +type CrmIapLeadRole struct { + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + RevealId *String `xmlrpc:"reveal_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmIapLeadRoles represents array of crm.iap.lead.role model. +type CrmIapLeadRoles []CrmIapLeadRole + +// CrmIapLeadRoleModel is the odoo model name. +const CrmIapLeadRoleModel = "crm.iap.lead.role" + +// Many2One convert CrmIapLeadRole to *Many2One. +func (cilr *CrmIapLeadRole) Many2One() *Many2One { + return NewMany2One(cilr.Id.Get(), "") +} + +// CreateCrmIapLeadRole creates a new crm.iap.lead.role model and returns its id. +func (c *Client) CreateCrmIapLeadRole(cilr *CrmIapLeadRole) (int64, error) { + ids, err := c.CreateCrmIapLeadRoles([]*CrmIapLeadRole{cilr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmIapLeadRole creates a new crm.iap.lead.role model and returns its id. +func (c *Client) CreateCrmIapLeadRoles(cilrs []*CrmIapLeadRole) ([]int64, error) { + var vv []interface{} + for _, v := range cilrs { + vv = append(vv, v) + } + return c.Create(CrmIapLeadRoleModel, vv, nil) +} + +// UpdateCrmIapLeadRole updates an existing crm.iap.lead.role record. +func (c *Client) UpdateCrmIapLeadRole(cilr *CrmIapLeadRole) error { + return c.UpdateCrmIapLeadRoles([]int64{cilr.Id.Get()}, cilr) +} + +// UpdateCrmIapLeadRoles updates existing crm.iap.lead.role records. +// All records (represented by ids) will be updated by cilr values. +func (c *Client) UpdateCrmIapLeadRoles(ids []int64, cilr *CrmIapLeadRole) error { + return c.Update(CrmIapLeadRoleModel, ids, cilr, nil) +} + +// DeleteCrmIapLeadRole deletes an existing crm.iap.lead.role record. +func (c *Client) DeleteCrmIapLeadRole(id int64) error { + return c.DeleteCrmIapLeadRoles([]int64{id}) +} + +// DeleteCrmIapLeadRoles deletes existing crm.iap.lead.role records. +func (c *Client) DeleteCrmIapLeadRoles(ids []int64) error { + return c.Delete(CrmIapLeadRoleModel, ids) +} + +// GetCrmIapLeadRole gets crm.iap.lead.role existing record. +func (c *Client) GetCrmIapLeadRole(id int64) (*CrmIapLeadRole, error) { + cilrs, err := c.GetCrmIapLeadRoles([]int64{id}) + if err != nil { + return nil, err + } + return &((*cilrs)[0]), nil +} + +// GetCrmIapLeadRoles gets crm.iap.lead.role existing records. +func (c *Client) GetCrmIapLeadRoles(ids []int64) (*CrmIapLeadRoles, error) { + cilrs := &CrmIapLeadRoles{} + if err := c.Read(CrmIapLeadRoleModel, ids, nil, cilrs); err != nil { + return nil, err + } + return cilrs, nil +} + +// FindCrmIapLeadRole finds crm.iap.lead.role record by querying it with criteria. +func (c *Client) FindCrmIapLeadRole(criteria *Criteria) (*CrmIapLeadRole, error) { + cilrs := &CrmIapLeadRoles{} + if err := c.SearchRead(CrmIapLeadRoleModel, criteria, NewOptions().Limit(1), cilrs); err != nil { + return nil, err + } + return &((*cilrs)[0]), nil +} + +// FindCrmIapLeadRoles finds crm.iap.lead.role records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmIapLeadRoles(criteria *Criteria, options *Options) (*CrmIapLeadRoles, error) { + cilrs := &CrmIapLeadRoles{} + if err := c.SearchRead(CrmIapLeadRoleModel, criteria, options, cilrs); err != nil { + return nil, err + } + return cilrs, nil +} + +// FindCrmIapLeadRoleIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmIapLeadRoleIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmIapLeadRoleModel, criteria, options) +} + +// FindCrmIapLeadRoleId finds record id by querying it with criteria. +func (c *Client) FindCrmIapLeadRoleId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmIapLeadRoleModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_iap_lead_seniority.go b/crm_iap_lead_seniority.go new file mode 100644 index 0000000..c7cbc44 --- /dev/null +++ b/crm_iap_lead_seniority.go @@ -0,0 +1,118 @@ +package odoo + +// CrmIapLeadSeniority represents crm.iap.lead.seniority model. +type CrmIapLeadSeniority struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + RevealId *String `xmlrpc:"reveal_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmIapLeadSenioritys represents array of crm.iap.lead.seniority model. +type CrmIapLeadSenioritys []CrmIapLeadSeniority + +// CrmIapLeadSeniorityModel is the odoo model name. +const CrmIapLeadSeniorityModel = "crm.iap.lead.seniority" + +// Many2One convert CrmIapLeadSeniority to *Many2One. +func (cils *CrmIapLeadSeniority) Many2One() *Many2One { + return NewMany2One(cils.Id.Get(), "") +} + +// CreateCrmIapLeadSeniority creates a new crm.iap.lead.seniority model and returns its id. +func (c *Client) CreateCrmIapLeadSeniority(cils *CrmIapLeadSeniority) (int64, error) { + ids, err := c.CreateCrmIapLeadSenioritys([]*CrmIapLeadSeniority{cils}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmIapLeadSeniority creates a new crm.iap.lead.seniority model and returns its id. +func (c *Client) CreateCrmIapLeadSenioritys(cilss []*CrmIapLeadSeniority) ([]int64, error) { + var vv []interface{} + for _, v := range cilss { + vv = append(vv, v) + } + return c.Create(CrmIapLeadSeniorityModel, vv, nil) +} + +// UpdateCrmIapLeadSeniority updates an existing crm.iap.lead.seniority record. +func (c *Client) UpdateCrmIapLeadSeniority(cils *CrmIapLeadSeniority) error { + return c.UpdateCrmIapLeadSenioritys([]int64{cils.Id.Get()}, cils) +} + +// UpdateCrmIapLeadSenioritys updates existing crm.iap.lead.seniority records. +// All records (represented by ids) will be updated by cils values. +func (c *Client) UpdateCrmIapLeadSenioritys(ids []int64, cils *CrmIapLeadSeniority) error { + return c.Update(CrmIapLeadSeniorityModel, ids, cils, nil) +} + +// DeleteCrmIapLeadSeniority deletes an existing crm.iap.lead.seniority record. +func (c *Client) DeleteCrmIapLeadSeniority(id int64) error { + return c.DeleteCrmIapLeadSenioritys([]int64{id}) +} + +// DeleteCrmIapLeadSenioritys deletes existing crm.iap.lead.seniority records. +func (c *Client) DeleteCrmIapLeadSenioritys(ids []int64) error { + return c.Delete(CrmIapLeadSeniorityModel, ids) +} + +// GetCrmIapLeadSeniority gets crm.iap.lead.seniority existing record. +func (c *Client) GetCrmIapLeadSeniority(id int64) (*CrmIapLeadSeniority, error) { + cilss, err := c.GetCrmIapLeadSenioritys([]int64{id}) + if err != nil { + return nil, err + } + return &((*cilss)[0]), nil +} + +// GetCrmIapLeadSenioritys gets crm.iap.lead.seniority existing records. +func (c *Client) GetCrmIapLeadSenioritys(ids []int64) (*CrmIapLeadSenioritys, error) { + cilss := &CrmIapLeadSenioritys{} + if err := c.Read(CrmIapLeadSeniorityModel, ids, nil, cilss); err != nil { + return nil, err + } + return cilss, nil +} + +// FindCrmIapLeadSeniority finds crm.iap.lead.seniority record by querying it with criteria. +func (c *Client) FindCrmIapLeadSeniority(criteria *Criteria) (*CrmIapLeadSeniority, error) { + cilss := &CrmIapLeadSenioritys{} + if err := c.SearchRead(CrmIapLeadSeniorityModel, criteria, NewOptions().Limit(1), cilss); err != nil { + return nil, err + } + return &((*cilss)[0]), nil +} + +// FindCrmIapLeadSenioritys finds crm.iap.lead.seniority records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmIapLeadSenioritys(criteria *Criteria, options *Options) (*CrmIapLeadSenioritys, error) { + cilss := &CrmIapLeadSenioritys{} + if err := c.SearchRead(CrmIapLeadSeniorityModel, criteria, options, cilss); err != nil { + return nil, err + } + return cilss, nil +} + +// FindCrmIapLeadSeniorityIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmIapLeadSeniorityIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmIapLeadSeniorityModel, criteria, options) +} + +// FindCrmIapLeadSeniorityId finds record id by querying it with criteria. +func (c *Client) FindCrmIapLeadSeniorityId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmIapLeadSeniorityModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_lead.go b/crm_lead.go new file mode 100644 index 0000000..31689b6 --- /dev/null +++ b/crm_lead.go @@ -0,0 +1,225 @@ +package odoo + +// CrmLead represents crm.lead model. +type CrmLead struct { + Active *Bool `xmlrpc:"active,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AutomatedProbability *Float `xmlrpc:"automated_probability,omitempty"` + CalendarEventIds *Relation `xmlrpc:"calendar_event_ids,omitempty"` + CampaignId *Many2One `xmlrpc:"campaign_id,omitempty"` + City *String `xmlrpc:"city,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyCurrency *Many2One `xmlrpc:"company_currency,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + ContactName *String `xmlrpc:"contact_name,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateAutomationLast *Time `xmlrpc:"date_automation_last,omitempty"` + DateClosed *Time `xmlrpc:"date_closed,omitempty"` + DateConversion *Time `xmlrpc:"date_conversion,omitempty"` + DateDeadline *Time `xmlrpc:"date_deadline,omitempty"` + DateLastStageUpdate *Time `xmlrpc:"date_last_stage_update,omitempty"` + DateOpen *Time `xmlrpc:"date_open,omitempty"` + DayClose *Float `xmlrpc:"day_close,omitempty"` + DayOpen *Float `xmlrpc:"day_open,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DuplicateLeadCount *Int `xmlrpc:"duplicate_lead_count,omitempty"` + DuplicateLeadIds *Relation `xmlrpc:"duplicate_lead_ids,omitempty"` + DurationTracking *String `xmlrpc:"duration_tracking,omitempty"` + EmailCc *String `xmlrpc:"email_cc,omitempty"` + EmailDomainCriterion *String `xmlrpc:"email_domain_criterion,omitempty"` + EmailFrom *String `xmlrpc:"email_from,omitempty"` + EmailNormalized *String `xmlrpc:"email_normalized,omitempty"` + EmailState *Selection `xmlrpc:"email_state,omitempty"` + ExpectedRevenue *Float `xmlrpc:"expected_revenue,omitempty"` + Function *String `xmlrpc:"function,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + IapEnrichDone *Bool `xmlrpc:"iap_enrich_done,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsAutomatedProbability *Bool `xmlrpc:"is_automated_probability,omitempty"` + IsBlacklisted *Bool `xmlrpc:"is_blacklisted,omitempty"` + IsPartnerVisible *Bool `xmlrpc:"is_partner_visible,omitempty"` + LangActiveCount *Int `xmlrpc:"lang_active_count,omitempty"` + LangCode *String `xmlrpc:"lang_code,omitempty"` + LangId *Many2One `xmlrpc:"lang_id,omitempty"` + LeadMiningRequestId *Many2One `xmlrpc:"lead_mining_request_id,omitempty"` + LeadProperties interface{} `xmlrpc:"lead_properties,omitempty"` + LostReasonId *Many2One `xmlrpc:"lost_reason_id,omitempty"` + MediumId *Many2One `xmlrpc:"medium_id,omitempty"` + MeetingDisplayDate *Time `xmlrpc:"meeting_display_date,omitempty"` + MeetingDisplayLabel *String `xmlrpc:"meeting_display_label,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageBounce *Int `xmlrpc:"message_bounce,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Mobile *String `xmlrpc:"mobile,omitempty"` + MobileBlacklisted *Bool `xmlrpc:"mobile_blacklisted,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OrderIds *Relation `xmlrpc:"order_ids,omitempty"` + PartnerEmailUpdate *Bool `xmlrpc:"partner_email_update,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerIsBlacklisted *Bool `xmlrpc:"partner_is_blacklisted,omitempty"` + PartnerName *String `xmlrpc:"partner_name,omitempty"` + PartnerPhoneUpdate *Bool `xmlrpc:"partner_phone_update,omitempty"` + Phone *String `xmlrpc:"phone,omitempty"` + PhoneBlacklisted *Bool `xmlrpc:"phone_blacklisted,omitempty"` + PhoneMobileSearch *String `xmlrpc:"phone_mobile_search,omitempty"` + PhoneSanitized *String `xmlrpc:"phone_sanitized,omitempty"` + PhoneSanitizedBlacklisted *Bool `xmlrpc:"phone_sanitized_blacklisted,omitempty"` + PhoneState *Selection `xmlrpc:"phone_state,omitempty"` + Priority *Selection `xmlrpc:"priority,omitempty"` + Probability *Float `xmlrpc:"probability,omitempty"` + ProratedRevenue *Float `xmlrpc:"prorated_revenue,omitempty"` + QuotationCount *Int `xmlrpc:"quotation_count,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RecurringPlan *Many2One `xmlrpc:"recurring_plan,omitempty"` + RecurringRevenue *Float `xmlrpc:"recurring_revenue,omitempty"` + RecurringRevenueMonthly *Float `xmlrpc:"recurring_revenue_monthly,omitempty"` + RecurringRevenueMonthlyProrated *Float `xmlrpc:"recurring_revenue_monthly_prorated,omitempty"` + RecurringRevenueProrated *Float `xmlrpc:"recurring_revenue_prorated,omitempty"` + Referred *String `xmlrpc:"referred,omitempty"` + RevealId *String `xmlrpc:"reveal_id,omitempty"` + SaleAmountTotal *Float `xmlrpc:"sale_amount_total,omitempty"` + SaleOrderCount *Int `xmlrpc:"sale_order_count,omitempty"` + ShowEnrichButton *Bool `xmlrpc:"show_enrich_button,omitempty"` + SourceId *Many2One `xmlrpc:"source_id,omitempty"` + StageId *Many2One `xmlrpc:"stage_id,omitempty"` + StateId *Many2One `xmlrpc:"state_id,omitempty"` + Street *String `xmlrpc:"street,omitempty"` + Street2 *String `xmlrpc:"street2,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + Title *Many2One `xmlrpc:"title,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + UserCompanyIds *Relation `xmlrpc:"user_company_ids,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + Website *String `xmlrpc:"website,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + Zip *String `xmlrpc:"zip,omitempty"` +} + +// CrmLeads represents array of crm.lead model. +type CrmLeads []CrmLead + +// CrmLeadModel is the odoo model name. +const CrmLeadModel = "crm.lead" + +// Many2One convert CrmLead to *Many2One. +func (cl *CrmLead) Many2One() *Many2One { + return NewMany2One(cl.Id.Get(), "") +} + +// CreateCrmLead creates a new crm.lead model and returns its id. +func (c *Client) CreateCrmLead(cl *CrmLead) (int64, error) { + ids, err := c.CreateCrmLeads([]*CrmLead{cl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmLead creates a new crm.lead model and returns its id. +func (c *Client) CreateCrmLeads(cls []*CrmLead) ([]int64, error) { + var vv []interface{} + for _, v := range cls { + vv = append(vv, v) + } + return c.Create(CrmLeadModel, vv, nil) +} + +// UpdateCrmLead updates an existing crm.lead record. +func (c *Client) UpdateCrmLead(cl *CrmLead) error { + return c.UpdateCrmLeads([]int64{cl.Id.Get()}, cl) +} + +// UpdateCrmLeads updates existing crm.lead records. +// All records (represented by ids) will be updated by cl values. +func (c *Client) UpdateCrmLeads(ids []int64, cl *CrmLead) error { + return c.Update(CrmLeadModel, ids, cl, nil) +} + +// DeleteCrmLead deletes an existing crm.lead record. +func (c *Client) DeleteCrmLead(id int64) error { + return c.DeleteCrmLeads([]int64{id}) +} + +// DeleteCrmLeads deletes existing crm.lead records. +func (c *Client) DeleteCrmLeads(ids []int64) error { + return c.Delete(CrmLeadModel, ids) +} + +// GetCrmLead gets crm.lead existing record. +func (c *Client) GetCrmLead(id int64) (*CrmLead, error) { + cls, err := c.GetCrmLeads([]int64{id}) + if err != nil { + return nil, err + } + return &((*cls)[0]), nil +} + +// GetCrmLeads gets crm.lead existing records. +func (c *Client) GetCrmLeads(ids []int64) (*CrmLeads, error) { + cls := &CrmLeads{} + if err := c.Read(CrmLeadModel, ids, nil, cls); err != nil { + return nil, err + } + return cls, nil +} + +// FindCrmLead finds crm.lead record by querying it with criteria. +func (c *Client) FindCrmLead(criteria *Criteria) (*CrmLead, error) { + cls := &CrmLeads{} + if err := c.SearchRead(CrmLeadModel, criteria, NewOptions().Limit(1), cls); err != nil { + return nil, err + } + return &((*cls)[0]), nil +} + +// FindCrmLeads finds crm.lead records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmLeads(criteria *Criteria, options *Options) (*CrmLeads, error) { + cls := &CrmLeads{} + if err := c.SearchRead(CrmLeadModel, criteria, options, cls); err != nil { + return nil, err + } + return cls, nil +} + +// FindCrmLeadIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmLeadIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmLeadModel, criteria, options) +} + +// FindCrmLeadId finds record id by querying it with criteria. +func (c *Client) FindCrmLeadId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmLeadModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_lead2opportunity_partner.go b/crm_lead2opportunity_partner.go new file mode 100644 index 0000000..a5ff2a7 --- /dev/null +++ b/crm_lead2opportunity_partner.go @@ -0,0 +1,124 @@ +package odoo + +// CrmLead2OpportunityPartner represents crm.lead2opportunity.partner model. +type CrmLead2OpportunityPartner struct { + Action *Selection `xmlrpc:"action,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DuplicatedLeadIds *Relation `xmlrpc:"duplicated_lead_ids,omitempty"` + ForceAssignment *Bool `xmlrpc:"force_assignment,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LeadId *Many2One `xmlrpc:"lead_id,omitempty"` + Name *Selection `xmlrpc:"name,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmLead2OpportunityPartners represents array of crm.lead2opportunity.partner model. +type CrmLead2OpportunityPartners []CrmLead2OpportunityPartner + +// CrmLead2OpportunityPartnerModel is the odoo model name. +const CrmLead2OpportunityPartnerModel = "crm.lead2opportunity.partner" + +// Many2One convert CrmLead2OpportunityPartner to *Many2One. +func (clp *CrmLead2OpportunityPartner) Many2One() *Many2One { + return NewMany2One(clp.Id.Get(), "") +} + +// CreateCrmLead2OpportunityPartner creates a new crm.lead2opportunity.partner model and returns its id. +func (c *Client) CreateCrmLead2OpportunityPartner(clp *CrmLead2OpportunityPartner) (int64, error) { + ids, err := c.CreateCrmLead2OpportunityPartners([]*CrmLead2OpportunityPartner{clp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmLead2OpportunityPartner creates a new crm.lead2opportunity.partner model and returns its id. +func (c *Client) CreateCrmLead2OpportunityPartners(clps []*CrmLead2OpportunityPartner) ([]int64, error) { + var vv []interface{} + for _, v := range clps { + vv = append(vv, v) + } + return c.Create(CrmLead2OpportunityPartnerModel, vv, nil) +} + +// UpdateCrmLead2OpportunityPartner updates an existing crm.lead2opportunity.partner record. +func (c *Client) UpdateCrmLead2OpportunityPartner(clp *CrmLead2OpportunityPartner) error { + return c.UpdateCrmLead2OpportunityPartners([]int64{clp.Id.Get()}, clp) +} + +// UpdateCrmLead2OpportunityPartners updates existing crm.lead2opportunity.partner records. +// All records (represented by ids) will be updated by clp values. +func (c *Client) UpdateCrmLead2OpportunityPartners(ids []int64, clp *CrmLead2OpportunityPartner) error { + return c.Update(CrmLead2OpportunityPartnerModel, ids, clp, nil) +} + +// DeleteCrmLead2OpportunityPartner deletes an existing crm.lead2opportunity.partner record. +func (c *Client) DeleteCrmLead2OpportunityPartner(id int64) error { + return c.DeleteCrmLead2OpportunityPartners([]int64{id}) +} + +// DeleteCrmLead2OpportunityPartners deletes existing crm.lead2opportunity.partner records. +func (c *Client) DeleteCrmLead2OpportunityPartners(ids []int64) error { + return c.Delete(CrmLead2OpportunityPartnerModel, ids) +} + +// GetCrmLead2OpportunityPartner gets crm.lead2opportunity.partner existing record. +func (c *Client) GetCrmLead2OpportunityPartner(id int64) (*CrmLead2OpportunityPartner, error) { + clps, err := c.GetCrmLead2OpportunityPartners([]int64{id}) + if err != nil { + return nil, err + } + return &((*clps)[0]), nil +} + +// GetCrmLead2OpportunityPartners gets crm.lead2opportunity.partner existing records. +func (c *Client) GetCrmLead2OpportunityPartners(ids []int64) (*CrmLead2OpportunityPartners, error) { + clps := &CrmLead2OpportunityPartners{} + if err := c.Read(CrmLead2OpportunityPartnerModel, ids, nil, clps); err != nil { + return nil, err + } + return clps, nil +} + +// FindCrmLead2OpportunityPartner finds crm.lead2opportunity.partner record by querying it with criteria. +func (c *Client) FindCrmLead2OpportunityPartner(criteria *Criteria) (*CrmLead2OpportunityPartner, error) { + clps := &CrmLead2OpportunityPartners{} + if err := c.SearchRead(CrmLead2OpportunityPartnerModel, criteria, NewOptions().Limit(1), clps); err != nil { + return nil, err + } + return &((*clps)[0]), nil +} + +// FindCrmLead2OpportunityPartners finds crm.lead2opportunity.partner records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmLead2OpportunityPartners(criteria *Criteria, options *Options) (*CrmLead2OpportunityPartners, error) { + clps := &CrmLead2OpportunityPartners{} + if err := c.SearchRead(CrmLead2OpportunityPartnerModel, criteria, options, clps); err != nil { + return nil, err + } + return clps, nil +} + +// FindCrmLead2OpportunityPartnerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmLead2OpportunityPartnerIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmLead2OpportunityPartnerModel, criteria, options) +} + +// FindCrmLead2OpportunityPartnerId finds record id by querying it with criteria. +func (c *Client) FindCrmLead2OpportunityPartnerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmLead2OpportunityPartnerModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_lead2opportunity_partner_mass.go b/crm_lead2opportunity_partner_mass.go new file mode 100644 index 0000000..c05c618 --- /dev/null +++ b/crm_lead2opportunity_partner_mass.go @@ -0,0 +1,127 @@ +package odoo + +// CrmLead2OpportunityPartnerMass represents crm.lead2opportunity.partner.mass model. +type CrmLead2OpportunityPartnerMass struct { + Action *Selection `xmlrpc:"action,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Deduplicate *Bool `xmlrpc:"deduplicate,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DuplicatedLeadIds *Relation `xmlrpc:"duplicated_lead_ids,omitempty"` + ForceAssignment *Bool `xmlrpc:"force_assignment,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LeadId *Many2One `xmlrpc:"lead_id,omitempty"` + LeadTomergeIds *Relation `xmlrpc:"lead_tomerge_ids,omitempty"` + Name *Selection `xmlrpc:"name,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + UserIds *Relation `xmlrpc:"user_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmLead2OpportunityPartnerMasss represents array of crm.lead2opportunity.partner.mass model. +type CrmLead2OpportunityPartnerMasss []CrmLead2OpportunityPartnerMass + +// CrmLead2OpportunityPartnerMassModel is the odoo model name. +const CrmLead2OpportunityPartnerMassModel = "crm.lead2opportunity.partner.mass" + +// Many2One convert CrmLead2OpportunityPartnerMass to *Many2One. +func (clpm *CrmLead2OpportunityPartnerMass) Many2One() *Many2One { + return NewMany2One(clpm.Id.Get(), "") +} + +// CreateCrmLead2OpportunityPartnerMass creates a new crm.lead2opportunity.partner.mass model and returns its id. +func (c *Client) CreateCrmLead2OpportunityPartnerMass(clpm *CrmLead2OpportunityPartnerMass) (int64, error) { + ids, err := c.CreateCrmLead2OpportunityPartnerMasss([]*CrmLead2OpportunityPartnerMass{clpm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmLead2OpportunityPartnerMass creates a new crm.lead2opportunity.partner.mass model and returns its id. +func (c *Client) CreateCrmLead2OpportunityPartnerMasss(clpms []*CrmLead2OpportunityPartnerMass) ([]int64, error) { + var vv []interface{} + for _, v := range clpms { + vv = append(vv, v) + } + return c.Create(CrmLead2OpportunityPartnerMassModel, vv, nil) +} + +// UpdateCrmLead2OpportunityPartnerMass updates an existing crm.lead2opportunity.partner.mass record. +func (c *Client) UpdateCrmLead2OpportunityPartnerMass(clpm *CrmLead2OpportunityPartnerMass) error { + return c.UpdateCrmLead2OpportunityPartnerMasss([]int64{clpm.Id.Get()}, clpm) +} + +// UpdateCrmLead2OpportunityPartnerMasss updates existing crm.lead2opportunity.partner.mass records. +// All records (represented by ids) will be updated by clpm values. +func (c *Client) UpdateCrmLead2OpportunityPartnerMasss(ids []int64, clpm *CrmLead2OpportunityPartnerMass) error { + return c.Update(CrmLead2OpportunityPartnerMassModel, ids, clpm, nil) +} + +// DeleteCrmLead2OpportunityPartnerMass deletes an existing crm.lead2opportunity.partner.mass record. +func (c *Client) DeleteCrmLead2OpportunityPartnerMass(id int64) error { + return c.DeleteCrmLead2OpportunityPartnerMasss([]int64{id}) +} + +// DeleteCrmLead2OpportunityPartnerMasss deletes existing crm.lead2opportunity.partner.mass records. +func (c *Client) DeleteCrmLead2OpportunityPartnerMasss(ids []int64) error { + return c.Delete(CrmLead2OpportunityPartnerMassModel, ids) +} + +// GetCrmLead2OpportunityPartnerMass gets crm.lead2opportunity.partner.mass existing record. +func (c *Client) GetCrmLead2OpportunityPartnerMass(id int64) (*CrmLead2OpportunityPartnerMass, error) { + clpms, err := c.GetCrmLead2OpportunityPartnerMasss([]int64{id}) + if err != nil { + return nil, err + } + return &((*clpms)[0]), nil +} + +// GetCrmLead2OpportunityPartnerMasss gets crm.lead2opportunity.partner.mass existing records. +func (c *Client) GetCrmLead2OpportunityPartnerMasss(ids []int64) (*CrmLead2OpportunityPartnerMasss, error) { + clpms := &CrmLead2OpportunityPartnerMasss{} + if err := c.Read(CrmLead2OpportunityPartnerMassModel, ids, nil, clpms); err != nil { + return nil, err + } + return clpms, nil +} + +// FindCrmLead2OpportunityPartnerMass finds crm.lead2opportunity.partner.mass record by querying it with criteria. +func (c *Client) FindCrmLead2OpportunityPartnerMass(criteria *Criteria) (*CrmLead2OpportunityPartnerMass, error) { + clpms := &CrmLead2OpportunityPartnerMasss{} + if err := c.SearchRead(CrmLead2OpportunityPartnerMassModel, criteria, NewOptions().Limit(1), clpms); err != nil { + return nil, err + } + return &((*clpms)[0]), nil +} + +// FindCrmLead2OpportunityPartnerMasss finds crm.lead2opportunity.partner.mass records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmLead2OpportunityPartnerMasss(criteria *Criteria, options *Options) (*CrmLead2OpportunityPartnerMasss, error) { + clpms := &CrmLead2OpportunityPartnerMasss{} + if err := c.SearchRead(CrmLead2OpportunityPartnerMassModel, criteria, options, clpms); err != nil { + return nil, err + } + return clpms, nil +} + +// FindCrmLead2OpportunityPartnerMassIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmLead2OpportunityPartnerMassIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmLead2OpportunityPartnerMassModel, criteria, options) +} + +// FindCrmLead2OpportunityPartnerMassId finds record id by querying it with criteria. +func (c *Client) FindCrmLead2OpportunityPartnerMassId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmLead2OpportunityPartnerMassModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_lead_lost.go b/crm_lead_lost.go new file mode 100644 index 0000000..5184a8c --- /dev/null +++ b/crm_lead_lost.go @@ -0,0 +1,119 @@ +package odoo + +// CrmLeadLost represents crm.lead.lost model. +type CrmLeadLost struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LeadIds *Relation `xmlrpc:"lead_ids,omitempty"` + LostFeedback *String `xmlrpc:"lost_feedback,omitempty"` + LostReasonId *Many2One `xmlrpc:"lost_reason_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmLeadLosts represents array of crm.lead.lost model. +type CrmLeadLosts []CrmLeadLost + +// CrmLeadLostModel is the odoo model name. +const CrmLeadLostModel = "crm.lead.lost" + +// Many2One convert CrmLeadLost to *Many2One. +func (cll *CrmLeadLost) Many2One() *Many2One { + return NewMany2One(cll.Id.Get(), "") +} + +// CreateCrmLeadLost creates a new crm.lead.lost model and returns its id. +func (c *Client) CreateCrmLeadLost(cll *CrmLeadLost) (int64, error) { + ids, err := c.CreateCrmLeadLosts([]*CrmLeadLost{cll}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmLeadLost creates a new crm.lead.lost model and returns its id. +func (c *Client) CreateCrmLeadLosts(clls []*CrmLeadLost) ([]int64, error) { + var vv []interface{} + for _, v := range clls { + vv = append(vv, v) + } + return c.Create(CrmLeadLostModel, vv, nil) +} + +// UpdateCrmLeadLost updates an existing crm.lead.lost record. +func (c *Client) UpdateCrmLeadLost(cll *CrmLeadLost) error { + return c.UpdateCrmLeadLosts([]int64{cll.Id.Get()}, cll) +} + +// UpdateCrmLeadLosts updates existing crm.lead.lost records. +// All records (represented by ids) will be updated by cll values. +func (c *Client) UpdateCrmLeadLosts(ids []int64, cll *CrmLeadLost) error { + return c.Update(CrmLeadLostModel, ids, cll, nil) +} + +// DeleteCrmLeadLost deletes an existing crm.lead.lost record. +func (c *Client) DeleteCrmLeadLost(id int64) error { + return c.DeleteCrmLeadLosts([]int64{id}) +} + +// DeleteCrmLeadLosts deletes existing crm.lead.lost records. +func (c *Client) DeleteCrmLeadLosts(ids []int64) error { + return c.Delete(CrmLeadLostModel, ids) +} + +// GetCrmLeadLost gets crm.lead.lost existing record. +func (c *Client) GetCrmLeadLost(id int64) (*CrmLeadLost, error) { + clls, err := c.GetCrmLeadLosts([]int64{id}) + if err != nil { + return nil, err + } + return &((*clls)[0]), nil +} + +// GetCrmLeadLosts gets crm.lead.lost existing records. +func (c *Client) GetCrmLeadLosts(ids []int64) (*CrmLeadLosts, error) { + clls := &CrmLeadLosts{} + if err := c.Read(CrmLeadLostModel, ids, nil, clls); err != nil { + return nil, err + } + return clls, nil +} + +// FindCrmLeadLost finds crm.lead.lost record by querying it with criteria. +func (c *Client) FindCrmLeadLost(criteria *Criteria) (*CrmLeadLost, error) { + clls := &CrmLeadLosts{} + if err := c.SearchRead(CrmLeadLostModel, criteria, NewOptions().Limit(1), clls); err != nil { + return nil, err + } + return &((*clls)[0]), nil +} + +// FindCrmLeadLosts finds crm.lead.lost records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmLeadLosts(criteria *Criteria, options *Options) (*CrmLeadLosts, error) { + clls := &CrmLeadLosts{} + if err := c.SearchRead(CrmLeadLostModel, criteria, options, clls); err != nil { + return nil, err + } + return clls, nil +} + +// FindCrmLeadLostIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmLeadLostIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmLeadLostModel, criteria, options) +} + +// FindCrmLeadLostId finds record id by querying it with criteria. +func (c *Client) FindCrmLeadLostId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmLeadLostModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_lead_pls_update.go b/crm_lead_pls_update.go new file mode 100644 index 0000000..ea7f1dd --- /dev/null +++ b/crm_lead_pls_update.go @@ -0,0 +1,118 @@ +package odoo + +// CrmLeadPlsUpdate represents crm.lead.pls.update model. +type CrmLeadPlsUpdate struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PlsFields *Relation `xmlrpc:"pls_fields,omitempty"` + PlsStartDate *Time `xmlrpc:"pls_start_date,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmLeadPlsUpdates represents array of crm.lead.pls.update model. +type CrmLeadPlsUpdates []CrmLeadPlsUpdate + +// CrmLeadPlsUpdateModel is the odoo model name. +const CrmLeadPlsUpdateModel = "crm.lead.pls.update" + +// Many2One convert CrmLeadPlsUpdate to *Many2One. +func (clpu *CrmLeadPlsUpdate) Many2One() *Many2One { + return NewMany2One(clpu.Id.Get(), "") +} + +// CreateCrmLeadPlsUpdate creates a new crm.lead.pls.update model and returns its id. +func (c *Client) CreateCrmLeadPlsUpdate(clpu *CrmLeadPlsUpdate) (int64, error) { + ids, err := c.CreateCrmLeadPlsUpdates([]*CrmLeadPlsUpdate{clpu}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmLeadPlsUpdate creates a new crm.lead.pls.update model and returns its id. +func (c *Client) CreateCrmLeadPlsUpdates(clpus []*CrmLeadPlsUpdate) ([]int64, error) { + var vv []interface{} + for _, v := range clpus { + vv = append(vv, v) + } + return c.Create(CrmLeadPlsUpdateModel, vv, nil) +} + +// UpdateCrmLeadPlsUpdate updates an existing crm.lead.pls.update record. +func (c *Client) UpdateCrmLeadPlsUpdate(clpu *CrmLeadPlsUpdate) error { + return c.UpdateCrmLeadPlsUpdates([]int64{clpu.Id.Get()}, clpu) +} + +// UpdateCrmLeadPlsUpdates updates existing crm.lead.pls.update records. +// All records (represented by ids) will be updated by clpu values. +func (c *Client) UpdateCrmLeadPlsUpdates(ids []int64, clpu *CrmLeadPlsUpdate) error { + return c.Update(CrmLeadPlsUpdateModel, ids, clpu, nil) +} + +// DeleteCrmLeadPlsUpdate deletes an existing crm.lead.pls.update record. +func (c *Client) DeleteCrmLeadPlsUpdate(id int64) error { + return c.DeleteCrmLeadPlsUpdates([]int64{id}) +} + +// DeleteCrmLeadPlsUpdates deletes existing crm.lead.pls.update records. +func (c *Client) DeleteCrmLeadPlsUpdates(ids []int64) error { + return c.Delete(CrmLeadPlsUpdateModel, ids) +} + +// GetCrmLeadPlsUpdate gets crm.lead.pls.update existing record. +func (c *Client) GetCrmLeadPlsUpdate(id int64) (*CrmLeadPlsUpdate, error) { + clpus, err := c.GetCrmLeadPlsUpdates([]int64{id}) + if err != nil { + return nil, err + } + return &((*clpus)[0]), nil +} + +// GetCrmLeadPlsUpdates gets crm.lead.pls.update existing records. +func (c *Client) GetCrmLeadPlsUpdates(ids []int64) (*CrmLeadPlsUpdates, error) { + clpus := &CrmLeadPlsUpdates{} + if err := c.Read(CrmLeadPlsUpdateModel, ids, nil, clpus); err != nil { + return nil, err + } + return clpus, nil +} + +// FindCrmLeadPlsUpdate finds crm.lead.pls.update record by querying it with criteria. +func (c *Client) FindCrmLeadPlsUpdate(criteria *Criteria) (*CrmLeadPlsUpdate, error) { + clpus := &CrmLeadPlsUpdates{} + if err := c.SearchRead(CrmLeadPlsUpdateModel, criteria, NewOptions().Limit(1), clpus); err != nil { + return nil, err + } + return &((*clpus)[0]), nil +} + +// FindCrmLeadPlsUpdates finds crm.lead.pls.update records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmLeadPlsUpdates(criteria *Criteria, options *Options) (*CrmLeadPlsUpdates, error) { + clpus := &CrmLeadPlsUpdates{} + if err := c.SearchRead(CrmLeadPlsUpdateModel, criteria, options, clpus); err != nil { + return nil, err + } + return clpus, nil +} + +// FindCrmLeadPlsUpdateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmLeadPlsUpdateIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmLeadPlsUpdateModel, criteria, options) +} + +// FindCrmLeadPlsUpdateId finds record id by querying it with criteria. +func (c *Client) FindCrmLeadPlsUpdateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmLeadPlsUpdateModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_lead_scoring_frequency.go b/crm_lead_scoring_frequency.go new file mode 100644 index 0000000..73aa33e --- /dev/null +++ b/crm_lead_scoring_frequency.go @@ -0,0 +1,121 @@ +package odoo + +// CrmLeadScoringFrequency represents crm.lead.scoring.frequency model. +type CrmLeadScoringFrequency struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LostCount *Float `xmlrpc:"lost_count,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + Value *String `xmlrpc:"value,omitempty"` + Variable *String `xmlrpc:"variable,omitempty"` + WonCount *Float `xmlrpc:"won_count,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmLeadScoringFrequencys represents array of crm.lead.scoring.frequency model. +type CrmLeadScoringFrequencys []CrmLeadScoringFrequency + +// CrmLeadScoringFrequencyModel is the odoo model name. +const CrmLeadScoringFrequencyModel = "crm.lead.scoring.frequency" + +// Many2One convert CrmLeadScoringFrequency to *Many2One. +func (clsf *CrmLeadScoringFrequency) Many2One() *Many2One { + return NewMany2One(clsf.Id.Get(), "") +} + +// CreateCrmLeadScoringFrequency creates a new crm.lead.scoring.frequency model and returns its id. +func (c *Client) CreateCrmLeadScoringFrequency(clsf *CrmLeadScoringFrequency) (int64, error) { + ids, err := c.CreateCrmLeadScoringFrequencys([]*CrmLeadScoringFrequency{clsf}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmLeadScoringFrequency creates a new crm.lead.scoring.frequency model and returns its id. +func (c *Client) CreateCrmLeadScoringFrequencys(clsfs []*CrmLeadScoringFrequency) ([]int64, error) { + var vv []interface{} + for _, v := range clsfs { + vv = append(vv, v) + } + return c.Create(CrmLeadScoringFrequencyModel, vv, nil) +} + +// UpdateCrmLeadScoringFrequency updates an existing crm.lead.scoring.frequency record. +func (c *Client) UpdateCrmLeadScoringFrequency(clsf *CrmLeadScoringFrequency) error { + return c.UpdateCrmLeadScoringFrequencys([]int64{clsf.Id.Get()}, clsf) +} + +// UpdateCrmLeadScoringFrequencys updates existing crm.lead.scoring.frequency records. +// All records (represented by ids) will be updated by clsf values. +func (c *Client) UpdateCrmLeadScoringFrequencys(ids []int64, clsf *CrmLeadScoringFrequency) error { + return c.Update(CrmLeadScoringFrequencyModel, ids, clsf, nil) +} + +// DeleteCrmLeadScoringFrequency deletes an existing crm.lead.scoring.frequency record. +func (c *Client) DeleteCrmLeadScoringFrequency(id int64) error { + return c.DeleteCrmLeadScoringFrequencys([]int64{id}) +} + +// DeleteCrmLeadScoringFrequencys deletes existing crm.lead.scoring.frequency records. +func (c *Client) DeleteCrmLeadScoringFrequencys(ids []int64) error { + return c.Delete(CrmLeadScoringFrequencyModel, ids) +} + +// GetCrmLeadScoringFrequency gets crm.lead.scoring.frequency existing record. +func (c *Client) GetCrmLeadScoringFrequency(id int64) (*CrmLeadScoringFrequency, error) { + clsfs, err := c.GetCrmLeadScoringFrequencys([]int64{id}) + if err != nil { + return nil, err + } + return &((*clsfs)[0]), nil +} + +// GetCrmLeadScoringFrequencys gets crm.lead.scoring.frequency existing records. +func (c *Client) GetCrmLeadScoringFrequencys(ids []int64) (*CrmLeadScoringFrequencys, error) { + clsfs := &CrmLeadScoringFrequencys{} + if err := c.Read(CrmLeadScoringFrequencyModel, ids, nil, clsfs); err != nil { + return nil, err + } + return clsfs, nil +} + +// FindCrmLeadScoringFrequency finds crm.lead.scoring.frequency record by querying it with criteria. +func (c *Client) FindCrmLeadScoringFrequency(criteria *Criteria) (*CrmLeadScoringFrequency, error) { + clsfs := &CrmLeadScoringFrequencys{} + if err := c.SearchRead(CrmLeadScoringFrequencyModel, criteria, NewOptions().Limit(1), clsfs); err != nil { + return nil, err + } + return &((*clsfs)[0]), nil +} + +// FindCrmLeadScoringFrequencys finds crm.lead.scoring.frequency records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmLeadScoringFrequencys(criteria *Criteria, options *Options) (*CrmLeadScoringFrequencys, error) { + clsfs := &CrmLeadScoringFrequencys{} + if err := c.SearchRead(CrmLeadScoringFrequencyModel, criteria, options, clsfs); err != nil { + return nil, err + } + return clsfs, nil +} + +// FindCrmLeadScoringFrequencyIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmLeadScoringFrequencyIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmLeadScoringFrequencyModel, criteria, options) +} + +// FindCrmLeadScoringFrequencyId finds record id by querying it with criteria. +func (c *Client) FindCrmLeadScoringFrequencyId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmLeadScoringFrequencyModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_lead_scoring_frequency_field.go b/crm_lead_scoring_frequency_field.go new file mode 100644 index 0000000..1dafcb8 --- /dev/null +++ b/crm_lead_scoring_frequency_field.go @@ -0,0 +1,118 @@ +package odoo + +// CrmLeadScoringFrequencyField represents crm.lead.scoring.frequency.field model. +type CrmLeadScoringFrequencyField struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FieldId *Many2One `xmlrpc:"field_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmLeadScoringFrequencyFields represents array of crm.lead.scoring.frequency.field model. +type CrmLeadScoringFrequencyFields []CrmLeadScoringFrequencyField + +// CrmLeadScoringFrequencyFieldModel is the odoo model name. +const CrmLeadScoringFrequencyFieldModel = "crm.lead.scoring.frequency.field" + +// Many2One convert CrmLeadScoringFrequencyField to *Many2One. +func (clsff *CrmLeadScoringFrequencyField) Many2One() *Many2One { + return NewMany2One(clsff.Id.Get(), "") +} + +// CreateCrmLeadScoringFrequencyField creates a new crm.lead.scoring.frequency.field model and returns its id. +func (c *Client) CreateCrmLeadScoringFrequencyField(clsff *CrmLeadScoringFrequencyField) (int64, error) { + ids, err := c.CreateCrmLeadScoringFrequencyFields([]*CrmLeadScoringFrequencyField{clsff}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmLeadScoringFrequencyField creates a new crm.lead.scoring.frequency.field model and returns its id. +func (c *Client) CreateCrmLeadScoringFrequencyFields(clsffs []*CrmLeadScoringFrequencyField) ([]int64, error) { + var vv []interface{} + for _, v := range clsffs { + vv = append(vv, v) + } + return c.Create(CrmLeadScoringFrequencyFieldModel, vv, nil) +} + +// UpdateCrmLeadScoringFrequencyField updates an existing crm.lead.scoring.frequency.field record. +func (c *Client) UpdateCrmLeadScoringFrequencyField(clsff *CrmLeadScoringFrequencyField) error { + return c.UpdateCrmLeadScoringFrequencyFields([]int64{clsff.Id.Get()}, clsff) +} + +// UpdateCrmLeadScoringFrequencyFields updates existing crm.lead.scoring.frequency.field records. +// All records (represented by ids) will be updated by clsff values. +func (c *Client) UpdateCrmLeadScoringFrequencyFields(ids []int64, clsff *CrmLeadScoringFrequencyField) error { + return c.Update(CrmLeadScoringFrequencyFieldModel, ids, clsff, nil) +} + +// DeleteCrmLeadScoringFrequencyField deletes an existing crm.lead.scoring.frequency.field record. +func (c *Client) DeleteCrmLeadScoringFrequencyField(id int64) error { + return c.DeleteCrmLeadScoringFrequencyFields([]int64{id}) +} + +// DeleteCrmLeadScoringFrequencyFields deletes existing crm.lead.scoring.frequency.field records. +func (c *Client) DeleteCrmLeadScoringFrequencyFields(ids []int64) error { + return c.Delete(CrmLeadScoringFrequencyFieldModel, ids) +} + +// GetCrmLeadScoringFrequencyField gets crm.lead.scoring.frequency.field existing record. +func (c *Client) GetCrmLeadScoringFrequencyField(id int64) (*CrmLeadScoringFrequencyField, error) { + clsffs, err := c.GetCrmLeadScoringFrequencyFields([]int64{id}) + if err != nil { + return nil, err + } + return &((*clsffs)[0]), nil +} + +// GetCrmLeadScoringFrequencyFields gets crm.lead.scoring.frequency.field existing records. +func (c *Client) GetCrmLeadScoringFrequencyFields(ids []int64) (*CrmLeadScoringFrequencyFields, error) { + clsffs := &CrmLeadScoringFrequencyFields{} + if err := c.Read(CrmLeadScoringFrequencyFieldModel, ids, nil, clsffs); err != nil { + return nil, err + } + return clsffs, nil +} + +// FindCrmLeadScoringFrequencyField finds crm.lead.scoring.frequency.field record by querying it with criteria. +func (c *Client) FindCrmLeadScoringFrequencyField(criteria *Criteria) (*CrmLeadScoringFrequencyField, error) { + clsffs := &CrmLeadScoringFrequencyFields{} + if err := c.SearchRead(CrmLeadScoringFrequencyFieldModel, criteria, NewOptions().Limit(1), clsffs); err != nil { + return nil, err + } + return &((*clsffs)[0]), nil +} + +// FindCrmLeadScoringFrequencyFields finds crm.lead.scoring.frequency.field records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmLeadScoringFrequencyFields(criteria *Criteria, options *Options) (*CrmLeadScoringFrequencyFields, error) { + clsffs := &CrmLeadScoringFrequencyFields{} + if err := c.SearchRead(CrmLeadScoringFrequencyFieldModel, criteria, options, clsffs); err != nil { + return nil, err + } + return clsffs, nil +} + +// FindCrmLeadScoringFrequencyFieldIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmLeadScoringFrequencyFieldIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmLeadScoringFrequencyFieldModel, criteria, options) +} + +// FindCrmLeadScoringFrequencyFieldId finds record id by querying it with criteria. +func (c *Client) FindCrmLeadScoringFrequencyFieldId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmLeadScoringFrequencyFieldModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_lost_reason.go b/crm_lost_reason.go new file mode 100644 index 0000000..82afe81 --- /dev/null +++ b/crm_lost_reason.go @@ -0,0 +1,119 @@ +package odoo + +// CrmLostReason represents crm.lost.reason model. +type CrmLostReason struct { + Active *Bool `xmlrpc:"active,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LeadsCount *Int `xmlrpc:"leads_count,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmLostReasons represents array of crm.lost.reason model. +type CrmLostReasons []CrmLostReason + +// CrmLostReasonModel is the odoo model name. +const CrmLostReasonModel = "crm.lost.reason" + +// Many2One convert CrmLostReason to *Many2One. +func (clr *CrmLostReason) Many2One() *Many2One { + return NewMany2One(clr.Id.Get(), "") +} + +// CreateCrmLostReason creates a new crm.lost.reason model and returns its id. +func (c *Client) CreateCrmLostReason(clr *CrmLostReason) (int64, error) { + ids, err := c.CreateCrmLostReasons([]*CrmLostReason{clr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmLostReason creates a new crm.lost.reason model and returns its id. +func (c *Client) CreateCrmLostReasons(clrs []*CrmLostReason) ([]int64, error) { + var vv []interface{} + for _, v := range clrs { + vv = append(vv, v) + } + return c.Create(CrmLostReasonModel, vv, nil) +} + +// UpdateCrmLostReason updates an existing crm.lost.reason record. +func (c *Client) UpdateCrmLostReason(clr *CrmLostReason) error { + return c.UpdateCrmLostReasons([]int64{clr.Id.Get()}, clr) +} + +// UpdateCrmLostReasons updates existing crm.lost.reason records. +// All records (represented by ids) will be updated by clr values. +func (c *Client) UpdateCrmLostReasons(ids []int64, clr *CrmLostReason) error { + return c.Update(CrmLostReasonModel, ids, clr, nil) +} + +// DeleteCrmLostReason deletes an existing crm.lost.reason record. +func (c *Client) DeleteCrmLostReason(id int64) error { + return c.DeleteCrmLostReasons([]int64{id}) +} + +// DeleteCrmLostReasons deletes existing crm.lost.reason records. +func (c *Client) DeleteCrmLostReasons(ids []int64) error { + return c.Delete(CrmLostReasonModel, ids) +} + +// GetCrmLostReason gets crm.lost.reason existing record. +func (c *Client) GetCrmLostReason(id int64) (*CrmLostReason, error) { + clrs, err := c.GetCrmLostReasons([]int64{id}) + if err != nil { + return nil, err + } + return &((*clrs)[0]), nil +} + +// GetCrmLostReasons gets crm.lost.reason existing records. +func (c *Client) GetCrmLostReasons(ids []int64) (*CrmLostReasons, error) { + clrs := &CrmLostReasons{} + if err := c.Read(CrmLostReasonModel, ids, nil, clrs); err != nil { + return nil, err + } + return clrs, nil +} + +// FindCrmLostReason finds crm.lost.reason record by querying it with criteria. +func (c *Client) FindCrmLostReason(criteria *Criteria) (*CrmLostReason, error) { + clrs := &CrmLostReasons{} + if err := c.SearchRead(CrmLostReasonModel, criteria, NewOptions().Limit(1), clrs); err != nil { + return nil, err + } + return &((*clrs)[0]), nil +} + +// FindCrmLostReasons finds crm.lost.reason records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmLostReasons(criteria *Criteria, options *Options) (*CrmLostReasons, error) { + clrs := &CrmLostReasons{} + if err := c.SearchRead(CrmLostReasonModel, criteria, options, clrs); err != nil { + return nil, err + } + return clrs, nil +} + +// FindCrmLostReasonIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmLostReasonIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmLostReasonModel, criteria, options) +} + +// FindCrmLostReasonId finds record id by querying it with criteria. +func (c *Client) FindCrmLostReasonId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmLostReasonModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_merge_opportunity.go b/crm_merge_opportunity.go new file mode 100644 index 0000000..c6230cc --- /dev/null +++ b/crm_merge_opportunity.go @@ -0,0 +1,119 @@ +package odoo + +// CrmMergeOpportunity represents crm.merge.opportunity model. +type CrmMergeOpportunity struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + OpportunityIds *Relation `xmlrpc:"opportunity_ids,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmMergeOpportunitys represents array of crm.merge.opportunity model. +type CrmMergeOpportunitys []CrmMergeOpportunity + +// CrmMergeOpportunityModel is the odoo model name. +const CrmMergeOpportunityModel = "crm.merge.opportunity" + +// Many2One convert CrmMergeOpportunity to *Many2One. +func (cmo *CrmMergeOpportunity) Many2One() *Many2One { + return NewMany2One(cmo.Id.Get(), "") +} + +// CreateCrmMergeOpportunity creates a new crm.merge.opportunity model and returns its id. +func (c *Client) CreateCrmMergeOpportunity(cmo *CrmMergeOpportunity) (int64, error) { + ids, err := c.CreateCrmMergeOpportunitys([]*CrmMergeOpportunity{cmo}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmMergeOpportunity creates a new crm.merge.opportunity model and returns its id. +func (c *Client) CreateCrmMergeOpportunitys(cmos []*CrmMergeOpportunity) ([]int64, error) { + var vv []interface{} + for _, v := range cmos { + vv = append(vv, v) + } + return c.Create(CrmMergeOpportunityModel, vv, nil) +} + +// UpdateCrmMergeOpportunity updates an existing crm.merge.opportunity record. +func (c *Client) UpdateCrmMergeOpportunity(cmo *CrmMergeOpportunity) error { + return c.UpdateCrmMergeOpportunitys([]int64{cmo.Id.Get()}, cmo) +} + +// UpdateCrmMergeOpportunitys updates existing crm.merge.opportunity records. +// All records (represented by ids) will be updated by cmo values. +func (c *Client) UpdateCrmMergeOpportunitys(ids []int64, cmo *CrmMergeOpportunity) error { + return c.Update(CrmMergeOpportunityModel, ids, cmo, nil) +} + +// DeleteCrmMergeOpportunity deletes an existing crm.merge.opportunity record. +func (c *Client) DeleteCrmMergeOpportunity(id int64) error { + return c.DeleteCrmMergeOpportunitys([]int64{id}) +} + +// DeleteCrmMergeOpportunitys deletes existing crm.merge.opportunity records. +func (c *Client) DeleteCrmMergeOpportunitys(ids []int64) error { + return c.Delete(CrmMergeOpportunityModel, ids) +} + +// GetCrmMergeOpportunity gets crm.merge.opportunity existing record. +func (c *Client) GetCrmMergeOpportunity(id int64) (*CrmMergeOpportunity, error) { + cmos, err := c.GetCrmMergeOpportunitys([]int64{id}) + if err != nil { + return nil, err + } + return &((*cmos)[0]), nil +} + +// GetCrmMergeOpportunitys gets crm.merge.opportunity existing records. +func (c *Client) GetCrmMergeOpportunitys(ids []int64) (*CrmMergeOpportunitys, error) { + cmos := &CrmMergeOpportunitys{} + if err := c.Read(CrmMergeOpportunityModel, ids, nil, cmos); err != nil { + return nil, err + } + return cmos, nil +} + +// FindCrmMergeOpportunity finds crm.merge.opportunity record by querying it with criteria. +func (c *Client) FindCrmMergeOpportunity(criteria *Criteria) (*CrmMergeOpportunity, error) { + cmos := &CrmMergeOpportunitys{} + if err := c.SearchRead(CrmMergeOpportunityModel, criteria, NewOptions().Limit(1), cmos); err != nil { + return nil, err + } + return &((*cmos)[0]), nil +} + +// FindCrmMergeOpportunitys finds crm.merge.opportunity records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmMergeOpportunitys(criteria *Criteria, options *Options) (*CrmMergeOpportunitys, error) { + cmos := &CrmMergeOpportunitys{} + if err := c.SearchRead(CrmMergeOpportunityModel, criteria, options, cmos); err != nil { + return nil, err + } + return cmos, nil +} + +// FindCrmMergeOpportunityIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmMergeOpportunityIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmMergeOpportunityModel, criteria, options) +} + +// FindCrmMergeOpportunityId finds record id by querying it with criteria. +func (c *Client) FindCrmMergeOpportunityId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmMergeOpportunityModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_quotation_partner.go b/crm_quotation_partner.go new file mode 100644 index 0000000..e6e3855 --- /dev/null +++ b/crm_quotation_partner.go @@ -0,0 +1,119 @@ +package odoo + +// CrmQuotationPartner represents crm.quotation.partner model. +type CrmQuotationPartner struct { + Action *Selection `xmlrpc:"action,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LeadId *Many2One `xmlrpc:"lead_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmQuotationPartners represents array of crm.quotation.partner model. +type CrmQuotationPartners []CrmQuotationPartner + +// CrmQuotationPartnerModel is the odoo model name. +const CrmQuotationPartnerModel = "crm.quotation.partner" + +// Many2One convert CrmQuotationPartner to *Many2One. +func (cqp *CrmQuotationPartner) Many2One() *Many2One { + return NewMany2One(cqp.Id.Get(), "") +} + +// CreateCrmQuotationPartner creates a new crm.quotation.partner model and returns its id. +func (c *Client) CreateCrmQuotationPartner(cqp *CrmQuotationPartner) (int64, error) { + ids, err := c.CreateCrmQuotationPartners([]*CrmQuotationPartner{cqp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmQuotationPartner creates a new crm.quotation.partner model and returns its id. +func (c *Client) CreateCrmQuotationPartners(cqps []*CrmQuotationPartner) ([]int64, error) { + var vv []interface{} + for _, v := range cqps { + vv = append(vv, v) + } + return c.Create(CrmQuotationPartnerModel, vv, nil) +} + +// UpdateCrmQuotationPartner updates an existing crm.quotation.partner record. +func (c *Client) UpdateCrmQuotationPartner(cqp *CrmQuotationPartner) error { + return c.UpdateCrmQuotationPartners([]int64{cqp.Id.Get()}, cqp) +} + +// UpdateCrmQuotationPartners updates existing crm.quotation.partner records. +// All records (represented by ids) will be updated by cqp values. +func (c *Client) UpdateCrmQuotationPartners(ids []int64, cqp *CrmQuotationPartner) error { + return c.Update(CrmQuotationPartnerModel, ids, cqp, nil) +} + +// DeleteCrmQuotationPartner deletes an existing crm.quotation.partner record. +func (c *Client) DeleteCrmQuotationPartner(id int64) error { + return c.DeleteCrmQuotationPartners([]int64{id}) +} + +// DeleteCrmQuotationPartners deletes existing crm.quotation.partner records. +func (c *Client) DeleteCrmQuotationPartners(ids []int64) error { + return c.Delete(CrmQuotationPartnerModel, ids) +} + +// GetCrmQuotationPartner gets crm.quotation.partner existing record. +func (c *Client) GetCrmQuotationPartner(id int64) (*CrmQuotationPartner, error) { + cqps, err := c.GetCrmQuotationPartners([]int64{id}) + if err != nil { + return nil, err + } + return &((*cqps)[0]), nil +} + +// GetCrmQuotationPartners gets crm.quotation.partner existing records. +func (c *Client) GetCrmQuotationPartners(ids []int64) (*CrmQuotationPartners, error) { + cqps := &CrmQuotationPartners{} + if err := c.Read(CrmQuotationPartnerModel, ids, nil, cqps); err != nil { + return nil, err + } + return cqps, nil +} + +// FindCrmQuotationPartner finds crm.quotation.partner record by querying it with criteria. +func (c *Client) FindCrmQuotationPartner(criteria *Criteria) (*CrmQuotationPartner, error) { + cqps := &CrmQuotationPartners{} + if err := c.SearchRead(CrmQuotationPartnerModel, criteria, NewOptions().Limit(1), cqps); err != nil { + return nil, err + } + return &((*cqps)[0]), nil +} + +// FindCrmQuotationPartners finds crm.quotation.partner records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmQuotationPartners(criteria *Criteria, options *Options) (*CrmQuotationPartners, error) { + cqps := &CrmQuotationPartners{} + if err := c.SearchRead(CrmQuotationPartnerModel, criteria, options, cqps); err != nil { + return nil, err + } + return cqps, nil +} + +// FindCrmQuotationPartnerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmQuotationPartnerIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmQuotationPartnerModel, criteria, options) +} + +// FindCrmQuotationPartnerId finds record id by querying it with criteria. +func (c *Client) FindCrmQuotationPartnerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmQuotationPartnerModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_recurring_plan.go b/crm_recurring_plan.go new file mode 100644 index 0000000..9ec0446 --- /dev/null +++ b/crm_recurring_plan.go @@ -0,0 +1,120 @@ +package odoo + +// CrmRecurringPlan represents crm.recurring.plan model. +type CrmRecurringPlan struct { + Active *Bool `xmlrpc:"active,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NumberOfMonths *Int `xmlrpc:"number_of_months,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmRecurringPlans represents array of crm.recurring.plan model. +type CrmRecurringPlans []CrmRecurringPlan + +// CrmRecurringPlanModel is the odoo model name. +const CrmRecurringPlanModel = "crm.recurring.plan" + +// Many2One convert CrmRecurringPlan to *Many2One. +func (crp *CrmRecurringPlan) Many2One() *Many2One { + return NewMany2One(crp.Id.Get(), "") +} + +// CreateCrmRecurringPlan creates a new crm.recurring.plan model and returns its id. +func (c *Client) CreateCrmRecurringPlan(crp *CrmRecurringPlan) (int64, error) { + ids, err := c.CreateCrmRecurringPlans([]*CrmRecurringPlan{crp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmRecurringPlan creates a new crm.recurring.plan model and returns its id. +func (c *Client) CreateCrmRecurringPlans(crps []*CrmRecurringPlan) ([]int64, error) { + var vv []interface{} + for _, v := range crps { + vv = append(vv, v) + } + return c.Create(CrmRecurringPlanModel, vv, nil) +} + +// UpdateCrmRecurringPlan updates an existing crm.recurring.plan record. +func (c *Client) UpdateCrmRecurringPlan(crp *CrmRecurringPlan) error { + return c.UpdateCrmRecurringPlans([]int64{crp.Id.Get()}, crp) +} + +// UpdateCrmRecurringPlans updates existing crm.recurring.plan records. +// All records (represented by ids) will be updated by crp values. +func (c *Client) UpdateCrmRecurringPlans(ids []int64, crp *CrmRecurringPlan) error { + return c.Update(CrmRecurringPlanModel, ids, crp, nil) +} + +// DeleteCrmRecurringPlan deletes an existing crm.recurring.plan record. +func (c *Client) DeleteCrmRecurringPlan(id int64) error { + return c.DeleteCrmRecurringPlans([]int64{id}) +} + +// DeleteCrmRecurringPlans deletes existing crm.recurring.plan records. +func (c *Client) DeleteCrmRecurringPlans(ids []int64) error { + return c.Delete(CrmRecurringPlanModel, ids) +} + +// GetCrmRecurringPlan gets crm.recurring.plan existing record. +func (c *Client) GetCrmRecurringPlan(id int64) (*CrmRecurringPlan, error) { + crps, err := c.GetCrmRecurringPlans([]int64{id}) + if err != nil { + return nil, err + } + return &((*crps)[0]), nil +} + +// GetCrmRecurringPlans gets crm.recurring.plan existing records. +func (c *Client) GetCrmRecurringPlans(ids []int64) (*CrmRecurringPlans, error) { + crps := &CrmRecurringPlans{} + if err := c.Read(CrmRecurringPlanModel, ids, nil, crps); err != nil { + return nil, err + } + return crps, nil +} + +// FindCrmRecurringPlan finds crm.recurring.plan record by querying it with criteria. +func (c *Client) FindCrmRecurringPlan(criteria *Criteria) (*CrmRecurringPlan, error) { + crps := &CrmRecurringPlans{} + if err := c.SearchRead(CrmRecurringPlanModel, criteria, NewOptions().Limit(1), crps); err != nil { + return nil, err + } + return &((*crps)[0]), nil +} + +// FindCrmRecurringPlans finds crm.recurring.plan records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmRecurringPlans(criteria *Criteria, options *Options) (*CrmRecurringPlans, error) { + crps := &CrmRecurringPlans{} + if err := c.SearchRead(CrmRecurringPlanModel, criteria, options, crps); err != nil { + return nil, err + } + return crps, nil +} + +// FindCrmRecurringPlanIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmRecurringPlanIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmRecurringPlanModel, criteria, options) +} + +// FindCrmRecurringPlanId finds record id by querying it with criteria. +func (c *Client) FindCrmRecurringPlanId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmRecurringPlanModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_stage.go b/crm_stage.go new file mode 100644 index 0000000..2b26408 --- /dev/null +++ b/crm_stage.go @@ -0,0 +1,123 @@ +package odoo + +// CrmStage represents crm.stage model. +type CrmStage struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Fold *Bool `xmlrpc:"fold,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsWon *Bool `xmlrpc:"is_won,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Requirements *String `xmlrpc:"requirements,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TeamCount *Int `xmlrpc:"team_count,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmStages represents array of crm.stage model. +type CrmStages []CrmStage + +// CrmStageModel is the odoo model name. +const CrmStageModel = "crm.stage" + +// Many2One convert CrmStage to *Many2One. +func (cs *CrmStage) Many2One() *Many2One { + return NewMany2One(cs.Id.Get(), "") +} + +// CreateCrmStage creates a new crm.stage model and returns its id. +func (c *Client) CreateCrmStage(cs *CrmStage) (int64, error) { + ids, err := c.CreateCrmStages([]*CrmStage{cs}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmStage creates a new crm.stage model and returns its id. +func (c *Client) CreateCrmStages(css []*CrmStage) ([]int64, error) { + var vv []interface{} + for _, v := range css { + vv = append(vv, v) + } + return c.Create(CrmStageModel, vv, nil) +} + +// UpdateCrmStage updates an existing crm.stage record. +func (c *Client) UpdateCrmStage(cs *CrmStage) error { + return c.UpdateCrmStages([]int64{cs.Id.Get()}, cs) +} + +// UpdateCrmStages updates existing crm.stage records. +// All records (represented by ids) will be updated by cs values. +func (c *Client) UpdateCrmStages(ids []int64, cs *CrmStage) error { + return c.Update(CrmStageModel, ids, cs, nil) +} + +// DeleteCrmStage deletes an existing crm.stage record. +func (c *Client) DeleteCrmStage(id int64) error { + return c.DeleteCrmStages([]int64{id}) +} + +// DeleteCrmStages deletes existing crm.stage records. +func (c *Client) DeleteCrmStages(ids []int64) error { + return c.Delete(CrmStageModel, ids) +} + +// GetCrmStage gets crm.stage existing record. +func (c *Client) GetCrmStage(id int64) (*CrmStage, error) { + css, err := c.GetCrmStages([]int64{id}) + if err != nil { + return nil, err + } + return &((*css)[0]), nil +} + +// GetCrmStages gets crm.stage existing records. +func (c *Client) GetCrmStages(ids []int64) (*CrmStages, error) { + css := &CrmStages{} + if err := c.Read(CrmStageModel, ids, nil, css); err != nil { + return nil, err + } + return css, nil +} + +// FindCrmStage finds crm.stage record by querying it with criteria. +func (c *Client) FindCrmStage(criteria *Criteria) (*CrmStage, error) { + css := &CrmStages{} + if err := c.SearchRead(CrmStageModel, criteria, NewOptions().Limit(1), css); err != nil { + return nil, err + } + return &((*css)[0]), nil +} + +// FindCrmStages finds crm.stage records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmStages(criteria *Criteria, options *Options) (*CrmStages, error) { + css := &CrmStages{} + if err := c.SearchRead(CrmStageModel, criteria, options, css); err != nil { + return nil, err + } + return css, nil +} + +// FindCrmStageIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmStageIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmStageModel, criteria, options) +} + +// FindCrmStageId finds record id by querying it with criteria. +func (c *Client) FindCrmStageId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmStageModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_tag.go b/crm_tag.go new file mode 100644 index 0000000..b2dd334 --- /dev/null +++ b/crm_tag.go @@ -0,0 +1,118 @@ +package odoo + +// CrmTag represents crm.tag model. +type CrmTag struct { + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmTags represents array of crm.tag model. +type CrmTags []CrmTag + +// CrmTagModel is the odoo model name. +const CrmTagModel = "crm.tag" + +// Many2One convert CrmTag to *Many2One. +func (ct *CrmTag) Many2One() *Many2One { + return NewMany2One(ct.Id.Get(), "") +} + +// CreateCrmTag creates a new crm.tag model and returns its id. +func (c *Client) CreateCrmTag(ct *CrmTag) (int64, error) { + ids, err := c.CreateCrmTags([]*CrmTag{ct}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmTag creates a new crm.tag model and returns its id. +func (c *Client) CreateCrmTags(cts []*CrmTag) ([]int64, error) { + var vv []interface{} + for _, v := range cts { + vv = append(vv, v) + } + return c.Create(CrmTagModel, vv, nil) +} + +// UpdateCrmTag updates an existing crm.tag record. +func (c *Client) UpdateCrmTag(ct *CrmTag) error { + return c.UpdateCrmTags([]int64{ct.Id.Get()}, ct) +} + +// UpdateCrmTags updates existing crm.tag records. +// All records (represented by ids) will be updated by ct values. +func (c *Client) UpdateCrmTags(ids []int64, ct *CrmTag) error { + return c.Update(CrmTagModel, ids, ct, nil) +} + +// DeleteCrmTag deletes an existing crm.tag record. +func (c *Client) DeleteCrmTag(id int64) error { + return c.DeleteCrmTags([]int64{id}) +} + +// DeleteCrmTags deletes existing crm.tag records. +func (c *Client) DeleteCrmTags(ids []int64) error { + return c.Delete(CrmTagModel, ids) +} + +// GetCrmTag gets crm.tag existing record. +func (c *Client) GetCrmTag(id int64) (*CrmTag, error) { + cts, err := c.GetCrmTags([]int64{id}) + if err != nil { + return nil, err + } + return &((*cts)[0]), nil +} + +// GetCrmTags gets crm.tag existing records. +func (c *Client) GetCrmTags(ids []int64) (*CrmTags, error) { + cts := &CrmTags{} + if err := c.Read(CrmTagModel, ids, nil, cts); err != nil { + return nil, err + } + return cts, nil +} + +// FindCrmTag finds crm.tag record by querying it with criteria. +func (c *Client) FindCrmTag(criteria *Criteria) (*CrmTag, error) { + cts := &CrmTags{} + if err := c.SearchRead(CrmTagModel, criteria, NewOptions().Limit(1), cts); err != nil { + return nil, err + } + return &((*cts)[0]), nil +} + +// FindCrmTags finds crm.tag records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmTags(criteria *Criteria, options *Options) (*CrmTags, error) { + cts := &CrmTags{} + if err := c.SearchRead(CrmTagModel, criteria, options, cts); err != nil { + return nil, err + } + return cts, nil +} + +// FindCrmTagIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmTagIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmTagModel, criteria, options) +} + +// FindCrmTagId finds record id by querying it with criteria. +func (c *Client) FindCrmTagId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmTagModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_team.go b/crm_team.go new file mode 100644 index 0000000..cbe4625 --- /dev/null +++ b/crm_team.go @@ -0,0 +1,182 @@ +package odoo + +// CrmTeam represents crm.team model. +type CrmTeam struct { + Active *Bool `xmlrpc:"active,omitempty"` + AliasBouncedContent *String `xmlrpc:"alias_bounced_content,omitempty"` + AliasContact *Selection `xmlrpc:"alias_contact,omitempty"` + AliasDefaults *String `xmlrpc:"alias_defaults,omitempty"` + AliasDomain *String `xmlrpc:"alias_domain,omitempty"` + AliasDomainId *Many2One `xmlrpc:"alias_domain_id,omitempty"` + AliasEmail *String `xmlrpc:"alias_email,omitempty"` + AliasForceThreadId *Int `xmlrpc:"alias_force_thread_id,omitempty"` + AliasFullName *String `xmlrpc:"alias_full_name,omitempty"` + AliasId *Many2One `xmlrpc:"alias_id,omitempty"` + AliasIncomingLocal *Bool `xmlrpc:"alias_incoming_local,omitempty"` + AliasModelId *Many2One `xmlrpc:"alias_model_id,omitempty"` + AliasName *String `xmlrpc:"alias_name,omitempty"` + AliasParentModelId *Many2One `xmlrpc:"alias_parent_model_id,omitempty"` + AliasParentThreadId *Int `xmlrpc:"alias_parent_thread_id,omitempty"` + AliasStatus *Selection `xmlrpc:"alias_status,omitempty"` + AssignmentAutoEnabled *Bool `xmlrpc:"assignment_auto_enabled,omitempty"` + AssignmentDomain *String `xmlrpc:"assignment_domain,omitempty"` + AssignmentEnabled *Bool `xmlrpc:"assignment_enabled,omitempty"` + AssignmentMax *Int `xmlrpc:"assignment_max,omitempty"` + AssignmentOptout *Bool `xmlrpc:"assignment_optout,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CrmTeamMemberAllIds *Relation `xmlrpc:"crm_team_member_all_ids,omitempty"` + CrmTeamMemberIds *Relation `xmlrpc:"crm_team_member_ids,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DashboardButtonName *String `xmlrpc:"dashboard_button_name,omitempty"` + DashboardGraphData *String `xmlrpc:"dashboard_graph_data,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FavoriteUserIds *Relation `xmlrpc:"favorite_user_ids,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Invoiced *Float `xmlrpc:"invoiced,omitempty"` + InvoicedTarget *Float `xmlrpc:"invoiced_target,omitempty"` + IsFavorite *Bool `xmlrpc:"is_favorite,omitempty"` + IsMembershipMulti *Bool `xmlrpc:"is_membership_multi,omitempty"` + LeadAllAssignedMonthCount *Int `xmlrpc:"lead_all_assigned_month_count,omitempty"` + LeadAllAssignedMonthExceeded *Bool `xmlrpc:"lead_all_assigned_month_exceeded,omitempty"` + LeadPropertiesDefinition interface{} `xmlrpc:"lead_properties_definition,omitempty"` + LeadUnassignedCount *Int `xmlrpc:"lead_unassigned_count,omitempty"` + MemberCompanyIds *Relation `xmlrpc:"member_company_ids,omitempty"` + MemberIds *Relation `xmlrpc:"member_ids,omitempty"` + MemberWarning *String `xmlrpc:"member_warning,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OpportunitiesAmount *Float `xmlrpc:"opportunities_amount,omitempty"` + OpportunitiesCount *Int `xmlrpc:"opportunities_count,omitempty"` + OpportunitiesOverdueAmount *Float `xmlrpc:"opportunities_overdue_amount,omitempty"` + OpportunitiesOverdueCount *Int `xmlrpc:"opportunities_overdue_count,omitempty"` + QuotationsAmount *Float `xmlrpc:"quotations_amount,omitempty"` + QuotationsCount *Int `xmlrpc:"quotations_count,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + SaleOrderCount *Int `xmlrpc:"sale_order_count,omitempty"` + SalesToInvoiceCount *Int `xmlrpc:"sales_to_invoice_count,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + UseLeads *Bool `xmlrpc:"use_leads,omitempty"` + UseOpportunities *Bool `xmlrpc:"use_opportunities,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmTeams represents array of crm.team model. +type CrmTeams []CrmTeam + +// CrmTeamModel is the odoo model name. +const CrmTeamModel = "crm.team" + +// Many2One convert CrmTeam to *Many2One. +func (ct *CrmTeam) Many2One() *Many2One { + return NewMany2One(ct.Id.Get(), "") +} + +// CreateCrmTeam creates a new crm.team model and returns its id. +func (c *Client) CreateCrmTeam(ct *CrmTeam) (int64, error) { + ids, err := c.CreateCrmTeams([]*CrmTeam{ct}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmTeam creates a new crm.team model and returns its id. +func (c *Client) CreateCrmTeams(cts []*CrmTeam) ([]int64, error) { + var vv []interface{} + for _, v := range cts { + vv = append(vv, v) + } + return c.Create(CrmTeamModel, vv, nil) +} + +// UpdateCrmTeam updates an existing crm.team record. +func (c *Client) UpdateCrmTeam(ct *CrmTeam) error { + return c.UpdateCrmTeams([]int64{ct.Id.Get()}, ct) +} + +// UpdateCrmTeams updates existing crm.team records. +// All records (represented by ids) will be updated by ct values. +func (c *Client) UpdateCrmTeams(ids []int64, ct *CrmTeam) error { + return c.Update(CrmTeamModel, ids, ct, nil) +} + +// DeleteCrmTeam deletes an existing crm.team record. +func (c *Client) DeleteCrmTeam(id int64) error { + return c.DeleteCrmTeams([]int64{id}) +} + +// DeleteCrmTeams deletes existing crm.team records. +func (c *Client) DeleteCrmTeams(ids []int64) error { + return c.Delete(CrmTeamModel, ids) +} + +// GetCrmTeam gets crm.team existing record. +func (c *Client) GetCrmTeam(id int64) (*CrmTeam, error) { + cts, err := c.GetCrmTeams([]int64{id}) + if err != nil { + return nil, err + } + return &((*cts)[0]), nil +} + +// GetCrmTeams gets crm.team existing records. +func (c *Client) GetCrmTeams(ids []int64) (*CrmTeams, error) { + cts := &CrmTeams{} + if err := c.Read(CrmTeamModel, ids, nil, cts); err != nil { + return nil, err + } + return cts, nil +} + +// FindCrmTeam finds crm.team record by querying it with criteria. +func (c *Client) FindCrmTeam(criteria *Criteria) (*CrmTeam, error) { + cts := &CrmTeams{} + if err := c.SearchRead(CrmTeamModel, criteria, NewOptions().Limit(1), cts); err != nil { + return nil, err + } + return &((*cts)[0]), nil +} + +// FindCrmTeams finds crm.team records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmTeams(criteria *Criteria, options *Options) (*CrmTeams, error) { + cts := &CrmTeams{} + if err := c.SearchRead(CrmTeamModel, criteria, options, cts); err != nil { + return nil, err + } + return cts, nil +} + +// FindCrmTeamIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmTeamIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmTeamModel, criteria, options) +} + +// FindCrmTeamId finds record id by querying it with criteria. +func (c *Client) FindCrmTeamId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmTeamModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/crm_team_member.go b/crm_team_member.go new file mode 100644 index 0000000..39e4657 --- /dev/null +++ b/crm_team_member.go @@ -0,0 +1,149 @@ +package odoo + +// CrmTeamMember represents crm.team.member model. +type CrmTeamMember struct { + Active *Bool `xmlrpc:"active,omitempty"` + AssignmentDomain *String `xmlrpc:"assignment_domain,omitempty"` + AssignmentEnabled *Bool `xmlrpc:"assignment_enabled,omitempty"` + AssignmentMax *Int `xmlrpc:"assignment_max,omitempty"` + AssignmentOptout *Bool `xmlrpc:"assignment_optout,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CrmTeamId *Many2One `xmlrpc:"crm_team_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Image128 *String `xmlrpc:"image_128,omitempty"` + Image1920 *String `xmlrpc:"image_1920,omitempty"` + IsMembershipMulti *Bool `xmlrpc:"is_membership_multi,omitempty"` + LeadDayCount *Int `xmlrpc:"lead_day_count,omitempty"` + LeadMonthCount *Int `xmlrpc:"lead_month_count,omitempty"` + MemberWarning *String `xmlrpc:"member_warning,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Mobile *String `xmlrpc:"mobile,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Phone *String `xmlrpc:"phone,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + UserCompanyIds *Relation `xmlrpc:"user_company_ids,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + UserInTeamsIds *Relation `xmlrpc:"user_in_teams_ids,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// CrmTeamMembers represents array of crm.team.member model. +type CrmTeamMembers []CrmTeamMember + +// CrmTeamMemberModel is the odoo model name. +const CrmTeamMemberModel = "crm.team.member" + +// Many2One convert CrmTeamMember to *Many2One. +func (ctm *CrmTeamMember) Many2One() *Many2One { + return NewMany2One(ctm.Id.Get(), "") +} + +// CreateCrmTeamMember creates a new crm.team.member model and returns its id. +func (c *Client) CreateCrmTeamMember(ctm *CrmTeamMember) (int64, error) { + ids, err := c.CreateCrmTeamMembers([]*CrmTeamMember{ctm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateCrmTeamMember creates a new crm.team.member model and returns its id. +func (c *Client) CreateCrmTeamMembers(ctms []*CrmTeamMember) ([]int64, error) { + var vv []interface{} + for _, v := range ctms { + vv = append(vv, v) + } + return c.Create(CrmTeamMemberModel, vv, nil) +} + +// UpdateCrmTeamMember updates an existing crm.team.member record. +func (c *Client) UpdateCrmTeamMember(ctm *CrmTeamMember) error { + return c.UpdateCrmTeamMembers([]int64{ctm.Id.Get()}, ctm) +} + +// UpdateCrmTeamMembers updates existing crm.team.member records. +// All records (represented by ids) will be updated by ctm values. +func (c *Client) UpdateCrmTeamMembers(ids []int64, ctm *CrmTeamMember) error { + return c.Update(CrmTeamMemberModel, ids, ctm, nil) +} + +// DeleteCrmTeamMember deletes an existing crm.team.member record. +func (c *Client) DeleteCrmTeamMember(id int64) error { + return c.DeleteCrmTeamMembers([]int64{id}) +} + +// DeleteCrmTeamMembers deletes existing crm.team.member records. +func (c *Client) DeleteCrmTeamMembers(ids []int64) error { + return c.Delete(CrmTeamMemberModel, ids) +} + +// GetCrmTeamMember gets crm.team.member existing record. +func (c *Client) GetCrmTeamMember(id int64) (*CrmTeamMember, error) { + ctms, err := c.GetCrmTeamMembers([]int64{id}) + if err != nil { + return nil, err + } + return &((*ctms)[0]), nil +} + +// GetCrmTeamMembers gets crm.team.member existing records. +func (c *Client) GetCrmTeamMembers(ids []int64) (*CrmTeamMembers, error) { + ctms := &CrmTeamMembers{} + if err := c.Read(CrmTeamMemberModel, ids, nil, ctms); err != nil { + return nil, err + } + return ctms, nil +} + +// FindCrmTeamMember finds crm.team.member record by querying it with criteria. +func (c *Client) FindCrmTeamMember(criteria *Criteria) (*CrmTeamMember, error) { + ctms := &CrmTeamMembers{} + if err := c.SearchRead(CrmTeamMemberModel, criteria, NewOptions().Limit(1), ctms); err != nil { + return nil, err + } + return &((*ctms)[0]), nil +} + +// FindCrmTeamMembers finds crm.team.member records by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmTeamMembers(criteria *Criteria, options *Options) (*CrmTeamMembers, error) { + ctms := &CrmTeamMembers{} + if err := c.SearchRead(CrmTeamMemberModel, criteria, options, ctms); err != nil { + return nil, err + } + return ctms, nil +} + +// FindCrmTeamMemberIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindCrmTeamMemberIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(CrmTeamMemberModel, criteria, options) +} + +// FindCrmTeamMemberId finds record id by querying it with criteria. +func (c *Client) FindCrmTeamMemberId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(CrmTeamMemberModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/decimal_precision.go b/decimal_precision.go new file mode 100644 index 0000000..36af5ea --- /dev/null +++ b/decimal_precision.go @@ -0,0 +1,118 @@ +package odoo + +// DecimalPrecision represents decimal.precision model. +type DecimalPrecision struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Digits *Int `xmlrpc:"digits,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// DecimalPrecisions represents array of decimal.precision model. +type DecimalPrecisions []DecimalPrecision + +// DecimalPrecisionModel is the odoo model name. +const DecimalPrecisionModel = "decimal.precision" + +// Many2One convert DecimalPrecision to *Many2One. +func (dp *DecimalPrecision) Many2One() *Many2One { + return NewMany2One(dp.Id.Get(), "") +} + +// CreateDecimalPrecision creates a new decimal.precision model and returns its id. +func (c *Client) CreateDecimalPrecision(dp *DecimalPrecision) (int64, error) { + ids, err := c.CreateDecimalPrecisions([]*DecimalPrecision{dp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateDecimalPrecision creates a new decimal.precision model and returns its id. +func (c *Client) CreateDecimalPrecisions(dps []*DecimalPrecision) ([]int64, error) { + var vv []interface{} + for _, v := range dps { + vv = append(vv, v) + } + return c.Create(DecimalPrecisionModel, vv, nil) +} + +// UpdateDecimalPrecision updates an existing decimal.precision record. +func (c *Client) UpdateDecimalPrecision(dp *DecimalPrecision) error { + return c.UpdateDecimalPrecisions([]int64{dp.Id.Get()}, dp) +} + +// UpdateDecimalPrecisions updates existing decimal.precision records. +// All records (represented by ids) will be updated by dp values. +func (c *Client) UpdateDecimalPrecisions(ids []int64, dp *DecimalPrecision) error { + return c.Update(DecimalPrecisionModel, ids, dp, nil) +} + +// DeleteDecimalPrecision deletes an existing decimal.precision record. +func (c *Client) DeleteDecimalPrecision(id int64) error { + return c.DeleteDecimalPrecisions([]int64{id}) +} + +// DeleteDecimalPrecisions deletes existing decimal.precision records. +func (c *Client) DeleteDecimalPrecisions(ids []int64) error { + return c.Delete(DecimalPrecisionModel, ids) +} + +// GetDecimalPrecision gets decimal.precision existing record. +func (c *Client) GetDecimalPrecision(id int64) (*DecimalPrecision, error) { + dps, err := c.GetDecimalPrecisions([]int64{id}) + if err != nil { + return nil, err + } + return &((*dps)[0]), nil +} + +// GetDecimalPrecisions gets decimal.precision existing records. +func (c *Client) GetDecimalPrecisions(ids []int64) (*DecimalPrecisions, error) { + dps := &DecimalPrecisions{} + if err := c.Read(DecimalPrecisionModel, ids, nil, dps); err != nil { + return nil, err + } + return dps, nil +} + +// FindDecimalPrecision finds decimal.precision record by querying it with criteria. +func (c *Client) FindDecimalPrecision(criteria *Criteria) (*DecimalPrecision, error) { + dps := &DecimalPrecisions{} + if err := c.SearchRead(DecimalPrecisionModel, criteria, NewOptions().Limit(1), dps); err != nil { + return nil, err + } + return &((*dps)[0]), nil +} + +// FindDecimalPrecisions finds decimal.precision records by querying it +// and filtering it with criteria and options. +func (c *Client) FindDecimalPrecisions(criteria *Criteria, options *Options) (*DecimalPrecisions, error) { + dps := &DecimalPrecisions{} + if err := c.SearchRead(DecimalPrecisionModel, criteria, options, dps); err != nil { + return nil, err + } + return dps, nil +} + +// FindDecimalPrecisionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindDecimalPrecisionIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(DecimalPrecisionModel, criteria, options) +} + +// FindDecimalPrecisionId finds record id by querying it with criteria. +func (c *Client) FindDecimalPrecisionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(DecimalPrecisionModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/digest_digest.go b/digest_digest.go new file mode 100644 index 0000000..df572b1 --- /dev/null +++ b/digest_digest.go @@ -0,0 +1,141 @@ +package odoo + +// DigestDigest represents digest.digest model. +type DigestDigest struct { + AvailableFields *String `xmlrpc:"available_fields,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsSubscribed *Bool `xmlrpc:"is_subscribed,omitempty"` + KpiAccountTotalRevenue *Bool `xmlrpc:"kpi_account_total_revenue,omitempty"` + KpiAccountTotalRevenueValue *Float `xmlrpc:"kpi_account_total_revenue_value,omitempty"` + KpiAllSaleTotal *Bool `xmlrpc:"kpi_all_sale_total,omitempty"` + KpiAllSaleTotalValue *Float `xmlrpc:"kpi_all_sale_total_value,omitempty"` + KpiCrmLeadCreated *Bool `xmlrpc:"kpi_crm_lead_created,omitempty"` + KpiCrmLeadCreatedValue *Int `xmlrpc:"kpi_crm_lead_created_value,omitempty"` + KpiCrmOpportunitiesWon *Bool `xmlrpc:"kpi_crm_opportunities_won,omitempty"` + KpiCrmOpportunitiesWonValue *Int `xmlrpc:"kpi_crm_opportunities_won_value,omitempty"` + KpiHrRecruitmentNewColleagues *Bool `xmlrpc:"kpi_hr_recruitment_new_colleagues,omitempty"` + KpiHrRecruitmentNewColleaguesValue *Int `xmlrpc:"kpi_hr_recruitment_new_colleagues_value,omitempty"` + KpiMailMessageTotal *Bool `xmlrpc:"kpi_mail_message_total,omitempty"` + KpiMailMessageTotalValue *Int `xmlrpc:"kpi_mail_message_total_value,omitempty"` + KpiProjectTaskOpened *Bool `xmlrpc:"kpi_project_task_opened,omitempty"` + KpiProjectTaskOpenedValue *Int `xmlrpc:"kpi_project_task_opened_value,omitempty"` + KpiResUsersConnected *Bool `xmlrpc:"kpi_res_users_connected,omitempty"` + KpiResUsersConnectedValue *Int `xmlrpc:"kpi_res_users_connected_value,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NextRunDate *Time `xmlrpc:"next_run_date,omitempty"` + Periodicity *Selection `xmlrpc:"periodicity,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + UserIds *Relation `xmlrpc:"user_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// DigestDigests represents array of digest.digest model. +type DigestDigests []DigestDigest + +// DigestDigestModel is the odoo model name. +const DigestDigestModel = "digest.digest" + +// Many2One convert DigestDigest to *Many2One. +func (dd *DigestDigest) Many2One() *Many2One { + return NewMany2One(dd.Id.Get(), "") +} + +// CreateDigestDigest creates a new digest.digest model and returns its id. +func (c *Client) CreateDigestDigest(dd *DigestDigest) (int64, error) { + ids, err := c.CreateDigestDigests([]*DigestDigest{dd}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateDigestDigest creates a new digest.digest model and returns its id. +func (c *Client) CreateDigestDigests(dds []*DigestDigest) ([]int64, error) { + var vv []interface{} + for _, v := range dds { + vv = append(vv, v) + } + return c.Create(DigestDigestModel, vv, nil) +} + +// UpdateDigestDigest updates an existing digest.digest record. +func (c *Client) UpdateDigestDigest(dd *DigestDigest) error { + return c.UpdateDigestDigests([]int64{dd.Id.Get()}, dd) +} + +// UpdateDigestDigests updates existing digest.digest records. +// All records (represented by ids) will be updated by dd values. +func (c *Client) UpdateDigestDigests(ids []int64, dd *DigestDigest) error { + return c.Update(DigestDigestModel, ids, dd, nil) +} + +// DeleteDigestDigest deletes an existing digest.digest record. +func (c *Client) DeleteDigestDigest(id int64) error { + return c.DeleteDigestDigests([]int64{id}) +} + +// DeleteDigestDigests deletes existing digest.digest records. +func (c *Client) DeleteDigestDigests(ids []int64) error { + return c.Delete(DigestDigestModel, ids) +} + +// GetDigestDigest gets digest.digest existing record. +func (c *Client) GetDigestDigest(id int64) (*DigestDigest, error) { + dds, err := c.GetDigestDigests([]int64{id}) + if err != nil { + return nil, err + } + return &((*dds)[0]), nil +} + +// GetDigestDigests gets digest.digest existing records. +func (c *Client) GetDigestDigests(ids []int64) (*DigestDigests, error) { + dds := &DigestDigests{} + if err := c.Read(DigestDigestModel, ids, nil, dds); err != nil { + return nil, err + } + return dds, nil +} + +// FindDigestDigest finds digest.digest record by querying it with criteria. +func (c *Client) FindDigestDigest(criteria *Criteria) (*DigestDigest, error) { + dds := &DigestDigests{} + if err := c.SearchRead(DigestDigestModel, criteria, NewOptions().Limit(1), dds); err != nil { + return nil, err + } + return &((*dds)[0]), nil +} + +// FindDigestDigests finds digest.digest records by querying it +// and filtering it with criteria and options. +func (c *Client) FindDigestDigests(criteria *Criteria, options *Options) (*DigestDigests, error) { + dds := &DigestDigests{} + if err := c.SearchRead(DigestDigestModel, criteria, options, dds); err != nil { + return nil, err + } + return dds, nil +} + +// FindDigestDigestIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindDigestDigestIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(DigestDigestModel, criteria, options) +} + +// FindDigestDigestId finds record id by querying it with criteria. +func (c *Client) FindDigestDigestId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(DigestDigestModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/digest_tip.go b/digest_tip.go new file mode 100644 index 0000000..a304dec --- /dev/null +++ b/digest_tip.go @@ -0,0 +1,121 @@ +package odoo + +// DigestTip represents digest.tip model. +type DigestTip struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + GroupId *Many2One `xmlrpc:"group_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TipDescription *String `xmlrpc:"tip_description,omitempty"` + UserIds *Relation `xmlrpc:"user_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// DigestTips represents array of digest.tip model. +type DigestTips []DigestTip + +// DigestTipModel is the odoo model name. +const DigestTipModel = "digest.tip" + +// Many2One convert DigestTip to *Many2One. +func (dt *DigestTip) Many2One() *Many2One { + return NewMany2One(dt.Id.Get(), "") +} + +// CreateDigestTip creates a new digest.tip model and returns its id. +func (c *Client) CreateDigestTip(dt *DigestTip) (int64, error) { + ids, err := c.CreateDigestTips([]*DigestTip{dt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateDigestTip creates a new digest.tip model and returns its id. +func (c *Client) CreateDigestTips(dts []*DigestTip) ([]int64, error) { + var vv []interface{} + for _, v := range dts { + vv = append(vv, v) + } + return c.Create(DigestTipModel, vv, nil) +} + +// UpdateDigestTip updates an existing digest.tip record. +func (c *Client) UpdateDigestTip(dt *DigestTip) error { + return c.UpdateDigestTips([]int64{dt.Id.Get()}, dt) +} + +// UpdateDigestTips updates existing digest.tip records. +// All records (represented by ids) will be updated by dt values. +func (c *Client) UpdateDigestTips(ids []int64, dt *DigestTip) error { + return c.Update(DigestTipModel, ids, dt, nil) +} + +// DeleteDigestTip deletes an existing digest.tip record. +func (c *Client) DeleteDigestTip(id int64) error { + return c.DeleteDigestTips([]int64{id}) +} + +// DeleteDigestTips deletes existing digest.tip records. +func (c *Client) DeleteDigestTips(ids []int64) error { + return c.Delete(DigestTipModel, ids) +} + +// GetDigestTip gets digest.tip existing record. +func (c *Client) GetDigestTip(id int64) (*DigestTip, error) { + dts, err := c.GetDigestTips([]int64{id}) + if err != nil { + return nil, err + } + return &((*dts)[0]), nil +} + +// GetDigestTips gets digest.tip existing records. +func (c *Client) GetDigestTips(ids []int64) (*DigestTips, error) { + dts := &DigestTips{} + if err := c.Read(DigestTipModel, ids, nil, dts); err != nil { + return nil, err + } + return dts, nil +} + +// FindDigestTip finds digest.tip record by querying it with criteria. +func (c *Client) FindDigestTip(criteria *Criteria) (*DigestTip, error) { + dts := &DigestTips{} + if err := c.SearchRead(DigestTipModel, criteria, NewOptions().Limit(1), dts); err != nil { + return nil, err + } + return &((*dts)[0]), nil +} + +// FindDigestTips finds digest.tip records by querying it +// and filtering it with criteria and options. +func (c *Client) FindDigestTips(criteria *Criteria, options *Options) (*DigestTips, error) { + dts := &DigestTips{} + if err := c.SearchRead(DigestTipModel, criteria, options, dts); err != nil { + return nil, err + } + return dts, nil +} + +// FindDigestTipIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindDigestTipIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(DigestTipModel, criteria, options) +} + +// FindDigestTipId finds record id by querying it with criteria. +func (c *Client) FindDigestTipId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(DigestTipModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/discuss_channel.go b/discuss_channel.go new file mode 100644 index 0000000..92c287d --- /dev/null +++ b/discuss_channel.go @@ -0,0 +1,156 @@ +package odoo + +// DiscussChannel represents discuss.channel model. +type DiscussChannel struct { + Active *Bool `xmlrpc:"active,omitempty"` + AllowPublicUpload *Bool `xmlrpc:"allow_public_upload,omitempty"` + Avatar128 *String `xmlrpc:"avatar_128,omitempty"` + AvatarCacheKey *String `xmlrpc:"avatar_cache_key,omitempty"` + ChannelMemberIds *Relation `xmlrpc:"channel_member_ids,omitempty"` + ChannelPartnerIds *Relation `xmlrpc:"channel_partner_ids,omitempty"` + ChannelType *Selection `xmlrpc:"channel_type,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DefaultDisplayMode *Selection `xmlrpc:"default_display_mode,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FromMessageId *Many2One `xmlrpc:"from_message_id,omitempty"` + GroupIds *Relation `xmlrpc:"group_ids,omitempty"` + GroupPublicId *Many2One `xmlrpc:"group_public_id,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Image128 *String `xmlrpc:"image_128,omitempty"` + InvitationUrl *String `xmlrpc:"invitation_url,omitempty"` + IsEditable *Bool `xmlrpc:"is_editable,omitempty"` + IsMember *Bool `xmlrpc:"is_member,omitempty"` + LastInterestDt *Time `xmlrpc:"last_interest_dt,omitempty"` + MemberCount *Int `xmlrpc:"member_count,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentChannelId *Many2One `xmlrpc:"parent_channel_id,omitempty"` + PinnedMessageIds *Relation `xmlrpc:"pinned_message_ids,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RtcSessionIds *Relation `xmlrpc:"rtc_session_ids,omitempty"` + SfuChannelUuid *String `xmlrpc:"sfu_channel_uuid,omitempty"` + SfuServerUrl *String `xmlrpc:"sfu_server_url,omitempty"` + SubChannelIds *Relation `xmlrpc:"sub_channel_ids,omitempty"` + SubscriptionDepartmentIds *Relation `xmlrpc:"subscription_department_ids,omitempty"` + Uuid *String `xmlrpc:"uuid,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// DiscussChannels represents array of discuss.channel model. +type DiscussChannels []DiscussChannel + +// DiscussChannelModel is the odoo model name. +const DiscussChannelModel = "discuss.channel" + +// Many2One convert DiscussChannel to *Many2One. +func (dc *DiscussChannel) Many2One() *Many2One { + return NewMany2One(dc.Id.Get(), "") +} + +// CreateDiscussChannel creates a new discuss.channel model and returns its id. +func (c *Client) CreateDiscussChannel(dc *DiscussChannel) (int64, error) { + ids, err := c.CreateDiscussChannels([]*DiscussChannel{dc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateDiscussChannel creates a new discuss.channel model and returns its id. +func (c *Client) CreateDiscussChannels(dcs []*DiscussChannel) ([]int64, error) { + var vv []interface{} + for _, v := range dcs { + vv = append(vv, v) + } + return c.Create(DiscussChannelModel, vv, nil) +} + +// UpdateDiscussChannel updates an existing discuss.channel record. +func (c *Client) UpdateDiscussChannel(dc *DiscussChannel) error { + return c.UpdateDiscussChannels([]int64{dc.Id.Get()}, dc) +} + +// UpdateDiscussChannels updates existing discuss.channel records. +// All records (represented by ids) will be updated by dc values. +func (c *Client) UpdateDiscussChannels(ids []int64, dc *DiscussChannel) error { + return c.Update(DiscussChannelModel, ids, dc, nil) +} + +// DeleteDiscussChannel deletes an existing discuss.channel record. +func (c *Client) DeleteDiscussChannel(id int64) error { + return c.DeleteDiscussChannels([]int64{id}) +} + +// DeleteDiscussChannels deletes existing discuss.channel records. +func (c *Client) DeleteDiscussChannels(ids []int64) error { + return c.Delete(DiscussChannelModel, ids) +} + +// GetDiscussChannel gets discuss.channel existing record. +func (c *Client) GetDiscussChannel(id int64) (*DiscussChannel, error) { + dcs, err := c.GetDiscussChannels([]int64{id}) + if err != nil { + return nil, err + } + return &((*dcs)[0]), nil +} + +// GetDiscussChannels gets discuss.channel existing records. +func (c *Client) GetDiscussChannels(ids []int64) (*DiscussChannels, error) { + dcs := &DiscussChannels{} + if err := c.Read(DiscussChannelModel, ids, nil, dcs); err != nil { + return nil, err + } + return dcs, nil +} + +// FindDiscussChannel finds discuss.channel record by querying it with criteria. +func (c *Client) FindDiscussChannel(criteria *Criteria) (*DiscussChannel, error) { + dcs := &DiscussChannels{} + if err := c.SearchRead(DiscussChannelModel, criteria, NewOptions().Limit(1), dcs); err != nil { + return nil, err + } + return &((*dcs)[0]), nil +} + +// FindDiscussChannels finds discuss.channel records by querying it +// and filtering it with criteria and options. +func (c *Client) FindDiscussChannels(criteria *Criteria, options *Options) (*DiscussChannels, error) { + dcs := &DiscussChannels{} + if err := c.SearchRead(DiscussChannelModel, criteria, options, dcs); err != nil { + return nil, err + } + return dcs, nil +} + +// FindDiscussChannelIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindDiscussChannelIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(DiscussChannelModel, criteria, options) +} + +// FindDiscussChannelId finds record id by querying it with criteria. +func (c *Client) FindDiscussChannelId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(DiscussChannelModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/discuss_channel_member.go b/discuss_channel_member.go new file mode 100644 index 0000000..f1ba5ea --- /dev/null +++ b/discuss_channel_member.go @@ -0,0 +1,134 @@ +package odoo + +// DiscussChannelMember represents discuss.channel.member model. +type DiscussChannelMember struct { + ChannelId *Many2One `xmlrpc:"channel_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CustomChannelName *String `xmlrpc:"custom_channel_name,omitempty"` + CustomNotifications *Selection `xmlrpc:"custom_notifications,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FetchedMessageId *Many2One `xmlrpc:"fetched_message_id,omitempty"` + FoldState *Selection `xmlrpc:"fold_state,omitempty"` + GuestId *Many2One `xmlrpc:"guest_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsPinned *Bool `xmlrpc:"is_pinned,omitempty"` + IsSelf *Bool `xmlrpc:"is_self,omitempty"` + LastInterestDt *Time `xmlrpc:"last_interest_dt,omitempty"` + LastSeenDt *Time `xmlrpc:"last_seen_dt,omitempty"` + MessageUnreadCounter *Int `xmlrpc:"message_unread_counter,omitempty"` + MuteUntilDt *Time `xmlrpc:"mute_until_dt,omitempty"` + NewMessageSeparator *Int `xmlrpc:"new_message_separator,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + RtcInvitingSessionId *Many2One `xmlrpc:"rtc_inviting_session_id,omitempty"` + RtcSessionIds *Relation `xmlrpc:"rtc_session_ids,omitempty"` + SeenMessageId *Many2One `xmlrpc:"seen_message_id,omitempty"` + UnpinDt *Time `xmlrpc:"unpin_dt,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// DiscussChannelMembers represents array of discuss.channel.member model. +type DiscussChannelMembers []DiscussChannelMember + +// DiscussChannelMemberModel is the odoo model name. +const DiscussChannelMemberModel = "discuss.channel.member" + +// Many2One convert DiscussChannelMember to *Many2One. +func (dcm *DiscussChannelMember) Many2One() *Many2One { + return NewMany2One(dcm.Id.Get(), "") +} + +// CreateDiscussChannelMember creates a new discuss.channel.member model and returns its id. +func (c *Client) CreateDiscussChannelMember(dcm *DiscussChannelMember) (int64, error) { + ids, err := c.CreateDiscussChannelMembers([]*DiscussChannelMember{dcm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateDiscussChannelMember creates a new discuss.channel.member model and returns its id. +func (c *Client) CreateDiscussChannelMembers(dcms []*DiscussChannelMember) ([]int64, error) { + var vv []interface{} + for _, v := range dcms { + vv = append(vv, v) + } + return c.Create(DiscussChannelMemberModel, vv, nil) +} + +// UpdateDiscussChannelMember updates an existing discuss.channel.member record. +func (c *Client) UpdateDiscussChannelMember(dcm *DiscussChannelMember) error { + return c.UpdateDiscussChannelMembers([]int64{dcm.Id.Get()}, dcm) +} + +// UpdateDiscussChannelMembers updates existing discuss.channel.member records. +// All records (represented by ids) will be updated by dcm values. +func (c *Client) UpdateDiscussChannelMembers(ids []int64, dcm *DiscussChannelMember) error { + return c.Update(DiscussChannelMemberModel, ids, dcm, nil) +} + +// DeleteDiscussChannelMember deletes an existing discuss.channel.member record. +func (c *Client) DeleteDiscussChannelMember(id int64) error { + return c.DeleteDiscussChannelMembers([]int64{id}) +} + +// DeleteDiscussChannelMembers deletes existing discuss.channel.member records. +func (c *Client) DeleteDiscussChannelMembers(ids []int64) error { + return c.Delete(DiscussChannelMemberModel, ids) +} + +// GetDiscussChannelMember gets discuss.channel.member existing record. +func (c *Client) GetDiscussChannelMember(id int64) (*DiscussChannelMember, error) { + dcms, err := c.GetDiscussChannelMembers([]int64{id}) + if err != nil { + return nil, err + } + return &((*dcms)[0]), nil +} + +// GetDiscussChannelMembers gets discuss.channel.member existing records. +func (c *Client) GetDiscussChannelMembers(ids []int64) (*DiscussChannelMembers, error) { + dcms := &DiscussChannelMembers{} + if err := c.Read(DiscussChannelMemberModel, ids, nil, dcms); err != nil { + return nil, err + } + return dcms, nil +} + +// FindDiscussChannelMember finds discuss.channel.member record by querying it with criteria. +func (c *Client) FindDiscussChannelMember(criteria *Criteria) (*DiscussChannelMember, error) { + dcms := &DiscussChannelMembers{} + if err := c.SearchRead(DiscussChannelMemberModel, criteria, NewOptions().Limit(1), dcms); err != nil { + return nil, err + } + return &((*dcms)[0]), nil +} + +// FindDiscussChannelMembers finds discuss.channel.member records by querying it +// and filtering it with criteria and options. +func (c *Client) FindDiscussChannelMembers(criteria *Criteria, options *Options) (*DiscussChannelMembers, error) { + dcms := &DiscussChannelMembers{} + if err := c.SearchRead(DiscussChannelMemberModel, criteria, options, dcms); err != nil { + return nil, err + } + return dcms, nil +} + +// FindDiscussChannelMemberIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindDiscussChannelMemberIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(DiscussChannelMemberModel, criteria, options) +} + +// FindDiscussChannelMemberId finds record id by querying it with criteria. +func (c *Client) FindDiscussChannelMemberId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(DiscussChannelMemberModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/discuss_channel_rtc_session.go b/discuss_channel_rtc_session.go new file mode 100644 index 0000000..589926a --- /dev/null +++ b/discuss_channel_rtc_session.go @@ -0,0 +1,124 @@ +package odoo + +// DiscussChannelRtcSession represents discuss.channel.rtc.session model. +type DiscussChannelRtcSession struct { + ChannelId *Many2One `xmlrpc:"channel_id,omitempty"` + ChannelMemberId *Many2One `xmlrpc:"channel_member_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + GuestId *Many2One `xmlrpc:"guest_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsCameraOn *Bool `xmlrpc:"is_camera_on,omitempty"` + IsDeaf *Bool `xmlrpc:"is_deaf,omitempty"` + IsMuted *Bool `xmlrpc:"is_muted,omitempty"` + IsScreenSharingOn *Bool `xmlrpc:"is_screen_sharing_on,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// DiscussChannelRtcSessions represents array of discuss.channel.rtc.session model. +type DiscussChannelRtcSessions []DiscussChannelRtcSession + +// DiscussChannelRtcSessionModel is the odoo model name. +const DiscussChannelRtcSessionModel = "discuss.channel.rtc.session" + +// Many2One convert DiscussChannelRtcSession to *Many2One. +func (dcrs *DiscussChannelRtcSession) Many2One() *Many2One { + return NewMany2One(dcrs.Id.Get(), "") +} + +// CreateDiscussChannelRtcSession creates a new discuss.channel.rtc.session model and returns its id. +func (c *Client) CreateDiscussChannelRtcSession(dcrs *DiscussChannelRtcSession) (int64, error) { + ids, err := c.CreateDiscussChannelRtcSessions([]*DiscussChannelRtcSession{dcrs}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateDiscussChannelRtcSession creates a new discuss.channel.rtc.session model and returns its id. +func (c *Client) CreateDiscussChannelRtcSessions(dcrss []*DiscussChannelRtcSession) ([]int64, error) { + var vv []interface{} + for _, v := range dcrss { + vv = append(vv, v) + } + return c.Create(DiscussChannelRtcSessionModel, vv, nil) +} + +// UpdateDiscussChannelRtcSession updates an existing discuss.channel.rtc.session record. +func (c *Client) UpdateDiscussChannelRtcSession(dcrs *DiscussChannelRtcSession) error { + return c.UpdateDiscussChannelRtcSessions([]int64{dcrs.Id.Get()}, dcrs) +} + +// UpdateDiscussChannelRtcSessions updates existing discuss.channel.rtc.session records. +// All records (represented by ids) will be updated by dcrs values. +func (c *Client) UpdateDiscussChannelRtcSessions(ids []int64, dcrs *DiscussChannelRtcSession) error { + return c.Update(DiscussChannelRtcSessionModel, ids, dcrs, nil) +} + +// DeleteDiscussChannelRtcSession deletes an existing discuss.channel.rtc.session record. +func (c *Client) DeleteDiscussChannelRtcSession(id int64) error { + return c.DeleteDiscussChannelRtcSessions([]int64{id}) +} + +// DeleteDiscussChannelRtcSessions deletes existing discuss.channel.rtc.session records. +func (c *Client) DeleteDiscussChannelRtcSessions(ids []int64) error { + return c.Delete(DiscussChannelRtcSessionModel, ids) +} + +// GetDiscussChannelRtcSession gets discuss.channel.rtc.session existing record. +func (c *Client) GetDiscussChannelRtcSession(id int64) (*DiscussChannelRtcSession, error) { + dcrss, err := c.GetDiscussChannelRtcSessions([]int64{id}) + if err != nil { + return nil, err + } + return &((*dcrss)[0]), nil +} + +// GetDiscussChannelRtcSessions gets discuss.channel.rtc.session existing records. +func (c *Client) GetDiscussChannelRtcSessions(ids []int64) (*DiscussChannelRtcSessions, error) { + dcrss := &DiscussChannelRtcSessions{} + if err := c.Read(DiscussChannelRtcSessionModel, ids, nil, dcrss); err != nil { + return nil, err + } + return dcrss, nil +} + +// FindDiscussChannelRtcSession finds discuss.channel.rtc.session record by querying it with criteria. +func (c *Client) FindDiscussChannelRtcSession(criteria *Criteria) (*DiscussChannelRtcSession, error) { + dcrss := &DiscussChannelRtcSessions{} + if err := c.SearchRead(DiscussChannelRtcSessionModel, criteria, NewOptions().Limit(1), dcrss); err != nil { + return nil, err + } + return &((*dcrss)[0]), nil +} + +// FindDiscussChannelRtcSessions finds discuss.channel.rtc.session records by querying it +// and filtering it with criteria and options. +func (c *Client) FindDiscussChannelRtcSessions(criteria *Criteria, options *Options) (*DiscussChannelRtcSessions, error) { + dcrss := &DiscussChannelRtcSessions{} + if err := c.SearchRead(DiscussChannelRtcSessionModel, criteria, options, dcrss); err != nil { + return nil, err + } + return dcrss, nil +} + +// FindDiscussChannelRtcSessionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindDiscussChannelRtcSessionIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(DiscussChannelRtcSessionModel, criteria, options) +} + +// FindDiscussChannelRtcSessionId finds record id by querying it with criteria. +func (c *Client) FindDiscussChannelRtcSessionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(DiscussChannelRtcSessionModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/discuss_gif_favorite.go b/discuss_gif_favorite.go new file mode 100644 index 0000000..d25ed8f --- /dev/null +++ b/discuss_gif_favorite.go @@ -0,0 +1,117 @@ +package odoo + +// DiscussGifFavorite represents discuss.gif.favorite model. +type DiscussGifFavorite struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + TenorGifId *String `xmlrpc:"tenor_gif_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// DiscussGifFavorites represents array of discuss.gif.favorite model. +type DiscussGifFavorites []DiscussGifFavorite + +// DiscussGifFavoriteModel is the odoo model name. +const DiscussGifFavoriteModel = "discuss.gif.favorite" + +// Many2One convert DiscussGifFavorite to *Many2One. +func (dgf *DiscussGifFavorite) Many2One() *Many2One { + return NewMany2One(dgf.Id.Get(), "") +} + +// CreateDiscussGifFavorite creates a new discuss.gif.favorite model and returns its id. +func (c *Client) CreateDiscussGifFavorite(dgf *DiscussGifFavorite) (int64, error) { + ids, err := c.CreateDiscussGifFavorites([]*DiscussGifFavorite{dgf}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateDiscussGifFavorite creates a new discuss.gif.favorite model and returns its id. +func (c *Client) CreateDiscussGifFavorites(dgfs []*DiscussGifFavorite) ([]int64, error) { + var vv []interface{} + for _, v := range dgfs { + vv = append(vv, v) + } + return c.Create(DiscussGifFavoriteModel, vv, nil) +} + +// UpdateDiscussGifFavorite updates an existing discuss.gif.favorite record. +func (c *Client) UpdateDiscussGifFavorite(dgf *DiscussGifFavorite) error { + return c.UpdateDiscussGifFavorites([]int64{dgf.Id.Get()}, dgf) +} + +// UpdateDiscussGifFavorites updates existing discuss.gif.favorite records. +// All records (represented by ids) will be updated by dgf values. +func (c *Client) UpdateDiscussGifFavorites(ids []int64, dgf *DiscussGifFavorite) error { + return c.Update(DiscussGifFavoriteModel, ids, dgf, nil) +} + +// DeleteDiscussGifFavorite deletes an existing discuss.gif.favorite record. +func (c *Client) DeleteDiscussGifFavorite(id int64) error { + return c.DeleteDiscussGifFavorites([]int64{id}) +} + +// DeleteDiscussGifFavorites deletes existing discuss.gif.favorite records. +func (c *Client) DeleteDiscussGifFavorites(ids []int64) error { + return c.Delete(DiscussGifFavoriteModel, ids) +} + +// GetDiscussGifFavorite gets discuss.gif.favorite existing record. +func (c *Client) GetDiscussGifFavorite(id int64) (*DiscussGifFavorite, error) { + dgfs, err := c.GetDiscussGifFavorites([]int64{id}) + if err != nil { + return nil, err + } + return &((*dgfs)[0]), nil +} + +// GetDiscussGifFavorites gets discuss.gif.favorite existing records. +func (c *Client) GetDiscussGifFavorites(ids []int64) (*DiscussGifFavorites, error) { + dgfs := &DiscussGifFavorites{} + if err := c.Read(DiscussGifFavoriteModel, ids, nil, dgfs); err != nil { + return nil, err + } + return dgfs, nil +} + +// FindDiscussGifFavorite finds discuss.gif.favorite record by querying it with criteria. +func (c *Client) FindDiscussGifFavorite(criteria *Criteria) (*DiscussGifFavorite, error) { + dgfs := &DiscussGifFavorites{} + if err := c.SearchRead(DiscussGifFavoriteModel, criteria, NewOptions().Limit(1), dgfs); err != nil { + return nil, err + } + return &((*dgfs)[0]), nil +} + +// FindDiscussGifFavorites finds discuss.gif.favorite records by querying it +// and filtering it with criteria and options. +func (c *Client) FindDiscussGifFavorites(criteria *Criteria, options *Options) (*DiscussGifFavorites, error) { + dgfs := &DiscussGifFavorites{} + if err := c.SearchRead(DiscussGifFavoriteModel, criteria, options, dgfs); err != nil { + return nil, err + } + return dgfs, nil +} + +// FindDiscussGifFavoriteIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindDiscussGifFavoriteIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(DiscussGifFavoriteModel, criteria, options) +} + +// FindDiscussGifFavoriteId finds record id by querying it with criteria. +func (c *Client) FindDiscussGifFavoriteId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(DiscussGifFavoriteModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/discuss_voice_metadata.go b/discuss_voice_metadata.go new file mode 100644 index 0000000..a7eb10f --- /dev/null +++ b/discuss_voice_metadata.go @@ -0,0 +1,117 @@ +package odoo + +// DiscussVoiceMetadata represents discuss.voice.metadata model. +type DiscussVoiceMetadata struct { + AttachmentId *Many2One `xmlrpc:"attachment_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// DiscussVoiceMetadatas represents array of discuss.voice.metadata model. +type DiscussVoiceMetadatas []DiscussVoiceMetadata + +// DiscussVoiceMetadataModel is the odoo model name. +const DiscussVoiceMetadataModel = "discuss.voice.metadata" + +// Many2One convert DiscussVoiceMetadata to *Many2One. +func (dvm *DiscussVoiceMetadata) Many2One() *Many2One { + return NewMany2One(dvm.Id.Get(), "") +} + +// CreateDiscussVoiceMetadata creates a new discuss.voice.metadata model and returns its id. +func (c *Client) CreateDiscussVoiceMetadata(dvm *DiscussVoiceMetadata) (int64, error) { + ids, err := c.CreateDiscussVoiceMetadatas([]*DiscussVoiceMetadata{dvm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateDiscussVoiceMetadata creates a new discuss.voice.metadata model and returns its id. +func (c *Client) CreateDiscussVoiceMetadatas(dvms []*DiscussVoiceMetadata) ([]int64, error) { + var vv []interface{} + for _, v := range dvms { + vv = append(vv, v) + } + return c.Create(DiscussVoiceMetadataModel, vv, nil) +} + +// UpdateDiscussVoiceMetadata updates an existing discuss.voice.metadata record. +func (c *Client) UpdateDiscussVoiceMetadata(dvm *DiscussVoiceMetadata) error { + return c.UpdateDiscussVoiceMetadatas([]int64{dvm.Id.Get()}, dvm) +} + +// UpdateDiscussVoiceMetadatas updates existing discuss.voice.metadata records. +// All records (represented by ids) will be updated by dvm values. +func (c *Client) UpdateDiscussVoiceMetadatas(ids []int64, dvm *DiscussVoiceMetadata) error { + return c.Update(DiscussVoiceMetadataModel, ids, dvm, nil) +} + +// DeleteDiscussVoiceMetadata deletes an existing discuss.voice.metadata record. +func (c *Client) DeleteDiscussVoiceMetadata(id int64) error { + return c.DeleteDiscussVoiceMetadatas([]int64{id}) +} + +// DeleteDiscussVoiceMetadatas deletes existing discuss.voice.metadata records. +func (c *Client) DeleteDiscussVoiceMetadatas(ids []int64) error { + return c.Delete(DiscussVoiceMetadataModel, ids) +} + +// GetDiscussVoiceMetadata gets discuss.voice.metadata existing record. +func (c *Client) GetDiscussVoiceMetadata(id int64) (*DiscussVoiceMetadata, error) { + dvms, err := c.GetDiscussVoiceMetadatas([]int64{id}) + if err != nil { + return nil, err + } + return &((*dvms)[0]), nil +} + +// GetDiscussVoiceMetadatas gets discuss.voice.metadata existing records. +func (c *Client) GetDiscussVoiceMetadatas(ids []int64) (*DiscussVoiceMetadatas, error) { + dvms := &DiscussVoiceMetadatas{} + if err := c.Read(DiscussVoiceMetadataModel, ids, nil, dvms); err != nil { + return nil, err + } + return dvms, nil +} + +// FindDiscussVoiceMetadata finds discuss.voice.metadata record by querying it with criteria. +func (c *Client) FindDiscussVoiceMetadata(criteria *Criteria) (*DiscussVoiceMetadata, error) { + dvms := &DiscussVoiceMetadatas{} + if err := c.SearchRead(DiscussVoiceMetadataModel, criteria, NewOptions().Limit(1), dvms); err != nil { + return nil, err + } + return &((*dvms)[0]), nil +} + +// FindDiscussVoiceMetadatas finds discuss.voice.metadata records by querying it +// and filtering it with criteria and options. +func (c *Client) FindDiscussVoiceMetadatas(criteria *Criteria, options *Options) (*DiscussVoiceMetadatas, error) { + dvms := &DiscussVoiceMetadatas{} + if err := c.SearchRead(DiscussVoiceMetadataModel, criteria, options, dvms); err != nil { + return nil, err + } + return dvms, nil +} + +// FindDiscussVoiceMetadataIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindDiscussVoiceMetadataIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(DiscussVoiceMetadataModel, criteria, options) +} + +// FindDiscussVoiceMetadataId finds record id by querying it with criteria. +func (c *Client) FindDiscussVoiceMetadataId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(DiscussVoiceMetadataModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/fetchmail_server.go b/fetchmail_server.go new file mode 100644 index 0000000..a635219 --- /dev/null +++ b/fetchmail_server.go @@ -0,0 +1,139 @@ +package odoo + +// FetchmailServer represents fetchmail.server model. +type FetchmailServer struct { + Active *Bool `xmlrpc:"active,omitempty"` + Attach *Bool `xmlrpc:"attach,omitempty"` + Configuration *String `xmlrpc:"configuration,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + GoogleGmailAccessToken *String `xmlrpc:"google_gmail_access_token,omitempty"` + GoogleGmailAccessTokenExpiration *Int `xmlrpc:"google_gmail_access_token_expiration,omitempty"` + GoogleGmailAuthorizationCode *String `xmlrpc:"google_gmail_authorization_code,omitempty"` + GoogleGmailRefreshToken *String `xmlrpc:"google_gmail_refresh_token,omitempty"` + GoogleGmailUri *String `xmlrpc:"google_gmail_uri,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsSsl *Bool `xmlrpc:"is_ssl,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ObjectId *Many2One `xmlrpc:"object_id,omitempty"` + Original *Bool `xmlrpc:"original,omitempty"` + Password *String `xmlrpc:"password,omitempty"` + Port *Int `xmlrpc:"port,omitempty"` + Priority *Int `xmlrpc:"priority,omitempty"` + Script *String `xmlrpc:"script,omitempty"` + Server *String `xmlrpc:"server,omitempty"` + ServerType *Selection `xmlrpc:"server_type,omitempty"` + ServerTypeInfo *String `xmlrpc:"server_type_info,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + User *String `xmlrpc:"user,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// FetchmailServers represents array of fetchmail.server model. +type FetchmailServers []FetchmailServer + +// FetchmailServerModel is the odoo model name. +const FetchmailServerModel = "fetchmail.server" + +// Many2One convert FetchmailServer to *Many2One. +func (fs *FetchmailServer) Many2One() *Many2One { + return NewMany2One(fs.Id.Get(), "") +} + +// CreateFetchmailServer creates a new fetchmail.server model and returns its id. +func (c *Client) CreateFetchmailServer(fs *FetchmailServer) (int64, error) { + ids, err := c.CreateFetchmailServers([]*FetchmailServer{fs}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateFetchmailServer creates a new fetchmail.server model and returns its id. +func (c *Client) CreateFetchmailServers(fss []*FetchmailServer) ([]int64, error) { + var vv []interface{} + for _, v := range fss { + vv = append(vv, v) + } + return c.Create(FetchmailServerModel, vv, nil) +} + +// UpdateFetchmailServer updates an existing fetchmail.server record. +func (c *Client) UpdateFetchmailServer(fs *FetchmailServer) error { + return c.UpdateFetchmailServers([]int64{fs.Id.Get()}, fs) +} + +// UpdateFetchmailServers updates existing fetchmail.server records. +// All records (represented by ids) will be updated by fs values. +func (c *Client) UpdateFetchmailServers(ids []int64, fs *FetchmailServer) error { + return c.Update(FetchmailServerModel, ids, fs, nil) +} + +// DeleteFetchmailServer deletes an existing fetchmail.server record. +func (c *Client) DeleteFetchmailServer(id int64) error { + return c.DeleteFetchmailServers([]int64{id}) +} + +// DeleteFetchmailServers deletes existing fetchmail.server records. +func (c *Client) DeleteFetchmailServers(ids []int64) error { + return c.Delete(FetchmailServerModel, ids) +} + +// GetFetchmailServer gets fetchmail.server existing record. +func (c *Client) GetFetchmailServer(id int64) (*FetchmailServer, error) { + fss, err := c.GetFetchmailServers([]int64{id}) + if err != nil { + return nil, err + } + return &((*fss)[0]), nil +} + +// GetFetchmailServers gets fetchmail.server existing records. +func (c *Client) GetFetchmailServers(ids []int64) (*FetchmailServers, error) { + fss := &FetchmailServers{} + if err := c.Read(FetchmailServerModel, ids, nil, fss); err != nil { + return nil, err + } + return fss, nil +} + +// FindFetchmailServer finds fetchmail.server record by querying it with criteria. +func (c *Client) FindFetchmailServer(criteria *Criteria) (*FetchmailServer, error) { + fss := &FetchmailServers{} + if err := c.SearchRead(FetchmailServerModel, criteria, NewOptions().Limit(1), fss); err != nil { + return nil, err + } + return &((*fss)[0]), nil +} + +// FindFetchmailServers finds fetchmail.server records by querying it +// and filtering it with criteria and options. +func (c *Client) FindFetchmailServers(criteria *Criteria, options *Options) (*FetchmailServers, error) { + fss := &FetchmailServers{} + if err := c.SearchRead(FetchmailServerModel, criteria, options, fss); err != nil { + return nil, err + } + return fss, nil +} + +// FindFetchmailServerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindFetchmailServerIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(FetchmailServerModel, criteria, options) +} + +// FindFetchmailServerId finds record id by querying it with criteria. +func (c *Client) FindFetchmailServerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(FetchmailServerModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/generator/cmd/tmpl/model.tmpl b/generator/cmd/tmpl/model.tmpl index 7268899..65f825e 100644 --- a/generator/cmd/tmpl/model.tmpl +++ b/generator/cmd/tmpl/model.tmpl @@ -1,4 +1,4 @@ -package models +package odoo // {{.StructName}} represents {{ .Name }} model. type {{.StructName}} struct { {{range .Fields}} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..448be0c --- /dev/null +++ b/go.mod @@ -0,0 +1,16 @@ +module github.com/helvethink/go-odoo + +go 1.23 + +toolchain go1.23.5 + +require ( + github.com/iancoleman/strcase v0.3.0 + github.com/kolo/xmlrpc v0.0.0-20201022064351-38db28db192b + github.com/spf13/cobra v1.8.1 +) + +require ( + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..8d81a36 --- /dev/null +++ b/go.sum @@ -0,0 +1,17 @@ +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/kolo/xmlrpc v0.0.0-20201022064351-38db28db192b h1:iNjcivnc6lhbvJA3LD622NPrUponluJrBWPIwGG/3Bg= +github.com/kolo/xmlrpc v0.0.0-20201022064351-38db28db192b/go.mod h1:pcaDhQK0/NJZEvtCO0qQPPropqV0sJOJ6YW7X+9kRwM= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/hr_applicant.go b/hr_applicant.go new file mode 100644 index 0000000..c36fa9f --- /dev/null +++ b/hr_applicant.go @@ -0,0 +1,199 @@ +package odoo + +// HrApplicant represents hr.applicant model. +type HrApplicant struct { + Active *Bool `xmlrpc:"active,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + ApplicantNotes *String `xmlrpc:"applicant_notes,omitempty"` + ApplicantProperties interface{} `xmlrpc:"applicant_properties,omitempty"` + ApplicationStatus *Selection `xmlrpc:"application_status,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + AttachmentNumber *Int `xmlrpc:"attachment_number,omitempty"` + Availability *Time `xmlrpc:"availability,omitempty"` + CampaignId *Many2One `xmlrpc:"campaign_id,omitempty"` + CandidateId *Many2One `xmlrpc:"candidate_id,omitempty"` + CandidateSkillIds *Relation `xmlrpc:"candidate_skill_ids,omitempty"` + CategIds *Relation `xmlrpc:"categ_ids,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateClosed *Time `xmlrpc:"date_closed,omitempty"` + DateLastStageUpdate *Time `xmlrpc:"date_last_stage_update,omitempty"` + DateOpen *Time `xmlrpc:"date_open,omitempty"` + DayClose *Float `xmlrpc:"day_close,omitempty"` + DayOpen *Float `xmlrpc:"day_open,omitempty"` + DelayClose *Float `xmlrpc:"delay_close,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DurationTracking *String `xmlrpc:"duration_tracking,omitempty"` + EmailCc *String `xmlrpc:"email_cc,omitempty"` + EmailFrom *String `xmlrpc:"email_from,omitempty"` + EmailNormalized *String `xmlrpc:"email_normalized,omitempty"` + EmpIsActive *Bool `xmlrpc:"emp_is_active,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + EmployeeName *String `xmlrpc:"employee_name,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InterviewerIds *Relation `xmlrpc:"interviewer_ids,omitempty"` + JobId *Many2One `xmlrpc:"job_id,omitempty"` + KanbanState *Selection `xmlrpc:"kanban_state,omitempty"` + LastStageId *Many2One `xmlrpc:"last_stage_id,omitempty"` + LegendBlocked *String `xmlrpc:"legend_blocked,omitempty"` + LegendDone *String `xmlrpc:"legend_done,omitempty"` + LegendNormal *String `xmlrpc:"legend_normal,omitempty"` + LinkedinProfile *String `xmlrpc:"linkedin_profile,omitempty"` + MediumId *Many2One `xmlrpc:"medium_id,omitempty"` + MeetingDisplayDate *Time `xmlrpc:"meeting_display_date,omitempty"` + MeetingDisplayText *String `xmlrpc:"meeting_display_text,omitempty"` + MeetingIds *Relation `xmlrpc:"meeting_ids,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageMainAttachmentId *Many2One `xmlrpc:"message_main_attachment_id,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + OtherApplicationsCount *Int `xmlrpc:"other_applications_count,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerName *String `xmlrpc:"partner_name,omitempty"` + PartnerPhone *String `xmlrpc:"partner_phone,omitempty"` + PartnerPhoneSanitized *String `xmlrpc:"partner_phone_sanitized,omitempty"` + Priority *Selection `xmlrpc:"priority,omitempty"` + Probability *Float `xmlrpc:"probability,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RefuseDate *Time `xmlrpc:"refuse_date,omitempty"` + RefuseReasonId *Many2One `xmlrpc:"refuse_reason_id,omitempty"` + SalaryExpected *Float `xmlrpc:"salary_expected,omitempty"` + SalaryExpectedExtra *String `xmlrpc:"salary_expected_extra,omitempty"` + SalaryProposed *Float `xmlrpc:"salary_proposed,omitempty"` + SalaryProposedExtra *String `xmlrpc:"salary_proposed_extra,omitempty"` + SkillIds *Relation `xmlrpc:"skill_ids,omitempty"` + SourceId *Many2One `xmlrpc:"source_id,omitempty"` + StageId *Many2One `xmlrpc:"stage_id,omitempty"` + TypeId *Many2One `xmlrpc:"type_id,omitempty"` + UserEmail *String `xmlrpc:"user_email,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrApplicants represents array of hr.applicant model. +type HrApplicants []HrApplicant + +// HrApplicantModel is the odoo model name. +const HrApplicantModel = "hr.applicant" + +// Many2One convert HrApplicant to *Many2One. +func (ha *HrApplicant) Many2One() *Many2One { + return NewMany2One(ha.Id.Get(), "") +} + +// CreateHrApplicant creates a new hr.applicant model and returns its id. +func (c *Client) CreateHrApplicant(ha *HrApplicant) (int64, error) { + ids, err := c.CreateHrApplicants([]*HrApplicant{ha}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrApplicant creates a new hr.applicant model and returns its id. +func (c *Client) CreateHrApplicants(has []*HrApplicant) ([]int64, error) { + var vv []interface{} + for _, v := range has { + vv = append(vv, v) + } + return c.Create(HrApplicantModel, vv, nil) +} + +// UpdateHrApplicant updates an existing hr.applicant record. +func (c *Client) UpdateHrApplicant(ha *HrApplicant) error { + return c.UpdateHrApplicants([]int64{ha.Id.Get()}, ha) +} + +// UpdateHrApplicants updates existing hr.applicant records. +// All records (represented by ids) will be updated by ha values. +func (c *Client) UpdateHrApplicants(ids []int64, ha *HrApplicant) error { + return c.Update(HrApplicantModel, ids, ha, nil) +} + +// DeleteHrApplicant deletes an existing hr.applicant record. +func (c *Client) DeleteHrApplicant(id int64) error { + return c.DeleteHrApplicants([]int64{id}) +} + +// DeleteHrApplicants deletes existing hr.applicant records. +func (c *Client) DeleteHrApplicants(ids []int64) error { + return c.Delete(HrApplicantModel, ids) +} + +// GetHrApplicant gets hr.applicant existing record. +func (c *Client) GetHrApplicant(id int64) (*HrApplicant, error) { + has, err := c.GetHrApplicants([]int64{id}) + if err != nil { + return nil, err + } + return &((*has)[0]), nil +} + +// GetHrApplicants gets hr.applicant existing records. +func (c *Client) GetHrApplicants(ids []int64) (*HrApplicants, error) { + has := &HrApplicants{} + if err := c.Read(HrApplicantModel, ids, nil, has); err != nil { + return nil, err + } + return has, nil +} + +// FindHrApplicant finds hr.applicant record by querying it with criteria. +func (c *Client) FindHrApplicant(criteria *Criteria) (*HrApplicant, error) { + has := &HrApplicants{} + if err := c.SearchRead(HrApplicantModel, criteria, NewOptions().Limit(1), has); err != nil { + return nil, err + } + return &((*has)[0]), nil +} + +// FindHrApplicants finds hr.applicant records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrApplicants(criteria *Criteria, options *Options) (*HrApplicants, error) { + has := &HrApplicants{} + if err := c.SearchRead(HrApplicantModel, criteria, options, has); err != nil { + return nil, err + } + return has, nil +} + +// FindHrApplicantIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrApplicantIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrApplicantModel, criteria, options) +} + +// FindHrApplicantId finds record id by querying it with criteria. +func (c *Client) FindHrApplicantId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrApplicantModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_applicant_category.go b/hr_applicant_category.go new file mode 100644 index 0000000..1d9eac1 --- /dev/null +++ b/hr_applicant_category.go @@ -0,0 +1,118 @@ +package odoo + +// HrApplicantCategory represents hr.applicant.category model. +type HrApplicantCategory struct { + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrApplicantCategorys represents array of hr.applicant.category model. +type HrApplicantCategorys []HrApplicantCategory + +// HrApplicantCategoryModel is the odoo model name. +const HrApplicantCategoryModel = "hr.applicant.category" + +// Many2One convert HrApplicantCategory to *Many2One. +func (hac *HrApplicantCategory) Many2One() *Many2One { + return NewMany2One(hac.Id.Get(), "") +} + +// CreateHrApplicantCategory creates a new hr.applicant.category model and returns its id. +func (c *Client) CreateHrApplicantCategory(hac *HrApplicantCategory) (int64, error) { + ids, err := c.CreateHrApplicantCategorys([]*HrApplicantCategory{hac}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrApplicantCategory creates a new hr.applicant.category model and returns its id. +func (c *Client) CreateHrApplicantCategorys(hacs []*HrApplicantCategory) ([]int64, error) { + var vv []interface{} + for _, v := range hacs { + vv = append(vv, v) + } + return c.Create(HrApplicantCategoryModel, vv, nil) +} + +// UpdateHrApplicantCategory updates an existing hr.applicant.category record. +func (c *Client) UpdateHrApplicantCategory(hac *HrApplicantCategory) error { + return c.UpdateHrApplicantCategorys([]int64{hac.Id.Get()}, hac) +} + +// UpdateHrApplicantCategorys updates existing hr.applicant.category records. +// All records (represented by ids) will be updated by hac values. +func (c *Client) UpdateHrApplicantCategorys(ids []int64, hac *HrApplicantCategory) error { + return c.Update(HrApplicantCategoryModel, ids, hac, nil) +} + +// DeleteHrApplicantCategory deletes an existing hr.applicant.category record. +func (c *Client) DeleteHrApplicantCategory(id int64) error { + return c.DeleteHrApplicantCategorys([]int64{id}) +} + +// DeleteHrApplicantCategorys deletes existing hr.applicant.category records. +func (c *Client) DeleteHrApplicantCategorys(ids []int64) error { + return c.Delete(HrApplicantCategoryModel, ids) +} + +// GetHrApplicantCategory gets hr.applicant.category existing record. +func (c *Client) GetHrApplicantCategory(id int64) (*HrApplicantCategory, error) { + hacs, err := c.GetHrApplicantCategorys([]int64{id}) + if err != nil { + return nil, err + } + return &((*hacs)[0]), nil +} + +// GetHrApplicantCategorys gets hr.applicant.category existing records. +func (c *Client) GetHrApplicantCategorys(ids []int64) (*HrApplicantCategorys, error) { + hacs := &HrApplicantCategorys{} + if err := c.Read(HrApplicantCategoryModel, ids, nil, hacs); err != nil { + return nil, err + } + return hacs, nil +} + +// FindHrApplicantCategory finds hr.applicant.category record by querying it with criteria. +func (c *Client) FindHrApplicantCategory(criteria *Criteria) (*HrApplicantCategory, error) { + hacs := &HrApplicantCategorys{} + if err := c.SearchRead(HrApplicantCategoryModel, criteria, NewOptions().Limit(1), hacs); err != nil { + return nil, err + } + return &((*hacs)[0]), nil +} + +// FindHrApplicantCategorys finds hr.applicant.category records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrApplicantCategorys(criteria *Criteria, options *Options) (*HrApplicantCategorys, error) { + hacs := &HrApplicantCategorys{} + if err := c.SearchRead(HrApplicantCategoryModel, criteria, options, hacs); err != nil { + return nil, err + } + return hacs, nil +} + +// FindHrApplicantCategoryIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrApplicantCategoryIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrApplicantCategoryModel, criteria, options) +} + +// FindHrApplicantCategoryId finds record id by querying it with criteria. +func (c *Client) FindHrApplicantCategoryId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrApplicantCategoryModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_applicant_refuse_reason.go b/hr_applicant_refuse_reason.go new file mode 100644 index 0000000..ae73aa8 --- /dev/null +++ b/hr_applicant_refuse_reason.go @@ -0,0 +1,120 @@ +package odoo + +// HrApplicantRefuseReason represents hr.applicant.refuse.reason model. +type HrApplicantRefuseReason struct { + Active *Bool `xmlrpc:"active,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TemplateId *Many2One `xmlrpc:"template_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrApplicantRefuseReasons represents array of hr.applicant.refuse.reason model. +type HrApplicantRefuseReasons []HrApplicantRefuseReason + +// HrApplicantRefuseReasonModel is the odoo model name. +const HrApplicantRefuseReasonModel = "hr.applicant.refuse.reason" + +// Many2One convert HrApplicantRefuseReason to *Many2One. +func (harr *HrApplicantRefuseReason) Many2One() *Many2One { + return NewMany2One(harr.Id.Get(), "") +} + +// CreateHrApplicantRefuseReason creates a new hr.applicant.refuse.reason model and returns its id. +func (c *Client) CreateHrApplicantRefuseReason(harr *HrApplicantRefuseReason) (int64, error) { + ids, err := c.CreateHrApplicantRefuseReasons([]*HrApplicantRefuseReason{harr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrApplicantRefuseReason creates a new hr.applicant.refuse.reason model and returns its id. +func (c *Client) CreateHrApplicantRefuseReasons(harrs []*HrApplicantRefuseReason) ([]int64, error) { + var vv []interface{} + for _, v := range harrs { + vv = append(vv, v) + } + return c.Create(HrApplicantRefuseReasonModel, vv, nil) +} + +// UpdateHrApplicantRefuseReason updates an existing hr.applicant.refuse.reason record. +func (c *Client) UpdateHrApplicantRefuseReason(harr *HrApplicantRefuseReason) error { + return c.UpdateHrApplicantRefuseReasons([]int64{harr.Id.Get()}, harr) +} + +// UpdateHrApplicantRefuseReasons updates existing hr.applicant.refuse.reason records. +// All records (represented by ids) will be updated by harr values. +func (c *Client) UpdateHrApplicantRefuseReasons(ids []int64, harr *HrApplicantRefuseReason) error { + return c.Update(HrApplicantRefuseReasonModel, ids, harr, nil) +} + +// DeleteHrApplicantRefuseReason deletes an existing hr.applicant.refuse.reason record. +func (c *Client) DeleteHrApplicantRefuseReason(id int64) error { + return c.DeleteHrApplicantRefuseReasons([]int64{id}) +} + +// DeleteHrApplicantRefuseReasons deletes existing hr.applicant.refuse.reason records. +func (c *Client) DeleteHrApplicantRefuseReasons(ids []int64) error { + return c.Delete(HrApplicantRefuseReasonModel, ids) +} + +// GetHrApplicantRefuseReason gets hr.applicant.refuse.reason existing record. +func (c *Client) GetHrApplicantRefuseReason(id int64) (*HrApplicantRefuseReason, error) { + harrs, err := c.GetHrApplicantRefuseReasons([]int64{id}) + if err != nil { + return nil, err + } + return &((*harrs)[0]), nil +} + +// GetHrApplicantRefuseReasons gets hr.applicant.refuse.reason existing records. +func (c *Client) GetHrApplicantRefuseReasons(ids []int64) (*HrApplicantRefuseReasons, error) { + harrs := &HrApplicantRefuseReasons{} + if err := c.Read(HrApplicantRefuseReasonModel, ids, nil, harrs); err != nil { + return nil, err + } + return harrs, nil +} + +// FindHrApplicantRefuseReason finds hr.applicant.refuse.reason record by querying it with criteria. +func (c *Client) FindHrApplicantRefuseReason(criteria *Criteria) (*HrApplicantRefuseReason, error) { + harrs := &HrApplicantRefuseReasons{} + if err := c.SearchRead(HrApplicantRefuseReasonModel, criteria, NewOptions().Limit(1), harrs); err != nil { + return nil, err + } + return &((*harrs)[0]), nil +} + +// FindHrApplicantRefuseReasons finds hr.applicant.refuse.reason records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrApplicantRefuseReasons(criteria *Criteria, options *Options) (*HrApplicantRefuseReasons, error) { + harrs := &HrApplicantRefuseReasons{} + if err := c.SearchRead(HrApplicantRefuseReasonModel, criteria, options, harrs); err != nil { + return nil, err + } + return harrs, nil +} + +// FindHrApplicantRefuseReasonIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrApplicantRefuseReasonIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrApplicantRefuseReasonModel, criteria, options) +} + +// FindHrApplicantRefuseReasonId finds record id by querying it with criteria. +func (c *Client) FindHrApplicantRefuseReasonId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrApplicantRefuseReasonModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_candidate.go b/hr_candidate.go new file mode 100644 index 0000000..e1de333 --- /dev/null +++ b/hr_candidate.go @@ -0,0 +1,184 @@ +package odoo + +// HrCandidate represents hr.candidate model. +type HrCandidate struct { + AcceptedApplicationsCount *Int `xmlrpc:"accepted_applications_count,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + ApplicantIds *Relation `xmlrpc:"applicant_ids,omitempty"` + ApplicationCount *Int `xmlrpc:"application_count,omitempty"` + ApplicationsCount *Int `xmlrpc:"applications_count,omitempty"` + AttachmentCount *Int `xmlrpc:"attachment_count,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + Availability *Time `xmlrpc:"availability,omitempty"` + CandidateProperties interface{} `xmlrpc:"candidate_properties,omitempty"` + CandidateSkillIds *Relation `xmlrpc:"candidate_skill_ids,omitempty"` + CategIds *Relation `xmlrpc:"categ_ids,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmailCc *String `xmlrpc:"email_cc,omitempty"` + EmailFrom *String `xmlrpc:"email_from,omitempty"` + EmailNormalized *String `xmlrpc:"email_normalized,omitempty"` + EmpIsActive *Bool `xmlrpc:"emp_is_active,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + EmployeeName *String `xmlrpc:"employee_name,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsBlacklisted *Bool `xmlrpc:"is_blacklisted,omitempty"` + LinkedinProfile *String `xmlrpc:"linkedin_profile,omitempty"` + MatchingScore *Float `xmlrpc:"matching_score,omitempty"` + MatchingSkillIds *Relation `xmlrpc:"matching_skill_ids,omitempty"` + MeetingDisplayDate *Time `xmlrpc:"meeting_display_date,omitempty"` + MeetingDisplayText *String `xmlrpc:"meeting_display_text,omitempty"` + MeetingIds *Relation `xmlrpc:"meeting_ids,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageBounce *Int `xmlrpc:"message_bounce,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageMainAttachmentId *Many2One `xmlrpc:"message_main_attachment_id,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MissingSkillIds *Relation `xmlrpc:"missing_skill_ids,omitempty"` + MobileBlacklisted *Bool `xmlrpc:"mobile_blacklisted,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerName *String `xmlrpc:"partner_name,omitempty"` + PartnerPhone *String `xmlrpc:"partner_phone,omitempty"` + PartnerPhoneSanitized *String `xmlrpc:"partner_phone_sanitized,omitempty"` + PhoneBlacklisted *Bool `xmlrpc:"phone_blacklisted,omitempty"` + PhoneMobileSearch *String `xmlrpc:"phone_mobile_search,omitempty"` + PhoneSanitized *String `xmlrpc:"phone_sanitized,omitempty"` + PhoneSanitizedBlacklisted *Bool `xmlrpc:"phone_sanitized_blacklisted,omitempty"` + Priority *Selection `xmlrpc:"priority,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RefusedApplicationsCount *Int `xmlrpc:"refused_applications_count,omitempty"` + SimilarCandidatesCount *Int `xmlrpc:"similar_candidates_count,omitempty"` + SkillIds *Relation `xmlrpc:"skill_ids,omitempty"` + TypeId *Many2One `xmlrpc:"type_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrCandidates represents array of hr.candidate model. +type HrCandidates []HrCandidate + +// HrCandidateModel is the odoo model name. +const HrCandidateModel = "hr.candidate" + +// Many2One convert HrCandidate to *Many2One. +func (hc *HrCandidate) Many2One() *Many2One { + return NewMany2One(hc.Id.Get(), "") +} + +// CreateHrCandidate creates a new hr.candidate model and returns its id. +func (c *Client) CreateHrCandidate(hc *HrCandidate) (int64, error) { + ids, err := c.CreateHrCandidates([]*HrCandidate{hc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrCandidate creates a new hr.candidate model and returns its id. +func (c *Client) CreateHrCandidates(hcs []*HrCandidate) ([]int64, error) { + var vv []interface{} + for _, v := range hcs { + vv = append(vv, v) + } + return c.Create(HrCandidateModel, vv, nil) +} + +// UpdateHrCandidate updates an existing hr.candidate record. +func (c *Client) UpdateHrCandidate(hc *HrCandidate) error { + return c.UpdateHrCandidates([]int64{hc.Id.Get()}, hc) +} + +// UpdateHrCandidates updates existing hr.candidate records. +// All records (represented by ids) will be updated by hc values. +func (c *Client) UpdateHrCandidates(ids []int64, hc *HrCandidate) error { + return c.Update(HrCandidateModel, ids, hc, nil) +} + +// DeleteHrCandidate deletes an existing hr.candidate record. +func (c *Client) DeleteHrCandidate(id int64) error { + return c.DeleteHrCandidates([]int64{id}) +} + +// DeleteHrCandidates deletes existing hr.candidate records. +func (c *Client) DeleteHrCandidates(ids []int64) error { + return c.Delete(HrCandidateModel, ids) +} + +// GetHrCandidate gets hr.candidate existing record. +func (c *Client) GetHrCandidate(id int64) (*HrCandidate, error) { + hcs, err := c.GetHrCandidates([]int64{id}) + if err != nil { + return nil, err + } + return &((*hcs)[0]), nil +} + +// GetHrCandidates gets hr.candidate existing records. +func (c *Client) GetHrCandidates(ids []int64) (*HrCandidates, error) { + hcs := &HrCandidates{} + if err := c.Read(HrCandidateModel, ids, nil, hcs); err != nil { + return nil, err + } + return hcs, nil +} + +// FindHrCandidate finds hr.candidate record by querying it with criteria. +func (c *Client) FindHrCandidate(criteria *Criteria) (*HrCandidate, error) { + hcs := &HrCandidates{} + if err := c.SearchRead(HrCandidateModel, criteria, NewOptions().Limit(1), hcs); err != nil { + return nil, err + } + return &((*hcs)[0]), nil +} + +// FindHrCandidates finds hr.candidate records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrCandidates(criteria *Criteria, options *Options) (*HrCandidates, error) { + hcs := &HrCandidates{} + if err := c.SearchRead(HrCandidateModel, criteria, options, hcs); err != nil { + return nil, err + } + return hcs, nil +} + +// FindHrCandidateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrCandidateIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrCandidateModel, criteria, options) +} + +// FindHrCandidateId finds record id by querying it with criteria. +func (c *Client) FindHrCandidateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrCandidateModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_candidate_skill.go b/hr_candidate_skill.go new file mode 100644 index 0000000..fb48bca --- /dev/null +++ b/hr_candidate_skill.go @@ -0,0 +1,121 @@ +package odoo + +// HrCandidateSkill represents hr.candidate.skill model. +type HrCandidateSkill struct { + CandidateId *Many2One `xmlrpc:"candidate_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LevelProgress *Int `xmlrpc:"level_progress,omitempty"` + SkillId *Many2One `xmlrpc:"skill_id,omitempty"` + SkillLevelId *Many2One `xmlrpc:"skill_level_id,omitempty"` + SkillTypeId *Many2One `xmlrpc:"skill_type_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrCandidateSkills represents array of hr.candidate.skill model. +type HrCandidateSkills []HrCandidateSkill + +// HrCandidateSkillModel is the odoo model name. +const HrCandidateSkillModel = "hr.candidate.skill" + +// Many2One convert HrCandidateSkill to *Many2One. +func (hcs *HrCandidateSkill) Many2One() *Many2One { + return NewMany2One(hcs.Id.Get(), "") +} + +// CreateHrCandidateSkill creates a new hr.candidate.skill model and returns its id. +func (c *Client) CreateHrCandidateSkill(hcs *HrCandidateSkill) (int64, error) { + ids, err := c.CreateHrCandidateSkills([]*HrCandidateSkill{hcs}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrCandidateSkill creates a new hr.candidate.skill model and returns its id. +func (c *Client) CreateHrCandidateSkills(hcss []*HrCandidateSkill) ([]int64, error) { + var vv []interface{} + for _, v := range hcss { + vv = append(vv, v) + } + return c.Create(HrCandidateSkillModel, vv, nil) +} + +// UpdateHrCandidateSkill updates an existing hr.candidate.skill record. +func (c *Client) UpdateHrCandidateSkill(hcs *HrCandidateSkill) error { + return c.UpdateHrCandidateSkills([]int64{hcs.Id.Get()}, hcs) +} + +// UpdateHrCandidateSkills updates existing hr.candidate.skill records. +// All records (represented by ids) will be updated by hcs values. +func (c *Client) UpdateHrCandidateSkills(ids []int64, hcs *HrCandidateSkill) error { + return c.Update(HrCandidateSkillModel, ids, hcs, nil) +} + +// DeleteHrCandidateSkill deletes an existing hr.candidate.skill record. +func (c *Client) DeleteHrCandidateSkill(id int64) error { + return c.DeleteHrCandidateSkills([]int64{id}) +} + +// DeleteHrCandidateSkills deletes existing hr.candidate.skill records. +func (c *Client) DeleteHrCandidateSkills(ids []int64) error { + return c.Delete(HrCandidateSkillModel, ids) +} + +// GetHrCandidateSkill gets hr.candidate.skill existing record. +func (c *Client) GetHrCandidateSkill(id int64) (*HrCandidateSkill, error) { + hcss, err := c.GetHrCandidateSkills([]int64{id}) + if err != nil { + return nil, err + } + return &((*hcss)[0]), nil +} + +// GetHrCandidateSkills gets hr.candidate.skill existing records. +func (c *Client) GetHrCandidateSkills(ids []int64) (*HrCandidateSkills, error) { + hcss := &HrCandidateSkills{} + if err := c.Read(HrCandidateSkillModel, ids, nil, hcss); err != nil { + return nil, err + } + return hcss, nil +} + +// FindHrCandidateSkill finds hr.candidate.skill record by querying it with criteria. +func (c *Client) FindHrCandidateSkill(criteria *Criteria) (*HrCandidateSkill, error) { + hcss := &HrCandidateSkills{} + if err := c.SearchRead(HrCandidateSkillModel, criteria, NewOptions().Limit(1), hcss); err != nil { + return nil, err + } + return &((*hcss)[0]), nil +} + +// FindHrCandidateSkills finds hr.candidate.skill records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrCandidateSkills(criteria *Criteria, options *Options) (*HrCandidateSkills, error) { + hcss := &HrCandidateSkills{} + if err := c.SearchRead(HrCandidateSkillModel, criteria, options, hcss); err != nil { + return nil, err + } + return hcss, nil +} + +// FindHrCandidateSkillIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrCandidateSkillIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrCandidateSkillModel, criteria, options) +} + +// FindHrCandidateSkillId finds record id by querying it with criteria. +func (c *Client) FindHrCandidateSkillId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrCandidateSkillModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_contract.go b/hr_contract.go new file mode 100644 index 0000000..01ac26a --- /dev/null +++ b/hr_contract.go @@ -0,0 +1,167 @@ +package odoo + +// HrContract represents hr.contract model. +type HrContract struct { + Active *Bool `xmlrpc:"active,omitempty"` + ActiveEmployee *Bool `xmlrpc:"active_employee,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + CalendarMismatch *Bool `xmlrpc:"calendar_mismatch,omitempty"` + CompanyCountryId *Many2One `xmlrpc:"company_country_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + ContractTypeId *Many2One `xmlrpc:"contract_type_id,omitempty"` + ContractWage *Float `xmlrpc:"contract_wage,omitempty"` + ContractsCount *Int `xmlrpc:"contracts_count,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DateEnd *Time `xmlrpc:"date_end,omitempty"` + DateStart *Time `xmlrpc:"date_start,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + FirstContractDate *Time `xmlrpc:"first_contract_date,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + HrResponsibleId *Many2One `xmlrpc:"hr_responsible_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JobId *Many2One `xmlrpc:"job_id,omitempty"` + KanbanState *Selection `xmlrpc:"kanban_state,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Notes *String `xmlrpc:"notes,omitempty"` + PermitNo *String `xmlrpc:"permit_no,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StructureTypeId *Many2One `xmlrpc:"structure_type_id,omitempty"` + TrialDateEnd *Time `xmlrpc:"trial_date_end,omitempty"` + VisaNo *String `xmlrpc:"visa_no,omitempty"` + Wage *Float `xmlrpc:"wage,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrContracts represents array of hr.contract model. +type HrContracts []HrContract + +// HrContractModel is the odoo model name. +const HrContractModel = "hr.contract" + +// Many2One convert HrContract to *Many2One. +func (hc *HrContract) Many2One() *Many2One { + return NewMany2One(hc.Id.Get(), "") +} + +// CreateHrContract creates a new hr.contract model and returns its id. +func (c *Client) CreateHrContract(hc *HrContract) (int64, error) { + ids, err := c.CreateHrContracts([]*HrContract{hc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrContract creates a new hr.contract model and returns its id. +func (c *Client) CreateHrContracts(hcs []*HrContract) ([]int64, error) { + var vv []interface{} + for _, v := range hcs { + vv = append(vv, v) + } + return c.Create(HrContractModel, vv, nil) +} + +// UpdateHrContract updates an existing hr.contract record. +func (c *Client) UpdateHrContract(hc *HrContract) error { + return c.UpdateHrContracts([]int64{hc.Id.Get()}, hc) +} + +// UpdateHrContracts updates existing hr.contract records. +// All records (represented by ids) will be updated by hc values. +func (c *Client) UpdateHrContracts(ids []int64, hc *HrContract) error { + return c.Update(HrContractModel, ids, hc, nil) +} + +// DeleteHrContract deletes an existing hr.contract record. +func (c *Client) DeleteHrContract(id int64) error { + return c.DeleteHrContracts([]int64{id}) +} + +// DeleteHrContracts deletes existing hr.contract records. +func (c *Client) DeleteHrContracts(ids []int64) error { + return c.Delete(HrContractModel, ids) +} + +// GetHrContract gets hr.contract existing record. +func (c *Client) GetHrContract(id int64) (*HrContract, error) { + hcs, err := c.GetHrContracts([]int64{id}) + if err != nil { + return nil, err + } + return &((*hcs)[0]), nil +} + +// GetHrContracts gets hr.contract existing records. +func (c *Client) GetHrContracts(ids []int64) (*HrContracts, error) { + hcs := &HrContracts{} + if err := c.Read(HrContractModel, ids, nil, hcs); err != nil { + return nil, err + } + return hcs, nil +} + +// FindHrContract finds hr.contract record by querying it with criteria. +func (c *Client) FindHrContract(criteria *Criteria) (*HrContract, error) { + hcs := &HrContracts{} + if err := c.SearchRead(HrContractModel, criteria, NewOptions().Limit(1), hcs); err != nil { + return nil, err + } + return &((*hcs)[0]), nil +} + +// FindHrContracts finds hr.contract records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrContracts(criteria *Criteria, options *Options) (*HrContracts, error) { + hcs := &HrContracts{} + if err := c.SearchRead(HrContractModel, criteria, options, hcs); err != nil { + return nil, err + } + return hcs, nil +} + +// FindHrContractIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrContractIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrContractModel, criteria, options) +} + +// FindHrContractId finds record id by querying it with criteria. +func (c *Client) FindHrContractId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrContractModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_contract_history.go b/hr_contract_history.go new file mode 100644 index 0000000..8fc8c80 --- /dev/null +++ b/hr_contract_history.go @@ -0,0 +1,136 @@ +package odoo + +// HrContractHistory represents hr.contract.history model. +type HrContractHistory struct { + ActiveEmployee *Bool `xmlrpc:"active_employee,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + CompanyCountryId *Many2One `xmlrpc:"company_country_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + ContractCount *Int `xmlrpc:"contract_count,omitempty"` + ContractId *Many2One `xmlrpc:"contract_id,omitempty"` + ContractIds *Relation `xmlrpc:"contract_ids,omitempty"` + ContractTypeId *Many2One `xmlrpc:"contract_type_id,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DateEnd *Time `xmlrpc:"date_end,omitempty"` + DateHired *Time `xmlrpc:"date_hired,omitempty"` + DateStart *Time `xmlrpc:"date_start,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + HrResponsibleId *Many2One `xmlrpc:"hr_responsible_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsUnderContract *Bool `xmlrpc:"is_under_contract,omitempty"` + JobId *Many2One `xmlrpc:"job_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StructureTypeId *Many2One `xmlrpc:"structure_type_id,omitempty"` + UnderContractState *Selection `xmlrpc:"under_contract_state,omitempty"` + Wage *Float `xmlrpc:"wage,omitempty"` +} + +// HrContractHistorys represents array of hr.contract.history model. +type HrContractHistorys []HrContractHistory + +// HrContractHistoryModel is the odoo model name. +const HrContractHistoryModel = "hr.contract.history" + +// Many2One convert HrContractHistory to *Many2One. +func (hch *HrContractHistory) Many2One() *Many2One { + return NewMany2One(hch.Id.Get(), "") +} + +// CreateHrContractHistory creates a new hr.contract.history model and returns its id. +func (c *Client) CreateHrContractHistory(hch *HrContractHistory) (int64, error) { + ids, err := c.CreateHrContractHistorys([]*HrContractHistory{hch}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrContractHistory creates a new hr.contract.history model and returns its id. +func (c *Client) CreateHrContractHistorys(hchs []*HrContractHistory) ([]int64, error) { + var vv []interface{} + for _, v := range hchs { + vv = append(vv, v) + } + return c.Create(HrContractHistoryModel, vv, nil) +} + +// UpdateHrContractHistory updates an existing hr.contract.history record. +func (c *Client) UpdateHrContractHistory(hch *HrContractHistory) error { + return c.UpdateHrContractHistorys([]int64{hch.Id.Get()}, hch) +} + +// UpdateHrContractHistorys updates existing hr.contract.history records. +// All records (represented by ids) will be updated by hch values. +func (c *Client) UpdateHrContractHistorys(ids []int64, hch *HrContractHistory) error { + return c.Update(HrContractHistoryModel, ids, hch, nil) +} + +// DeleteHrContractHistory deletes an existing hr.contract.history record. +func (c *Client) DeleteHrContractHistory(id int64) error { + return c.DeleteHrContractHistorys([]int64{id}) +} + +// DeleteHrContractHistorys deletes existing hr.contract.history records. +func (c *Client) DeleteHrContractHistorys(ids []int64) error { + return c.Delete(HrContractHistoryModel, ids) +} + +// GetHrContractHistory gets hr.contract.history existing record. +func (c *Client) GetHrContractHistory(id int64) (*HrContractHistory, error) { + hchs, err := c.GetHrContractHistorys([]int64{id}) + if err != nil { + return nil, err + } + return &((*hchs)[0]), nil +} + +// GetHrContractHistorys gets hr.contract.history existing records. +func (c *Client) GetHrContractHistorys(ids []int64) (*HrContractHistorys, error) { + hchs := &HrContractHistorys{} + if err := c.Read(HrContractHistoryModel, ids, nil, hchs); err != nil { + return nil, err + } + return hchs, nil +} + +// FindHrContractHistory finds hr.contract.history record by querying it with criteria. +func (c *Client) FindHrContractHistory(criteria *Criteria) (*HrContractHistory, error) { + hchs := &HrContractHistorys{} + if err := c.SearchRead(HrContractHistoryModel, criteria, NewOptions().Limit(1), hchs); err != nil { + return nil, err + } + return &((*hchs)[0]), nil +} + +// FindHrContractHistorys finds hr.contract.history records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrContractHistorys(criteria *Criteria, options *Options) (*HrContractHistorys, error) { + hchs := &HrContractHistorys{} + if err := c.SearchRead(HrContractHistoryModel, criteria, options, hchs); err != nil { + return nil, err + } + return hchs, nil +} + +// FindHrContractHistoryIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrContractHistoryIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrContractHistoryModel, criteria, options) +} + +// FindHrContractHistoryId finds record id by querying it with criteria. +func (c *Client) FindHrContractHistoryId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrContractHistoryModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_contract_type.go b/hr_contract_type.go new file mode 100644 index 0000000..4f24114 --- /dev/null +++ b/hr_contract_type.go @@ -0,0 +1,120 @@ +package odoo + +// HrContractType represents hr.contract.type model. +type HrContractType struct { + Code *String `xmlrpc:"code,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrContractTypes represents array of hr.contract.type model. +type HrContractTypes []HrContractType + +// HrContractTypeModel is the odoo model name. +const HrContractTypeModel = "hr.contract.type" + +// Many2One convert HrContractType to *Many2One. +func (hct *HrContractType) Many2One() *Many2One { + return NewMany2One(hct.Id.Get(), "") +} + +// CreateHrContractType creates a new hr.contract.type model and returns its id. +func (c *Client) CreateHrContractType(hct *HrContractType) (int64, error) { + ids, err := c.CreateHrContractTypes([]*HrContractType{hct}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrContractType creates a new hr.contract.type model and returns its id. +func (c *Client) CreateHrContractTypes(hcts []*HrContractType) ([]int64, error) { + var vv []interface{} + for _, v := range hcts { + vv = append(vv, v) + } + return c.Create(HrContractTypeModel, vv, nil) +} + +// UpdateHrContractType updates an existing hr.contract.type record. +func (c *Client) UpdateHrContractType(hct *HrContractType) error { + return c.UpdateHrContractTypes([]int64{hct.Id.Get()}, hct) +} + +// UpdateHrContractTypes updates existing hr.contract.type records. +// All records (represented by ids) will be updated by hct values. +func (c *Client) UpdateHrContractTypes(ids []int64, hct *HrContractType) error { + return c.Update(HrContractTypeModel, ids, hct, nil) +} + +// DeleteHrContractType deletes an existing hr.contract.type record. +func (c *Client) DeleteHrContractType(id int64) error { + return c.DeleteHrContractTypes([]int64{id}) +} + +// DeleteHrContractTypes deletes existing hr.contract.type records. +func (c *Client) DeleteHrContractTypes(ids []int64) error { + return c.Delete(HrContractTypeModel, ids) +} + +// GetHrContractType gets hr.contract.type existing record. +func (c *Client) GetHrContractType(id int64) (*HrContractType, error) { + hcts, err := c.GetHrContractTypes([]int64{id}) + if err != nil { + return nil, err + } + return &((*hcts)[0]), nil +} + +// GetHrContractTypes gets hr.contract.type existing records. +func (c *Client) GetHrContractTypes(ids []int64) (*HrContractTypes, error) { + hcts := &HrContractTypes{} + if err := c.Read(HrContractTypeModel, ids, nil, hcts); err != nil { + return nil, err + } + return hcts, nil +} + +// FindHrContractType finds hr.contract.type record by querying it with criteria. +func (c *Client) FindHrContractType(criteria *Criteria) (*HrContractType, error) { + hcts := &HrContractTypes{} + if err := c.SearchRead(HrContractTypeModel, criteria, NewOptions().Limit(1), hcts); err != nil { + return nil, err + } + return &((*hcts)[0]), nil +} + +// FindHrContractTypes finds hr.contract.type records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrContractTypes(criteria *Criteria, options *Options) (*HrContractTypes, error) { + hcts := &HrContractTypes{} + if err := c.SearchRead(HrContractTypeModel, criteria, options, hcts); err != nil { + return nil, err + } + return hcts, nil +} + +// FindHrContractTypeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrContractTypeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrContractTypeModel, criteria, options) +} + +// FindHrContractTypeId finds record id by querying it with criteria. +func (c *Client) FindHrContractTypeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrContractTypeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_department.go b/hr_department.go new file mode 100644 index 0000000..f5f3a28 --- /dev/null +++ b/hr_department.go @@ -0,0 +1,164 @@ +package odoo + +// HrDepartment represents hr.department model. +type HrDepartment struct { + AbsenceOfToday *Int `xmlrpc:"absence_of_today,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AllocationToApproveCount *Int `xmlrpc:"allocation_to_approve_count,omitempty"` + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompleteName *String `xmlrpc:"complete_name,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExpectedEmployee *Int `xmlrpc:"expected_employee,omitempty"` + ExpenseSheetsToApproveCount *Int `xmlrpc:"expense_sheets_to_approve_count,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + HasReadAccess *Bool `xmlrpc:"has_read_access,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JobsIds *Relation `xmlrpc:"jobs_ids,omitempty"` + LeaveToApproveCount *Int `xmlrpc:"leave_to_approve_count,omitempty"` + ManagerId *Many2One `xmlrpc:"manager_id,omitempty"` + MasterDepartmentId *Many2One `xmlrpc:"master_department_id,omitempty"` + MemberIds *Relation `xmlrpc:"member_ids,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NewApplicantCount *Int `xmlrpc:"new_applicant_count,omitempty"` + NewHiredEmployee *Int `xmlrpc:"new_hired_employee,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + ParentPath *String `xmlrpc:"parent_path,omitempty"` + PlanIds *Relation `xmlrpc:"plan_ids,omitempty"` + PlansCount *Int `xmlrpc:"plans_count,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + TotalEmployee *Int `xmlrpc:"total_employee,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrDepartments represents array of hr.department model. +type HrDepartments []HrDepartment + +// HrDepartmentModel is the odoo model name. +const HrDepartmentModel = "hr.department" + +// Many2One convert HrDepartment to *Many2One. +func (hd *HrDepartment) Many2One() *Many2One { + return NewMany2One(hd.Id.Get(), "") +} + +// CreateHrDepartment creates a new hr.department model and returns its id. +func (c *Client) CreateHrDepartment(hd *HrDepartment) (int64, error) { + ids, err := c.CreateHrDepartments([]*HrDepartment{hd}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrDepartment creates a new hr.department model and returns its id. +func (c *Client) CreateHrDepartments(hds []*HrDepartment) ([]int64, error) { + var vv []interface{} + for _, v := range hds { + vv = append(vv, v) + } + return c.Create(HrDepartmentModel, vv, nil) +} + +// UpdateHrDepartment updates an existing hr.department record. +func (c *Client) UpdateHrDepartment(hd *HrDepartment) error { + return c.UpdateHrDepartments([]int64{hd.Id.Get()}, hd) +} + +// UpdateHrDepartments updates existing hr.department records. +// All records (represented by ids) will be updated by hd values. +func (c *Client) UpdateHrDepartments(ids []int64, hd *HrDepartment) error { + return c.Update(HrDepartmentModel, ids, hd, nil) +} + +// DeleteHrDepartment deletes an existing hr.department record. +func (c *Client) DeleteHrDepartment(id int64) error { + return c.DeleteHrDepartments([]int64{id}) +} + +// DeleteHrDepartments deletes existing hr.department records. +func (c *Client) DeleteHrDepartments(ids []int64) error { + return c.Delete(HrDepartmentModel, ids) +} + +// GetHrDepartment gets hr.department existing record. +func (c *Client) GetHrDepartment(id int64) (*HrDepartment, error) { + hds, err := c.GetHrDepartments([]int64{id}) + if err != nil { + return nil, err + } + return &((*hds)[0]), nil +} + +// GetHrDepartments gets hr.department existing records. +func (c *Client) GetHrDepartments(ids []int64) (*HrDepartments, error) { + hds := &HrDepartments{} + if err := c.Read(HrDepartmentModel, ids, nil, hds); err != nil { + return nil, err + } + return hds, nil +} + +// FindHrDepartment finds hr.department record by querying it with criteria. +func (c *Client) FindHrDepartment(criteria *Criteria) (*HrDepartment, error) { + hds := &HrDepartments{} + if err := c.SearchRead(HrDepartmentModel, criteria, NewOptions().Limit(1), hds); err != nil { + return nil, err + } + return &((*hds)[0]), nil +} + +// FindHrDepartments finds hr.department records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrDepartments(criteria *Criteria, options *Options) (*HrDepartments, error) { + hds := &HrDepartments{} + if err := c.SearchRead(HrDepartmentModel, criteria, options, hds); err != nil { + return nil, err + } + return hds, nil +} + +// FindHrDepartmentIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrDepartmentIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrDepartmentModel, criteria, options) +} + +// FindHrDepartmentId finds record id by querying it with criteria. +func (c *Client) FindHrDepartmentId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrDepartmentModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_departure_reason.go b/hr_departure_reason.go new file mode 100644 index 0000000..ad49446 --- /dev/null +++ b/hr_departure_reason.go @@ -0,0 +1,119 @@ +package odoo + +// HrDepartureReason represents hr.departure.reason model. +type HrDepartureReason struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ReasonCode *Int `xmlrpc:"reason_code,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrDepartureReasons represents array of hr.departure.reason model. +type HrDepartureReasons []HrDepartureReason + +// HrDepartureReasonModel is the odoo model name. +const HrDepartureReasonModel = "hr.departure.reason" + +// Many2One convert HrDepartureReason to *Many2One. +func (hdr *HrDepartureReason) Many2One() *Many2One { + return NewMany2One(hdr.Id.Get(), "") +} + +// CreateHrDepartureReason creates a new hr.departure.reason model and returns its id. +func (c *Client) CreateHrDepartureReason(hdr *HrDepartureReason) (int64, error) { + ids, err := c.CreateHrDepartureReasons([]*HrDepartureReason{hdr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrDepartureReason creates a new hr.departure.reason model and returns its id. +func (c *Client) CreateHrDepartureReasons(hdrs []*HrDepartureReason) ([]int64, error) { + var vv []interface{} + for _, v := range hdrs { + vv = append(vv, v) + } + return c.Create(HrDepartureReasonModel, vv, nil) +} + +// UpdateHrDepartureReason updates an existing hr.departure.reason record. +func (c *Client) UpdateHrDepartureReason(hdr *HrDepartureReason) error { + return c.UpdateHrDepartureReasons([]int64{hdr.Id.Get()}, hdr) +} + +// UpdateHrDepartureReasons updates existing hr.departure.reason records. +// All records (represented by ids) will be updated by hdr values. +func (c *Client) UpdateHrDepartureReasons(ids []int64, hdr *HrDepartureReason) error { + return c.Update(HrDepartureReasonModel, ids, hdr, nil) +} + +// DeleteHrDepartureReason deletes an existing hr.departure.reason record. +func (c *Client) DeleteHrDepartureReason(id int64) error { + return c.DeleteHrDepartureReasons([]int64{id}) +} + +// DeleteHrDepartureReasons deletes existing hr.departure.reason records. +func (c *Client) DeleteHrDepartureReasons(ids []int64) error { + return c.Delete(HrDepartureReasonModel, ids) +} + +// GetHrDepartureReason gets hr.departure.reason existing record. +func (c *Client) GetHrDepartureReason(id int64) (*HrDepartureReason, error) { + hdrs, err := c.GetHrDepartureReasons([]int64{id}) + if err != nil { + return nil, err + } + return &((*hdrs)[0]), nil +} + +// GetHrDepartureReasons gets hr.departure.reason existing records. +func (c *Client) GetHrDepartureReasons(ids []int64) (*HrDepartureReasons, error) { + hdrs := &HrDepartureReasons{} + if err := c.Read(HrDepartureReasonModel, ids, nil, hdrs); err != nil { + return nil, err + } + return hdrs, nil +} + +// FindHrDepartureReason finds hr.departure.reason record by querying it with criteria. +func (c *Client) FindHrDepartureReason(criteria *Criteria) (*HrDepartureReason, error) { + hdrs := &HrDepartureReasons{} + if err := c.SearchRead(HrDepartureReasonModel, criteria, NewOptions().Limit(1), hdrs); err != nil { + return nil, err + } + return &((*hdrs)[0]), nil +} + +// FindHrDepartureReasons finds hr.departure.reason records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrDepartureReasons(criteria *Criteria, options *Options) (*HrDepartureReasons, error) { + hdrs := &HrDepartureReasons{} + if err := c.SearchRead(HrDepartureReasonModel, criteria, options, hdrs); err != nil { + return nil, err + } + return hdrs, nil +} + +// FindHrDepartureReasonIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrDepartureReasonIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrDepartureReasonModel, criteria, options) +} + +// FindHrDepartureReasonId finds record id by querying it with criteria. +func (c *Client) FindHrDepartureReasonId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrDepartureReasonModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_departure_wizard.go b/hr_departure_wizard.go new file mode 100644 index 0000000..242f97e --- /dev/null +++ b/hr_departure_wizard.go @@ -0,0 +1,121 @@ +package odoo + +// HrDepartureWizard represents hr.departure.wizard model. +type HrDepartureWizard struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DepartureDate *Time `xmlrpc:"departure_date,omitempty"` + DepartureDescription *String `xmlrpc:"departure_description,omitempty"` + DepartureReasonId *Many2One `xmlrpc:"departure_reason_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + SetDateEnd *Bool `xmlrpc:"set_date_end,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrDepartureWizards represents array of hr.departure.wizard model. +type HrDepartureWizards []HrDepartureWizard + +// HrDepartureWizardModel is the odoo model name. +const HrDepartureWizardModel = "hr.departure.wizard" + +// Many2One convert HrDepartureWizard to *Many2One. +func (hdw *HrDepartureWizard) Many2One() *Many2One { + return NewMany2One(hdw.Id.Get(), "") +} + +// CreateHrDepartureWizard creates a new hr.departure.wizard model and returns its id. +func (c *Client) CreateHrDepartureWizard(hdw *HrDepartureWizard) (int64, error) { + ids, err := c.CreateHrDepartureWizards([]*HrDepartureWizard{hdw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrDepartureWizard creates a new hr.departure.wizard model and returns its id. +func (c *Client) CreateHrDepartureWizards(hdws []*HrDepartureWizard) ([]int64, error) { + var vv []interface{} + for _, v := range hdws { + vv = append(vv, v) + } + return c.Create(HrDepartureWizardModel, vv, nil) +} + +// UpdateHrDepartureWizard updates an existing hr.departure.wizard record. +func (c *Client) UpdateHrDepartureWizard(hdw *HrDepartureWizard) error { + return c.UpdateHrDepartureWizards([]int64{hdw.Id.Get()}, hdw) +} + +// UpdateHrDepartureWizards updates existing hr.departure.wizard records. +// All records (represented by ids) will be updated by hdw values. +func (c *Client) UpdateHrDepartureWizards(ids []int64, hdw *HrDepartureWizard) error { + return c.Update(HrDepartureWizardModel, ids, hdw, nil) +} + +// DeleteHrDepartureWizard deletes an existing hr.departure.wizard record. +func (c *Client) DeleteHrDepartureWizard(id int64) error { + return c.DeleteHrDepartureWizards([]int64{id}) +} + +// DeleteHrDepartureWizards deletes existing hr.departure.wizard records. +func (c *Client) DeleteHrDepartureWizards(ids []int64) error { + return c.Delete(HrDepartureWizardModel, ids) +} + +// GetHrDepartureWizard gets hr.departure.wizard existing record. +func (c *Client) GetHrDepartureWizard(id int64) (*HrDepartureWizard, error) { + hdws, err := c.GetHrDepartureWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*hdws)[0]), nil +} + +// GetHrDepartureWizards gets hr.departure.wizard existing records. +func (c *Client) GetHrDepartureWizards(ids []int64) (*HrDepartureWizards, error) { + hdws := &HrDepartureWizards{} + if err := c.Read(HrDepartureWizardModel, ids, nil, hdws); err != nil { + return nil, err + } + return hdws, nil +} + +// FindHrDepartureWizard finds hr.departure.wizard record by querying it with criteria. +func (c *Client) FindHrDepartureWizard(criteria *Criteria) (*HrDepartureWizard, error) { + hdws := &HrDepartureWizards{} + if err := c.SearchRead(HrDepartureWizardModel, criteria, NewOptions().Limit(1), hdws); err != nil { + return nil, err + } + return &((*hdws)[0]), nil +} + +// FindHrDepartureWizards finds hr.departure.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrDepartureWizards(criteria *Criteria, options *Options) (*HrDepartureWizards, error) { + hdws := &HrDepartureWizards{} + if err := c.SearchRead(HrDepartureWizardModel, criteria, options, hdws); err != nil { + return nil, err + } + return hdws, nil +} + +// FindHrDepartureWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrDepartureWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrDepartureWizardModel, criteria, options) +} + +// FindHrDepartureWizardId finds record id by querying it with criteria. +func (c *Client) FindHrDepartureWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrDepartureWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_employee.go b/hr_employee.go new file mode 100644 index 0000000..34b3063 --- /dev/null +++ b/hr_employee.go @@ -0,0 +1,276 @@ +package odoo + +// HrEmployee represents hr.employee model. +type HrEmployee struct { + Active *Bool `xmlrpc:"active,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AdditionalNote *String `xmlrpc:"additional_note,omitempty"` + AddressId *Many2One `xmlrpc:"address_id,omitempty"` + AllocationCount *Float `xmlrpc:"allocation_count,omitempty"` + AllocationDisplay *String `xmlrpc:"allocation_display,omitempty"` + AllocationRemainingDisplay *String `xmlrpc:"allocation_remaining_display,omitempty"` + AllocationsCount *Int `xmlrpc:"allocations_count,omitempty"` + Avatar1024 *String `xmlrpc:"avatar_1024,omitempty"` + Avatar128 *String `xmlrpc:"avatar_128,omitempty"` + Avatar1920 *String `xmlrpc:"avatar_1920,omitempty"` + Avatar256 *String `xmlrpc:"avatar_256,omitempty"` + Avatar512 *String `xmlrpc:"avatar_512,omitempty"` + BankAccountId *Many2One `xmlrpc:"bank_account_id,omitempty"` + Barcode *String `xmlrpc:"barcode,omitempty"` + Birthday *Time `xmlrpc:"birthday,omitempty"` + CalendarMismatch *Bool `xmlrpc:"calendar_mismatch,omitempty"` + CandidateId *Relation `xmlrpc:"candidate_id,omitempty"` + CategoryIds *Relation `xmlrpc:"category_ids,omitempty"` + Certificate *Selection `xmlrpc:"certificate,omitempty"` + ChildAllCount *Int `xmlrpc:"child_all_count,omitempty"` + ChildCount *Int `xmlrpc:"child_count,omitempty"` + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + Children *Int `xmlrpc:"children,omitempty"` + CoachId *Many2One `xmlrpc:"coach_id,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyCountryCode *String `xmlrpc:"company_country_code,omitempty"` + CompanyCountryId *Many2One `xmlrpc:"company_country_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + ContractId *Many2One `xmlrpc:"contract_id,omitempty"` + ContractIds *Relation `xmlrpc:"contract_ids,omitempty"` + ContractWarning *Bool `xmlrpc:"contract_warning,omitempty"` + ContractsCount *Int `xmlrpc:"contracts_count,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CountryOfBirth *Many2One `xmlrpc:"country_of_birth,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + CurrentLeaveId *Many2One `xmlrpc:"current_leave_id,omitempty"` + CurrentLeaveState *Selection `xmlrpc:"current_leave_state,omitempty"` + DepartmentColor *Int `xmlrpc:"department_color,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DepartureDate *Time `xmlrpc:"departure_date,omitempty"` + DepartureDescription *String `xmlrpc:"departure_description,omitempty"` + DepartureReasonId *Many2One `xmlrpc:"departure_reason_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DistanceHomeWork *Int `xmlrpc:"distance_home_work,omitempty"` + DistanceHomeWorkUnit *Selection `xmlrpc:"distance_home_work_unit,omitempty"` + DrivingLicense *String `xmlrpc:"driving_license,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + EmergencyContact *String `xmlrpc:"emergency_contact,omitempty"` + EmergencyPhone *String `xmlrpc:"emergency_phone,omitempty"` + EmployeeProperties interface{} `xmlrpc:"employee_properties,omitempty"` + EmployeeSkillIds *Relation `xmlrpc:"employee_skill_ids,omitempty"` + EmployeeType *Selection `xmlrpc:"employee_type,omitempty"` + ExpenseManagerId *Many2One `xmlrpc:"expense_manager_id,omitempty"` + FilterForExpense *Bool `xmlrpc:"filter_for_expense,omitempty"` + FirstContractDate *Time `xmlrpc:"first_contract_date,omitempty"` + Gender *Selection `xmlrpc:"gender,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + HasTimesheet *Bool `xmlrpc:"has_timesheet,omitempty"` + HasWorkPermit *String `xmlrpc:"has_work_permit,omitempty"` + HourlyCost *Float `xmlrpc:"hourly_cost,omitempty"` + HrIconDisplay *Selection `xmlrpc:"hr_icon_display,omitempty"` + HrPresenceState *Selection `xmlrpc:"hr_presence_state,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IdCard *String `xmlrpc:"id_card,omitempty"` + IdentificationId *String `xmlrpc:"identification_id,omitempty"` + ImStatus *String `xmlrpc:"im_status,omitempty"` + Image1024 *String `xmlrpc:"image_1024,omitempty"` + Image128 *String `xmlrpc:"image_128,omitempty"` + Image1920 *String `xmlrpc:"image_1920,omitempty"` + Image256 *String `xmlrpc:"image_256,omitempty"` + Image512 *String `xmlrpc:"image_512,omitempty"` + IsAbsent *Bool `xmlrpc:"is_absent,omitempty"` + IsFlexible *Bool `xmlrpc:"is_flexible,omitempty"` + IsFullyFlexible *Bool `xmlrpc:"is_fully_flexible,omitempty"` + IsSubordinate *Bool `xmlrpc:"is_subordinate,omitempty"` + JobId *Many2One `xmlrpc:"job_id,omitempty"` + JobTitle *String `xmlrpc:"job_title,omitempty"` + KmHomeWork *Int `xmlrpc:"km_home_work,omitempty"` + Lang *Selection `xmlrpc:"lang,omitempty"` + LastActivity *Time `xmlrpc:"last_activity,omitempty"` + LastActivityTime *String `xmlrpc:"last_activity_time,omitempty"` + LeaveDateFrom *Time `xmlrpc:"leave_date_from,omitempty"` + LeaveDateTo *Time `xmlrpc:"leave_date_to,omitempty"` + LeaveManagerId *Many2One `xmlrpc:"leave_manager_id,omitempty"` + LeavesCount *Float `xmlrpc:"leaves_count,omitempty"` + LegalName *String `xmlrpc:"legal_name,omitempty"` + Marital *Selection `xmlrpc:"marital,omitempty"` + MemberOfDepartment *Bool `xmlrpc:"member_of_department,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageMainAttachmentId *Many2One `xmlrpc:"message_main_attachment_id,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MobilePhone *String `xmlrpc:"mobile_phone,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NewlyHired *Bool `xmlrpc:"newly_hired,omitempty"` + Notes *String `xmlrpc:"notes,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + PassportId *String `xmlrpc:"passport_id,omitempty"` + PermitNo *String `xmlrpc:"permit_no,omitempty"` + Phone *String `xmlrpc:"phone,omitempty"` + Pin *String `xmlrpc:"pin,omitempty"` + PlaceOfBirth *String `xmlrpc:"place_of_birth,omitempty"` + PrivateCarPlate *String `xmlrpc:"private_car_plate,omitempty"` + PrivateCity *String `xmlrpc:"private_city,omitempty"` + PrivateCountryId *Many2One `xmlrpc:"private_country_id,omitempty"` + PrivateEmail *String `xmlrpc:"private_email,omitempty"` + PrivatePhone *String `xmlrpc:"private_phone,omitempty"` + PrivateStateId *Many2One `xmlrpc:"private_state_id,omitempty"` + PrivateStreet *String `xmlrpc:"private_street,omitempty"` + PrivateStreet2 *String `xmlrpc:"private_street2,omitempty"` + PrivateZip *String `xmlrpc:"private_zip,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RelatedPartnersCount *Int `xmlrpc:"related_partners_count,omitempty"` + RemainingLeaves *Float `xmlrpc:"remaining_leaves,omitempty"` + ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omitempty"` + ResourceId *Many2One `xmlrpc:"resource_id,omitempty"` + ResumeLineIds *Relation `xmlrpc:"resume_line_ids,omitempty"` + Share *Bool `xmlrpc:"share,omitempty"` + ShowHrIconDisplay *Bool `xmlrpc:"show_hr_icon_display,omitempty"` + ShowLeaves *Bool `xmlrpc:"show_leaves,omitempty"` + Sinid *String `xmlrpc:"sinid,omitempty"` + SkillIds *Relation `xmlrpc:"skill_ids,omitempty"` + SpouseBirthdate *Time `xmlrpc:"spouse_birthdate,omitempty"` + SpouseCompleteName *String `xmlrpc:"spouse_complete_name,omitempty"` + Ssnid *String `xmlrpc:"ssnid,omitempty"` + StudyField *String `xmlrpc:"study_field,omitempty"` + StudySchool *String `xmlrpc:"study_school,omitempty"` + SubordinateIds *Relation `xmlrpc:"subordinate_ids,omitempty"` + Tz *Selection `xmlrpc:"tz,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + UserPartnerId *Many2One `xmlrpc:"user_partner_id,omitempty"` + Vehicle *String `xmlrpc:"vehicle,omitempty"` + VisaExpire *Time `xmlrpc:"visa_expire,omitempty"` + VisaNo *String `xmlrpc:"visa_no,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WorkContactId *Many2One `xmlrpc:"work_contact_id,omitempty"` + WorkEmail *String `xmlrpc:"work_email,omitempty"` + WorkLocationId *Many2One `xmlrpc:"work_location_id,omitempty"` + WorkLocationName *String `xmlrpc:"work_location_name,omitempty"` + WorkLocationType *Selection `xmlrpc:"work_location_type,omitempty"` + WorkPermitExpirationDate *Time `xmlrpc:"work_permit_expiration_date,omitempty"` + WorkPermitName *String `xmlrpc:"work_permit_name,omitempty"` + WorkPermitScheduledActivity *Bool `xmlrpc:"work_permit_scheduled_activity,omitempty"` + WorkPhone *String `xmlrpc:"work_phone,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrEmployees represents array of hr.employee model. +type HrEmployees []HrEmployee + +// HrEmployeeModel is the odoo model name. +const HrEmployeeModel = "hr.employee" + +// Many2One convert HrEmployee to *Many2One. +func (he *HrEmployee) Many2One() *Many2One { + return NewMany2One(he.Id.Get(), "") +} + +// CreateHrEmployee creates a new hr.employee model and returns its id. +func (c *Client) CreateHrEmployee(he *HrEmployee) (int64, error) { + ids, err := c.CreateHrEmployees([]*HrEmployee{he}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrEmployee creates a new hr.employee model and returns its id. +func (c *Client) CreateHrEmployees(hes []*HrEmployee) ([]int64, error) { + var vv []interface{} + for _, v := range hes { + vv = append(vv, v) + } + return c.Create(HrEmployeeModel, vv, nil) +} + +// UpdateHrEmployee updates an existing hr.employee record. +func (c *Client) UpdateHrEmployee(he *HrEmployee) error { + return c.UpdateHrEmployees([]int64{he.Id.Get()}, he) +} + +// UpdateHrEmployees updates existing hr.employee records. +// All records (represented by ids) will be updated by he values. +func (c *Client) UpdateHrEmployees(ids []int64, he *HrEmployee) error { + return c.Update(HrEmployeeModel, ids, he, nil) +} + +// DeleteHrEmployee deletes an existing hr.employee record. +func (c *Client) DeleteHrEmployee(id int64) error { + return c.DeleteHrEmployees([]int64{id}) +} + +// DeleteHrEmployees deletes existing hr.employee records. +func (c *Client) DeleteHrEmployees(ids []int64) error { + return c.Delete(HrEmployeeModel, ids) +} + +// GetHrEmployee gets hr.employee existing record. +func (c *Client) GetHrEmployee(id int64) (*HrEmployee, error) { + hes, err := c.GetHrEmployees([]int64{id}) + if err != nil { + return nil, err + } + return &((*hes)[0]), nil +} + +// GetHrEmployees gets hr.employee existing records. +func (c *Client) GetHrEmployees(ids []int64) (*HrEmployees, error) { + hes := &HrEmployees{} + if err := c.Read(HrEmployeeModel, ids, nil, hes); err != nil { + return nil, err + } + return hes, nil +} + +// FindHrEmployee finds hr.employee record by querying it with criteria. +func (c *Client) FindHrEmployee(criteria *Criteria) (*HrEmployee, error) { + hes := &HrEmployees{} + if err := c.SearchRead(HrEmployeeModel, criteria, NewOptions().Limit(1), hes); err != nil { + return nil, err + } + return &((*hes)[0]), nil +} + +// FindHrEmployees finds hr.employee records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrEmployees(criteria *Criteria, options *Options) (*HrEmployees, error) { + hes := &HrEmployees{} + if err := c.SearchRead(HrEmployeeModel, criteria, options, hes); err != nil { + return nil, err + } + return hes, nil +} + +// FindHrEmployeeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrEmployeeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrEmployeeModel, criteria, options) +} + +// FindHrEmployeeId finds record id by querying it with criteria. +func (c *Client) FindHrEmployeeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrEmployeeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_employee_category.go b/hr_employee_category.go new file mode 100644 index 0000000..47f7132 --- /dev/null +++ b/hr_employee_category.go @@ -0,0 +1,119 @@ +package odoo + +// HrEmployeeCategory represents hr.employee.category model. +type HrEmployeeCategory struct { + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeIds *Relation `xmlrpc:"employee_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrEmployeeCategorys represents array of hr.employee.category model. +type HrEmployeeCategorys []HrEmployeeCategory + +// HrEmployeeCategoryModel is the odoo model name. +const HrEmployeeCategoryModel = "hr.employee.category" + +// Many2One convert HrEmployeeCategory to *Many2One. +func (hec *HrEmployeeCategory) Many2One() *Many2One { + return NewMany2One(hec.Id.Get(), "") +} + +// CreateHrEmployeeCategory creates a new hr.employee.category model and returns its id. +func (c *Client) CreateHrEmployeeCategory(hec *HrEmployeeCategory) (int64, error) { + ids, err := c.CreateHrEmployeeCategorys([]*HrEmployeeCategory{hec}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrEmployeeCategory creates a new hr.employee.category model and returns its id. +func (c *Client) CreateHrEmployeeCategorys(hecs []*HrEmployeeCategory) ([]int64, error) { + var vv []interface{} + for _, v := range hecs { + vv = append(vv, v) + } + return c.Create(HrEmployeeCategoryModel, vv, nil) +} + +// UpdateHrEmployeeCategory updates an existing hr.employee.category record. +func (c *Client) UpdateHrEmployeeCategory(hec *HrEmployeeCategory) error { + return c.UpdateHrEmployeeCategorys([]int64{hec.Id.Get()}, hec) +} + +// UpdateHrEmployeeCategorys updates existing hr.employee.category records. +// All records (represented by ids) will be updated by hec values. +func (c *Client) UpdateHrEmployeeCategorys(ids []int64, hec *HrEmployeeCategory) error { + return c.Update(HrEmployeeCategoryModel, ids, hec, nil) +} + +// DeleteHrEmployeeCategory deletes an existing hr.employee.category record. +func (c *Client) DeleteHrEmployeeCategory(id int64) error { + return c.DeleteHrEmployeeCategorys([]int64{id}) +} + +// DeleteHrEmployeeCategorys deletes existing hr.employee.category records. +func (c *Client) DeleteHrEmployeeCategorys(ids []int64) error { + return c.Delete(HrEmployeeCategoryModel, ids) +} + +// GetHrEmployeeCategory gets hr.employee.category existing record. +func (c *Client) GetHrEmployeeCategory(id int64) (*HrEmployeeCategory, error) { + hecs, err := c.GetHrEmployeeCategorys([]int64{id}) + if err != nil { + return nil, err + } + return &((*hecs)[0]), nil +} + +// GetHrEmployeeCategorys gets hr.employee.category existing records. +func (c *Client) GetHrEmployeeCategorys(ids []int64) (*HrEmployeeCategorys, error) { + hecs := &HrEmployeeCategorys{} + if err := c.Read(HrEmployeeCategoryModel, ids, nil, hecs); err != nil { + return nil, err + } + return hecs, nil +} + +// FindHrEmployeeCategory finds hr.employee.category record by querying it with criteria. +func (c *Client) FindHrEmployeeCategory(criteria *Criteria) (*HrEmployeeCategory, error) { + hecs := &HrEmployeeCategorys{} + if err := c.SearchRead(HrEmployeeCategoryModel, criteria, NewOptions().Limit(1), hecs); err != nil { + return nil, err + } + return &((*hecs)[0]), nil +} + +// FindHrEmployeeCategorys finds hr.employee.category records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrEmployeeCategorys(criteria *Criteria, options *Options) (*HrEmployeeCategorys, error) { + hecs := &HrEmployeeCategorys{} + if err := c.SearchRead(HrEmployeeCategoryModel, criteria, options, hecs); err != nil { + return nil, err + } + return hecs, nil +} + +// FindHrEmployeeCategoryIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrEmployeeCategoryIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrEmployeeCategoryModel, criteria, options) +} + +// FindHrEmployeeCategoryId finds record id by querying it with criteria. +func (c *Client) FindHrEmployeeCategoryId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrEmployeeCategoryModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_employee_cv_wizard.go b/hr_employee_cv_wizard.go new file mode 100644 index 0000000..d82ecdf --- /dev/null +++ b/hr_employee_cv_wizard.go @@ -0,0 +1,124 @@ +package odoo + +// HrEmployeeCvWizard represents hr.employee.cv.wizard model. +type HrEmployeeCvWizard struct { + CanShowOthers *Bool `xmlrpc:"can_show_others,omitempty"` + CanShowSkills *Bool `xmlrpc:"can_show_skills,omitempty"` + ColorPrimary *String `xmlrpc:"color_primary,omitempty"` + ColorSecondary *String `xmlrpc:"color_secondary,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeIds *Relation `xmlrpc:"employee_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ShowContact *Bool `xmlrpc:"show_contact,omitempty"` + ShowOthers *Bool `xmlrpc:"show_others,omitempty"` + ShowSkills *Bool `xmlrpc:"show_skills,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrEmployeeCvWizards represents array of hr.employee.cv.wizard model. +type HrEmployeeCvWizards []HrEmployeeCvWizard + +// HrEmployeeCvWizardModel is the odoo model name. +const HrEmployeeCvWizardModel = "hr.employee.cv.wizard" + +// Many2One convert HrEmployeeCvWizard to *Many2One. +func (hecw *HrEmployeeCvWizard) Many2One() *Many2One { + return NewMany2One(hecw.Id.Get(), "") +} + +// CreateHrEmployeeCvWizard creates a new hr.employee.cv.wizard model and returns its id. +func (c *Client) CreateHrEmployeeCvWizard(hecw *HrEmployeeCvWizard) (int64, error) { + ids, err := c.CreateHrEmployeeCvWizards([]*HrEmployeeCvWizard{hecw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrEmployeeCvWizard creates a new hr.employee.cv.wizard model and returns its id. +func (c *Client) CreateHrEmployeeCvWizards(hecws []*HrEmployeeCvWizard) ([]int64, error) { + var vv []interface{} + for _, v := range hecws { + vv = append(vv, v) + } + return c.Create(HrEmployeeCvWizardModel, vv, nil) +} + +// UpdateHrEmployeeCvWizard updates an existing hr.employee.cv.wizard record. +func (c *Client) UpdateHrEmployeeCvWizard(hecw *HrEmployeeCvWizard) error { + return c.UpdateHrEmployeeCvWizards([]int64{hecw.Id.Get()}, hecw) +} + +// UpdateHrEmployeeCvWizards updates existing hr.employee.cv.wizard records. +// All records (represented by ids) will be updated by hecw values. +func (c *Client) UpdateHrEmployeeCvWizards(ids []int64, hecw *HrEmployeeCvWizard) error { + return c.Update(HrEmployeeCvWizardModel, ids, hecw, nil) +} + +// DeleteHrEmployeeCvWizard deletes an existing hr.employee.cv.wizard record. +func (c *Client) DeleteHrEmployeeCvWizard(id int64) error { + return c.DeleteHrEmployeeCvWizards([]int64{id}) +} + +// DeleteHrEmployeeCvWizards deletes existing hr.employee.cv.wizard records. +func (c *Client) DeleteHrEmployeeCvWizards(ids []int64) error { + return c.Delete(HrEmployeeCvWizardModel, ids) +} + +// GetHrEmployeeCvWizard gets hr.employee.cv.wizard existing record. +func (c *Client) GetHrEmployeeCvWizard(id int64) (*HrEmployeeCvWizard, error) { + hecws, err := c.GetHrEmployeeCvWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*hecws)[0]), nil +} + +// GetHrEmployeeCvWizards gets hr.employee.cv.wizard existing records. +func (c *Client) GetHrEmployeeCvWizards(ids []int64) (*HrEmployeeCvWizards, error) { + hecws := &HrEmployeeCvWizards{} + if err := c.Read(HrEmployeeCvWizardModel, ids, nil, hecws); err != nil { + return nil, err + } + return hecws, nil +} + +// FindHrEmployeeCvWizard finds hr.employee.cv.wizard record by querying it with criteria. +func (c *Client) FindHrEmployeeCvWizard(criteria *Criteria) (*HrEmployeeCvWizard, error) { + hecws := &HrEmployeeCvWizards{} + if err := c.SearchRead(HrEmployeeCvWizardModel, criteria, NewOptions().Limit(1), hecws); err != nil { + return nil, err + } + return &((*hecws)[0]), nil +} + +// FindHrEmployeeCvWizards finds hr.employee.cv.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrEmployeeCvWizards(criteria *Criteria, options *Options) (*HrEmployeeCvWizards, error) { + hecws := &HrEmployeeCvWizards{} + if err := c.SearchRead(HrEmployeeCvWizardModel, criteria, options, hecws); err != nil { + return nil, err + } + return hecws, nil +} + +// FindHrEmployeeCvWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrEmployeeCvWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrEmployeeCvWizardModel, criteria, options) +} + +// FindHrEmployeeCvWizardId finds record id by querying it with criteria. +func (c *Client) FindHrEmployeeCvWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrEmployeeCvWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_employee_delete_wizard.go b/hr_employee_delete_wizard.go new file mode 100644 index 0000000..30ed512 --- /dev/null +++ b/hr_employee_delete_wizard.go @@ -0,0 +1,119 @@ +package odoo + +// HrEmployeeDeleteWizard represents hr.employee.delete.wizard model. +type HrEmployeeDeleteWizard struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeIds *Relation `xmlrpc:"employee_ids,omitempty"` + HasActiveEmployee *Bool `xmlrpc:"has_active_employee,omitempty"` + HasTimesheet *Bool `xmlrpc:"has_timesheet,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrEmployeeDeleteWizards represents array of hr.employee.delete.wizard model. +type HrEmployeeDeleteWizards []HrEmployeeDeleteWizard + +// HrEmployeeDeleteWizardModel is the odoo model name. +const HrEmployeeDeleteWizardModel = "hr.employee.delete.wizard" + +// Many2One convert HrEmployeeDeleteWizard to *Many2One. +func (hedw *HrEmployeeDeleteWizard) Many2One() *Many2One { + return NewMany2One(hedw.Id.Get(), "") +} + +// CreateHrEmployeeDeleteWizard creates a new hr.employee.delete.wizard model and returns its id. +func (c *Client) CreateHrEmployeeDeleteWizard(hedw *HrEmployeeDeleteWizard) (int64, error) { + ids, err := c.CreateHrEmployeeDeleteWizards([]*HrEmployeeDeleteWizard{hedw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrEmployeeDeleteWizard creates a new hr.employee.delete.wizard model and returns its id. +func (c *Client) CreateHrEmployeeDeleteWizards(hedws []*HrEmployeeDeleteWizard) ([]int64, error) { + var vv []interface{} + for _, v := range hedws { + vv = append(vv, v) + } + return c.Create(HrEmployeeDeleteWizardModel, vv, nil) +} + +// UpdateHrEmployeeDeleteWizard updates an existing hr.employee.delete.wizard record. +func (c *Client) UpdateHrEmployeeDeleteWizard(hedw *HrEmployeeDeleteWizard) error { + return c.UpdateHrEmployeeDeleteWizards([]int64{hedw.Id.Get()}, hedw) +} + +// UpdateHrEmployeeDeleteWizards updates existing hr.employee.delete.wizard records. +// All records (represented by ids) will be updated by hedw values. +func (c *Client) UpdateHrEmployeeDeleteWizards(ids []int64, hedw *HrEmployeeDeleteWizard) error { + return c.Update(HrEmployeeDeleteWizardModel, ids, hedw, nil) +} + +// DeleteHrEmployeeDeleteWizard deletes an existing hr.employee.delete.wizard record. +func (c *Client) DeleteHrEmployeeDeleteWizard(id int64) error { + return c.DeleteHrEmployeeDeleteWizards([]int64{id}) +} + +// DeleteHrEmployeeDeleteWizards deletes existing hr.employee.delete.wizard records. +func (c *Client) DeleteHrEmployeeDeleteWizards(ids []int64) error { + return c.Delete(HrEmployeeDeleteWizardModel, ids) +} + +// GetHrEmployeeDeleteWizard gets hr.employee.delete.wizard existing record. +func (c *Client) GetHrEmployeeDeleteWizard(id int64) (*HrEmployeeDeleteWizard, error) { + hedws, err := c.GetHrEmployeeDeleteWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*hedws)[0]), nil +} + +// GetHrEmployeeDeleteWizards gets hr.employee.delete.wizard existing records. +func (c *Client) GetHrEmployeeDeleteWizards(ids []int64) (*HrEmployeeDeleteWizards, error) { + hedws := &HrEmployeeDeleteWizards{} + if err := c.Read(HrEmployeeDeleteWizardModel, ids, nil, hedws); err != nil { + return nil, err + } + return hedws, nil +} + +// FindHrEmployeeDeleteWizard finds hr.employee.delete.wizard record by querying it with criteria. +func (c *Client) FindHrEmployeeDeleteWizard(criteria *Criteria) (*HrEmployeeDeleteWizard, error) { + hedws := &HrEmployeeDeleteWizards{} + if err := c.SearchRead(HrEmployeeDeleteWizardModel, criteria, NewOptions().Limit(1), hedws); err != nil { + return nil, err + } + return &((*hedws)[0]), nil +} + +// FindHrEmployeeDeleteWizards finds hr.employee.delete.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrEmployeeDeleteWizards(criteria *Criteria, options *Options) (*HrEmployeeDeleteWizards, error) { + hedws := &HrEmployeeDeleteWizards{} + if err := c.SearchRead(HrEmployeeDeleteWizardModel, criteria, options, hedws); err != nil { + return nil, err + } + return hedws, nil +} + +// FindHrEmployeeDeleteWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrEmployeeDeleteWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrEmployeeDeleteWizardModel, criteria, options) +} + +// FindHrEmployeeDeleteWizardId finds record id by querying it with criteria. +func (c *Client) FindHrEmployeeDeleteWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrEmployeeDeleteWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_employee_public.go b/hr_employee_public.go new file mode 100644 index 0000000..6c9e73d --- /dev/null +++ b/hr_employee_public.go @@ -0,0 +1,186 @@ +package odoo + +// HrEmployeePublic represents hr.employee.public model. +type HrEmployeePublic struct { + Active *Bool `xmlrpc:"active,omitempty"` + AddressId *Many2One `xmlrpc:"address_id,omitempty"` + AllocationCount *Float `xmlrpc:"allocation_count,omitempty"` + AllocationDisplay *String `xmlrpc:"allocation_display,omitempty"` + AllocationRemainingDisplay *String `xmlrpc:"allocation_remaining_display,omitempty"` + AllocationsCount *Int `xmlrpc:"allocations_count,omitempty"` + Avatar1024 *String `xmlrpc:"avatar_1024,omitempty"` + Avatar128 *String `xmlrpc:"avatar_128,omitempty"` + Avatar1920 *String `xmlrpc:"avatar_1920,omitempty"` + Avatar256 *String `xmlrpc:"avatar_256,omitempty"` + Avatar512 *String `xmlrpc:"avatar_512,omitempty"` + ChildAllCount *Int `xmlrpc:"child_all_count,omitempty"` + ChildCount *Int `xmlrpc:"child_count,omitempty"` + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + CoachId *Many2One `xmlrpc:"coach_id,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrentLeaveState *Selection `xmlrpc:"current_leave_state,omitempty"` + DepartmentColor *Int `xmlrpc:"department_color,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + EmployeeSkillIds *Relation `xmlrpc:"employee_skill_ids,omitempty"` + ExpenseManagerId *Many2One `xmlrpc:"expense_manager_id,omitempty"` + FilterForExpense *Bool `xmlrpc:"filter_for_expense,omitempty"` + FirstContractDate *Time `xmlrpc:"first_contract_date,omitempty"` + HrIconDisplay *Selection `xmlrpc:"hr_icon_display,omitempty"` + HrPresenceState *Selection `xmlrpc:"hr_presence_state,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ImStatus *String `xmlrpc:"im_status,omitempty"` + Image1024 *String `xmlrpc:"image_1024,omitempty"` + Image128 *String `xmlrpc:"image_128,omitempty"` + Image1920 *String `xmlrpc:"image_1920,omitempty"` + Image256 *String `xmlrpc:"image_256,omitempty"` + Image512 *String `xmlrpc:"image_512,omitempty"` + IsAbsent *Bool `xmlrpc:"is_absent,omitempty"` + IsFlexible *Bool `xmlrpc:"is_flexible,omitempty"` + IsFullyFlexible *Bool `xmlrpc:"is_fully_flexible,omitempty"` + IsManager *Bool `xmlrpc:"is_manager,omitempty"` + IsSubordinate *Bool `xmlrpc:"is_subordinate,omitempty"` + JobId *Many2One `xmlrpc:"job_id,omitempty"` + JobTitle *String `xmlrpc:"job_title,omitempty"` + LastActivity *Time `xmlrpc:"last_activity,omitempty"` + LastActivityTime *String `xmlrpc:"last_activity_time,omitempty"` + LeaveDateFrom *Time `xmlrpc:"leave_date_from,omitempty"` + LeaveDateTo *Time `xmlrpc:"leave_date_to,omitempty"` + LeaveManagerId *Many2One `xmlrpc:"leave_manager_id,omitempty"` + LeavesCount *Float `xmlrpc:"leaves_count,omitempty"` + MemberOfDepartment *Bool `xmlrpc:"member_of_department,omitempty"` + MobilePhone *String `xmlrpc:"mobile_phone,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NewlyHired *Bool `xmlrpc:"newly_hired,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + Phone *String `xmlrpc:"phone,omitempty"` + RemainingLeaves *Float `xmlrpc:"remaining_leaves,omitempty"` + ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omitempty"` + ResourceId *Many2One `xmlrpc:"resource_id,omitempty"` + ResumeLineIds *Relation `xmlrpc:"resume_line_ids,omitempty"` + Share *Bool `xmlrpc:"share,omitempty"` + ShowHrIconDisplay *Bool `xmlrpc:"show_hr_icon_display,omitempty"` + ShowLeaves *Bool `xmlrpc:"show_leaves,omitempty"` + SubordinateIds *Relation `xmlrpc:"subordinate_ids,omitempty"` + Tz *Selection `xmlrpc:"tz,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + UserPartnerId *Many2One `xmlrpc:"user_partner_id,omitempty"` + WorkContactId *Many2One `xmlrpc:"work_contact_id,omitempty"` + WorkEmail *String `xmlrpc:"work_email,omitempty"` + WorkLocationId *Many2One `xmlrpc:"work_location_id,omitempty"` + WorkLocationName *String `xmlrpc:"work_location_name,omitempty"` + WorkLocationType *Selection `xmlrpc:"work_location_type,omitempty"` + WorkPhone *String `xmlrpc:"work_phone,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrEmployeePublics represents array of hr.employee.public model. +type HrEmployeePublics []HrEmployeePublic + +// HrEmployeePublicModel is the odoo model name. +const HrEmployeePublicModel = "hr.employee.public" + +// Many2One convert HrEmployeePublic to *Many2One. +func (hep *HrEmployeePublic) Many2One() *Many2One { + return NewMany2One(hep.Id.Get(), "") +} + +// CreateHrEmployeePublic creates a new hr.employee.public model and returns its id. +func (c *Client) CreateHrEmployeePublic(hep *HrEmployeePublic) (int64, error) { + ids, err := c.CreateHrEmployeePublics([]*HrEmployeePublic{hep}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrEmployeePublic creates a new hr.employee.public model and returns its id. +func (c *Client) CreateHrEmployeePublics(heps []*HrEmployeePublic) ([]int64, error) { + var vv []interface{} + for _, v := range heps { + vv = append(vv, v) + } + return c.Create(HrEmployeePublicModel, vv, nil) +} + +// UpdateHrEmployeePublic updates an existing hr.employee.public record. +func (c *Client) UpdateHrEmployeePublic(hep *HrEmployeePublic) error { + return c.UpdateHrEmployeePublics([]int64{hep.Id.Get()}, hep) +} + +// UpdateHrEmployeePublics updates existing hr.employee.public records. +// All records (represented by ids) will be updated by hep values. +func (c *Client) UpdateHrEmployeePublics(ids []int64, hep *HrEmployeePublic) error { + return c.Update(HrEmployeePublicModel, ids, hep, nil) +} + +// DeleteHrEmployeePublic deletes an existing hr.employee.public record. +func (c *Client) DeleteHrEmployeePublic(id int64) error { + return c.DeleteHrEmployeePublics([]int64{id}) +} + +// DeleteHrEmployeePublics deletes existing hr.employee.public records. +func (c *Client) DeleteHrEmployeePublics(ids []int64) error { + return c.Delete(HrEmployeePublicModel, ids) +} + +// GetHrEmployeePublic gets hr.employee.public existing record. +func (c *Client) GetHrEmployeePublic(id int64) (*HrEmployeePublic, error) { + heps, err := c.GetHrEmployeePublics([]int64{id}) + if err != nil { + return nil, err + } + return &((*heps)[0]), nil +} + +// GetHrEmployeePublics gets hr.employee.public existing records. +func (c *Client) GetHrEmployeePublics(ids []int64) (*HrEmployeePublics, error) { + heps := &HrEmployeePublics{} + if err := c.Read(HrEmployeePublicModel, ids, nil, heps); err != nil { + return nil, err + } + return heps, nil +} + +// FindHrEmployeePublic finds hr.employee.public record by querying it with criteria. +func (c *Client) FindHrEmployeePublic(criteria *Criteria) (*HrEmployeePublic, error) { + heps := &HrEmployeePublics{} + if err := c.SearchRead(HrEmployeePublicModel, criteria, NewOptions().Limit(1), heps); err != nil { + return nil, err + } + return &((*heps)[0]), nil +} + +// FindHrEmployeePublics finds hr.employee.public records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrEmployeePublics(criteria *Criteria, options *Options) (*HrEmployeePublics, error) { + heps := &HrEmployeePublics{} + if err := c.SearchRead(HrEmployeePublicModel, criteria, options, heps); err != nil { + return nil, err + } + return heps, nil +} + +// FindHrEmployeePublicIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrEmployeePublicIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrEmployeePublicModel, criteria, options) +} + +// FindHrEmployeePublicId finds record id by querying it with criteria. +func (c *Client) FindHrEmployeePublicId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrEmployeePublicModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_employee_skill.go b/hr_employee_skill.go new file mode 100644 index 0000000..5136507 --- /dev/null +++ b/hr_employee_skill.go @@ -0,0 +1,122 @@ +package odoo + +// HrEmployeeSkill represents hr.employee.skill model. +type HrEmployeeSkill struct { + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LevelProgress *Int `xmlrpc:"level_progress,omitempty"` + SkillId *Many2One `xmlrpc:"skill_id,omitempty"` + SkillLevelId *Many2One `xmlrpc:"skill_level_id,omitempty"` + SkillTypeId *Many2One `xmlrpc:"skill_type_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrEmployeeSkills represents array of hr.employee.skill model. +type HrEmployeeSkills []HrEmployeeSkill + +// HrEmployeeSkillModel is the odoo model name. +const HrEmployeeSkillModel = "hr.employee.skill" + +// Many2One convert HrEmployeeSkill to *Many2One. +func (hes *HrEmployeeSkill) Many2One() *Many2One { + return NewMany2One(hes.Id.Get(), "") +} + +// CreateHrEmployeeSkill creates a new hr.employee.skill model and returns its id. +func (c *Client) CreateHrEmployeeSkill(hes *HrEmployeeSkill) (int64, error) { + ids, err := c.CreateHrEmployeeSkills([]*HrEmployeeSkill{hes}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrEmployeeSkill creates a new hr.employee.skill model and returns its id. +func (c *Client) CreateHrEmployeeSkills(hess []*HrEmployeeSkill) ([]int64, error) { + var vv []interface{} + for _, v := range hess { + vv = append(vv, v) + } + return c.Create(HrEmployeeSkillModel, vv, nil) +} + +// UpdateHrEmployeeSkill updates an existing hr.employee.skill record. +func (c *Client) UpdateHrEmployeeSkill(hes *HrEmployeeSkill) error { + return c.UpdateHrEmployeeSkills([]int64{hes.Id.Get()}, hes) +} + +// UpdateHrEmployeeSkills updates existing hr.employee.skill records. +// All records (represented by ids) will be updated by hes values. +func (c *Client) UpdateHrEmployeeSkills(ids []int64, hes *HrEmployeeSkill) error { + return c.Update(HrEmployeeSkillModel, ids, hes, nil) +} + +// DeleteHrEmployeeSkill deletes an existing hr.employee.skill record. +func (c *Client) DeleteHrEmployeeSkill(id int64) error { + return c.DeleteHrEmployeeSkills([]int64{id}) +} + +// DeleteHrEmployeeSkills deletes existing hr.employee.skill records. +func (c *Client) DeleteHrEmployeeSkills(ids []int64) error { + return c.Delete(HrEmployeeSkillModel, ids) +} + +// GetHrEmployeeSkill gets hr.employee.skill existing record. +func (c *Client) GetHrEmployeeSkill(id int64) (*HrEmployeeSkill, error) { + hess, err := c.GetHrEmployeeSkills([]int64{id}) + if err != nil { + return nil, err + } + return &((*hess)[0]), nil +} + +// GetHrEmployeeSkills gets hr.employee.skill existing records. +func (c *Client) GetHrEmployeeSkills(ids []int64) (*HrEmployeeSkills, error) { + hess := &HrEmployeeSkills{} + if err := c.Read(HrEmployeeSkillModel, ids, nil, hess); err != nil { + return nil, err + } + return hess, nil +} + +// FindHrEmployeeSkill finds hr.employee.skill record by querying it with criteria. +func (c *Client) FindHrEmployeeSkill(criteria *Criteria) (*HrEmployeeSkill, error) { + hess := &HrEmployeeSkills{} + if err := c.SearchRead(HrEmployeeSkillModel, criteria, NewOptions().Limit(1), hess); err != nil { + return nil, err + } + return &((*hess)[0]), nil +} + +// FindHrEmployeeSkills finds hr.employee.skill records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrEmployeeSkills(criteria *Criteria, options *Options) (*HrEmployeeSkills, error) { + hess := &HrEmployeeSkills{} + if err := c.SearchRead(HrEmployeeSkillModel, criteria, options, hess); err != nil { + return nil, err + } + return hess, nil +} + +// FindHrEmployeeSkillIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrEmployeeSkillIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrEmployeeSkillModel, criteria, options) +} + +// FindHrEmployeeSkillId finds record id by querying it with criteria. +func (c *Client) FindHrEmployeeSkillId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrEmployeeSkillModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_employee_skill_log.go b/hr_employee_skill_log.go new file mode 100644 index 0000000..f81d735 --- /dev/null +++ b/hr_employee_skill_log.go @@ -0,0 +1,123 @@ +package odoo + +// HrEmployeeSkillLog represents hr.employee.skill.log model. +type HrEmployeeSkillLog struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LevelProgress *Int `xmlrpc:"level_progress,omitempty"` + SkillId *Many2One `xmlrpc:"skill_id,omitempty"` + SkillLevelId *Many2One `xmlrpc:"skill_level_id,omitempty"` + SkillTypeId *Many2One `xmlrpc:"skill_type_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrEmployeeSkillLogs represents array of hr.employee.skill.log model. +type HrEmployeeSkillLogs []HrEmployeeSkillLog + +// HrEmployeeSkillLogModel is the odoo model name. +const HrEmployeeSkillLogModel = "hr.employee.skill.log" + +// Many2One convert HrEmployeeSkillLog to *Many2One. +func (hesl *HrEmployeeSkillLog) Many2One() *Many2One { + return NewMany2One(hesl.Id.Get(), "") +} + +// CreateHrEmployeeSkillLog creates a new hr.employee.skill.log model and returns its id. +func (c *Client) CreateHrEmployeeSkillLog(hesl *HrEmployeeSkillLog) (int64, error) { + ids, err := c.CreateHrEmployeeSkillLogs([]*HrEmployeeSkillLog{hesl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrEmployeeSkillLog creates a new hr.employee.skill.log model and returns its id. +func (c *Client) CreateHrEmployeeSkillLogs(hesls []*HrEmployeeSkillLog) ([]int64, error) { + var vv []interface{} + for _, v := range hesls { + vv = append(vv, v) + } + return c.Create(HrEmployeeSkillLogModel, vv, nil) +} + +// UpdateHrEmployeeSkillLog updates an existing hr.employee.skill.log record. +func (c *Client) UpdateHrEmployeeSkillLog(hesl *HrEmployeeSkillLog) error { + return c.UpdateHrEmployeeSkillLogs([]int64{hesl.Id.Get()}, hesl) +} + +// UpdateHrEmployeeSkillLogs updates existing hr.employee.skill.log records. +// All records (represented by ids) will be updated by hesl values. +func (c *Client) UpdateHrEmployeeSkillLogs(ids []int64, hesl *HrEmployeeSkillLog) error { + return c.Update(HrEmployeeSkillLogModel, ids, hesl, nil) +} + +// DeleteHrEmployeeSkillLog deletes an existing hr.employee.skill.log record. +func (c *Client) DeleteHrEmployeeSkillLog(id int64) error { + return c.DeleteHrEmployeeSkillLogs([]int64{id}) +} + +// DeleteHrEmployeeSkillLogs deletes existing hr.employee.skill.log records. +func (c *Client) DeleteHrEmployeeSkillLogs(ids []int64) error { + return c.Delete(HrEmployeeSkillLogModel, ids) +} + +// GetHrEmployeeSkillLog gets hr.employee.skill.log existing record. +func (c *Client) GetHrEmployeeSkillLog(id int64) (*HrEmployeeSkillLog, error) { + hesls, err := c.GetHrEmployeeSkillLogs([]int64{id}) + if err != nil { + return nil, err + } + return &((*hesls)[0]), nil +} + +// GetHrEmployeeSkillLogs gets hr.employee.skill.log existing records. +func (c *Client) GetHrEmployeeSkillLogs(ids []int64) (*HrEmployeeSkillLogs, error) { + hesls := &HrEmployeeSkillLogs{} + if err := c.Read(HrEmployeeSkillLogModel, ids, nil, hesls); err != nil { + return nil, err + } + return hesls, nil +} + +// FindHrEmployeeSkillLog finds hr.employee.skill.log record by querying it with criteria. +func (c *Client) FindHrEmployeeSkillLog(criteria *Criteria) (*HrEmployeeSkillLog, error) { + hesls := &HrEmployeeSkillLogs{} + if err := c.SearchRead(HrEmployeeSkillLogModel, criteria, NewOptions().Limit(1), hesls); err != nil { + return nil, err + } + return &((*hesls)[0]), nil +} + +// FindHrEmployeeSkillLogs finds hr.employee.skill.log records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrEmployeeSkillLogs(criteria *Criteria, options *Options) (*HrEmployeeSkillLogs, error) { + hesls := &HrEmployeeSkillLogs{} + if err := c.SearchRead(HrEmployeeSkillLogModel, criteria, options, hesls); err != nil { + return nil, err + } + return hesls, nil +} + +// FindHrEmployeeSkillLogIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrEmployeeSkillLogIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrEmployeeSkillLogModel, criteria, options) +} + +// FindHrEmployeeSkillLogId finds record id by querying it with criteria. +func (c *Client) FindHrEmployeeSkillLogId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrEmployeeSkillLogModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_employee_skill_report.go b/hr_employee_skill_report.go new file mode 100644 index 0000000..cacb3a9 --- /dev/null +++ b/hr_employee_skill_report.go @@ -0,0 +1,121 @@ +package odoo + +// HrEmployeeSkillReport represents hr.employee.skill.report model. +type HrEmployeeSkillReport struct { + Active *Bool `xmlrpc:"active,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + HasDepartmentManagerAccess *Bool `xmlrpc:"has_department_manager_access,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LevelProgress *Float `xmlrpc:"level_progress,omitempty"` + SkillId *Many2One `xmlrpc:"skill_id,omitempty"` + SkillLevel *String `xmlrpc:"skill_level,omitempty"` + SkillTypeId *Many2One `xmlrpc:"skill_type_id,omitempty"` +} + +// HrEmployeeSkillReports represents array of hr.employee.skill.report model. +type HrEmployeeSkillReports []HrEmployeeSkillReport + +// HrEmployeeSkillReportModel is the odoo model name. +const HrEmployeeSkillReportModel = "hr.employee.skill.report" + +// Many2One convert HrEmployeeSkillReport to *Many2One. +func (hesr *HrEmployeeSkillReport) Many2One() *Many2One { + return NewMany2One(hesr.Id.Get(), "") +} + +// CreateHrEmployeeSkillReport creates a new hr.employee.skill.report model and returns its id. +func (c *Client) CreateHrEmployeeSkillReport(hesr *HrEmployeeSkillReport) (int64, error) { + ids, err := c.CreateHrEmployeeSkillReports([]*HrEmployeeSkillReport{hesr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrEmployeeSkillReport creates a new hr.employee.skill.report model and returns its id. +func (c *Client) CreateHrEmployeeSkillReports(hesrs []*HrEmployeeSkillReport) ([]int64, error) { + var vv []interface{} + for _, v := range hesrs { + vv = append(vv, v) + } + return c.Create(HrEmployeeSkillReportModel, vv, nil) +} + +// UpdateHrEmployeeSkillReport updates an existing hr.employee.skill.report record. +func (c *Client) UpdateHrEmployeeSkillReport(hesr *HrEmployeeSkillReport) error { + return c.UpdateHrEmployeeSkillReports([]int64{hesr.Id.Get()}, hesr) +} + +// UpdateHrEmployeeSkillReports updates existing hr.employee.skill.report records. +// All records (represented by ids) will be updated by hesr values. +func (c *Client) UpdateHrEmployeeSkillReports(ids []int64, hesr *HrEmployeeSkillReport) error { + return c.Update(HrEmployeeSkillReportModel, ids, hesr, nil) +} + +// DeleteHrEmployeeSkillReport deletes an existing hr.employee.skill.report record. +func (c *Client) DeleteHrEmployeeSkillReport(id int64) error { + return c.DeleteHrEmployeeSkillReports([]int64{id}) +} + +// DeleteHrEmployeeSkillReports deletes existing hr.employee.skill.report records. +func (c *Client) DeleteHrEmployeeSkillReports(ids []int64) error { + return c.Delete(HrEmployeeSkillReportModel, ids) +} + +// GetHrEmployeeSkillReport gets hr.employee.skill.report existing record. +func (c *Client) GetHrEmployeeSkillReport(id int64) (*HrEmployeeSkillReport, error) { + hesrs, err := c.GetHrEmployeeSkillReports([]int64{id}) + if err != nil { + return nil, err + } + return &((*hesrs)[0]), nil +} + +// GetHrEmployeeSkillReports gets hr.employee.skill.report existing records. +func (c *Client) GetHrEmployeeSkillReports(ids []int64) (*HrEmployeeSkillReports, error) { + hesrs := &HrEmployeeSkillReports{} + if err := c.Read(HrEmployeeSkillReportModel, ids, nil, hesrs); err != nil { + return nil, err + } + return hesrs, nil +} + +// FindHrEmployeeSkillReport finds hr.employee.skill.report record by querying it with criteria. +func (c *Client) FindHrEmployeeSkillReport(criteria *Criteria) (*HrEmployeeSkillReport, error) { + hesrs := &HrEmployeeSkillReports{} + if err := c.SearchRead(HrEmployeeSkillReportModel, criteria, NewOptions().Limit(1), hesrs); err != nil { + return nil, err + } + return &((*hesrs)[0]), nil +} + +// FindHrEmployeeSkillReports finds hr.employee.skill.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrEmployeeSkillReports(criteria *Criteria, options *Options) (*HrEmployeeSkillReports, error) { + hesrs := &HrEmployeeSkillReports{} + if err := c.SearchRead(HrEmployeeSkillReportModel, criteria, options, hesrs); err != nil { + return nil, err + } + return hesrs, nil +} + +// FindHrEmployeeSkillReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrEmployeeSkillReportIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrEmployeeSkillReportModel, criteria, options) +} + +// FindHrEmployeeSkillReportId finds record id by querying it with criteria. +func (c *Client) FindHrEmployeeSkillReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrEmployeeSkillReportModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_expense.go b/hr_expense.go new file mode 100644 index 0000000..de8aea0 --- /dev/null +++ b/hr_expense.go @@ -0,0 +1,184 @@ +package odoo + +// HrExpense represents hr.expense model. +type HrExpense struct { + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + AccountingDate *Time `xmlrpc:"accounting_date,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AnalyticDistribution *String `xmlrpc:"analytic_distribution,omitempty"` + AnalyticPrecision *Int `xmlrpc:"analytic_precision,omitempty"` + ApprovedBy *Many2One `xmlrpc:"approved_by,omitempty"` + ApprovedOn *Time `xmlrpc:"approved_on,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + CanBeReinvoiced *Bool `xmlrpc:"can_be_reinvoiced,omitempty"` + CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + CurrencyRate *Float `xmlrpc:"currency_rate,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DistributionAnalyticAccountIds *Relation `xmlrpc:"distribution_analytic_account_ids,omitempty"` + DuplicateExpenseIds *Relation `xmlrpc:"duplicate_expense_ids,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsEditable *Bool `xmlrpc:"is_editable,omitempty"` + IsMultipleCurrency *Bool `xmlrpc:"is_multiple_currency,omitempty"` + LabelCurrencyRate *String `xmlrpc:"label_currency_rate,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageMainAttachmentChecksum *String `xmlrpc:"message_main_attachment_checksum,omitempty"` + MessageMainAttachmentId *Many2One `xmlrpc:"message_main_attachment_id,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NbAttachment *Int `xmlrpc:"nb_attachment,omitempty"` + PaymentMode *Selection `xmlrpc:"payment_mode,omitempty"` + PriceUnit *Float `xmlrpc:"price_unit,omitempty"` + ProductDescription *String `xmlrpc:"product_description,omitempty"` + ProductHasCost *Bool `xmlrpc:"product_has_cost,omitempty"` + ProductHasTax *Bool `xmlrpc:"product_has_tax,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductUomCategoryId *Many2One `xmlrpc:"product_uom_category_id,omitempty"` + ProductUomId *Many2One `xmlrpc:"product_uom_id,omitempty"` + Quantity *Float `xmlrpc:"quantity,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + SaleOrderId *Many2One `xmlrpc:"sale_order_id,omitempty"` + SameReceiptExpenseIds *Relation `xmlrpc:"same_receipt_expense_ids,omitempty"` + SheetId *Many2One `xmlrpc:"sheet_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TaxAmount *Float `xmlrpc:"tax_amount,omitempty"` + TaxAmountCurrency *Float `xmlrpc:"tax_amount_currency,omitempty"` + TaxIds *Relation `xmlrpc:"tax_ids,omitempty"` + TotalAmount *Float `xmlrpc:"total_amount,omitempty"` + TotalAmountCurrency *Float `xmlrpc:"total_amount_currency,omitempty"` + UntaxedAmountCurrency *Float `xmlrpc:"untaxed_amount_currency,omitempty"` + VendorId *Many2One `xmlrpc:"vendor_id,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrExpenses represents array of hr.expense model. +type HrExpenses []HrExpense + +// HrExpenseModel is the odoo model name. +const HrExpenseModel = "hr.expense" + +// Many2One convert HrExpense to *Many2One. +func (he *HrExpense) Many2One() *Many2One { + return NewMany2One(he.Id.Get(), "") +} + +// CreateHrExpense creates a new hr.expense model and returns its id. +func (c *Client) CreateHrExpense(he *HrExpense) (int64, error) { + ids, err := c.CreateHrExpenses([]*HrExpense{he}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrExpense creates a new hr.expense model and returns its id. +func (c *Client) CreateHrExpenses(hes []*HrExpense) ([]int64, error) { + var vv []interface{} + for _, v := range hes { + vv = append(vv, v) + } + return c.Create(HrExpenseModel, vv, nil) +} + +// UpdateHrExpense updates an existing hr.expense record. +func (c *Client) UpdateHrExpense(he *HrExpense) error { + return c.UpdateHrExpenses([]int64{he.Id.Get()}, he) +} + +// UpdateHrExpenses updates existing hr.expense records. +// All records (represented by ids) will be updated by he values. +func (c *Client) UpdateHrExpenses(ids []int64, he *HrExpense) error { + return c.Update(HrExpenseModel, ids, he, nil) +} + +// DeleteHrExpense deletes an existing hr.expense record. +func (c *Client) DeleteHrExpense(id int64) error { + return c.DeleteHrExpenses([]int64{id}) +} + +// DeleteHrExpenses deletes existing hr.expense records. +func (c *Client) DeleteHrExpenses(ids []int64) error { + return c.Delete(HrExpenseModel, ids) +} + +// GetHrExpense gets hr.expense existing record. +func (c *Client) GetHrExpense(id int64) (*HrExpense, error) { + hes, err := c.GetHrExpenses([]int64{id}) + if err != nil { + return nil, err + } + return &((*hes)[0]), nil +} + +// GetHrExpenses gets hr.expense existing records. +func (c *Client) GetHrExpenses(ids []int64) (*HrExpenses, error) { + hes := &HrExpenses{} + if err := c.Read(HrExpenseModel, ids, nil, hes); err != nil { + return nil, err + } + return hes, nil +} + +// FindHrExpense finds hr.expense record by querying it with criteria. +func (c *Client) FindHrExpense(criteria *Criteria) (*HrExpense, error) { + hes := &HrExpenses{} + if err := c.SearchRead(HrExpenseModel, criteria, NewOptions().Limit(1), hes); err != nil { + return nil, err + } + return &((*hes)[0]), nil +} + +// FindHrExpenses finds hr.expense records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrExpenses(criteria *Criteria, options *Options) (*HrExpenses, error) { + hes := &HrExpenses{} + if err := c.SearchRead(HrExpenseModel, criteria, options, hes); err != nil { + return nil, err + } + return hes, nil +} + +// FindHrExpenseIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrExpenseIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrExpenseModel, criteria, options) +} + +// FindHrExpenseId finds record id by querying it with criteria. +func (c *Client) FindHrExpenseId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrExpenseModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_expense_approve_duplicate.go b/hr_expense_approve_duplicate.go new file mode 100644 index 0000000..ea21b5a --- /dev/null +++ b/hr_expense_approve_duplicate.go @@ -0,0 +1,118 @@ +package odoo + +// HrExpenseApproveDuplicate represents hr.expense.approve.duplicate model. +type HrExpenseApproveDuplicate struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExpenseIds *Relation `xmlrpc:"expense_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + SheetIds *Relation `xmlrpc:"sheet_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrExpenseApproveDuplicates represents array of hr.expense.approve.duplicate model. +type HrExpenseApproveDuplicates []HrExpenseApproveDuplicate + +// HrExpenseApproveDuplicateModel is the odoo model name. +const HrExpenseApproveDuplicateModel = "hr.expense.approve.duplicate" + +// Many2One convert HrExpenseApproveDuplicate to *Many2One. +func (head *HrExpenseApproveDuplicate) Many2One() *Many2One { + return NewMany2One(head.Id.Get(), "") +} + +// CreateHrExpenseApproveDuplicate creates a new hr.expense.approve.duplicate model and returns its id. +func (c *Client) CreateHrExpenseApproveDuplicate(head *HrExpenseApproveDuplicate) (int64, error) { + ids, err := c.CreateHrExpenseApproveDuplicates([]*HrExpenseApproveDuplicate{head}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrExpenseApproveDuplicate creates a new hr.expense.approve.duplicate model and returns its id. +func (c *Client) CreateHrExpenseApproveDuplicates(heads []*HrExpenseApproveDuplicate) ([]int64, error) { + var vv []interface{} + for _, v := range heads { + vv = append(vv, v) + } + return c.Create(HrExpenseApproveDuplicateModel, vv, nil) +} + +// UpdateHrExpenseApproveDuplicate updates an existing hr.expense.approve.duplicate record. +func (c *Client) UpdateHrExpenseApproveDuplicate(head *HrExpenseApproveDuplicate) error { + return c.UpdateHrExpenseApproveDuplicates([]int64{head.Id.Get()}, head) +} + +// UpdateHrExpenseApproveDuplicates updates existing hr.expense.approve.duplicate records. +// All records (represented by ids) will be updated by head values. +func (c *Client) UpdateHrExpenseApproveDuplicates(ids []int64, head *HrExpenseApproveDuplicate) error { + return c.Update(HrExpenseApproveDuplicateModel, ids, head, nil) +} + +// DeleteHrExpenseApproveDuplicate deletes an existing hr.expense.approve.duplicate record. +func (c *Client) DeleteHrExpenseApproveDuplicate(id int64) error { + return c.DeleteHrExpenseApproveDuplicates([]int64{id}) +} + +// DeleteHrExpenseApproveDuplicates deletes existing hr.expense.approve.duplicate records. +func (c *Client) DeleteHrExpenseApproveDuplicates(ids []int64) error { + return c.Delete(HrExpenseApproveDuplicateModel, ids) +} + +// GetHrExpenseApproveDuplicate gets hr.expense.approve.duplicate existing record. +func (c *Client) GetHrExpenseApproveDuplicate(id int64) (*HrExpenseApproveDuplicate, error) { + heads, err := c.GetHrExpenseApproveDuplicates([]int64{id}) + if err != nil { + return nil, err + } + return &((*heads)[0]), nil +} + +// GetHrExpenseApproveDuplicates gets hr.expense.approve.duplicate existing records. +func (c *Client) GetHrExpenseApproveDuplicates(ids []int64) (*HrExpenseApproveDuplicates, error) { + heads := &HrExpenseApproveDuplicates{} + if err := c.Read(HrExpenseApproveDuplicateModel, ids, nil, heads); err != nil { + return nil, err + } + return heads, nil +} + +// FindHrExpenseApproveDuplicate finds hr.expense.approve.duplicate record by querying it with criteria. +func (c *Client) FindHrExpenseApproveDuplicate(criteria *Criteria) (*HrExpenseApproveDuplicate, error) { + heads := &HrExpenseApproveDuplicates{} + if err := c.SearchRead(HrExpenseApproveDuplicateModel, criteria, NewOptions().Limit(1), heads); err != nil { + return nil, err + } + return &((*heads)[0]), nil +} + +// FindHrExpenseApproveDuplicates finds hr.expense.approve.duplicate records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrExpenseApproveDuplicates(criteria *Criteria, options *Options) (*HrExpenseApproveDuplicates, error) { + heads := &HrExpenseApproveDuplicates{} + if err := c.SearchRead(HrExpenseApproveDuplicateModel, criteria, options, heads); err != nil { + return nil, err + } + return heads, nil +} + +// FindHrExpenseApproveDuplicateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrExpenseApproveDuplicateIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrExpenseApproveDuplicateModel, criteria, options) +} + +// FindHrExpenseApproveDuplicateId finds record id by querying it with criteria. +func (c *Client) FindHrExpenseApproveDuplicateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrExpenseApproveDuplicateModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_expense_refuse_wizard.go b/hr_expense_refuse_wizard.go new file mode 100644 index 0000000..07dc3aa --- /dev/null +++ b/hr_expense_refuse_wizard.go @@ -0,0 +1,118 @@ +package odoo + +// HrExpenseRefuseWizard represents hr.expense.refuse.wizard model. +type HrExpenseRefuseWizard struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Reason *String `xmlrpc:"reason,omitempty"` + SheetIds *Relation `xmlrpc:"sheet_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrExpenseRefuseWizards represents array of hr.expense.refuse.wizard model. +type HrExpenseRefuseWizards []HrExpenseRefuseWizard + +// HrExpenseRefuseWizardModel is the odoo model name. +const HrExpenseRefuseWizardModel = "hr.expense.refuse.wizard" + +// Many2One convert HrExpenseRefuseWizard to *Many2One. +func (herw *HrExpenseRefuseWizard) Many2One() *Many2One { + return NewMany2One(herw.Id.Get(), "") +} + +// CreateHrExpenseRefuseWizard creates a new hr.expense.refuse.wizard model and returns its id. +func (c *Client) CreateHrExpenseRefuseWizard(herw *HrExpenseRefuseWizard) (int64, error) { + ids, err := c.CreateHrExpenseRefuseWizards([]*HrExpenseRefuseWizard{herw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrExpenseRefuseWizard creates a new hr.expense.refuse.wizard model and returns its id. +func (c *Client) CreateHrExpenseRefuseWizards(herws []*HrExpenseRefuseWizard) ([]int64, error) { + var vv []interface{} + for _, v := range herws { + vv = append(vv, v) + } + return c.Create(HrExpenseRefuseWizardModel, vv, nil) +} + +// UpdateHrExpenseRefuseWizard updates an existing hr.expense.refuse.wizard record. +func (c *Client) UpdateHrExpenseRefuseWizard(herw *HrExpenseRefuseWizard) error { + return c.UpdateHrExpenseRefuseWizards([]int64{herw.Id.Get()}, herw) +} + +// UpdateHrExpenseRefuseWizards updates existing hr.expense.refuse.wizard records. +// All records (represented by ids) will be updated by herw values. +func (c *Client) UpdateHrExpenseRefuseWizards(ids []int64, herw *HrExpenseRefuseWizard) error { + return c.Update(HrExpenseRefuseWizardModel, ids, herw, nil) +} + +// DeleteHrExpenseRefuseWizard deletes an existing hr.expense.refuse.wizard record. +func (c *Client) DeleteHrExpenseRefuseWizard(id int64) error { + return c.DeleteHrExpenseRefuseWizards([]int64{id}) +} + +// DeleteHrExpenseRefuseWizards deletes existing hr.expense.refuse.wizard records. +func (c *Client) DeleteHrExpenseRefuseWizards(ids []int64) error { + return c.Delete(HrExpenseRefuseWizardModel, ids) +} + +// GetHrExpenseRefuseWizard gets hr.expense.refuse.wizard existing record. +func (c *Client) GetHrExpenseRefuseWizard(id int64) (*HrExpenseRefuseWizard, error) { + herws, err := c.GetHrExpenseRefuseWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*herws)[0]), nil +} + +// GetHrExpenseRefuseWizards gets hr.expense.refuse.wizard existing records. +func (c *Client) GetHrExpenseRefuseWizards(ids []int64) (*HrExpenseRefuseWizards, error) { + herws := &HrExpenseRefuseWizards{} + if err := c.Read(HrExpenseRefuseWizardModel, ids, nil, herws); err != nil { + return nil, err + } + return herws, nil +} + +// FindHrExpenseRefuseWizard finds hr.expense.refuse.wizard record by querying it with criteria. +func (c *Client) FindHrExpenseRefuseWizard(criteria *Criteria) (*HrExpenseRefuseWizard, error) { + herws := &HrExpenseRefuseWizards{} + if err := c.SearchRead(HrExpenseRefuseWizardModel, criteria, NewOptions().Limit(1), herws); err != nil { + return nil, err + } + return &((*herws)[0]), nil +} + +// FindHrExpenseRefuseWizards finds hr.expense.refuse.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrExpenseRefuseWizards(criteria *Criteria, options *Options) (*HrExpenseRefuseWizards, error) { + herws := &HrExpenseRefuseWizards{} + if err := c.SearchRead(HrExpenseRefuseWizardModel, criteria, options, herws); err != nil { + return nil, err + } + return herws, nil +} + +// FindHrExpenseRefuseWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrExpenseRefuseWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrExpenseRefuseWizardModel, criteria, options) +} + +// FindHrExpenseRefuseWizardId finds record id by querying it with criteria. +func (c *Client) FindHrExpenseRefuseWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrExpenseRefuseWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_expense_sheet.go b/hr_expense_sheet.go new file mode 100644 index 0000000..02917e5 --- /dev/null +++ b/hr_expense_sheet.go @@ -0,0 +1,174 @@ +package odoo + +// HrExpenseSheet represents hr.expense.sheet model. +type HrExpenseSheet struct { + AccountMoveIds *Relation `xmlrpc:"account_move_ids,omitempty"` + AccountingDate *Time `xmlrpc:"accounting_date,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AmountResidual *Float `xmlrpc:"amount_residual,omitempty"` + ApprovalDate *Time `xmlrpc:"approval_date,omitempty"` + ApprovalState *Selection `xmlrpc:"approval_state,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + CanApprove *Bool `xmlrpc:"can_approve,omitempty"` + CanReset *Bool `xmlrpc:"can_reset,omitempty"` + CannotApproveReason *String `xmlrpc:"cannot_approve_reason,omitempty"` + CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + EmployeeJournalId *Many2One `xmlrpc:"employee_journal_id,omitempty"` + ExpenseLineIds *Relation `xmlrpc:"expense_line_ids,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsEditable *Bool `xmlrpc:"is_editable,omitempty"` + IsMultipleCurrency *Bool `xmlrpc:"is_multiple_currency,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageMainAttachmentId *Many2One `xmlrpc:"message_main_attachment_id,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NbAccountMove *Int `xmlrpc:"nb_account_move,omitempty"` + NbExpense *Int `xmlrpc:"nb_expense,omitempty"` + PaymentMethodLineId *Many2One `xmlrpc:"payment_method_line_id,omitempty"` + PaymentMode *Selection `xmlrpc:"payment_mode,omitempty"` + PaymentState *Selection `xmlrpc:"payment_state,omitempty"` + ProductIds *Relation `xmlrpc:"product_ids,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + SaleOrderCount *Int `xmlrpc:"sale_order_count,omitempty"` + SelectablePaymentMethodLineIds *Relation `xmlrpc:"selectable_payment_method_line_ids,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TotalAmount *Float `xmlrpc:"total_amount,omitempty"` + TotalTaxAmount *Float `xmlrpc:"total_tax_amount,omitempty"` + UntaxedAmount *Float `xmlrpc:"untaxed_amount,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrExpenseSheets represents array of hr.expense.sheet model. +type HrExpenseSheets []HrExpenseSheet + +// HrExpenseSheetModel is the odoo model name. +const HrExpenseSheetModel = "hr.expense.sheet" + +// Many2One convert HrExpenseSheet to *Many2One. +func (hes *HrExpenseSheet) Many2One() *Many2One { + return NewMany2One(hes.Id.Get(), "") +} + +// CreateHrExpenseSheet creates a new hr.expense.sheet model and returns its id. +func (c *Client) CreateHrExpenseSheet(hes *HrExpenseSheet) (int64, error) { + ids, err := c.CreateHrExpenseSheets([]*HrExpenseSheet{hes}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrExpenseSheet creates a new hr.expense.sheet model and returns its id. +func (c *Client) CreateHrExpenseSheets(hess []*HrExpenseSheet) ([]int64, error) { + var vv []interface{} + for _, v := range hess { + vv = append(vv, v) + } + return c.Create(HrExpenseSheetModel, vv, nil) +} + +// UpdateHrExpenseSheet updates an existing hr.expense.sheet record. +func (c *Client) UpdateHrExpenseSheet(hes *HrExpenseSheet) error { + return c.UpdateHrExpenseSheets([]int64{hes.Id.Get()}, hes) +} + +// UpdateHrExpenseSheets updates existing hr.expense.sheet records. +// All records (represented by ids) will be updated by hes values. +func (c *Client) UpdateHrExpenseSheets(ids []int64, hes *HrExpenseSheet) error { + return c.Update(HrExpenseSheetModel, ids, hes, nil) +} + +// DeleteHrExpenseSheet deletes an existing hr.expense.sheet record. +func (c *Client) DeleteHrExpenseSheet(id int64) error { + return c.DeleteHrExpenseSheets([]int64{id}) +} + +// DeleteHrExpenseSheets deletes existing hr.expense.sheet records. +func (c *Client) DeleteHrExpenseSheets(ids []int64) error { + return c.Delete(HrExpenseSheetModel, ids) +} + +// GetHrExpenseSheet gets hr.expense.sheet existing record. +func (c *Client) GetHrExpenseSheet(id int64) (*HrExpenseSheet, error) { + hess, err := c.GetHrExpenseSheets([]int64{id}) + if err != nil { + return nil, err + } + return &((*hess)[0]), nil +} + +// GetHrExpenseSheets gets hr.expense.sheet existing records. +func (c *Client) GetHrExpenseSheets(ids []int64) (*HrExpenseSheets, error) { + hess := &HrExpenseSheets{} + if err := c.Read(HrExpenseSheetModel, ids, nil, hess); err != nil { + return nil, err + } + return hess, nil +} + +// FindHrExpenseSheet finds hr.expense.sheet record by querying it with criteria. +func (c *Client) FindHrExpenseSheet(criteria *Criteria) (*HrExpenseSheet, error) { + hess := &HrExpenseSheets{} + if err := c.SearchRead(HrExpenseSheetModel, criteria, NewOptions().Limit(1), hess); err != nil { + return nil, err + } + return &((*hess)[0]), nil +} + +// FindHrExpenseSheets finds hr.expense.sheet records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrExpenseSheets(criteria *Criteria, options *Options) (*HrExpenseSheets, error) { + hess := &HrExpenseSheets{} + if err := c.SearchRead(HrExpenseSheetModel, criteria, options, hess); err != nil { + return nil, err + } + return hess, nil +} + +// FindHrExpenseSheetIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrExpenseSheetIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrExpenseSheetModel, criteria, options) +} + +// FindHrExpenseSheetId finds record id by querying it with criteria. +func (c *Client) FindHrExpenseSheetId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrExpenseSheetModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_expense_split.go b/hr_expense_split.go new file mode 100644 index 0000000..cb6fd2e --- /dev/null +++ b/hr_expense_split.go @@ -0,0 +1,133 @@ +package odoo + +// HrExpenseSplit represents hr.expense.split model. +type HrExpenseSplit struct { + AnalyticDistribution *String `xmlrpc:"analytic_distribution,omitempty"` + AnalyticPrecision *Int `xmlrpc:"analytic_precision,omitempty"` + CanBeReinvoiced *Bool `xmlrpc:"can_be_reinvoiced,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DistributionAnalyticAccountIds *Relation `xmlrpc:"distribution_analytic_account_ids,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + ExpenseId *Many2One `xmlrpc:"expense_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ProductHasCost *Bool `xmlrpc:"product_has_cost,omitempty"` + ProductHasTax *Bool `xmlrpc:"product_has_tax,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + SaleOrderId *Many2One `xmlrpc:"sale_order_id,omitempty"` + TaxAmountCurrency *Float `xmlrpc:"tax_amount_currency,omitempty"` + TaxIds *Relation `xmlrpc:"tax_ids,omitempty"` + TotalAmountCurrency *Float `xmlrpc:"total_amount_currency,omitempty"` + WizardId *Many2One `xmlrpc:"wizard_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrExpenseSplits represents array of hr.expense.split model. +type HrExpenseSplits []HrExpenseSplit + +// HrExpenseSplitModel is the odoo model name. +const HrExpenseSplitModel = "hr.expense.split" + +// Many2One convert HrExpenseSplit to *Many2One. +func (hes *HrExpenseSplit) Many2One() *Many2One { + return NewMany2One(hes.Id.Get(), "") +} + +// CreateHrExpenseSplit creates a new hr.expense.split model and returns its id. +func (c *Client) CreateHrExpenseSplit(hes *HrExpenseSplit) (int64, error) { + ids, err := c.CreateHrExpenseSplits([]*HrExpenseSplit{hes}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrExpenseSplit creates a new hr.expense.split model and returns its id. +func (c *Client) CreateHrExpenseSplits(hess []*HrExpenseSplit) ([]int64, error) { + var vv []interface{} + for _, v := range hess { + vv = append(vv, v) + } + return c.Create(HrExpenseSplitModel, vv, nil) +} + +// UpdateHrExpenseSplit updates an existing hr.expense.split record. +func (c *Client) UpdateHrExpenseSplit(hes *HrExpenseSplit) error { + return c.UpdateHrExpenseSplits([]int64{hes.Id.Get()}, hes) +} + +// UpdateHrExpenseSplits updates existing hr.expense.split records. +// All records (represented by ids) will be updated by hes values. +func (c *Client) UpdateHrExpenseSplits(ids []int64, hes *HrExpenseSplit) error { + return c.Update(HrExpenseSplitModel, ids, hes, nil) +} + +// DeleteHrExpenseSplit deletes an existing hr.expense.split record. +func (c *Client) DeleteHrExpenseSplit(id int64) error { + return c.DeleteHrExpenseSplits([]int64{id}) +} + +// DeleteHrExpenseSplits deletes existing hr.expense.split records. +func (c *Client) DeleteHrExpenseSplits(ids []int64) error { + return c.Delete(HrExpenseSplitModel, ids) +} + +// GetHrExpenseSplit gets hr.expense.split existing record. +func (c *Client) GetHrExpenseSplit(id int64) (*HrExpenseSplit, error) { + hess, err := c.GetHrExpenseSplits([]int64{id}) + if err != nil { + return nil, err + } + return &((*hess)[0]), nil +} + +// GetHrExpenseSplits gets hr.expense.split existing records. +func (c *Client) GetHrExpenseSplits(ids []int64) (*HrExpenseSplits, error) { + hess := &HrExpenseSplits{} + if err := c.Read(HrExpenseSplitModel, ids, nil, hess); err != nil { + return nil, err + } + return hess, nil +} + +// FindHrExpenseSplit finds hr.expense.split record by querying it with criteria. +func (c *Client) FindHrExpenseSplit(criteria *Criteria) (*HrExpenseSplit, error) { + hess := &HrExpenseSplits{} + if err := c.SearchRead(HrExpenseSplitModel, criteria, NewOptions().Limit(1), hess); err != nil { + return nil, err + } + return &((*hess)[0]), nil +} + +// FindHrExpenseSplits finds hr.expense.split records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrExpenseSplits(criteria *Criteria, options *Options) (*HrExpenseSplits, error) { + hess := &HrExpenseSplits{} + if err := c.SearchRead(HrExpenseSplitModel, criteria, options, hess); err != nil { + return nil, err + } + return hess, nil +} + +// FindHrExpenseSplitIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrExpenseSplitIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrExpenseSplitModel, criteria, options) +} + +// FindHrExpenseSplitId finds record id by querying it with criteria. +func (c *Client) FindHrExpenseSplitId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrExpenseSplitModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_expense_split_wizard.go b/hr_expense_split_wizard.go new file mode 100644 index 0000000..d4e23e9 --- /dev/null +++ b/hr_expense_split_wizard.go @@ -0,0 +1,123 @@ +package odoo + +// HrExpenseSplitWizard represents hr.expense.split.wizard model. +type HrExpenseSplitWizard struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExpenseId *Many2One `xmlrpc:"expense_id,omitempty"` + ExpenseSplitLineIds *Relation `xmlrpc:"expense_split_line_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + SplitPossible *Bool `xmlrpc:"split_possible,omitempty"` + TaxAmountCurrency *Float `xmlrpc:"tax_amount_currency,omitempty"` + TotalAmountCurrency *Float `xmlrpc:"total_amount_currency,omitempty"` + TotalAmountCurrencyOriginal *Float `xmlrpc:"total_amount_currency_original,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrExpenseSplitWizards represents array of hr.expense.split.wizard model. +type HrExpenseSplitWizards []HrExpenseSplitWizard + +// HrExpenseSplitWizardModel is the odoo model name. +const HrExpenseSplitWizardModel = "hr.expense.split.wizard" + +// Many2One convert HrExpenseSplitWizard to *Many2One. +func (hesw *HrExpenseSplitWizard) Many2One() *Many2One { + return NewMany2One(hesw.Id.Get(), "") +} + +// CreateHrExpenseSplitWizard creates a new hr.expense.split.wizard model and returns its id. +func (c *Client) CreateHrExpenseSplitWizard(hesw *HrExpenseSplitWizard) (int64, error) { + ids, err := c.CreateHrExpenseSplitWizards([]*HrExpenseSplitWizard{hesw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrExpenseSplitWizard creates a new hr.expense.split.wizard model and returns its id. +func (c *Client) CreateHrExpenseSplitWizards(hesws []*HrExpenseSplitWizard) ([]int64, error) { + var vv []interface{} + for _, v := range hesws { + vv = append(vv, v) + } + return c.Create(HrExpenseSplitWizardModel, vv, nil) +} + +// UpdateHrExpenseSplitWizard updates an existing hr.expense.split.wizard record. +func (c *Client) UpdateHrExpenseSplitWizard(hesw *HrExpenseSplitWizard) error { + return c.UpdateHrExpenseSplitWizards([]int64{hesw.Id.Get()}, hesw) +} + +// UpdateHrExpenseSplitWizards updates existing hr.expense.split.wizard records. +// All records (represented by ids) will be updated by hesw values. +func (c *Client) UpdateHrExpenseSplitWizards(ids []int64, hesw *HrExpenseSplitWizard) error { + return c.Update(HrExpenseSplitWizardModel, ids, hesw, nil) +} + +// DeleteHrExpenseSplitWizard deletes an existing hr.expense.split.wizard record. +func (c *Client) DeleteHrExpenseSplitWizard(id int64) error { + return c.DeleteHrExpenseSplitWizards([]int64{id}) +} + +// DeleteHrExpenseSplitWizards deletes existing hr.expense.split.wizard records. +func (c *Client) DeleteHrExpenseSplitWizards(ids []int64) error { + return c.Delete(HrExpenseSplitWizardModel, ids) +} + +// GetHrExpenseSplitWizard gets hr.expense.split.wizard existing record. +func (c *Client) GetHrExpenseSplitWizard(id int64) (*HrExpenseSplitWizard, error) { + hesws, err := c.GetHrExpenseSplitWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*hesws)[0]), nil +} + +// GetHrExpenseSplitWizards gets hr.expense.split.wizard existing records. +func (c *Client) GetHrExpenseSplitWizards(ids []int64) (*HrExpenseSplitWizards, error) { + hesws := &HrExpenseSplitWizards{} + if err := c.Read(HrExpenseSplitWizardModel, ids, nil, hesws); err != nil { + return nil, err + } + return hesws, nil +} + +// FindHrExpenseSplitWizard finds hr.expense.split.wizard record by querying it with criteria. +func (c *Client) FindHrExpenseSplitWizard(criteria *Criteria) (*HrExpenseSplitWizard, error) { + hesws := &HrExpenseSplitWizards{} + if err := c.SearchRead(HrExpenseSplitWizardModel, criteria, NewOptions().Limit(1), hesws); err != nil { + return nil, err + } + return &((*hesws)[0]), nil +} + +// FindHrExpenseSplitWizards finds hr.expense.split.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrExpenseSplitWizards(criteria *Criteria, options *Options) (*HrExpenseSplitWizards, error) { + hesws := &HrExpenseSplitWizards{} + if err := c.SearchRead(HrExpenseSplitWizardModel, criteria, options, hesws); err != nil { + return nil, err + } + return hesws, nil +} + +// FindHrExpenseSplitWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrExpenseSplitWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrExpenseSplitWizardModel, criteria, options) +} + +// FindHrExpenseSplitWizardId finds record id by querying it with criteria. +func (c *Client) FindHrExpenseSplitWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrExpenseSplitWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_holidays_cancel_leave.go b/hr_holidays_cancel_leave.go new file mode 100644 index 0000000..eff2746 --- /dev/null +++ b/hr_holidays_cancel_leave.go @@ -0,0 +1,118 @@ +package odoo + +// HrHolidaysCancelLeave represents hr.holidays.cancel.leave model. +type HrHolidaysCancelLeave struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LeaveId *Many2One `xmlrpc:"leave_id,omitempty"` + Reason *String `xmlrpc:"reason,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrHolidaysCancelLeaves represents array of hr.holidays.cancel.leave model. +type HrHolidaysCancelLeaves []HrHolidaysCancelLeave + +// HrHolidaysCancelLeaveModel is the odoo model name. +const HrHolidaysCancelLeaveModel = "hr.holidays.cancel.leave" + +// Many2One convert HrHolidaysCancelLeave to *Many2One. +func (hhcl *HrHolidaysCancelLeave) Many2One() *Many2One { + return NewMany2One(hhcl.Id.Get(), "") +} + +// CreateHrHolidaysCancelLeave creates a new hr.holidays.cancel.leave model and returns its id. +func (c *Client) CreateHrHolidaysCancelLeave(hhcl *HrHolidaysCancelLeave) (int64, error) { + ids, err := c.CreateHrHolidaysCancelLeaves([]*HrHolidaysCancelLeave{hhcl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrHolidaysCancelLeave creates a new hr.holidays.cancel.leave model and returns its id. +func (c *Client) CreateHrHolidaysCancelLeaves(hhcls []*HrHolidaysCancelLeave) ([]int64, error) { + var vv []interface{} + for _, v := range hhcls { + vv = append(vv, v) + } + return c.Create(HrHolidaysCancelLeaveModel, vv, nil) +} + +// UpdateHrHolidaysCancelLeave updates an existing hr.holidays.cancel.leave record. +func (c *Client) UpdateHrHolidaysCancelLeave(hhcl *HrHolidaysCancelLeave) error { + return c.UpdateHrHolidaysCancelLeaves([]int64{hhcl.Id.Get()}, hhcl) +} + +// UpdateHrHolidaysCancelLeaves updates existing hr.holidays.cancel.leave records. +// All records (represented by ids) will be updated by hhcl values. +func (c *Client) UpdateHrHolidaysCancelLeaves(ids []int64, hhcl *HrHolidaysCancelLeave) error { + return c.Update(HrHolidaysCancelLeaveModel, ids, hhcl, nil) +} + +// DeleteHrHolidaysCancelLeave deletes an existing hr.holidays.cancel.leave record. +func (c *Client) DeleteHrHolidaysCancelLeave(id int64) error { + return c.DeleteHrHolidaysCancelLeaves([]int64{id}) +} + +// DeleteHrHolidaysCancelLeaves deletes existing hr.holidays.cancel.leave records. +func (c *Client) DeleteHrHolidaysCancelLeaves(ids []int64) error { + return c.Delete(HrHolidaysCancelLeaveModel, ids) +} + +// GetHrHolidaysCancelLeave gets hr.holidays.cancel.leave existing record. +func (c *Client) GetHrHolidaysCancelLeave(id int64) (*HrHolidaysCancelLeave, error) { + hhcls, err := c.GetHrHolidaysCancelLeaves([]int64{id}) + if err != nil { + return nil, err + } + return &((*hhcls)[0]), nil +} + +// GetHrHolidaysCancelLeaves gets hr.holidays.cancel.leave existing records. +func (c *Client) GetHrHolidaysCancelLeaves(ids []int64) (*HrHolidaysCancelLeaves, error) { + hhcls := &HrHolidaysCancelLeaves{} + if err := c.Read(HrHolidaysCancelLeaveModel, ids, nil, hhcls); err != nil { + return nil, err + } + return hhcls, nil +} + +// FindHrHolidaysCancelLeave finds hr.holidays.cancel.leave record by querying it with criteria. +func (c *Client) FindHrHolidaysCancelLeave(criteria *Criteria) (*HrHolidaysCancelLeave, error) { + hhcls := &HrHolidaysCancelLeaves{} + if err := c.SearchRead(HrHolidaysCancelLeaveModel, criteria, NewOptions().Limit(1), hhcls); err != nil { + return nil, err + } + return &((*hhcls)[0]), nil +} + +// FindHrHolidaysCancelLeaves finds hr.holidays.cancel.leave records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrHolidaysCancelLeaves(criteria *Criteria, options *Options) (*HrHolidaysCancelLeaves, error) { + hhcls := &HrHolidaysCancelLeaves{} + if err := c.SearchRead(HrHolidaysCancelLeaveModel, criteria, options, hhcls); err != nil { + return nil, err + } + return hhcls, nil +} + +// FindHrHolidaysCancelLeaveIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrHolidaysCancelLeaveIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrHolidaysCancelLeaveModel, criteria, options) +} + +// FindHrHolidaysCancelLeaveId finds record id by querying it with criteria. +func (c *Client) FindHrHolidaysCancelLeaveId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrHolidaysCancelLeaveModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_holidays_summary_employee.go b/hr_holidays_summary_employee.go new file mode 100644 index 0000000..202eee0 --- /dev/null +++ b/hr_holidays_summary_employee.go @@ -0,0 +1,119 @@ +package odoo + +// HrHolidaysSummaryEmployee represents hr.holidays.summary.employee model. +type HrHolidaysSummaryEmployee struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateFrom *Time `xmlrpc:"date_from,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Emp *Relation `xmlrpc:"emp,omitempty"` + HolidayType *Selection `xmlrpc:"holiday_type,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrHolidaysSummaryEmployees represents array of hr.holidays.summary.employee model. +type HrHolidaysSummaryEmployees []HrHolidaysSummaryEmployee + +// HrHolidaysSummaryEmployeeModel is the odoo model name. +const HrHolidaysSummaryEmployeeModel = "hr.holidays.summary.employee" + +// Many2One convert HrHolidaysSummaryEmployee to *Many2One. +func (hhse *HrHolidaysSummaryEmployee) Many2One() *Many2One { + return NewMany2One(hhse.Id.Get(), "") +} + +// CreateHrHolidaysSummaryEmployee creates a new hr.holidays.summary.employee model and returns its id. +func (c *Client) CreateHrHolidaysSummaryEmployee(hhse *HrHolidaysSummaryEmployee) (int64, error) { + ids, err := c.CreateHrHolidaysSummaryEmployees([]*HrHolidaysSummaryEmployee{hhse}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrHolidaysSummaryEmployee creates a new hr.holidays.summary.employee model and returns its id. +func (c *Client) CreateHrHolidaysSummaryEmployees(hhses []*HrHolidaysSummaryEmployee) ([]int64, error) { + var vv []interface{} + for _, v := range hhses { + vv = append(vv, v) + } + return c.Create(HrHolidaysSummaryEmployeeModel, vv, nil) +} + +// UpdateHrHolidaysSummaryEmployee updates an existing hr.holidays.summary.employee record. +func (c *Client) UpdateHrHolidaysSummaryEmployee(hhse *HrHolidaysSummaryEmployee) error { + return c.UpdateHrHolidaysSummaryEmployees([]int64{hhse.Id.Get()}, hhse) +} + +// UpdateHrHolidaysSummaryEmployees updates existing hr.holidays.summary.employee records. +// All records (represented by ids) will be updated by hhse values. +func (c *Client) UpdateHrHolidaysSummaryEmployees(ids []int64, hhse *HrHolidaysSummaryEmployee) error { + return c.Update(HrHolidaysSummaryEmployeeModel, ids, hhse, nil) +} + +// DeleteHrHolidaysSummaryEmployee deletes an existing hr.holidays.summary.employee record. +func (c *Client) DeleteHrHolidaysSummaryEmployee(id int64) error { + return c.DeleteHrHolidaysSummaryEmployees([]int64{id}) +} + +// DeleteHrHolidaysSummaryEmployees deletes existing hr.holidays.summary.employee records. +func (c *Client) DeleteHrHolidaysSummaryEmployees(ids []int64) error { + return c.Delete(HrHolidaysSummaryEmployeeModel, ids) +} + +// GetHrHolidaysSummaryEmployee gets hr.holidays.summary.employee existing record. +func (c *Client) GetHrHolidaysSummaryEmployee(id int64) (*HrHolidaysSummaryEmployee, error) { + hhses, err := c.GetHrHolidaysSummaryEmployees([]int64{id}) + if err != nil { + return nil, err + } + return &((*hhses)[0]), nil +} + +// GetHrHolidaysSummaryEmployees gets hr.holidays.summary.employee existing records. +func (c *Client) GetHrHolidaysSummaryEmployees(ids []int64) (*HrHolidaysSummaryEmployees, error) { + hhses := &HrHolidaysSummaryEmployees{} + if err := c.Read(HrHolidaysSummaryEmployeeModel, ids, nil, hhses); err != nil { + return nil, err + } + return hhses, nil +} + +// FindHrHolidaysSummaryEmployee finds hr.holidays.summary.employee record by querying it with criteria. +func (c *Client) FindHrHolidaysSummaryEmployee(criteria *Criteria) (*HrHolidaysSummaryEmployee, error) { + hhses := &HrHolidaysSummaryEmployees{} + if err := c.SearchRead(HrHolidaysSummaryEmployeeModel, criteria, NewOptions().Limit(1), hhses); err != nil { + return nil, err + } + return &((*hhses)[0]), nil +} + +// FindHrHolidaysSummaryEmployees finds hr.holidays.summary.employee records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrHolidaysSummaryEmployees(criteria *Criteria, options *Options) (*HrHolidaysSummaryEmployees, error) { + hhses := &HrHolidaysSummaryEmployees{} + if err := c.SearchRead(HrHolidaysSummaryEmployeeModel, criteria, options, hhses); err != nil { + return nil, err + } + return hhses, nil +} + +// FindHrHolidaysSummaryEmployeeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrHolidaysSummaryEmployeeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrHolidaysSummaryEmployeeModel, criteria, options) +} + +// FindHrHolidaysSummaryEmployeeId finds record id by querying it with criteria. +func (c *Client) FindHrHolidaysSummaryEmployeeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrHolidaysSummaryEmployeeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_job.go b/hr_job.go new file mode 100644 index 0000000..9db7363 --- /dev/null +++ b/hr_job.go @@ -0,0 +1,181 @@ +package odoo + +// HrJob represents hr.job model. +type HrJob struct { + Active *Bool `xmlrpc:"active,omitempty"` + ActivitiesOverdue *Int `xmlrpc:"activities_overdue,omitempty"` + ActivitiesToday *Int `xmlrpc:"activities_today,omitempty"` + AddressId *Many2One `xmlrpc:"address_id,omitempty"` + AliasBouncedContent *String `xmlrpc:"alias_bounced_content,omitempty"` + AliasContact *Selection `xmlrpc:"alias_contact,omitempty"` + AliasDefaults *String `xmlrpc:"alias_defaults,omitempty"` + AliasDomain *String `xmlrpc:"alias_domain,omitempty"` + AliasDomainId *Many2One `xmlrpc:"alias_domain_id,omitempty"` + AliasEmail *String `xmlrpc:"alias_email,omitempty"` + AliasForceThreadId *Int `xmlrpc:"alias_force_thread_id,omitempty"` + AliasFullName *String `xmlrpc:"alias_full_name,omitempty"` + AliasId *Many2One `xmlrpc:"alias_id,omitempty"` + AliasIncomingLocal *Bool `xmlrpc:"alias_incoming_local,omitempty"` + AliasModelId *Many2One `xmlrpc:"alias_model_id,omitempty"` + AliasName *String `xmlrpc:"alias_name,omitempty"` + AliasParentModelId *Many2One `xmlrpc:"alias_parent_model_id,omitempty"` + AliasParentThreadId *Int `xmlrpc:"alias_parent_thread_id,omitempty"` + AliasStatus *Selection `xmlrpc:"alias_status,omitempty"` + AllApplicationCount *Int `xmlrpc:"all_application_count,omitempty"` + ApplicantHired *Int `xmlrpc:"applicant_hired,omitempty"` + ApplicantPropertiesDefinition interface{} `xmlrpc:"applicant_properties_definition,omitempty"` + ApplicationCount *Int `xmlrpc:"application_count,omitempty"` + ApplicationIds *Relation `xmlrpc:"application_ids,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + ContractTypeId *Many2One `xmlrpc:"contract_type_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"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DocumentIds *Relation `xmlrpc:"document_ids,omitempty"` + DocumentsCount *Int `xmlrpc:"documents_count,omitempty"` + EmployeeIds *Relation `xmlrpc:"employee_ids,omitempty"` + ExpectedEmployees *Int `xmlrpc:"expected_employees,omitempty"` + ExtendedInterviewerIds *Relation `xmlrpc:"extended_interviewer_ids,omitempty"` + FavoriteUserIds *Relation `xmlrpc:"favorite_user_ids,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IndustryId *Many2One `xmlrpc:"industry_id,omitempty"` + InterviewerIds *Relation `xmlrpc:"interviewer_ids,omitempty"` + IsFavorite *Bool `xmlrpc:"is_favorite,omitempty"` + JobProperties interface{} `xmlrpc:"job_properties,omitempty"` + ManagerId *Many2One `xmlrpc:"manager_id,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NewApplicationCount *Int `xmlrpc:"new_application_count,omitempty"` + NoOfEmployee *Int `xmlrpc:"no_of_employee,omitempty"` + NoOfHiredEmployee *Int `xmlrpc:"no_of_hired_employee,omitempty"` + NoOfRecruitment *Int `xmlrpc:"no_of_recruitment,omitempty"` + OldApplicationCount *Int `xmlrpc:"old_application_count,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + Requirements *String `xmlrpc:"requirements,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SkillIds *Relation `xmlrpc:"skill_ids,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrJobs represents array of hr.job model. +type HrJobs []HrJob + +// HrJobModel is the odoo model name. +const HrJobModel = "hr.job" + +// Many2One convert HrJob to *Many2One. +func (hj *HrJob) Many2One() *Many2One { + return NewMany2One(hj.Id.Get(), "") +} + +// CreateHrJob creates a new hr.job model and returns its id. +func (c *Client) CreateHrJob(hj *HrJob) (int64, error) { + ids, err := c.CreateHrJobs([]*HrJob{hj}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrJob creates a new hr.job model and returns its id. +func (c *Client) CreateHrJobs(hjs []*HrJob) ([]int64, error) { + var vv []interface{} + for _, v := range hjs { + vv = append(vv, v) + } + return c.Create(HrJobModel, vv, nil) +} + +// UpdateHrJob updates an existing hr.job record. +func (c *Client) UpdateHrJob(hj *HrJob) error { + return c.UpdateHrJobs([]int64{hj.Id.Get()}, hj) +} + +// UpdateHrJobs updates existing hr.job records. +// All records (represented by ids) will be updated by hj values. +func (c *Client) UpdateHrJobs(ids []int64, hj *HrJob) error { + return c.Update(HrJobModel, ids, hj, nil) +} + +// DeleteHrJob deletes an existing hr.job record. +func (c *Client) DeleteHrJob(id int64) error { + return c.DeleteHrJobs([]int64{id}) +} + +// DeleteHrJobs deletes existing hr.job records. +func (c *Client) DeleteHrJobs(ids []int64) error { + return c.Delete(HrJobModel, ids) +} + +// GetHrJob gets hr.job existing record. +func (c *Client) GetHrJob(id int64) (*HrJob, error) { + hjs, err := c.GetHrJobs([]int64{id}) + if err != nil { + return nil, err + } + return &((*hjs)[0]), nil +} + +// GetHrJobs gets hr.job existing records. +func (c *Client) GetHrJobs(ids []int64) (*HrJobs, error) { + hjs := &HrJobs{} + if err := c.Read(HrJobModel, ids, nil, hjs); err != nil { + return nil, err + } + return hjs, nil +} + +// FindHrJob finds hr.job record by querying it with criteria. +func (c *Client) FindHrJob(criteria *Criteria) (*HrJob, error) { + hjs := &HrJobs{} + if err := c.SearchRead(HrJobModel, criteria, NewOptions().Limit(1), hjs); err != nil { + return nil, err + } + return &((*hjs)[0]), nil +} + +// FindHrJobs finds hr.job records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrJobs(criteria *Criteria, options *Options) (*HrJobs, error) { + hjs := &HrJobs{} + if err := c.SearchRead(HrJobModel, criteria, options, hjs); err != nil { + return nil, err + } + return hjs, nil +} + +// FindHrJobIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrJobIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrJobModel, criteria, options) +} + +// FindHrJobId finds record id by querying it with criteria. +func (c *Client) FindHrJobId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrJobModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_job_platform.go b/hr_job_platform.go new file mode 100644 index 0000000..77fe73a --- /dev/null +++ b/hr_job_platform.go @@ -0,0 +1,119 @@ +package odoo + +// HrJobPlatform represents hr.job.platform model. +type HrJobPlatform struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Regex *String `xmlrpc:"regex,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrJobPlatforms represents array of hr.job.platform model. +type HrJobPlatforms []HrJobPlatform + +// HrJobPlatformModel is the odoo model name. +const HrJobPlatformModel = "hr.job.platform" + +// Many2One convert HrJobPlatform to *Many2One. +func (hjp *HrJobPlatform) Many2One() *Many2One { + return NewMany2One(hjp.Id.Get(), "") +} + +// CreateHrJobPlatform creates a new hr.job.platform model and returns its id. +func (c *Client) CreateHrJobPlatform(hjp *HrJobPlatform) (int64, error) { + ids, err := c.CreateHrJobPlatforms([]*HrJobPlatform{hjp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrJobPlatform creates a new hr.job.platform model and returns its id. +func (c *Client) CreateHrJobPlatforms(hjps []*HrJobPlatform) ([]int64, error) { + var vv []interface{} + for _, v := range hjps { + vv = append(vv, v) + } + return c.Create(HrJobPlatformModel, vv, nil) +} + +// UpdateHrJobPlatform updates an existing hr.job.platform record. +func (c *Client) UpdateHrJobPlatform(hjp *HrJobPlatform) error { + return c.UpdateHrJobPlatforms([]int64{hjp.Id.Get()}, hjp) +} + +// UpdateHrJobPlatforms updates existing hr.job.platform records. +// All records (represented by ids) will be updated by hjp values. +func (c *Client) UpdateHrJobPlatforms(ids []int64, hjp *HrJobPlatform) error { + return c.Update(HrJobPlatformModel, ids, hjp, nil) +} + +// DeleteHrJobPlatform deletes an existing hr.job.platform record. +func (c *Client) DeleteHrJobPlatform(id int64) error { + return c.DeleteHrJobPlatforms([]int64{id}) +} + +// DeleteHrJobPlatforms deletes existing hr.job.platform records. +func (c *Client) DeleteHrJobPlatforms(ids []int64) error { + return c.Delete(HrJobPlatformModel, ids) +} + +// GetHrJobPlatform gets hr.job.platform existing record. +func (c *Client) GetHrJobPlatform(id int64) (*HrJobPlatform, error) { + hjps, err := c.GetHrJobPlatforms([]int64{id}) + if err != nil { + return nil, err + } + return &((*hjps)[0]), nil +} + +// GetHrJobPlatforms gets hr.job.platform existing records. +func (c *Client) GetHrJobPlatforms(ids []int64) (*HrJobPlatforms, error) { + hjps := &HrJobPlatforms{} + if err := c.Read(HrJobPlatformModel, ids, nil, hjps); err != nil { + return nil, err + } + return hjps, nil +} + +// FindHrJobPlatform finds hr.job.platform record by querying it with criteria. +func (c *Client) FindHrJobPlatform(criteria *Criteria) (*HrJobPlatform, error) { + hjps := &HrJobPlatforms{} + if err := c.SearchRead(HrJobPlatformModel, criteria, NewOptions().Limit(1), hjps); err != nil { + return nil, err + } + return &((*hjps)[0]), nil +} + +// FindHrJobPlatforms finds hr.job.platform records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrJobPlatforms(criteria *Criteria, options *Options) (*HrJobPlatforms, error) { + hjps := &HrJobPlatforms{} + if err := c.SearchRead(HrJobPlatformModel, criteria, options, hjps); err != nil { + return nil, err + } + return hjps, nil +} + +// FindHrJobPlatformIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrJobPlatformIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrJobPlatformModel, criteria, options) +} + +// FindHrJobPlatformId finds record id by querying it with criteria. +func (c *Client) FindHrJobPlatformId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrJobPlatformModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_leave.go b/hr_leave.go new file mode 100644 index 0000000..4a79b17 --- /dev/null +++ b/hr_leave.go @@ -0,0 +1,187 @@ +package odoo + +// HrLeave represents hr.leave model. +type HrLeave struct { + ActiveEmployee *Bool `xmlrpc:"active_employee,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + CanApprove *Bool `xmlrpc:"can_approve,omitempty"` + CanCancel *Bool `xmlrpc:"can_cancel,omitempty"` + CanReset *Bool `xmlrpc:"can_reset,omitempty"` + Color *Int `xmlrpc:"color,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"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DurationDisplay *String `xmlrpc:"duration_display,omitempty"` + EmployeeCompanyId *Many2One `xmlrpc:"employee_company_id,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + FirstApproverId *Many2One `xmlrpc:"first_approver_id,omitempty"` + HasMandatoryDay *Bool `xmlrpc:"has_mandatory_day,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + HolidayStatusId *Many2One `xmlrpc:"holiday_status_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsHatched *Bool `xmlrpc:"is_hatched,omitempty"` + IsStriked *Bool `xmlrpc:"is_striked,omitempty"` + LastSeveralDays *Bool `xmlrpc:"last_several_days,omitempty"` + LeaveTypeIncreasesDuration *Bool `xmlrpc:"leave_type_increases_duration,omitempty"` + LeaveTypeRequestUnit *Selection `xmlrpc:"leave_type_request_unit,omitempty"` + LeaveTypeSupportDocument *Bool `xmlrpc:"leave_type_support_document,omitempty"` + ManagerId *Many2One `xmlrpc:"manager_id,omitempty"` + MeetingId *Many2One `xmlrpc:"meeting_id,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageMainAttachmentId *Many2One `xmlrpc:"message_main_attachment_id,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Notes *String `xmlrpc:"notes,omitempty"` + NumberOfDays *Float `xmlrpc:"number_of_days,omitempty"` + NumberOfHours *Float `xmlrpc:"number_of_hours,omitempty"` + PrivateName *String `xmlrpc:"private_name,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RequestDateFrom *Time `xmlrpc:"request_date_from,omitempty"` + RequestDateFromPeriod *Selection `xmlrpc:"request_date_from_period,omitempty"` + RequestDateTo *Time `xmlrpc:"request_date_to,omitempty"` + RequestHourFrom *Float `xmlrpc:"request_hour_from,omitempty"` + RequestHourTo *Float `xmlrpc:"request_hour_to,omitempty"` + RequestUnitHalf *Bool `xmlrpc:"request_unit_half,omitempty"` + RequestUnitHours *Bool `xmlrpc:"request_unit_hours,omitempty"` + ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omitempty"` + SecondApproverId *Many2One `xmlrpc:"second_approver_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + SupportedAttachmentIds *Relation `xmlrpc:"supported_attachment_ids,omitempty"` + SupportedAttachmentIdsCount *Int `xmlrpc:"supported_attachment_ids_count,omitempty"` + TimesheetIds *Relation `xmlrpc:"timesheet_ids,omitempty"` + Tz *Selection `xmlrpc:"tz,omitempty"` + TzMismatch *Bool `xmlrpc:"tz_mismatch,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + ValidationType *Selection `xmlrpc:"validation_type,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrLeaves represents array of hr.leave model. +type HrLeaves []HrLeave + +// HrLeaveModel is the odoo model name. +const HrLeaveModel = "hr.leave" + +// Many2One convert HrLeave to *Many2One. +func (hl *HrLeave) Many2One() *Many2One { + return NewMany2One(hl.Id.Get(), "") +} + +// CreateHrLeave creates a new hr.leave model and returns its id. +func (c *Client) CreateHrLeave(hl *HrLeave) (int64, error) { + ids, err := c.CreateHrLeaves([]*HrLeave{hl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrLeave creates a new hr.leave model and returns its id. +func (c *Client) CreateHrLeaves(hls []*HrLeave) ([]int64, error) { + var vv []interface{} + for _, v := range hls { + vv = append(vv, v) + } + return c.Create(HrLeaveModel, vv, nil) +} + +// UpdateHrLeave updates an existing hr.leave record. +func (c *Client) UpdateHrLeave(hl *HrLeave) error { + return c.UpdateHrLeaves([]int64{hl.Id.Get()}, hl) +} + +// UpdateHrLeaves updates existing hr.leave records. +// All records (represented by ids) will be updated by hl values. +func (c *Client) UpdateHrLeaves(ids []int64, hl *HrLeave) error { + return c.Update(HrLeaveModel, ids, hl, nil) +} + +// DeleteHrLeave deletes an existing hr.leave record. +func (c *Client) DeleteHrLeave(id int64) error { + return c.DeleteHrLeaves([]int64{id}) +} + +// DeleteHrLeaves deletes existing hr.leave records. +func (c *Client) DeleteHrLeaves(ids []int64) error { + return c.Delete(HrLeaveModel, ids) +} + +// GetHrLeave gets hr.leave existing record. +func (c *Client) GetHrLeave(id int64) (*HrLeave, error) { + hls, err := c.GetHrLeaves([]int64{id}) + if err != nil { + return nil, err + } + return &((*hls)[0]), nil +} + +// GetHrLeaves gets hr.leave existing records. +func (c *Client) GetHrLeaves(ids []int64) (*HrLeaves, error) { + hls := &HrLeaves{} + if err := c.Read(HrLeaveModel, ids, nil, hls); err != nil { + return nil, err + } + return hls, nil +} + +// FindHrLeave finds hr.leave record by querying it with criteria. +func (c *Client) FindHrLeave(criteria *Criteria) (*HrLeave, error) { + hls := &HrLeaves{} + if err := c.SearchRead(HrLeaveModel, criteria, NewOptions().Limit(1), hls); err != nil { + return nil, err + } + return &((*hls)[0]), nil +} + +// FindHrLeaves finds hr.leave records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaves(criteria *Criteria, options *Options) (*HrLeaves, error) { + hls := &HrLeaves{} + if err := c.SearchRead(HrLeaveModel, criteria, options, hls); err != nil { + return nil, err + } + return hls, nil +} + +// FindHrLeaveIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrLeaveModel, criteria, options) +} + +// FindHrLeaveId finds record id by querying it with criteria. +func (c *Client) FindHrLeaveId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrLeaveModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_leave_accrual_level.go b/hr_leave_accrual_level.go new file mode 100644 index 0000000..b60d8f7 --- /dev/null +++ b/hr_leave_accrual_level.go @@ -0,0 +1,148 @@ +package odoo + +// HrLeaveAccrualLevel represents hr.leave.accrual.level model. +type HrLeaveAccrualLevel struct { + AccrualPlanId *Many2One `xmlrpc:"accrual_plan_id,omitempty"` + AccrualValidity *Bool `xmlrpc:"accrual_validity,omitempty"` + AccrualValidityCount *Int `xmlrpc:"accrual_validity_count,omitempty"` + AccrualValidityType *Selection `xmlrpc:"accrual_validity_type,omitempty"` + AccruedGainTime *Selection `xmlrpc:"accrued_gain_time,omitempty"` + ActionWithUnusedAccruals *Selection `xmlrpc:"action_with_unused_accruals,omitempty"` + AddedValue *Float `xmlrpc:"added_value,omitempty"` + AddedValueType *Selection `xmlrpc:"added_value_type,omitempty"` + CanModifyValueType *Bool `xmlrpc:"can_modify_value_type,omitempty"` + CapAccruedTime *Bool `xmlrpc:"cap_accrued_time,omitempty"` + CapAccruedTimeYearly *Bool `xmlrpc:"cap_accrued_time_yearly,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FirstDay *Int `xmlrpc:"first_day,omitempty"` + FirstDayDisplay *Selection `xmlrpc:"first_day_display,omitempty"` + FirstMonth *Selection `xmlrpc:"first_month,omitempty"` + FirstMonthDay *Int `xmlrpc:"first_month_day,omitempty"` + FirstMonthDayDisplay *Selection `xmlrpc:"first_month_day_display,omitempty"` + Frequency *Selection `xmlrpc:"frequency,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MaximumLeave *Float `xmlrpc:"maximum_leave,omitempty"` + MaximumLeaveYearly *Float `xmlrpc:"maximum_leave_yearly,omitempty"` + PostponeMaxDays *Int `xmlrpc:"postpone_max_days,omitempty"` + SecondDay *Int `xmlrpc:"second_day,omitempty"` + SecondDayDisplay *Selection `xmlrpc:"second_day_display,omitempty"` + SecondMonth *Selection `xmlrpc:"second_month,omitempty"` + SecondMonthDay *Int `xmlrpc:"second_month_day,omitempty"` + SecondMonthDayDisplay *Selection `xmlrpc:"second_month_day_display,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + StartCount *Int `xmlrpc:"start_count,omitempty"` + StartType *Selection `xmlrpc:"start_type,omitempty"` + WeekDay *Selection `xmlrpc:"week_day,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + YearlyDay *Int `xmlrpc:"yearly_day,omitempty"` + YearlyDayDisplay *Selection `xmlrpc:"yearly_day_display,omitempty"` + YearlyMonth *Selection `xmlrpc:"yearly_month,omitempty"` +} + +// HrLeaveAccrualLevels represents array of hr.leave.accrual.level model. +type HrLeaveAccrualLevels []HrLeaveAccrualLevel + +// HrLeaveAccrualLevelModel is the odoo model name. +const HrLeaveAccrualLevelModel = "hr.leave.accrual.level" + +// Many2One convert HrLeaveAccrualLevel to *Many2One. +func (hlal *HrLeaveAccrualLevel) Many2One() *Many2One { + return NewMany2One(hlal.Id.Get(), "") +} + +// CreateHrLeaveAccrualLevel creates a new hr.leave.accrual.level model and returns its id. +func (c *Client) CreateHrLeaveAccrualLevel(hlal *HrLeaveAccrualLevel) (int64, error) { + ids, err := c.CreateHrLeaveAccrualLevels([]*HrLeaveAccrualLevel{hlal}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrLeaveAccrualLevel creates a new hr.leave.accrual.level model and returns its id. +func (c *Client) CreateHrLeaveAccrualLevels(hlals []*HrLeaveAccrualLevel) ([]int64, error) { + var vv []interface{} + for _, v := range hlals { + vv = append(vv, v) + } + return c.Create(HrLeaveAccrualLevelModel, vv, nil) +} + +// UpdateHrLeaveAccrualLevel updates an existing hr.leave.accrual.level record. +func (c *Client) UpdateHrLeaveAccrualLevel(hlal *HrLeaveAccrualLevel) error { + return c.UpdateHrLeaveAccrualLevels([]int64{hlal.Id.Get()}, hlal) +} + +// UpdateHrLeaveAccrualLevels updates existing hr.leave.accrual.level records. +// All records (represented by ids) will be updated by hlal values. +func (c *Client) UpdateHrLeaveAccrualLevels(ids []int64, hlal *HrLeaveAccrualLevel) error { + return c.Update(HrLeaveAccrualLevelModel, ids, hlal, nil) +} + +// DeleteHrLeaveAccrualLevel deletes an existing hr.leave.accrual.level record. +func (c *Client) DeleteHrLeaveAccrualLevel(id int64) error { + return c.DeleteHrLeaveAccrualLevels([]int64{id}) +} + +// DeleteHrLeaveAccrualLevels deletes existing hr.leave.accrual.level records. +func (c *Client) DeleteHrLeaveAccrualLevels(ids []int64) error { + return c.Delete(HrLeaveAccrualLevelModel, ids) +} + +// GetHrLeaveAccrualLevel gets hr.leave.accrual.level existing record. +func (c *Client) GetHrLeaveAccrualLevel(id int64) (*HrLeaveAccrualLevel, error) { + hlals, err := c.GetHrLeaveAccrualLevels([]int64{id}) + if err != nil { + return nil, err + } + return &((*hlals)[0]), nil +} + +// GetHrLeaveAccrualLevels gets hr.leave.accrual.level existing records. +func (c *Client) GetHrLeaveAccrualLevels(ids []int64) (*HrLeaveAccrualLevels, error) { + hlals := &HrLeaveAccrualLevels{} + if err := c.Read(HrLeaveAccrualLevelModel, ids, nil, hlals); err != nil { + return nil, err + } + return hlals, nil +} + +// FindHrLeaveAccrualLevel finds hr.leave.accrual.level record by querying it with criteria. +func (c *Client) FindHrLeaveAccrualLevel(criteria *Criteria) (*HrLeaveAccrualLevel, error) { + hlals := &HrLeaveAccrualLevels{} + if err := c.SearchRead(HrLeaveAccrualLevelModel, criteria, NewOptions().Limit(1), hlals); err != nil { + return nil, err + } + return &((*hlals)[0]), nil +} + +// FindHrLeaveAccrualLevels finds hr.leave.accrual.level records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveAccrualLevels(criteria *Criteria, options *Options) (*HrLeaveAccrualLevels, error) { + hlals := &HrLeaveAccrualLevels{} + if err := c.SearchRead(HrLeaveAccrualLevelModel, criteria, options, hlals); err != nil { + return nil, err + } + return hlals, nil +} + +// FindHrLeaveAccrualLevelIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveAccrualLevelIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrLeaveAccrualLevelModel, criteria, options) +} + +// FindHrLeaveAccrualLevelId finds record id by querying it with criteria. +func (c *Client) FindHrLeaveAccrualLevelId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrLeaveAccrualLevelModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_leave_accrual_plan.go b/hr_leave_accrual_plan.go new file mode 100644 index 0000000..80658b9 --- /dev/null +++ b/hr_leave_accrual_plan.go @@ -0,0 +1,133 @@ +package odoo + +// HrLeaveAccrualPlan represents hr.leave.accrual.plan model. +type HrLeaveAccrualPlan struct { + AccruedGainTime *Selection `xmlrpc:"accrued_gain_time,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + AddedValueType *Selection `xmlrpc:"added_value_type,omitempty"` + AllocationIds *Relation `xmlrpc:"allocation_ids,omitempty"` + CarryoverDate *Selection `xmlrpc:"carryover_date,omitempty"` + CarryoverDay *Int `xmlrpc:"carryover_day,omitempty"` + CarryoverDayDisplay *Selection `xmlrpc:"carryover_day_display,omitempty"` + CarryoverMonth *Selection `xmlrpc:"carryover_month,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeesCount *Int `xmlrpc:"employees_count,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsBasedOnWorkedTime *Bool `xmlrpc:"is_based_on_worked_time,omitempty"` + LevelCount *Int `xmlrpc:"level_count,omitempty"` + LevelIds *Relation `xmlrpc:"level_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ShowTransitionMode *Bool `xmlrpc:"show_transition_mode,omitempty"` + TimeOffTypeId *Many2One `xmlrpc:"time_off_type_id,omitempty"` + TransitionMode *Selection `xmlrpc:"transition_mode,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrLeaveAccrualPlans represents array of hr.leave.accrual.plan model. +type HrLeaveAccrualPlans []HrLeaveAccrualPlan + +// HrLeaveAccrualPlanModel is the odoo model name. +const HrLeaveAccrualPlanModel = "hr.leave.accrual.plan" + +// Many2One convert HrLeaveAccrualPlan to *Many2One. +func (hlap *HrLeaveAccrualPlan) Many2One() *Many2One { + return NewMany2One(hlap.Id.Get(), "") +} + +// CreateHrLeaveAccrualPlan creates a new hr.leave.accrual.plan model and returns its id. +func (c *Client) CreateHrLeaveAccrualPlan(hlap *HrLeaveAccrualPlan) (int64, error) { + ids, err := c.CreateHrLeaveAccrualPlans([]*HrLeaveAccrualPlan{hlap}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrLeaveAccrualPlan creates a new hr.leave.accrual.plan model and returns its id. +func (c *Client) CreateHrLeaveAccrualPlans(hlaps []*HrLeaveAccrualPlan) ([]int64, error) { + var vv []interface{} + for _, v := range hlaps { + vv = append(vv, v) + } + return c.Create(HrLeaveAccrualPlanModel, vv, nil) +} + +// UpdateHrLeaveAccrualPlan updates an existing hr.leave.accrual.plan record. +func (c *Client) UpdateHrLeaveAccrualPlan(hlap *HrLeaveAccrualPlan) error { + return c.UpdateHrLeaveAccrualPlans([]int64{hlap.Id.Get()}, hlap) +} + +// UpdateHrLeaveAccrualPlans updates existing hr.leave.accrual.plan records. +// All records (represented by ids) will be updated by hlap values. +func (c *Client) UpdateHrLeaveAccrualPlans(ids []int64, hlap *HrLeaveAccrualPlan) error { + return c.Update(HrLeaveAccrualPlanModel, ids, hlap, nil) +} + +// DeleteHrLeaveAccrualPlan deletes an existing hr.leave.accrual.plan record. +func (c *Client) DeleteHrLeaveAccrualPlan(id int64) error { + return c.DeleteHrLeaveAccrualPlans([]int64{id}) +} + +// DeleteHrLeaveAccrualPlans deletes existing hr.leave.accrual.plan records. +func (c *Client) DeleteHrLeaveAccrualPlans(ids []int64) error { + return c.Delete(HrLeaveAccrualPlanModel, ids) +} + +// GetHrLeaveAccrualPlan gets hr.leave.accrual.plan existing record. +func (c *Client) GetHrLeaveAccrualPlan(id int64) (*HrLeaveAccrualPlan, error) { + hlaps, err := c.GetHrLeaveAccrualPlans([]int64{id}) + if err != nil { + return nil, err + } + return &((*hlaps)[0]), nil +} + +// GetHrLeaveAccrualPlans gets hr.leave.accrual.plan existing records. +func (c *Client) GetHrLeaveAccrualPlans(ids []int64) (*HrLeaveAccrualPlans, error) { + hlaps := &HrLeaveAccrualPlans{} + if err := c.Read(HrLeaveAccrualPlanModel, ids, nil, hlaps); err != nil { + return nil, err + } + return hlaps, nil +} + +// FindHrLeaveAccrualPlan finds hr.leave.accrual.plan record by querying it with criteria. +func (c *Client) FindHrLeaveAccrualPlan(criteria *Criteria) (*HrLeaveAccrualPlan, error) { + hlaps := &HrLeaveAccrualPlans{} + if err := c.SearchRead(HrLeaveAccrualPlanModel, criteria, NewOptions().Limit(1), hlaps); err != nil { + return nil, err + } + return &((*hlaps)[0]), nil +} + +// FindHrLeaveAccrualPlans finds hr.leave.accrual.plan records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveAccrualPlans(criteria *Criteria, options *Options) (*HrLeaveAccrualPlans, error) { + hlaps := &HrLeaveAccrualPlans{} + if err := c.SearchRead(HrLeaveAccrualPlanModel, criteria, options, hlaps); err != nil { + return nil, err + } + return hlaps, nil +} + +// FindHrLeaveAccrualPlanIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveAccrualPlanIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrLeaveAccrualPlanModel, criteria, options) +} + +// FindHrLeaveAccrualPlanId finds record id by querying it with criteria. +func (c *Client) FindHrLeaveAccrualPlanId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrLeaveAccrualPlanModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_leave_allocation.go b/hr_leave_allocation.go new file mode 100644 index 0000000..81406c8 --- /dev/null +++ b/hr_leave_allocation.go @@ -0,0 +1,175 @@ +package odoo + +// HrLeaveAllocation represents hr.leave.allocation model. +type HrLeaveAllocation struct { + AccrualPlanId *Many2One `xmlrpc:"accrual_plan_id,omitempty"` + ActiveEmployee *Bool `xmlrpc:"active_employee,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + ActualLastcall *Time `xmlrpc:"actual_lastcall,omitempty"` + AllocationType *Selection `xmlrpc:"allocation_type,omitempty"` + AlreadyAccrued *Bool `xmlrpc:"already_accrued,omitempty"` + ApproverId *Many2One `xmlrpc:"approver_id,omitempty"` + CanApprove *Bool `xmlrpc:"can_approve,omitempty"` + CarriedOverDaysExpirationDate *Time `xmlrpc:"carried_over_days_expiration_date,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"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DurationDisplay *String `xmlrpc:"duration_display,omitempty"` + EmployeeCompanyId *Many2One `xmlrpc:"employee_company_id,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + ExpiringCarryoverDays *Float `xmlrpc:"expiring_carryover_days,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + HolidayStatusId *Many2One `xmlrpc:"holiday_status_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsNameCustom *Bool `xmlrpc:"is_name_custom,omitempty"` + IsOfficer *Bool `xmlrpc:"is_officer,omitempty"` + LastExecutedCarryoverDate *Time `xmlrpc:"last_executed_carryover_date,omitempty"` + Lastcall *Time `xmlrpc:"lastcall,omitempty"` + LeavesTaken *Float `xmlrpc:"leaves_taken,omitempty"` + ManagerId *Many2One `xmlrpc:"manager_id,omitempty"` + MaxLeaves *Float `xmlrpc:"max_leaves,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NameValidity *String `xmlrpc:"name_validity,omitempty"` + Nextcall *Time `xmlrpc:"nextcall,omitempty"` + Notes *String `xmlrpc:"notes,omitempty"` + NumberOfDays *Float `xmlrpc:"number_of_days,omitempty"` + NumberOfDaysDisplay *Float `xmlrpc:"number_of_days_display,omitempty"` + NumberOfHoursDisplay *Float `xmlrpc:"number_of_hours_display,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + SecondApproverId *Many2One `xmlrpc:"second_approver_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TypeRequestUnit *Selection `xmlrpc:"type_request_unit,omitempty"` + ValidationType *Selection `xmlrpc:"validation_type,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + YearlyAccruedAmount *Float `xmlrpc:"yearly_accrued_amount,omitempty"` +} + +// HrLeaveAllocations represents array of hr.leave.allocation model. +type HrLeaveAllocations []HrLeaveAllocation + +// HrLeaveAllocationModel is the odoo model name. +const HrLeaveAllocationModel = "hr.leave.allocation" + +// Many2One convert HrLeaveAllocation to *Many2One. +func (hla *HrLeaveAllocation) Many2One() *Many2One { + return NewMany2One(hla.Id.Get(), "") +} + +// CreateHrLeaveAllocation creates a new hr.leave.allocation model and returns its id. +func (c *Client) CreateHrLeaveAllocation(hla *HrLeaveAllocation) (int64, error) { + ids, err := c.CreateHrLeaveAllocations([]*HrLeaveAllocation{hla}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrLeaveAllocation creates a new hr.leave.allocation model and returns its id. +func (c *Client) CreateHrLeaveAllocations(hlas []*HrLeaveAllocation) ([]int64, error) { + var vv []interface{} + for _, v := range hlas { + vv = append(vv, v) + } + return c.Create(HrLeaveAllocationModel, vv, nil) +} + +// UpdateHrLeaveAllocation updates an existing hr.leave.allocation record. +func (c *Client) UpdateHrLeaveAllocation(hla *HrLeaveAllocation) error { + return c.UpdateHrLeaveAllocations([]int64{hla.Id.Get()}, hla) +} + +// UpdateHrLeaveAllocations updates existing hr.leave.allocation records. +// All records (represented by ids) will be updated by hla values. +func (c *Client) UpdateHrLeaveAllocations(ids []int64, hla *HrLeaveAllocation) error { + return c.Update(HrLeaveAllocationModel, ids, hla, nil) +} + +// DeleteHrLeaveAllocation deletes an existing hr.leave.allocation record. +func (c *Client) DeleteHrLeaveAllocation(id int64) error { + return c.DeleteHrLeaveAllocations([]int64{id}) +} + +// DeleteHrLeaveAllocations deletes existing hr.leave.allocation records. +func (c *Client) DeleteHrLeaveAllocations(ids []int64) error { + return c.Delete(HrLeaveAllocationModel, ids) +} + +// GetHrLeaveAllocation gets hr.leave.allocation existing record. +func (c *Client) GetHrLeaveAllocation(id int64) (*HrLeaveAllocation, error) { + hlas, err := c.GetHrLeaveAllocations([]int64{id}) + if err != nil { + return nil, err + } + return &((*hlas)[0]), nil +} + +// GetHrLeaveAllocations gets hr.leave.allocation existing records. +func (c *Client) GetHrLeaveAllocations(ids []int64) (*HrLeaveAllocations, error) { + hlas := &HrLeaveAllocations{} + if err := c.Read(HrLeaveAllocationModel, ids, nil, hlas); err != nil { + return nil, err + } + return hlas, nil +} + +// FindHrLeaveAllocation finds hr.leave.allocation record by querying it with criteria. +func (c *Client) FindHrLeaveAllocation(criteria *Criteria) (*HrLeaveAllocation, error) { + hlas := &HrLeaveAllocations{} + if err := c.SearchRead(HrLeaveAllocationModel, criteria, NewOptions().Limit(1), hlas); err != nil { + return nil, err + } + return &((*hlas)[0]), nil +} + +// FindHrLeaveAllocations finds hr.leave.allocation records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveAllocations(criteria *Criteria, options *Options) (*HrLeaveAllocations, error) { + hlas := &HrLeaveAllocations{} + if err := c.SearchRead(HrLeaveAllocationModel, criteria, options, hlas); err != nil { + return nil, err + } + return hlas, nil +} + +// FindHrLeaveAllocationIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveAllocationIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrLeaveAllocationModel, criteria, options) +} + +// FindHrLeaveAllocationId finds record id by querying it with criteria. +func (c *Client) FindHrLeaveAllocationId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrLeaveAllocationModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_leave_allocation_generate_multi_wizard.go b/hr_leave_allocation_generate_multi_wizard.go new file mode 100644 index 0000000..47a1f61 --- /dev/null +++ b/hr_leave_allocation_generate_multi_wizard.go @@ -0,0 +1,130 @@ +package odoo + +// HrLeaveAllocationGenerateMultiWizard represents hr.leave.allocation.generate.multi.wizard model. +type HrLeaveAllocationGenerateMultiWizard struct { + AccrualPlanId *Many2One `xmlrpc:"accrual_plan_id,omitempty"` + AllocationMode *Selection `xmlrpc:"allocation_mode,omitempty"` + AllocationType *Selection `xmlrpc:"allocation_type,omitempty"` + CategoryId *Many2One `xmlrpc:"category_id,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"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Duration *Float `xmlrpc:"duration,omitempty"` + EmployeeIds *Relation `xmlrpc:"employee_ids,omitempty"` + HolidayStatusId *Many2One `xmlrpc:"holiday_status_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Notes *String `xmlrpc:"notes,omitempty"` + RequestUnit *Selection `xmlrpc:"request_unit,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrLeaveAllocationGenerateMultiWizards represents array of hr.leave.allocation.generate.multi.wizard model. +type HrLeaveAllocationGenerateMultiWizards []HrLeaveAllocationGenerateMultiWizard + +// HrLeaveAllocationGenerateMultiWizardModel is the odoo model name. +const HrLeaveAllocationGenerateMultiWizardModel = "hr.leave.allocation.generate.multi.wizard" + +// Many2One convert HrLeaveAllocationGenerateMultiWizard to *Many2One. +func (hlagmw *HrLeaveAllocationGenerateMultiWizard) Many2One() *Many2One { + return NewMany2One(hlagmw.Id.Get(), "") +} + +// CreateHrLeaveAllocationGenerateMultiWizard creates a new hr.leave.allocation.generate.multi.wizard model and returns its id. +func (c *Client) CreateHrLeaveAllocationGenerateMultiWizard(hlagmw *HrLeaveAllocationGenerateMultiWizard) (int64, error) { + ids, err := c.CreateHrLeaveAllocationGenerateMultiWizards([]*HrLeaveAllocationGenerateMultiWizard{hlagmw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrLeaveAllocationGenerateMultiWizard creates a new hr.leave.allocation.generate.multi.wizard model and returns its id. +func (c *Client) CreateHrLeaveAllocationGenerateMultiWizards(hlagmws []*HrLeaveAllocationGenerateMultiWizard) ([]int64, error) { + var vv []interface{} + for _, v := range hlagmws { + vv = append(vv, v) + } + return c.Create(HrLeaveAllocationGenerateMultiWizardModel, vv, nil) +} + +// UpdateHrLeaveAllocationGenerateMultiWizard updates an existing hr.leave.allocation.generate.multi.wizard record. +func (c *Client) UpdateHrLeaveAllocationGenerateMultiWizard(hlagmw *HrLeaveAllocationGenerateMultiWizard) error { + return c.UpdateHrLeaveAllocationGenerateMultiWizards([]int64{hlagmw.Id.Get()}, hlagmw) +} + +// UpdateHrLeaveAllocationGenerateMultiWizards updates existing hr.leave.allocation.generate.multi.wizard records. +// All records (represented by ids) will be updated by hlagmw values. +func (c *Client) UpdateHrLeaveAllocationGenerateMultiWizards(ids []int64, hlagmw *HrLeaveAllocationGenerateMultiWizard) error { + return c.Update(HrLeaveAllocationGenerateMultiWizardModel, ids, hlagmw, nil) +} + +// DeleteHrLeaveAllocationGenerateMultiWizard deletes an existing hr.leave.allocation.generate.multi.wizard record. +func (c *Client) DeleteHrLeaveAllocationGenerateMultiWizard(id int64) error { + return c.DeleteHrLeaveAllocationGenerateMultiWizards([]int64{id}) +} + +// DeleteHrLeaveAllocationGenerateMultiWizards deletes existing hr.leave.allocation.generate.multi.wizard records. +func (c *Client) DeleteHrLeaveAllocationGenerateMultiWizards(ids []int64) error { + return c.Delete(HrLeaveAllocationGenerateMultiWizardModel, ids) +} + +// GetHrLeaveAllocationGenerateMultiWizard gets hr.leave.allocation.generate.multi.wizard existing record. +func (c *Client) GetHrLeaveAllocationGenerateMultiWizard(id int64) (*HrLeaveAllocationGenerateMultiWizard, error) { + hlagmws, err := c.GetHrLeaveAllocationGenerateMultiWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*hlagmws)[0]), nil +} + +// GetHrLeaveAllocationGenerateMultiWizards gets hr.leave.allocation.generate.multi.wizard existing records. +func (c *Client) GetHrLeaveAllocationGenerateMultiWizards(ids []int64) (*HrLeaveAllocationGenerateMultiWizards, error) { + hlagmws := &HrLeaveAllocationGenerateMultiWizards{} + if err := c.Read(HrLeaveAllocationGenerateMultiWizardModel, ids, nil, hlagmws); err != nil { + return nil, err + } + return hlagmws, nil +} + +// FindHrLeaveAllocationGenerateMultiWizard finds hr.leave.allocation.generate.multi.wizard record by querying it with criteria. +func (c *Client) FindHrLeaveAllocationGenerateMultiWizard(criteria *Criteria) (*HrLeaveAllocationGenerateMultiWizard, error) { + hlagmws := &HrLeaveAllocationGenerateMultiWizards{} + if err := c.SearchRead(HrLeaveAllocationGenerateMultiWizardModel, criteria, NewOptions().Limit(1), hlagmws); err != nil { + return nil, err + } + return &((*hlagmws)[0]), nil +} + +// FindHrLeaveAllocationGenerateMultiWizards finds hr.leave.allocation.generate.multi.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveAllocationGenerateMultiWizards(criteria *Criteria, options *Options) (*HrLeaveAllocationGenerateMultiWizards, error) { + hlagmws := &HrLeaveAllocationGenerateMultiWizards{} + if err := c.SearchRead(HrLeaveAllocationGenerateMultiWizardModel, criteria, options, hlagmws); err != nil { + return nil, err + } + return hlagmws, nil +} + +// FindHrLeaveAllocationGenerateMultiWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveAllocationGenerateMultiWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrLeaveAllocationGenerateMultiWizardModel, criteria, options) +} + +// FindHrLeaveAllocationGenerateMultiWizardId finds record id by querying it with criteria. +func (c *Client) FindHrLeaveAllocationGenerateMultiWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrLeaveAllocationGenerateMultiWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_leave_employee_type_report.go b/hr_leave_employee_type_report.go new file mode 100644 index 0000000..75ab6f4 --- /dev/null +++ b/hr_leave_employee_type_report.go @@ -0,0 +1,123 @@ +package odoo + +// HrLeaveEmployeeTypeReport represents hr.leave.employee.type.report model. +type HrLeaveEmployeeTypeReport struct { + ActiveEmployee *Bool `xmlrpc:"active_employee,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + DateFrom *Time `xmlrpc:"date_from,omitempty"` + DateTo *Time `xmlrpc:"date_to,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + HolidayStatus *Selection `xmlrpc:"holiday_status,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LeaveType *Many2One `xmlrpc:"leave_type,omitempty"` + NumberOfDays *Float `xmlrpc:"number_of_days,omitempty"` + NumberOfHours *Float `xmlrpc:"number_of_hours,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` +} + +// HrLeaveEmployeeTypeReports represents array of hr.leave.employee.type.report model. +type HrLeaveEmployeeTypeReports []HrLeaveEmployeeTypeReport + +// HrLeaveEmployeeTypeReportModel is the odoo model name. +const HrLeaveEmployeeTypeReportModel = "hr.leave.employee.type.report" + +// Many2One convert HrLeaveEmployeeTypeReport to *Many2One. +func (hletr *HrLeaveEmployeeTypeReport) Many2One() *Many2One { + return NewMany2One(hletr.Id.Get(), "") +} + +// CreateHrLeaveEmployeeTypeReport creates a new hr.leave.employee.type.report model and returns its id. +func (c *Client) CreateHrLeaveEmployeeTypeReport(hletr *HrLeaveEmployeeTypeReport) (int64, error) { + ids, err := c.CreateHrLeaveEmployeeTypeReports([]*HrLeaveEmployeeTypeReport{hletr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrLeaveEmployeeTypeReport creates a new hr.leave.employee.type.report model and returns its id. +func (c *Client) CreateHrLeaveEmployeeTypeReports(hletrs []*HrLeaveEmployeeTypeReport) ([]int64, error) { + var vv []interface{} + for _, v := range hletrs { + vv = append(vv, v) + } + return c.Create(HrLeaveEmployeeTypeReportModel, vv, nil) +} + +// UpdateHrLeaveEmployeeTypeReport updates an existing hr.leave.employee.type.report record. +func (c *Client) UpdateHrLeaveEmployeeTypeReport(hletr *HrLeaveEmployeeTypeReport) error { + return c.UpdateHrLeaveEmployeeTypeReports([]int64{hletr.Id.Get()}, hletr) +} + +// UpdateHrLeaveEmployeeTypeReports updates existing hr.leave.employee.type.report records. +// All records (represented by ids) will be updated by hletr values. +func (c *Client) UpdateHrLeaveEmployeeTypeReports(ids []int64, hletr *HrLeaveEmployeeTypeReport) error { + return c.Update(HrLeaveEmployeeTypeReportModel, ids, hletr, nil) +} + +// DeleteHrLeaveEmployeeTypeReport deletes an existing hr.leave.employee.type.report record. +func (c *Client) DeleteHrLeaveEmployeeTypeReport(id int64) error { + return c.DeleteHrLeaveEmployeeTypeReports([]int64{id}) +} + +// DeleteHrLeaveEmployeeTypeReports deletes existing hr.leave.employee.type.report records. +func (c *Client) DeleteHrLeaveEmployeeTypeReports(ids []int64) error { + return c.Delete(HrLeaveEmployeeTypeReportModel, ids) +} + +// GetHrLeaveEmployeeTypeReport gets hr.leave.employee.type.report existing record. +func (c *Client) GetHrLeaveEmployeeTypeReport(id int64) (*HrLeaveEmployeeTypeReport, error) { + hletrs, err := c.GetHrLeaveEmployeeTypeReports([]int64{id}) + if err != nil { + return nil, err + } + return &((*hletrs)[0]), nil +} + +// GetHrLeaveEmployeeTypeReports gets hr.leave.employee.type.report existing records. +func (c *Client) GetHrLeaveEmployeeTypeReports(ids []int64) (*HrLeaveEmployeeTypeReports, error) { + hletrs := &HrLeaveEmployeeTypeReports{} + if err := c.Read(HrLeaveEmployeeTypeReportModel, ids, nil, hletrs); err != nil { + return nil, err + } + return hletrs, nil +} + +// FindHrLeaveEmployeeTypeReport finds hr.leave.employee.type.report record by querying it with criteria. +func (c *Client) FindHrLeaveEmployeeTypeReport(criteria *Criteria) (*HrLeaveEmployeeTypeReport, error) { + hletrs := &HrLeaveEmployeeTypeReports{} + if err := c.SearchRead(HrLeaveEmployeeTypeReportModel, criteria, NewOptions().Limit(1), hletrs); err != nil { + return nil, err + } + return &((*hletrs)[0]), nil +} + +// FindHrLeaveEmployeeTypeReports finds hr.leave.employee.type.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveEmployeeTypeReports(criteria *Criteria, options *Options) (*HrLeaveEmployeeTypeReports, error) { + hletrs := &HrLeaveEmployeeTypeReports{} + if err := c.SearchRead(HrLeaveEmployeeTypeReportModel, criteria, options, hletrs); err != nil { + return nil, err + } + return hletrs, nil +} + +// FindHrLeaveEmployeeTypeReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveEmployeeTypeReportIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrLeaveEmployeeTypeReportModel, criteria, options) +} + +// FindHrLeaveEmployeeTypeReportId finds record id by querying it with criteria. +func (c *Client) FindHrLeaveEmployeeTypeReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrLeaveEmployeeTypeReportModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_leave_generate_multi_wizard.go b/hr_leave_generate_multi_wizard.go new file mode 100644 index 0000000..4918e01 --- /dev/null +++ b/hr_leave_generate_multi_wizard.go @@ -0,0 +1,125 @@ +package odoo + +// HrLeaveGenerateMultiWizard represents hr.leave.generate.multi.wizard model. +type HrLeaveGenerateMultiWizard struct { + AllocationMode *Selection `xmlrpc:"allocation_mode,omitempty"` + CategoryId *Many2One `xmlrpc:"category_id,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"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeIds *Relation `xmlrpc:"employee_ids,omitempty"` + HolidayStatusId *Many2One `xmlrpc:"holiday_status_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrLeaveGenerateMultiWizards represents array of hr.leave.generate.multi.wizard model. +type HrLeaveGenerateMultiWizards []HrLeaveGenerateMultiWizard + +// HrLeaveGenerateMultiWizardModel is the odoo model name. +const HrLeaveGenerateMultiWizardModel = "hr.leave.generate.multi.wizard" + +// Many2One convert HrLeaveGenerateMultiWizard to *Many2One. +func (hlgmw *HrLeaveGenerateMultiWizard) Many2One() *Many2One { + return NewMany2One(hlgmw.Id.Get(), "") +} + +// CreateHrLeaveGenerateMultiWizard creates a new hr.leave.generate.multi.wizard model and returns its id. +func (c *Client) CreateHrLeaveGenerateMultiWizard(hlgmw *HrLeaveGenerateMultiWizard) (int64, error) { + ids, err := c.CreateHrLeaveGenerateMultiWizards([]*HrLeaveGenerateMultiWizard{hlgmw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrLeaveGenerateMultiWizard creates a new hr.leave.generate.multi.wizard model and returns its id. +func (c *Client) CreateHrLeaveGenerateMultiWizards(hlgmws []*HrLeaveGenerateMultiWizard) ([]int64, error) { + var vv []interface{} + for _, v := range hlgmws { + vv = append(vv, v) + } + return c.Create(HrLeaveGenerateMultiWizardModel, vv, nil) +} + +// UpdateHrLeaveGenerateMultiWizard updates an existing hr.leave.generate.multi.wizard record. +func (c *Client) UpdateHrLeaveGenerateMultiWizard(hlgmw *HrLeaveGenerateMultiWizard) error { + return c.UpdateHrLeaveGenerateMultiWizards([]int64{hlgmw.Id.Get()}, hlgmw) +} + +// UpdateHrLeaveGenerateMultiWizards updates existing hr.leave.generate.multi.wizard records. +// All records (represented by ids) will be updated by hlgmw values. +func (c *Client) UpdateHrLeaveGenerateMultiWizards(ids []int64, hlgmw *HrLeaveGenerateMultiWizard) error { + return c.Update(HrLeaveGenerateMultiWizardModel, ids, hlgmw, nil) +} + +// DeleteHrLeaveGenerateMultiWizard deletes an existing hr.leave.generate.multi.wizard record. +func (c *Client) DeleteHrLeaveGenerateMultiWizard(id int64) error { + return c.DeleteHrLeaveGenerateMultiWizards([]int64{id}) +} + +// DeleteHrLeaveGenerateMultiWizards deletes existing hr.leave.generate.multi.wizard records. +func (c *Client) DeleteHrLeaveGenerateMultiWizards(ids []int64) error { + return c.Delete(HrLeaveGenerateMultiWizardModel, ids) +} + +// GetHrLeaveGenerateMultiWizard gets hr.leave.generate.multi.wizard existing record. +func (c *Client) GetHrLeaveGenerateMultiWizard(id int64) (*HrLeaveGenerateMultiWizard, error) { + hlgmws, err := c.GetHrLeaveGenerateMultiWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*hlgmws)[0]), nil +} + +// GetHrLeaveGenerateMultiWizards gets hr.leave.generate.multi.wizard existing records. +func (c *Client) GetHrLeaveGenerateMultiWizards(ids []int64) (*HrLeaveGenerateMultiWizards, error) { + hlgmws := &HrLeaveGenerateMultiWizards{} + if err := c.Read(HrLeaveGenerateMultiWizardModel, ids, nil, hlgmws); err != nil { + return nil, err + } + return hlgmws, nil +} + +// FindHrLeaveGenerateMultiWizard finds hr.leave.generate.multi.wizard record by querying it with criteria. +func (c *Client) FindHrLeaveGenerateMultiWizard(criteria *Criteria) (*HrLeaveGenerateMultiWizard, error) { + hlgmws := &HrLeaveGenerateMultiWizards{} + if err := c.SearchRead(HrLeaveGenerateMultiWizardModel, criteria, NewOptions().Limit(1), hlgmws); err != nil { + return nil, err + } + return &((*hlgmws)[0]), nil +} + +// FindHrLeaveGenerateMultiWizards finds hr.leave.generate.multi.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveGenerateMultiWizards(criteria *Criteria, options *Options) (*HrLeaveGenerateMultiWizards, error) { + hlgmws := &HrLeaveGenerateMultiWizards{} + if err := c.SearchRead(HrLeaveGenerateMultiWizardModel, criteria, options, hlgmws); err != nil { + return nil, err + } + return hlgmws, nil +} + +// FindHrLeaveGenerateMultiWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveGenerateMultiWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrLeaveGenerateMultiWizardModel, criteria, options) +} + +// FindHrLeaveGenerateMultiWizardId finds record id by querying it with criteria. +func (c *Client) FindHrLeaveGenerateMultiWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrLeaveGenerateMultiWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_leave_mandatory_day.go b/hr_leave_mandatory_day.go new file mode 100644 index 0000000..54b9b35 --- /dev/null +++ b/hr_leave_mandatory_day.go @@ -0,0 +1,123 @@ +package odoo + +// HrLeaveMandatoryDay represents hr.leave.mandatory.day model. +type HrLeaveMandatoryDay struct { + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DepartmentIds *Relation `xmlrpc:"department_ids,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EndDate *Time `xmlrpc:"end_date,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omitempty"` + StartDate *Time `xmlrpc:"start_date,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrLeaveMandatoryDays represents array of hr.leave.mandatory.day model. +type HrLeaveMandatoryDays []HrLeaveMandatoryDay + +// HrLeaveMandatoryDayModel is the odoo model name. +const HrLeaveMandatoryDayModel = "hr.leave.mandatory.day" + +// Many2One convert HrLeaveMandatoryDay to *Many2One. +func (hlmd *HrLeaveMandatoryDay) Many2One() *Many2One { + return NewMany2One(hlmd.Id.Get(), "") +} + +// CreateHrLeaveMandatoryDay creates a new hr.leave.mandatory.day model and returns its id. +func (c *Client) CreateHrLeaveMandatoryDay(hlmd *HrLeaveMandatoryDay) (int64, error) { + ids, err := c.CreateHrLeaveMandatoryDays([]*HrLeaveMandatoryDay{hlmd}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrLeaveMandatoryDay creates a new hr.leave.mandatory.day model and returns its id. +func (c *Client) CreateHrLeaveMandatoryDays(hlmds []*HrLeaveMandatoryDay) ([]int64, error) { + var vv []interface{} + for _, v := range hlmds { + vv = append(vv, v) + } + return c.Create(HrLeaveMandatoryDayModel, vv, nil) +} + +// UpdateHrLeaveMandatoryDay updates an existing hr.leave.mandatory.day record. +func (c *Client) UpdateHrLeaveMandatoryDay(hlmd *HrLeaveMandatoryDay) error { + return c.UpdateHrLeaveMandatoryDays([]int64{hlmd.Id.Get()}, hlmd) +} + +// UpdateHrLeaveMandatoryDays updates existing hr.leave.mandatory.day records. +// All records (represented by ids) will be updated by hlmd values. +func (c *Client) UpdateHrLeaveMandatoryDays(ids []int64, hlmd *HrLeaveMandatoryDay) error { + return c.Update(HrLeaveMandatoryDayModel, ids, hlmd, nil) +} + +// DeleteHrLeaveMandatoryDay deletes an existing hr.leave.mandatory.day record. +func (c *Client) DeleteHrLeaveMandatoryDay(id int64) error { + return c.DeleteHrLeaveMandatoryDays([]int64{id}) +} + +// DeleteHrLeaveMandatoryDays deletes existing hr.leave.mandatory.day records. +func (c *Client) DeleteHrLeaveMandatoryDays(ids []int64) error { + return c.Delete(HrLeaveMandatoryDayModel, ids) +} + +// GetHrLeaveMandatoryDay gets hr.leave.mandatory.day existing record. +func (c *Client) GetHrLeaveMandatoryDay(id int64) (*HrLeaveMandatoryDay, error) { + hlmds, err := c.GetHrLeaveMandatoryDays([]int64{id}) + if err != nil { + return nil, err + } + return &((*hlmds)[0]), nil +} + +// GetHrLeaveMandatoryDays gets hr.leave.mandatory.day existing records. +func (c *Client) GetHrLeaveMandatoryDays(ids []int64) (*HrLeaveMandatoryDays, error) { + hlmds := &HrLeaveMandatoryDays{} + if err := c.Read(HrLeaveMandatoryDayModel, ids, nil, hlmds); err != nil { + return nil, err + } + return hlmds, nil +} + +// FindHrLeaveMandatoryDay finds hr.leave.mandatory.day record by querying it with criteria. +func (c *Client) FindHrLeaveMandatoryDay(criteria *Criteria) (*HrLeaveMandatoryDay, error) { + hlmds := &HrLeaveMandatoryDays{} + if err := c.SearchRead(HrLeaveMandatoryDayModel, criteria, NewOptions().Limit(1), hlmds); err != nil { + return nil, err + } + return &((*hlmds)[0]), nil +} + +// FindHrLeaveMandatoryDays finds hr.leave.mandatory.day records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveMandatoryDays(criteria *Criteria, options *Options) (*HrLeaveMandatoryDays, error) { + hlmds := &HrLeaveMandatoryDays{} + if err := c.SearchRead(HrLeaveMandatoryDayModel, criteria, options, hlmds); err != nil { + return nil, err + } + return hlmds, nil +} + +// FindHrLeaveMandatoryDayIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveMandatoryDayIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrLeaveMandatoryDayModel, criteria, options) +} + +// FindHrLeaveMandatoryDayId finds record id by querying it with criteria. +func (c *Client) FindHrLeaveMandatoryDayId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrLeaveMandatoryDayModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_leave_report.go b/hr_leave_report.go new file mode 100644 index 0000000..7f43bbd --- /dev/null +++ b/hr_leave_report.go @@ -0,0 +1,126 @@ +package odoo + +// HrLeaveReport represents hr.leave.report model. +type HrLeaveReport struct { + AllocationId *Many2One `xmlrpc:"allocation_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + DateFrom *Time `xmlrpc:"date_from,omitempty"` + DateTo *Time `xmlrpc:"date_to,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + HasDepartmentManagerAccess *Bool `xmlrpc:"has_department_manager_access,omitempty"` + HolidayStatusId *Many2One `xmlrpc:"holiday_status_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LeaveId *Many2One `xmlrpc:"leave_id,omitempty"` + LeaveType *Selection `xmlrpc:"leave_type,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NumberOfDays *Float `xmlrpc:"number_of_days,omitempty"` + NumberOfHours *Float `xmlrpc:"number_of_hours,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` +} + +// HrLeaveReports represents array of hr.leave.report model. +type HrLeaveReports []HrLeaveReport + +// HrLeaveReportModel is the odoo model name. +const HrLeaveReportModel = "hr.leave.report" + +// Many2One convert HrLeaveReport to *Many2One. +func (hlr *HrLeaveReport) Many2One() *Many2One { + return NewMany2One(hlr.Id.Get(), "") +} + +// CreateHrLeaveReport creates a new hr.leave.report model and returns its id. +func (c *Client) CreateHrLeaveReport(hlr *HrLeaveReport) (int64, error) { + ids, err := c.CreateHrLeaveReports([]*HrLeaveReport{hlr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrLeaveReport creates a new hr.leave.report model and returns its id. +func (c *Client) CreateHrLeaveReports(hlrs []*HrLeaveReport) ([]int64, error) { + var vv []interface{} + for _, v := range hlrs { + vv = append(vv, v) + } + return c.Create(HrLeaveReportModel, vv, nil) +} + +// UpdateHrLeaveReport updates an existing hr.leave.report record. +func (c *Client) UpdateHrLeaveReport(hlr *HrLeaveReport) error { + return c.UpdateHrLeaveReports([]int64{hlr.Id.Get()}, hlr) +} + +// UpdateHrLeaveReports updates existing hr.leave.report records. +// All records (represented by ids) will be updated by hlr values. +func (c *Client) UpdateHrLeaveReports(ids []int64, hlr *HrLeaveReport) error { + return c.Update(HrLeaveReportModel, ids, hlr, nil) +} + +// DeleteHrLeaveReport deletes an existing hr.leave.report record. +func (c *Client) DeleteHrLeaveReport(id int64) error { + return c.DeleteHrLeaveReports([]int64{id}) +} + +// DeleteHrLeaveReports deletes existing hr.leave.report records. +func (c *Client) DeleteHrLeaveReports(ids []int64) error { + return c.Delete(HrLeaveReportModel, ids) +} + +// GetHrLeaveReport gets hr.leave.report existing record. +func (c *Client) GetHrLeaveReport(id int64) (*HrLeaveReport, error) { + hlrs, err := c.GetHrLeaveReports([]int64{id}) + if err != nil { + return nil, err + } + return &((*hlrs)[0]), nil +} + +// GetHrLeaveReports gets hr.leave.report existing records. +func (c *Client) GetHrLeaveReports(ids []int64) (*HrLeaveReports, error) { + hlrs := &HrLeaveReports{} + if err := c.Read(HrLeaveReportModel, ids, nil, hlrs); err != nil { + return nil, err + } + return hlrs, nil +} + +// FindHrLeaveReport finds hr.leave.report record by querying it with criteria. +func (c *Client) FindHrLeaveReport(criteria *Criteria) (*HrLeaveReport, error) { + hlrs := &HrLeaveReports{} + if err := c.SearchRead(HrLeaveReportModel, criteria, NewOptions().Limit(1), hlrs); err != nil { + return nil, err + } + return &((*hlrs)[0]), nil +} + +// FindHrLeaveReports finds hr.leave.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveReports(criteria *Criteria, options *Options) (*HrLeaveReports, error) { + hlrs := &HrLeaveReports{} + if err := c.SearchRead(HrLeaveReportModel, criteria, options, hlrs); err != nil { + return nil, err + } + return hlrs, nil +} + +// FindHrLeaveReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveReportIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrLeaveReportModel, criteria, options) +} + +// FindHrLeaveReportId finds record id by querying it with criteria. +func (c *Client) FindHrLeaveReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrLeaveReportModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_leave_report_calendar.go b/hr_leave_report_calendar.go new file mode 100644 index 0000000..0e1e709 --- /dev/null +++ b/hr_leave_report_calendar.go @@ -0,0 +1,130 @@ +package odoo + +// HrLeaveReportCalendar represents hr.leave.report.calendar model. +type HrLeaveReportCalendar struct { + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Duration *Float `xmlrpc:"duration,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + HolidayStatusId *Many2One `xmlrpc:"holiday_status_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsAbsent *Bool `xmlrpc:"is_absent,omitempty"` + IsHatched *Bool `xmlrpc:"is_hatched,omitempty"` + IsManager *Bool `xmlrpc:"is_manager,omitempty"` + IsStriked *Bool `xmlrpc:"is_striked,omitempty"` + JobId *Many2One `xmlrpc:"job_id,omitempty"` + LeaveId *Many2One `xmlrpc:"leave_id,omitempty"` + LeaveManagerId *Many2One `xmlrpc:"leave_manager_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + StartDatetime *Time `xmlrpc:"start_datetime,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StopDatetime *Time `xmlrpc:"stop_datetime,omitempty"` + Tz *Selection `xmlrpc:"tz,omitempty"` +} + +// HrLeaveReportCalendars represents array of hr.leave.report.calendar model. +type HrLeaveReportCalendars []HrLeaveReportCalendar + +// HrLeaveReportCalendarModel is the odoo model name. +const HrLeaveReportCalendarModel = "hr.leave.report.calendar" + +// Many2One convert HrLeaveReportCalendar to *Many2One. +func (hlrc *HrLeaveReportCalendar) Many2One() *Many2One { + return NewMany2One(hlrc.Id.Get(), "") +} + +// CreateHrLeaveReportCalendar creates a new hr.leave.report.calendar model and returns its id. +func (c *Client) CreateHrLeaveReportCalendar(hlrc *HrLeaveReportCalendar) (int64, error) { + ids, err := c.CreateHrLeaveReportCalendars([]*HrLeaveReportCalendar{hlrc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrLeaveReportCalendar creates a new hr.leave.report.calendar model and returns its id. +func (c *Client) CreateHrLeaveReportCalendars(hlrcs []*HrLeaveReportCalendar) ([]int64, error) { + var vv []interface{} + for _, v := range hlrcs { + vv = append(vv, v) + } + return c.Create(HrLeaveReportCalendarModel, vv, nil) +} + +// UpdateHrLeaveReportCalendar updates an existing hr.leave.report.calendar record. +func (c *Client) UpdateHrLeaveReportCalendar(hlrc *HrLeaveReportCalendar) error { + return c.UpdateHrLeaveReportCalendars([]int64{hlrc.Id.Get()}, hlrc) +} + +// UpdateHrLeaveReportCalendars updates existing hr.leave.report.calendar records. +// All records (represented by ids) will be updated by hlrc values. +func (c *Client) UpdateHrLeaveReportCalendars(ids []int64, hlrc *HrLeaveReportCalendar) error { + return c.Update(HrLeaveReportCalendarModel, ids, hlrc, nil) +} + +// DeleteHrLeaveReportCalendar deletes an existing hr.leave.report.calendar record. +func (c *Client) DeleteHrLeaveReportCalendar(id int64) error { + return c.DeleteHrLeaveReportCalendars([]int64{id}) +} + +// DeleteHrLeaveReportCalendars deletes existing hr.leave.report.calendar records. +func (c *Client) DeleteHrLeaveReportCalendars(ids []int64) error { + return c.Delete(HrLeaveReportCalendarModel, ids) +} + +// GetHrLeaveReportCalendar gets hr.leave.report.calendar existing record. +func (c *Client) GetHrLeaveReportCalendar(id int64) (*HrLeaveReportCalendar, error) { + hlrcs, err := c.GetHrLeaveReportCalendars([]int64{id}) + if err != nil { + return nil, err + } + return &((*hlrcs)[0]), nil +} + +// GetHrLeaveReportCalendars gets hr.leave.report.calendar existing records. +func (c *Client) GetHrLeaveReportCalendars(ids []int64) (*HrLeaveReportCalendars, error) { + hlrcs := &HrLeaveReportCalendars{} + if err := c.Read(HrLeaveReportCalendarModel, ids, nil, hlrcs); err != nil { + return nil, err + } + return hlrcs, nil +} + +// FindHrLeaveReportCalendar finds hr.leave.report.calendar record by querying it with criteria. +func (c *Client) FindHrLeaveReportCalendar(criteria *Criteria) (*HrLeaveReportCalendar, error) { + hlrcs := &HrLeaveReportCalendars{} + if err := c.SearchRead(HrLeaveReportCalendarModel, criteria, NewOptions().Limit(1), hlrcs); err != nil { + return nil, err + } + return &((*hlrcs)[0]), nil +} + +// FindHrLeaveReportCalendars finds hr.leave.report.calendar records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveReportCalendars(criteria *Criteria, options *Options) (*HrLeaveReportCalendars, error) { + hlrcs := &HrLeaveReportCalendars{} + if err := c.SearchRead(HrLeaveReportCalendarModel, criteria, options, hlrcs); err != nil { + return nil, err + } + return hlrcs, nil +} + +// FindHrLeaveReportCalendarIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveReportCalendarIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrLeaveReportCalendarModel, criteria, options) +} + +// FindHrLeaveReportCalendarId finds record id by querying it with criteria. +func (c *Client) FindHrLeaveReportCalendarId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrLeaveReportCalendarModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_leave_type.go b/hr_leave_type.go new file mode 100644 index 0000000..23fa4a4 --- /dev/null +++ b/hr_leave_type.go @@ -0,0 +1,151 @@ +package odoo + +// HrLeaveType represents hr.leave.type model. +type HrLeaveType struct { + AccrualCount *Float `xmlrpc:"accrual_count,omitempty"` + AccrualsIds *Relation `xmlrpc:"accruals_ids,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + AllocationCount *Int `xmlrpc:"allocation_count,omitempty"` + AllocationNotifSubtypeId *Many2One `xmlrpc:"allocation_notif_subtype_id,omitempty"` + AllocationValidationType *Selection `xmlrpc:"allocation_validation_type,omitempty"` + AllowsNegative *Bool `xmlrpc:"allows_negative,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CreateCalendarMeeting *Bool `xmlrpc:"create_calendar_meeting,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeRequests *Selection `xmlrpc:"employee_requests,omitempty"` + GroupDaysLeave *Float `xmlrpc:"group_days_leave,omitempty"` + HasValidAllocation *Bool `xmlrpc:"has_valid_allocation,omitempty"` + IconId *Many2One `xmlrpc:"icon_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IncludePublicHolidaysInDuration *Bool `xmlrpc:"include_public_holidays_in_duration,omitempty"` + LeaveNotifSubtypeId *Many2One `xmlrpc:"leave_notif_subtype_id,omitempty"` + LeaveValidationType *Selection `xmlrpc:"leave_validation_type,omitempty"` + LeavesTaken *Float `xmlrpc:"leaves_taken,omitempty"` + MaxAllowedNegative *Int `xmlrpc:"max_allowed_negative,omitempty"` + MaxLeaves *Float `xmlrpc:"max_leaves,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + RequestUnit *Selection `xmlrpc:"request_unit,omitempty"` + RequiresAllocation *Selection `xmlrpc:"requires_allocation,omitempty"` + ResponsibleIds *Relation `xmlrpc:"responsible_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + ShowOnDashboard *Bool `xmlrpc:"show_on_dashboard,omitempty"` + SupportDocument *Bool `xmlrpc:"support_document,omitempty"` + TimeType *Selection `xmlrpc:"time_type,omitempty"` + TimesheetGenerate *Bool `xmlrpc:"timesheet_generate,omitempty"` + TimesheetProjectId *Many2One `xmlrpc:"timesheet_project_id,omitempty"` + TimesheetTaskId *Many2One `xmlrpc:"timesheet_task_id,omitempty"` + Unpaid *Bool `xmlrpc:"unpaid,omitempty"` + VirtualRemainingLeaves *Float `xmlrpc:"virtual_remaining_leaves,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrLeaveTypes represents array of hr.leave.type model. +type HrLeaveTypes []HrLeaveType + +// HrLeaveTypeModel is the odoo model name. +const HrLeaveTypeModel = "hr.leave.type" + +// Many2One convert HrLeaveType to *Many2One. +func (hlt *HrLeaveType) Many2One() *Many2One { + return NewMany2One(hlt.Id.Get(), "") +} + +// CreateHrLeaveType creates a new hr.leave.type model and returns its id. +func (c *Client) CreateHrLeaveType(hlt *HrLeaveType) (int64, error) { + ids, err := c.CreateHrLeaveTypes([]*HrLeaveType{hlt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrLeaveType creates a new hr.leave.type model and returns its id. +func (c *Client) CreateHrLeaveTypes(hlts []*HrLeaveType) ([]int64, error) { + var vv []interface{} + for _, v := range hlts { + vv = append(vv, v) + } + return c.Create(HrLeaveTypeModel, vv, nil) +} + +// UpdateHrLeaveType updates an existing hr.leave.type record. +func (c *Client) UpdateHrLeaveType(hlt *HrLeaveType) error { + return c.UpdateHrLeaveTypes([]int64{hlt.Id.Get()}, hlt) +} + +// UpdateHrLeaveTypes updates existing hr.leave.type records. +// All records (represented by ids) will be updated by hlt values. +func (c *Client) UpdateHrLeaveTypes(ids []int64, hlt *HrLeaveType) error { + return c.Update(HrLeaveTypeModel, ids, hlt, nil) +} + +// DeleteHrLeaveType deletes an existing hr.leave.type record. +func (c *Client) DeleteHrLeaveType(id int64) error { + return c.DeleteHrLeaveTypes([]int64{id}) +} + +// DeleteHrLeaveTypes deletes existing hr.leave.type records. +func (c *Client) DeleteHrLeaveTypes(ids []int64) error { + return c.Delete(HrLeaveTypeModel, ids) +} + +// GetHrLeaveType gets hr.leave.type existing record. +func (c *Client) GetHrLeaveType(id int64) (*HrLeaveType, error) { + hlts, err := c.GetHrLeaveTypes([]int64{id}) + if err != nil { + return nil, err + } + return &((*hlts)[0]), nil +} + +// GetHrLeaveTypes gets hr.leave.type existing records. +func (c *Client) GetHrLeaveTypes(ids []int64) (*HrLeaveTypes, error) { + hlts := &HrLeaveTypes{} + if err := c.Read(HrLeaveTypeModel, ids, nil, hlts); err != nil { + return nil, err + } + return hlts, nil +} + +// FindHrLeaveType finds hr.leave.type record by querying it with criteria. +func (c *Client) FindHrLeaveType(criteria *Criteria) (*HrLeaveType, error) { + hlts := &HrLeaveTypes{} + if err := c.SearchRead(HrLeaveTypeModel, criteria, NewOptions().Limit(1), hlts); err != nil { + return nil, err + } + return &((*hlts)[0]), nil +} + +// FindHrLeaveTypes finds hr.leave.type records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveTypes(criteria *Criteria, options *Options) (*HrLeaveTypes, error) { + hlts := &HrLeaveTypes{} + if err := c.SearchRead(HrLeaveTypeModel, criteria, options, hlts); err != nil { + return nil, err + } + return hlts, nil +} + +// FindHrLeaveTypeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrLeaveTypeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrLeaveTypeModel, criteria, options) +} + +// FindHrLeaveTypeId finds record id by querying it with criteria. +func (c *Client) FindHrLeaveTypeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrLeaveTypeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_payroll_structure_type.go b/hr_payroll_structure_type.go new file mode 100644 index 0000000..54869ea --- /dev/null +++ b/hr_payroll_structure_type.go @@ -0,0 +1,120 @@ +package odoo + +// HrPayrollStructureType represents hr.payroll.structure.type model. +type HrPayrollStructureType struct { + CountryCode *String `xmlrpc:"country_code,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DefaultResourceCalendarId *Many2One `xmlrpc:"default_resource_calendar_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrPayrollStructureTypes represents array of hr.payroll.structure.type model. +type HrPayrollStructureTypes []HrPayrollStructureType + +// HrPayrollStructureTypeModel is the odoo model name. +const HrPayrollStructureTypeModel = "hr.payroll.structure.type" + +// Many2One convert HrPayrollStructureType to *Many2One. +func (hpst *HrPayrollStructureType) Many2One() *Many2One { + return NewMany2One(hpst.Id.Get(), "") +} + +// CreateHrPayrollStructureType creates a new hr.payroll.structure.type model and returns its id. +func (c *Client) CreateHrPayrollStructureType(hpst *HrPayrollStructureType) (int64, error) { + ids, err := c.CreateHrPayrollStructureTypes([]*HrPayrollStructureType{hpst}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrPayrollStructureType creates a new hr.payroll.structure.type model and returns its id. +func (c *Client) CreateHrPayrollStructureTypes(hpsts []*HrPayrollStructureType) ([]int64, error) { + var vv []interface{} + for _, v := range hpsts { + vv = append(vv, v) + } + return c.Create(HrPayrollStructureTypeModel, vv, nil) +} + +// UpdateHrPayrollStructureType updates an existing hr.payroll.structure.type record. +func (c *Client) UpdateHrPayrollStructureType(hpst *HrPayrollStructureType) error { + return c.UpdateHrPayrollStructureTypes([]int64{hpst.Id.Get()}, hpst) +} + +// UpdateHrPayrollStructureTypes updates existing hr.payroll.structure.type records. +// All records (represented by ids) will be updated by hpst values. +func (c *Client) UpdateHrPayrollStructureTypes(ids []int64, hpst *HrPayrollStructureType) error { + return c.Update(HrPayrollStructureTypeModel, ids, hpst, nil) +} + +// DeleteHrPayrollStructureType deletes an existing hr.payroll.structure.type record. +func (c *Client) DeleteHrPayrollStructureType(id int64) error { + return c.DeleteHrPayrollStructureTypes([]int64{id}) +} + +// DeleteHrPayrollStructureTypes deletes existing hr.payroll.structure.type records. +func (c *Client) DeleteHrPayrollStructureTypes(ids []int64) error { + return c.Delete(HrPayrollStructureTypeModel, ids) +} + +// GetHrPayrollStructureType gets hr.payroll.structure.type existing record. +func (c *Client) GetHrPayrollStructureType(id int64) (*HrPayrollStructureType, error) { + hpsts, err := c.GetHrPayrollStructureTypes([]int64{id}) + if err != nil { + return nil, err + } + return &((*hpsts)[0]), nil +} + +// GetHrPayrollStructureTypes gets hr.payroll.structure.type existing records. +func (c *Client) GetHrPayrollStructureTypes(ids []int64) (*HrPayrollStructureTypes, error) { + hpsts := &HrPayrollStructureTypes{} + if err := c.Read(HrPayrollStructureTypeModel, ids, nil, hpsts); err != nil { + return nil, err + } + return hpsts, nil +} + +// FindHrPayrollStructureType finds hr.payroll.structure.type record by querying it with criteria. +func (c *Client) FindHrPayrollStructureType(criteria *Criteria) (*HrPayrollStructureType, error) { + hpsts := &HrPayrollStructureTypes{} + if err := c.SearchRead(HrPayrollStructureTypeModel, criteria, NewOptions().Limit(1), hpsts); err != nil { + return nil, err + } + return &((*hpsts)[0]), nil +} + +// FindHrPayrollStructureTypes finds hr.payroll.structure.type records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrPayrollStructureTypes(criteria *Criteria, options *Options) (*HrPayrollStructureTypes, error) { + hpsts := &HrPayrollStructureTypes{} + if err := c.SearchRead(HrPayrollStructureTypeModel, criteria, options, hpsts); err != nil { + return nil, err + } + return hpsts, nil +} + +// FindHrPayrollStructureTypeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrPayrollStructureTypeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrPayrollStructureTypeModel, criteria, options) +} + +// FindHrPayrollStructureTypeId finds record id by querying it with criteria. +func (c *Client) FindHrPayrollStructureTypeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrPayrollStructureTypeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_recruitment_degree.go b/hr_recruitment_degree.go new file mode 100644 index 0000000..c36e315 --- /dev/null +++ b/hr_recruitment_degree.go @@ -0,0 +1,118 @@ +package odoo + +// HrRecruitmentDegree represents hr.recruitment.degree model. +type HrRecruitmentDegree struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrRecruitmentDegrees represents array of hr.recruitment.degree model. +type HrRecruitmentDegrees []HrRecruitmentDegree + +// HrRecruitmentDegreeModel is the odoo model name. +const HrRecruitmentDegreeModel = "hr.recruitment.degree" + +// Many2One convert HrRecruitmentDegree to *Many2One. +func (hrd *HrRecruitmentDegree) Many2One() *Many2One { + return NewMany2One(hrd.Id.Get(), "") +} + +// CreateHrRecruitmentDegree creates a new hr.recruitment.degree model and returns its id. +func (c *Client) CreateHrRecruitmentDegree(hrd *HrRecruitmentDegree) (int64, error) { + ids, err := c.CreateHrRecruitmentDegrees([]*HrRecruitmentDegree{hrd}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrRecruitmentDegree creates a new hr.recruitment.degree model and returns its id. +func (c *Client) CreateHrRecruitmentDegrees(hrds []*HrRecruitmentDegree) ([]int64, error) { + var vv []interface{} + for _, v := range hrds { + vv = append(vv, v) + } + return c.Create(HrRecruitmentDegreeModel, vv, nil) +} + +// UpdateHrRecruitmentDegree updates an existing hr.recruitment.degree record. +func (c *Client) UpdateHrRecruitmentDegree(hrd *HrRecruitmentDegree) error { + return c.UpdateHrRecruitmentDegrees([]int64{hrd.Id.Get()}, hrd) +} + +// UpdateHrRecruitmentDegrees updates existing hr.recruitment.degree records. +// All records (represented by ids) will be updated by hrd values. +func (c *Client) UpdateHrRecruitmentDegrees(ids []int64, hrd *HrRecruitmentDegree) error { + return c.Update(HrRecruitmentDegreeModel, ids, hrd, nil) +} + +// DeleteHrRecruitmentDegree deletes an existing hr.recruitment.degree record. +func (c *Client) DeleteHrRecruitmentDegree(id int64) error { + return c.DeleteHrRecruitmentDegrees([]int64{id}) +} + +// DeleteHrRecruitmentDegrees deletes existing hr.recruitment.degree records. +func (c *Client) DeleteHrRecruitmentDegrees(ids []int64) error { + return c.Delete(HrRecruitmentDegreeModel, ids) +} + +// GetHrRecruitmentDegree gets hr.recruitment.degree existing record. +func (c *Client) GetHrRecruitmentDegree(id int64) (*HrRecruitmentDegree, error) { + hrds, err := c.GetHrRecruitmentDegrees([]int64{id}) + if err != nil { + return nil, err + } + return &((*hrds)[0]), nil +} + +// GetHrRecruitmentDegrees gets hr.recruitment.degree existing records. +func (c *Client) GetHrRecruitmentDegrees(ids []int64) (*HrRecruitmentDegrees, error) { + hrds := &HrRecruitmentDegrees{} + if err := c.Read(HrRecruitmentDegreeModel, ids, nil, hrds); err != nil { + return nil, err + } + return hrds, nil +} + +// FindHrRecruitmentDegree finds hr.recruitment.degree record by querying it with criteria. +func (c *Client) FindHrRecruitmentDegree(criteria *Criteria) (*HrRecruitmentDegree, error) { + hrds := &HrRecruitmentDegrees{} + if err := c.SearchRead(HrRecruitmentDegreeModel, criteria, NewOptions().Limit(1), hrds); err != nil { + return nil, err + } + return &((*hrds)[0]), nil +} + +// FindHrRecruitmentDegrees finds hr.recruitment.degree records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrRecruitmentDegrees(criteria *Criteria, options *Options) (*HrRecruitmentDegrees, error) { + hrds := &HrRecruitmentDegrees{} + if err := c.SearchRead(HrRecruitmentDegreeModel, criteria, options, hrds); err != nil { + return nil, err + } + return hrds, nil +} + +// FindHrRecruitmentDegreeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrRecruitmentDegreeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrRecruitmentDegreeModel, criteria, options) +} + +// FindHrRecruitmentDegreeId finds record id by querying it with criteria. +func (c *Client) FindHrRecruitmentDegreeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrRecruitmentDegreeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_recruitment_source.go b/hr_recruitment_source.go new file mode 100644 index 0000000..a42307f --- /dev/null +++ b/hr_recruitment_source.go @@ -0,0 +1,123 @@ +package odoo + +// HrRecruitmentSource represents hr.recruitment.source model. +type HrRecruitmentSource struct { + AliasId *Many2One `xmlrpc:"alias_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + HasDomain *String `xmlrpc:"has_domain,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JobId *Many2One `xmlrpc:"job_id,omitempty"` + MediumId *Many2One `xmlrpc:"medium_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + SourceId *Many2One `xmlrpc:"source_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrRecruitmentSources represents array of hr.recruitment.source model. +type HrRecruitmentSources []HrRecruitmentSource + +// HrRecruitmentSourceModel is the odoo model name. +const HrRecruitmentSourceModel = "hr.recruitment.source" + +// Many2One convert HrRecruitmentSource to *Many2One. +func (hrs *HrRecruitmentSource) Many2One() *Many2One { + return NewMany2One(hrs.Id.Get(), "") +} + +// CreateHrRecruitmentSource creates a new hr.recruitment.source model and returns its id. +func (c *Client) CreateHrRecruitmentSource(hrs *HrRecruitmentSource) (int64, error) { + ids, err := c.CreateHrRecruitmentSources([]*HrRecruitmentSource{hrs}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrRecruitmentSource creates a new hr.recruitment.source model and returns its id. +func (c *Client) CreateHrRecruitmentSources(hrss []*HrRecruitmentSource) ([]int64, error) { + var vv []interface{} + for _, v := range hrss { + vv = append(vv, v) + } + return c.Create(HrRecruitmentSourceModel, vv, nil) +} + +// UpdateHrRecruitmentSource updates an existing hr.recruitment.source record. +func (c *Client) UpdateHrRecruitmentSource(hrs *HrRecruitmentSource) error { + return c.UpdateHrRecruitmentSources([]int64{hrs.Id.Get()}, hrs) +} + +// UpdateHrRecruitmentSources updates existing hr.recruitment.source records. +// All records (represented by ids) will be updated by hrs values. +func (c *Client) UpdateHrRecruitmentSources(ids []int64, hrs *HrRecruitmentSource) error { + return c.Update(HrRecruitmentSourceModel, ids, hrs, nil) +} + +// DeleteHrRecruitmentSource deletes an existing hr.recruitment.source record. +func (c *Client) DeleteHrRecruitmentSource(id int64) error { + return c.DeleteHrRecruitmentSources([]int64{id}) +} + +// DeleteHrRecruitmentSources deletes existing hr.recruitment.source records. +func (c *Client) DeleteHrRecruitmentSources(ids []int64) error { + return c.Delete(HrRecruitmentSourceModel, ids) +} + +// GetHrRecruitmentSource gets hr.recruitment.source existing record. +func (c *Client) GetHrRecruitmentSource(id int64) (*HrRecruitmentSource, error) { + hrss, err := c.GetHrRecruitmentSources([]int64{id}) + if err != nil { + return nil, err + } + return &((*hrss)[0]), nil +} + +// GetHrRecruitmentSources gets hr.recruitment.source existing records. +func (c *Client) GetHrRecruitmentSources(ids []int64) (*HrRecruitmentSources, error) { + hrss := &HrRecruitmentSources{} + if err := c.Read(HrRecruitmentSourceModel, ids, nil, hrss); err != nil { + return nil, err + } + return hrss, nil +} + +// FindHrRecruitmentSource finds hr.recruitment.source record by querying it with criteria. +func (c *Client) FindHrRecruitmentSource(criteria *Criteria) (*HrRecruitmentSource, error) { + hrss := &HrRecruitmentSources{} + if err := c.SearchRead(HrRecruitmentSourceModel, criteria, NewOptions().Limit(1), hrss); err != nil { + return nil, err + } + return &((*hrss)[0]), nil +} + +// FindHrRecruitmentSources finds hr.recruitment.source records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrRecruitmentSources(criteria *Criteria, options *Options) (*HrRecruitmentSources, error) { + hrss := &HrRecruitmentSources{} + if err := c.SearchRead(HrRecruitmentSourceModel, criteria, options, hrss); err != nil { + return nil, err + } + return hrss, nil +} + +// FindHrRecruitmentSourceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrRecruitmentSourceIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrRecruitmentSourceModel, criteria, options) +} + +// FindHrRecruitmentSourceId finds record id by querying it with criteria. +func (c *Client) FindHrRecruitmentSourceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrRecruitmentSourceModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_recruitment_stage.go b/hr_recruitment_stage.go new file mode 100644 index 0000000..c95f4ca --- /dev/null +++ b/hr_recruitment_stage.go @@ -0,0 +1,127 @@ +package odoo + +// HrRecruitmentStage represents hr.recruitment.stage model. +type HrRecruitmentStage struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Fold *Bool `xmlrpc:"fold,omitempty"` + HiredStage *Bool `xmlrpc:"hired_stage,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsWarningVisible *Bool `xmlrpc:"is_warning_visible,omitempty"` + JobIds *Relation `xmlrpc:"job_ids,omitempty"` + LegendBlocked *String `xmlrpc:"legend_blocked,omitempty"` + LegendDone *String `xmlrpc:"legend_done,omitempty"` + LegendNormal *String `xmlrpc:"legend_normal,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Requirements *String `xmlrpc:"requirements,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TemplateId *Many2One `xmlrpc:"template_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrRecruitmentStages represents array of hr.recruitment.stage model. +type HrRecruitmentStages []HrRecruitmentStage + +// HrRecruitmentStageModel is the odoo model name. +const HrRecruitmentStageModel = "hr.recruitment.stage" + +// Many2One convert HrRecruitmentStage to *Many2One. +func (hrs *HrRecruitmentStage) Many2One() *Many2One { + return NewMany2One(hrs.Id.Get(), "") +} + +// CreateHrRecruitmentStage creates a new hr.recruitment.stage model and returns its id. +func (c *Client) CreateHrRecruitmentStage(hrs *HrRecruitmentStage) (int64, error) { + ids, err := c.CreateHrRecruitmentStages([]*HrRecruitmentStage{hrs}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrRecruitmentStage creates a new hr.recruitment.stage model and returns its id. +func (c *Client) CreateHrRecruitmentStages(hrss []*HrRecruitmentStage) ([]int64, error) { + var vv []interface{} + for _, v := range hrss { + vv = append(vv, v) + } + return c.Create(HrRecruitmentStageModel, vv, nil) +} + +// UpdateHrRecruitmentStage updates an existing hr.recruitment.stage record. +func (c *Client) UpdateHrRecruitmentStage(hrs *HrRecruitmentStage) error { + return c.UpdateHrRecruitmentStages([]int64{hrs.Id.Get()}, hrs) +} + +// UpdateHrRecruitmentStages updates existing hr.recruitment.stage records. +// All records (represented by ids) will be updated by hrs values. +func (c *Client) UpdateHrRecruitmentStages(ids []int64, hrs *HrRecruitmentStage) error { + return c.Update(HrRecruitmentStageModel, ids, hrs, nil) +} + +// DeleteHrRecruitmentStage deletes an existing hr.recruitment.stage record. +func (c *Client) DeleteHrRecruitmentStage(id int64) error { + return c.DeleteHrRecruitmentStages([]int64{id}) +} + +// DeleteHrRecruitmentStages deletes existing hr.recruitment.stage records. +func (c *Client) DeleteHrRecruitmentStages(ids []int64) error { + return c.Delete(HrRecruitmentStageModel, ids) +} + +// GetHrRecruitmentStage gets hr.recruitment.stage existing record. +func (c *Client) GetHrRecruitmentStage(id int64) (*HrRecruitmentStage, error) { + hrss, err := c.GetHrRecruitmentStages([]int64{id}) + if err != nil { + return nil, err + } + return &((*hrss)[0]), nil +} + +// GetHrRecruitmentStages gets hr.recruitment.stage existing records. +func (c *Client) GetHrRecruitmentStages(ids []int64) (*HrRecruitmentStages, error) { + hrss := &HrRecruitmentStages{} + if err := c.Read(HrRecruitmentStageModel, ids, nil, hrss); err != nil { + return nil, err + } + return hrss, nil +} + +// FindHrRecruitmentStage finds hr.recruitment.stage record by querying it with criteria. +func (c *Client) FindHrRecruitmentStage(criteria *Criteria) (*HrRecruitmentStage, error) { + hrss := &HrRecruitmentStages{} + if err := c.SearchRead(HrRecruitmentStageModel, criteria, NewOptions().Limit(1), hrss); err != nil { + return nil, err + } + return &((*hrss)[0]), nil +} + +// FindHrRecruitmentStages finds hr.recruitment.stage records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrRecruitmentStages(criteria *Criteria, options *Options) (*HrRecruitmentStages, error) { + hrss := &HrRecruitmentStages{} + if err := c.SearchRead(HrRecruitmentStageModel, criteria, options, hrss); err != nil { + return nil, err + } + return hrss, nil +} + +// FindHrRecruitmentStageIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrRecruitmentStageIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrRecruitmentStageModel, criteria, options) +} + +// FindHrRecruitmentStageId finds record id by querying it with criteria. +func (c *Client) FindHrRecruitmentStageId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrRecruitmentStageModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_resume_line.go b/hr_resume_line.go new file mode 100644 index 0000000..10045c1 --- /dev/null +++ b/hr_resume_line.go @@ -0,0 +1,123 @@ +package odoo + +// HrResumeLine represents hr.resume.line model. +type HrResumeLine struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateEnd *Time `xmlrpc:"date_end,omitempty"` + DateStart *Time `xmlrpc:"date_start,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayType *Selection `xmlrpc:"display_type,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LineTypeId *Many2One `xmlrpc:"line_type_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrResumeLines represents array of hr.resume.line model. +type HrResumeLines []HrResumeLine + +// HrResumeLineModel is the odoo model name. +const HrResumeLineModel = "hr.resume.line" + +// Many2One convert HrResumeLine to *Many2One. +func (hrl *HrResumeLine) Many2One() *Many2One { + return NewMany2One(hrl.Id.Get(), "") +} + +// CreateHrResumeLine creates a new hr.resume.line model and returns its id. +func (c *Client) CreateHrResumeLine(hrl *HrResumeLine) (int64, error) { + ids, err := c.CreateHrResumeLines([]*HrResumeLine{hrl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrResumeLine creates a new hr.resume.line model and returns its id. +func (c *Client) CreateHrResumeLines(hrls []*HrResumeLine) ([]int64, error) { + var vv []interface{} + for _, v := range hrls { + vv = append(vv, v) + } + return c.Create(HrResumeLineModel, vv, nil) +} + +// UpdateHrResumeLine updates an existing hr.resume.line record. +func (c *Client) UpdateHrResumeLine(hrl *HrResumeLine) error { + return c.UpdateHrResumeLines([]int64{hrl.Id.Get()}, hrl) +} + +// UpdateHrResumeLines updates existing hr.resume.line records. +// All records (represented by ids) will be updated by hrl values. +func (c *Client) UpdateHrResumeLines(ids []int64, hrl *HrResumeLine) error { + return c.Update(HrResumeLineModel, ids, hrl, nil) +} + +// DeleteHrResumeLine deletes an existing hr.resume.line record. +func (c *Client) DeleteHrResumeLine(id int64) error { + return c.DeleteHrResumeLines([]int64{id}) +} + +// DeleteHrResumeLines deletes existing hr.resume.line records. +func (c *Client) DeleteHrResumeLines(ids []int64) error { + return c.Delete(HrResumeLineModel, ids) +} + +// GetHrResumeLine gets hr.resume.line existing record. +func (c *Client) GetHrResumeLine(id int64) (*HrResumeLine, error) { + hrls, err := c.GetHrResumeLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*hrls)[0]), nil +} + +// GetHrResumeLines gets hr.resume.line existing records. +func (c *Client) GetHrResumeLines(ids []int64) (*HrResumeLines, error) { + hrls := &HrResumeLines{} + if err := c.Read(HrResumeLineModel, ids, nil, hrls); err != nil { + return nil, err + } + return hrls, nil +} + +// FindHrResumeLine finds hr.resume.line record by querying it with criteria. +func (c *Client) FindHrResumeLine(criteria *Criteria) (*HrResumeLine, error) { + hrls := &HrResumeLines{} + if err := c.SearchRead(HrResumeLineModel, criteria, NewOptions().Limit(1), hrls); err != nil { + return nil, err + } + return &((*hrls)[0]), nil +} + +// FindHrResumeLines finds hr.resume.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrResumeLines(criteria *Criteria, options *Options) (*HrResumeLines, error) { + hrls := &HrResumeLines{} + if err := c.SearchRead(HrResumeLineModel, criteria, options, hrls); err != nil { + return nil, err + } + return hrls, nil +} + +// FindHrResumeLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrResumeLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrResumeLineModel, criteria, options) +} + +// FindHrResumeLineId finds record id by querying it with criteria. +func (c *Client) FindHrResumeLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrResumeLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_resume_line_type.go b/hr_resume_line_type.go new file mode 100644 index 0000000..a037e14 --- /dev/null +++ b/hr_resume_line_type.go @@ -0,0 +1,118 @@ +package odoo + +// HrResumeLineType represents hr.resume.line.type model. +type HrResumeLineType struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrResumeLineTypes represents array of hr.resume.line.type model. +type HrResumeLineTypes []HrResumeLineType + +// HrResumeLineTypeModel is the odoo model name. +const HrResumeLineTypeModel = "hr.resume.line.type" + +// Many2One convert HrResumeLineType to *Many2One. +func (hrlt *HrResumeLineType) Many2One() *Many2One { + return NewMany2One(hrlt.Id.Get(), "") +} + +// CreateHrResumeLineType creates a new hr.resume.line.type model and returns its id. +func (c *Client) CreateHrResumeLineType(hrlt *HrResumeLineType) (int64, error) { + ids, err := c.CreateHrResumeLineTypes([]*HrResumeLineType{hrlt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrResumeLineType creates a new hr.resume.line.type model and returns its id. +func (c *Client) CreateHrResumeLineTypes(hrlts []*HrResumeLineType) ([]int64, error) { + var vv []interface{} + for _, v := range hrlts { + vv = append(vv, v) + } + return c.Create(HrResumeLineTypeModel, vv, nil) +} + +// UpdateHrResumeLineType updates an existing hr.resume.line.type record. +func (c *Client) UpdateHrResumeLineType(hrlt *HrResumeLineType) error { + return c.UpdateHrResumeLineTypes([]int64{hrlt.Id.Get()}, hrlt) +} + +// UpdateHrResumeLineTypes updates existing hr.resume.line.type records. +// All records (represented by ids) will be updated by hrlt values. +func (c *Client) UpdateHrResumeLineTypes(ids []int64, hrlt *HrResumeLineType) error { + return c.Update(HrResumeLineTypeModel, ids, hrlt, nil) +} + +// DeleteHrResumeLineType deletes an existing hr.resume.line.type record. +func (c *Client) DeleteHrResumeLineType(id int64) error { + return c.DeleteHrResumeLineTypes([]int64{id}) +} + +// DeleteHrResumeLineTypes deletes existing hr.resume.line.type records. +func (c *Client) DeleteHrResumeLineTypes(ids []int64) error { + return c.Delete(HrResumeLineTypeModel, ids) +} + +// GetHrResumeLineType gets hr.resume.line.type existing record. +func (c *Client) GetHrResumeLineType(id int64) (*HrResumeLineType, error) { + hrlts, err := c.GetHrResumeLineTypes([]int64{id}) + if err != nil { + return nil, err + } + return &((*hrlts)[0]), nil +} + +// GetHrResumeLineTypes gets hr.resume.line.type existing records. +func (c *Client) GetHrResumeLineTypes(ids []int64) (*HrResumeLineTypes, error) { + hrlts := &HrResumeLineTypes{} + if err := c.Read(HrResumeLineTypeModel, ids, nil, hrlts); err != nil { + return nil, err + } + return hrlts, nil +} + +// FindHrResumeLineType finds hr.resume.line.type record by querying it with criteria. +func (c *Client) FindHrResumeLineType(criteria *Criteria) (*HrResumeLineType, error) { + hrlts := &HrResumeLineTypes{} + if err := c.SearchRead(HrResumeLineTypeModel, criteria, NewOptions().Limit(1), hrlts); err != nil { + return nil, err + } + return &((*hrlts)[0]), nil +} + +// FindHrResumeLineTypes finds hr.resume.line.type records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrResumeLineTypes(criteria *Criteria, options *Options) (*HrResumeLineTypes, error) { + hrlts := &HrResumeLineTypes{} + if err := c.SearchRead(HrResumeLineTypeModel, criteria, options, hrlts); err != nil { + return nil, err + } + return hrlts, nil +} + +// FindHrResumeLineTypeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrResumeLineTypeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrResumeLineTypeModel, criteria, options) +} + +// FindHrResumeLineTypeId finds record id by querying it with criteria. +func (c *Client) FindHrResumeLineTypeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrResumeLineTypeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_skill.go b/hr_skill.go new file mode 100644 index 0000000..e26999d --- /dev/null +++ b/hr_skill.go @@ -0,0 +1,120 @@ +package odoo + +// HrSkill represents hr.skill model. +type HrSkill struct { + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SkillTypeId *Many2One `xmlrpc:"skill_type_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrSkills represents array of hr.skill model. +type HrSkills []HrSkill + +// HrSkillModel is the odoo model name. +const HrSkillModel = "hr.skill" + +// Many2One convert HrSkill to *Many2One. +func (hs *HrSkill) Many2One() *Many2One { + return NewMany2One(hs.Id.Get(), "") +} + +// CreateHrSkill creates a new hr.skill model and returns its id. +func (c *Client) CreateHrSkill(hs *HrSkill) (int64, error) { + ids, err := c.CreateHrSkills([]*HrSkill{hs}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrSkill creates a new hr.skill model and returns its id. +func (c *Client) CreateHrSkills(hss []*HrSkill) ([]int64, error) { + var vv []interface{} + for _, v := range hss { + vv = append(vv, v) + } + return c.Create(HrSkillModel, vv, nil) +} + +// UpdateHrSkill updates an existing hr.skill record. +func (c *Client) UpdateHrSkill(hs *HrSkill) error { + return c.UpdateHrSkills([]int64{hs.Id.Get()}, hs) +} + +// UpdateHrSkills updates existing hr.skill records. +// All records (represented by ids) will be updated by hs values. +func (c *Client) UpdateHrSkills(ids []int64, hs *HrSkill) error { + return c.Update(HrSkillModel, ids, hs, nil) +} + +// DeleteHrSkill deletes an existing hr.skill record. +func (c *Client) DeleteHrSkill(id int64) error { + return c.DeleteHrSkills([]int64{id}) +} + +// DeleteHrSkills deletes existing hr.skill records. +func (c *Client) DeleteHrSkills(ids []int64) error { + return c.Delete(HrSkillModel, ids) +} + +// GetHrSkill gets hr.skill existing record. +func (c *Client) GetHrSkill(id int64) (*HrSkill, error) { + hss, err := c.GetHrSkills([]int64{id}) + if err != nil { + return nil, err + } + return &((*hss)[0]), nil +} + +// GetHrSkills gets hr.skill existing records. +func (c *Client) GetHrSkills(ids []int64) (*HrSkills, error) { + hss := &HrSkills{} + if err := c.Read(HrSkillModel, ids, nil, hss); err != nil { + return nil, err + } + return hss, nil +} + +// FindHrSkill finds hr.skill record by querying it with criteria. +func (c *Client) FindHrSkill(criteria *Criteria) (*HrSkill, error) { + hss := &HrSkills{} + if err := c.SearchRead(HrSkillModel, criteria, NewOptions().Limit(1), hss); err != nil { + return nil, err + } + return &((*hss)[0]), nil +} + +// FindHrSkills finds hr.skill records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrSkills(criteria *Criteria, options *Options) (*HrSkills, error) { + hss := &HrSkills{} + if err := c.SearchRead(HrSkillModel, criteria, options, hss); err != nil { + return nil, err + } + return hss, nil +} + +// FindHrSkillIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrSkillIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrSkillModel, criteria, options) +} + +// FindHrSkillId finds record id by querying it with criteria. +func (c *Client) FindHrSkillId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrSkillModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_skill_level.go b/hr_skill_level.go new file mode 100644 index 0000000..5ce1f69 --- /dev/null +++ b/hr_skill_level.go @@ -0,0 +1,120 @@ +package odoo + +// HrSkillLevel represents hr.skill.level model. +type HrSkillLevel struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DefaultLevel *Bool `xmlrpc:"default_level,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LevelProgress *Int `xmlrpc:"level_progress,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + SkillTypeId *Many2One `xmlrpc:"skill_type_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrSkillLevels represents array of hr.skill.level model. +type HrSkillLevels []HrSkillLevel + +// HrSkillLevelModel is the odoo model name. +const HrSkillLevelModel = "hr.skill.level" + +// Many2One convert HrSkillLevel to *Many2One. +func (hsl *HrSkillLevel) Many2One() *Many2One { + return NewMany2One(hsl.Id.Get(), "") +} + +// CreateHrSkillLevel creates a new hr.skill.level model and returns its id. +func (c *Client) CreateHrSkillLevel(hsl *HrSkillLevel) (int64, error) { + ids, err := c.CreateHrSkillLevels([]*HrSkillLevel{hsl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrSkillLevel creates a new hr.skill.level model and returns its id. +func (c *Client) CreateHrSkillLevels(hsls []*HrSkillLevel) ([]int64, error) { + var vv []interface{} + for _, v := range hsls { + vv = append(vv, v) + } + return c.Create(HrSkillLevelModel, vv, nil) +} + +// UpdateHrSkillLevel updates an existing hr.skill.level record. +func (c *Client) UpdateHrSkillLevel(hsl *HrSkillLevel) error { + return c.UpdateHrSkillLevels([]int64{hsl.Id.Get()}, hsl) +} + +// UpdateHrSkillLevels updates existing hr.skill.level records. +// All records (represented by ids) will be updated by hsl values. +func (c *Client) UpdateHrSkillLevels(ids []int64, hsl *HrSkillLevel) error { + return c.Update(HrSkillLevelModel, ids, hsl, nil) +} + +// DeleteHrSkillLevel deletes an existing hr.skill.level record. +func (c *Client) DeleteHrSkillLevel(id int64) error { + return c.DeleteHrSkillLevels([]int64{id}) +} + +// DeleteHrSkillLevels deletes existing hr.skill.level records. +func (c *Client) DeleteHrSkillLevels(ids []int64) error { + return c.Delete(HrSkillLevelModel, ids) +} + +// GetHrSkillLevel gets hr.skill.level existing record. +func (c *Client) GetHrSkillLevel(id int64) (*HrSkillLevel, error) { + hsls, err := c.GetHrSkillLevels([]int64{id}) + if err != nil { + return nil, err + } + return &((*hsls)[0]), nil +} + +// GetHrSkillLevels gets hr.skill.level existing records. +func (c *Client) GetHrSkillLevels(ids []int64) (*HrSkillLevels, error) { + hsls := &HrSkillLevels{} + if err := c.Read(HrSkillLevelModel, ids, nil, hsls); err != nil { + return nil, err + } + return hsls, nil +} + +// FindHrSkillLevel finds hr.skill.level record by querying it with criteria. +func (c *Client) FindHrSkillLevel(criteria *Criteria) (*HrSkillLevel, error) { + hsls := &HrSkillLevels{} + if err := c.SearchRead(HrSkillLevelModel, criteria, NewOptions().Limit(1), hsls); err != nil { + return nil, err + } + return &((*hsls)[0]), nil +} + +// FindHrSkillLevels finds hr.skill.level records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrSkillLevels(criteria *Criteria, options *Options) (*HrSkillLevels, error) { + hsls := &HrSkillLevels{} + if err := c.SearchRead(HrSkillLevelModel, criteria, options, hsls); err != nil { + return nil, err + } + return hsls, nil +} + +// FindHrSkillLevelIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrSkillLevelIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrSkillLevelModel, criteria, options) +} + +// FindHrSkillLevelId finds record id by querying it with criteria. +func (c *Client) FindHrSkillLevelId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrSkillLevelModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_skill_type.go b/hr_skill_type.go new file mode 100644 index 0000000..ab0f381 --- /dev/null +++ b/hr_skill_type.go @@ -0,0 +1,121 @@ +package odoo + +// HrSkillType represents hr.skill.type model. +type HrSkillType struct { + Active *Bool `xmlrpc:"active,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + SkillIds *Relation `xmlrpc:"skill_ids,omitempty"` + SkillLevelIds *Relation `xmlrpc:"skill_level_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrSkillTypes represents array of hr.skill.type model. +type HrSkillTypes []HrSkillType + +// HrSkillTypeModel is the odoo model name. +const HrSkillTypeModel = "hr.skill.type" + +// Many2One convert HrSkillType to *Many2One. +func (hst *HrSkillType) Many2One() *Many2One { + return NewMany2One(hst.Id.Get(), "") +} + +// CreateHrSkillType creates a new hr.skill.type model and returns its id. +func (c *Client) CreateHrSkillType(hst *HrSkillType) (int64, error) { + ids, err := c.CreateHrSkillTypes([]*HrSkillType{hst}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrSkillType creates a new hr.skill.type model and returns its id. +func (c *Client) CreateHrSkillTypes(hsts []*HrSkillType) ([]int64, error) { + var vv []interface{} + for _, v := range hsts { + vv = append(vv, v) + } + return c.Create(HrSkillTypeModel, vv, nil) +} + +// UpdateHrSkillType updates an existing hr.skill.type record. +func (c *Client) UpdateHrSkillType(hst *HrSkillType) error { + return c.UpdateHrSkillTypes([]int64{hst.Id.Get()}, hst) +} + +// UpdateHrSkillTypes updates existing hr.skill.type records. +// All records (represented by ids) will be updated by hst values. +func (c *Client) UpdateHrSkillTypes(ids []int64, hst *HrSkillType) error { + return c.Update(HrSkillTypeModel, ids, hst, nil) +} + +// DeleteHrSkillType deletes an existing hr.skill.type record. +func (c *Client) DeleteHrSkillType(id int64) error { + return c.DeleteHrSkillTypes([]int64{id}) +} + +// DeleteHrSkillTypes deletes existing hr.skill.type records. +func (c *Client) DeleteHrSkillTypes(ids []int64) error { + return c.Delete(HrSkillTypeModel, ids) +} + +// GetHrSkillType gets hr.skill.type existing record. +func (c *Client) GetHrSkillType(id int64) (*HrSkillType, error) { + hsts, err := c.GetHrSkillTypes([]int64{id}) + if err != nil { + return nil, err + } + return &((*hsts)[0]), nil +} + +// GetHrSkillTypes gets hr.skill.type existing records. +func (c *Client) GetHrSkillTypes(ids []int64) (*HrSkillTypes, error) { + hsts := &HrSkillTypes{} + if err := c.Read(HrSkillTypeModel, ids, nil, hsts); err != nil { + return nil, err + } + return hsts, nil +} + +// FindHrSkillType finds hr.skill.type record by querying it with criteria. +func (c *Client) FindHrSkillType(criteria *Criteria) (*HrSkillType, error) { + hsts := &HrSkillTypes{} + if err := c.SearchRead(HrSkillTypeModel, criteria, NewOptions().Limit(1), hsts); err != nil { + return nil, err + } + return &((*hsts)[0]), nil +} + +// FindHrSkillTypes finds hr.skill.type records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrSkillTypes(criteria *Criteria, options *Options) (*HrSkillTypes, error) { + hsts := &HrSkillTypes{} + if err := c.SearchRead(HrSkillTypeModel, criteria, options, hsts); err != nil { + return nil, err + } + return hsts, nil +} + +// FindHrSkillTypeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrSkillTypeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrSkillTypeModel, criteria, options) +} + +// FindHrSkillTypeId finds record id by querying it with criteria. +func (c *Client) FindHrSkillTypeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrSkillTypeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/hr_work_location.go b/hr_work_location.go new file mode 100644 index 0000000..fe193c7 --- /dev/null +++ b/hr_work_location.go @@ -0,0 +1,122 @@ +package odoo + +// HrWorkLocation represents hr.work.location model. +type HrWorkLocation struct { + Active *Bool `xmlrpc:"active,omitempty"` + AddressId *Many2One `xmlrpc:"address_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LocationNumber *String `xmlrpc:"location_number,omitempty"` + LocationType *Selection `xmlrpc:"location_type,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// HrWorkLocations represents array of hr.work.location model. +type HrWorkLocations []HrWorkLocation + +// HrWorkLocationModel is the odoo model name. +const HrWorkLocationModel = "hr.work.location" + +// Many2One convert HrWorkLocation to *Many2One. +func (hwl *HrWorkLocation) Many2One() *Many2One { + return NewMany2One(hwl.Id.Get(), "") +} + +// CreateHrWorkLocation creates a new hr.work.location model and returns its id. +func (c *Client) CreateHrWorkLocation(hwl *HrWorkLocation) (int64, error) { + ids, err := c.CreateHrWorkLocations([]*HrWorkLocation{hwl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateHrWorkLocation creates a new hr.work.location model and returns its id. +func (c *Client) CreateHrWorkLocations(hwls []*HrWorkLocation) ([]int64, error) { + var vv []interface{} + for _, v := range hwls { + vv = append(vv, v) + } + return c.Create(HrWorkLocationModel, vv, nil) +} + +// UpdateHrWorkLocation updates an existing hr.work.location record. +func (c *Client) UpdateHrWorkLocation(hwl *HrWorkLocation) error { + return c.UpdateHrWorkLocations([]int64{hwl.Id.Get()}, hwl) +} + +// UpdateHrWorkLocations updates existing hr.work.location records. +// All records (represented by ids) will be updated by hwl values. +func (c *Client) UpdateHrWorkLocations(ids []int64, hwl *HrWorkLocation) error { + return c.Update(HrWorkLocationModel, ids, hwl, nil) +} + +// DeleteHrWorkLocation deletes an existing hr.work.location record. +func (c *Client) DeleteHrWorkLocation(id int64) error { + return c.DeleteHrWorkLocations([]int64{id}) +} + +// DeleteHrWorkLocations deletes existing hr.work.location records. +func (c *Client) DeleteHrWorkLocations(ids []int64) error { + return c.Delete(HrWorkLocationModel, ids) +} + +// GetHrWorkLocation gets hr.work.location existing record. +func (c *Client) GetHrWorkLocation(id int64) (*HrWorkLocation, error) { + hwls, err := c.GetHrWorkLocations([]int64{id}) + if err != nil { + return nil, err + } + return &((*hwls)[0]), nil +} + +// GetHrWorkLocations gets hr.work.location existing records. +func (c *Client) GetHrWorkLocations(ids []int64) (*HrWorkLocations, error) { + hwls := &HrWorkLocations{} + if err := c.Read(HrWorkLocationModel, ids, nil, hwls); err != nil { + return nil, err + } + return hwls, nil +} + +// FindHrWorkLocation finds hr.work.location record by querying it with criteria. +func (c *Client) FindHrWorkLocation(criteria *Criteria) (*HrWorkLocation, error) { + hwls := &HrWorkLocations{} + if err := c.SearchRead(HrWorkLocationModel, criteria, NewOptions().Limit(1), hwls); err != nil { + return nil, err + } + return &((*hwls)[0]), nil +} + +// FindHrWorkLocations finds hr.work.location records by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrWorkLocations(criteria *Criteria, options *Options) (*HrWorkLocations, error) { + hwls := &HrWorkLocations{} + if err := c.SearchRead(HrWorkLocationModel, criteria, options, hwls); err != nil { + return nil, err + } + return hwls, nil +} + +// FindHrWorkLocationIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindHrWorkLocationIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(HrWorkLocationModel, criteria, options) +} + +// FindHrWorkLocationId finds record id by querying it with criteria. +func (c *Client) FindHrWorkLocationId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(HrWorkLocationModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/iap_account.go b/iap_account.go new file mode 100644 index 0000000..479dfc7 --- /dev/null +++ b/iap_account.go @@ -0,0 +1,141 @@ +package odoo + +// IapAccount represents iap.account model. +type IapAccount struct { + AccountToken *String `xmlrpc:"account_token,omitempty"` + Balance *String `xmlrpc:"balance,omitempty"` + CompanyIds *Relation `xmlrpc:"company_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + SenderName *String `xmlrpc:"sender_name,omitempty"` + ServiceId *Many2One `xmlrpc:"service_id,omitempty"` + ServiceLocked *Bool `xmlrpc:"service_locked,omitempty"` + ServiceName *String `xmlrpc:"service_name,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + WarningThreshold *Float `xmlrpc:"warning_threshold,omitempty"` + WarningUserIds *Relation `xmlrpc:"warning_user_ids,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IapAccounts represents array of iap.account model. +type IapAccounts []IapAccount + +// IapAccountModel is the odoo model name. +const IapAccountModel = "iap.account" + +// Many2One convert IapAccount to *Many2One. +func (ia *IapAccount) Many2One() *Many2One { + return NewMany2One(ia.Id.Get(), "") +} + +// CreateIapAccount creates a new iap.account model and returns its id. +func (c *Client) CreateIapAccount(ia *IapAccount) (int64, error) { + ids, err := c.CreateIapAccounts([]*IapAccount{ia}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIapAccount creates a new iap.account model and returns its id. +func (c *Client) CreateIapAccounts(ias []*IapAccount) ([]int64, error) { + var vv []interface{} + for _, v := range ias { + vv = append(vv, v) + } + return c.Create(IapAccountModel, vv, nil) +} + +// UpdateIapAccount updates an existing iap.account record. +func (c *Client) UpdateIapAccount(ia *IapAccount) error { + return c.UpdateIapAccounts([]int64{ia.Id.Get()}, ia) +} + +// UpdateIapAccounts updates existing iap.account records. +// All records (represented by ids) will be updated by ia values. +func (c *Client) UpdateIapAccounts(ids []int64, ia *IapAccount) error { + return c.Update(IapAccountModel, ids, ia, nil) +} + +// DeleteIapAccount deletes an existing iap.account record. +func (c *Client) DeleteIapAccount(id int64) error { + return c.DeleteIapAccounts([]int64{id}) +} + +// DeleteIapAccounts deletes existing iap.account records. +func (c *Client) DeleteIapAccounts(ids []int64) error { + return c.Delete(IapAccountModel, ids) +} + +// GetIapAccount gets iap.account existing record. +func (c *Client) GetIapAccount(id int64) (*IapAccount, error) { + ias, err := c.GetIapAccounts([]int64{id}) + if err != nil { + return nil, err + } + return &((*ias)[0]), nil +} + +// GetIapAccounts gets iap.account existing records. +func (c *Client) GetIapAccounts(ids []int64) (*IapAccounts, error) { + ias := &IapAccounts{} + if err := c.Read(IapAccountModel, ids, nil, ias); err != nil { + return nil, err + } + return ias, nil +} + +// FindIapAccount finds iap.account record by querying it with criteria. +func (c *Client) FindIapAccount(criteria *Criteria) (*IapAccount, error) { + ias := &IapAccounts{} + if err := c.SearchRead(IapAccountModel, criteria, NewOptions().Limit(1), ias); err != nil { + return nil, err + } + return &((*ias)[0]), nil +} + +// FindIapAccounts finds iap.account records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIapAccounts(criteria *Criteria, options *Options) (*IapAccounts, error) { + ias := &IapAccounts{} + if err := c.SearchRead(IapAccountModel, criteria, options, ias); err != nil { + return nil, err + } + return ias, nil +} + +// FindIapAccountIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIapAccountIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IapAccountModel, criteria, options) +} + +// FindIapAccountId finds record id by querying it with criteria. +func (c *Client) FindIapAccountId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IapAccountModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/iap_service.go b/iap_service.go new file mode 100644 index 0000000..c90bd91 --- /dev/null +++ b/iap_service.go @@ -0,0 +1,121 @@ +package odoo + +// IapService represents iap.service model. +type IapService struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IntegerBalance *Bool `xmlrpc:"integer_balance,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + TechnicalName *String `xmlrpc:"technical_name,omitempty"` + UnitName *String `xmlrpc:"unit_name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IapServices represents array of iap.service model. +type IapServices []IapService + +// IapServiceModel is the odoo model name. +const IapServiceModel = "iap.service" + +// Many2One convert IapService to *Many2One. +func (is *IapService) Many2One() *Many2One { + return NewMany2One(is.Id.Get(), "") +} + +// CreateIapService creates a new iap.service model and returns its id. +func (c *Client) CreateIapService(is *IapService) (int64, error) { + ids, err := c.CreateIapServices([]*IapService{is}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIapService creates a new iap.service model and returns its id. +func (c *Client) CreateIapServices(iss []*IapService) ([]int64, error) { + var vv []interface{} + for _, v := range iss { + vv = append(vv, v) + } + return c.Create(IapServiceModel, vv, nil) +} + +// UpdateIapService updates an existing iap.service record. +func (c *Client) UpdateIapService(is *IapService) error { + return c.UpdateIapServices([]int64{is.Id.Get()}, is) +} + +// UpdateIapServices updates existing iap.service records. +// All records (represented by ids) will be updated by is values. +func (c *Client) UpdateIapServices(ids []int64, is *IapService) error { + return c.Update(IapServiceModel, ids, is, nil) +} + +// DeleteIapService deletes an existing iap.service record. +func (c *Client) DeleteIapService(id int64) error { + return c.DeleteIapServices([]int64{id}) +} + +// DeleteIapServices deletes existing iap.service records. +func (c *Client) DeleteIapServices(ids []int64) error { + return c.Delete(IapServiceModel, ids) +} + +// GetIapService gets iap.service existing record. +func (c *Client) GetIapService(id int64) (*IapService, error) { + iss, err := c.GetIapServices([]int64{id}) + if err != nil { + return nil, err + } + return &((*iss)[0]), nil +} + +// GetIapServices gets iap.service existing records. +func (c *Client) GetIapServices(ids []int64) (*IapServices, error) { + iss := &IapServices{} + if err := c.Read(IapServiceModel, ids, nil, iss); err != nil { + return nil, err + } + return iss, nil +} + +// FindIapService finds iap.service record by querying it with criteria. +func (c *Client) FindIapService(criteria *Criteria) (*IapService, error) { + iss := &IapServices{} + if err := c.SearchRead(IapServiceModel, criteria, NewOptions().Limit(1), iss); err != nil { + return nil, err + } + return &((*iss)[0]), nil +} + +// FindIapServices finds iap.service records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIapServices(criteria *Criteria, options *Options) (*IapServices, error) { + iss := &IapServices{} + if err := c.SearchRead(IapServiceModel, criteria, options, iss); err != nil { + return nil, err + } + return iss, nil +} + +// FindIapServiceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIapServiceIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IapServiceModel, criteria, options) +} + +// FindIapServiceId finds record id by querying it with criteria. +func (c *Client) FindIapServiceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IapServiceModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_actions_act_url.go b/ir_actions_act_url.go new file mode 100644 index 0000000..bd51e89 --- /dev/null +++ b/ir_actions_act_url.go @@ -0,0 +1,126 @@ +package odoo + +// IrActionsActUrl represents ir.actions.act_url model. +type IrActionsActUrl struct { + BindingModelId *Many2One `xmlrpc:"binding_model_id,omitempty"` + BindingType *Selection `xmlrpc:"binding_type,omitempty"` + BindingViewTypes *String `xmlrpc:"binding_view_types,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Help *String `xmlrpc:"help,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Path *String `xmlrpc:"path,omitempty"` + Target *Selection `xmlrpc:"target,omitempty"` + Type *String `xmlrpc:"type,omitempty"` + Url *String `xmlrpc:"url,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + XmlId *String `xmlrpc:"xml_id,omitempty"` +} + +// IrActionsActUrls represents array of ir.actions.act_url model. +type IrActionsActUrls []IrActionsActUrl + +// IrActionsActUrlModel is the odoo model name. +const IrActionsActUrlModel = "ir.actions.act_url" + +// Many2One convert IrActionsActUrl to *Many2One. +func (iaa *IrActionsActUrl) Many2One() *Many2One { + return NewMany2One(iaa.Id.Get(), "") +} + +// CreateIrActionsActUrl creates a new ir.actions.act_url model and returns its id. +func (c *Client) CreateIrActionsActUrl(iaa *IrActionsActUrl) (int64, error) { + ids, err := c.CreateIrActionsActUrls([]*IrActionsActUrl{iaa}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrActionsActUrl creates a new ir.actions.act_url model and returns its id. +func (c *Client) CreateIrActionsActUrls(iaas []*IrActionsActUrl) ([]int64, error) { + var vv []interface{} + for _, v := range iaas { + vv = append(vv, v) + } + return c.Create(IrActionsActUrlModel, vv, nil) +} + +// UpdateIrActionsActUrl updates an existing ir.actions.act_url record. +func (c *Client) UpdateIrActionsActUrl(iaa *IrActionsActUrl) error { + return c.UpdateIrActionsActUrls([]int64{iaa.Id.Get()}, iaa) +} + +// UpdateIrActionsActUrls updates existing ir.actions.act_url records. +// All records (represented by ids) will be updated by iaa values. +func (c *Client) UpdateIrActionsActUrls(ids []int64, iaa *IrActionsActUrl) error { + return c.Update(IrActionsActUrlModel, ids, iaa, nil) +} + +// DeleteIrActionsActUrl deletes an existing ir.actions.act_url record. +func (c *Client) DeleteIrActionsActUrl(id int64) error { + return c.DeleteIrActionsActUrls([]int64{id}) +} + +// DeleteIrActionsActUrls deletes existing ir.actions.act_url records. +func (c *Client) DeleteIrActionsActUrls(ids []int64) error { + return c.Delete(IrActionsActUrlModel, ids) +} + +// GetIrActionsActUrl gets ir.actions.act_url existing record. +func (c *Client) GetIrActionsActUrl(id int64) (*IrActionsActUrl, error) { + iaas, err := c.GetIrActionsActUrls([]int64{id}) + if err != nil { + return nil, err + } + return &((*iaas)[0]), nil +} + +// GetIrActionsActUrls gets ir.actions.act_url existing records. +func (c *Client) GetIrActionsActUrls(ids []int64) (*IrActionsActUrls, error) { + iaas := &IrActionsActUrls{} + if err := c.Read(IrActionsActUrlModel, ids, nil, iaas); err != nil { + return nil, err + } + return iaas, nil +} + +// FindIrActionsActUrl finds ir.actions.act_url record by querying it with criteria. +func (c *Client) FindIrActionsActUrl(criteria *Criteria) (*IrActionsActUrl, error) { + iaas := &IrActionsActUrls{} + if err := c.SearchRead(IrActionsActUrlModel, criteria, NewOptions().Limit(1), iaas); err != nil { + return nil, err + } + return &((*iaas)[0]), nil +} + +// FindIrActionsActUrls finds ir.actions.act_url records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsActUrls(criteria *Criteria, options *Options) (*IrActionsActUrls, error) { + iaas := &IrActionsActUrls{} + if err := c.SearchRead(IrActionsActUrlModel, criteria, options, iaas); err != nil { + return nil, err + } + return iaas, nil +} + +// FindIrActionsActUrlIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsActUrlIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrActionsActUrlModel, criteria, options) +} + +// FindIrActionsActUrlId finds record id by querying it with criteria. +func (c *Client) FindIrActionsActUrlId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrActionsActUrlModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_actions_act_window.go b/ir_actions_act_window.go new file mode 100644 index 0000000..d5dee94 --- /dev/null +++ b/ir_actions_act_window.go @@ -0,0 +1,140 @@ +package odoo + +// IrActionsActWindow represents ir.actions.act_window model. +type IrActionsActWindow struct { + BindingModelId *Many2One `xmlrpc:"binding_model_id,omitempty"` + BindingType *Selection `xmlrpc:"binding_type,omitempty"` + BindingViewTypes *String `xmlrpc:"binding_view_types,omitempty"` + Context *String `xmlrpc:"context,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Domain *String `xmlrpc:"domain,omitempty"` + EmbeddedActionIds *Relation `xmlrpc:"embedded_action_ids,omitempty"` + Filter *Bool `xmlrpc:"filter,omitempty"` + GroupsId *Relation `xmlrpc:"groups_id,omitempty"` + Help *String `xmlrpc:"help,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Limit *Int `xmlrpc:"limit,omitempty"` + MobileViewMode *String `xmlrpc:"mobile_view_mode,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Path *String `xmlrpc:"path,omitempty"` + ResId *Int `xmlrpc:"res_id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + SearchViewId *Many2One `xmlrpc:"search_view_id,omitempty"` + Target *Selection `xmlrpc:"target,omitempty"` + Type *String `xmlrpc:"type,omitempty"` + Usage *String `xmlrpc:"usage,omitempty"` + ViewId *Many2One `xmlrpc:"view_id,omitempty"` + ViewIds *Relation `xmlrpc:"view_ids,omitempty"` + ViewMode *String `xmlrpc:"view_mode,omitempty"` + Views *String `xmlrpc:"views,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + XmlId *String `xmlrpc:"xml_id,omitempty"` +} + +// IrActionsActWindows represents array of ir.actions.act_window model. +type IrActionsActWindows []IrActionsActWindow + +// IrActionsActWindowModel is the odoo model name. +const IrActionsActWindowModel = "ir.actions.act_window" + +// Many2One convert IrActionsActWindow to *Many2One. +func (iaa *IrActionsActWindow) Many2One() *Many2One { + return NewMany2One(iaa.Id.Get(), "") +} + +// CreateIrActionsActWindow creates a new ir.actions.act_window model and returns its id. +func (c *Client) CreateIrActionsActWindow(iaa *IrActionsActWindow) (int64, error) { + ids, err := c.CreateIrActionsActWindows([]*IrActionsActWindow{iaa}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrActionsActWindow creates a new ir.actions.act_window model and returns its id. +func (c *Client) CreateIrActionsActWindows(iaas []*IrActionsActWindow) ([]int64, error) { + var vv []interface{} + for _, v := range iaas { + vv = append(vv, v) + } + return c.Create(IrActionsActWindowModel, vv, nil) +} + +// UpdateIrActionsActWindow updates an existing ir.actions.act_window record. +func (c *Client) UpdateIrActionsActWindow(iaa *IrActionsActWindow) error { + return c.UpdateIrActionsActWindows([]int64{iaa.Id.Get()}, iaa) +} + +// UpdateIrActionsActWindows updates existing ir.actions.act_window records. +// All records (represented by ids) will be updated by iaa values. +func (c *Client) UpdateIrActionsActWindows(ids []int64, iaa *IrActionsActWindow) error { + return c.Update(IrActionsActWindowModel, ids, iaa, nil) +} + +// DeleteIrActionsActWindow deletes an existing ir.actions.act_window record. +func (c *Client) DeleteIrActionsActWindow(id int64) error { + return c.DeleteIrActionsActWindows([]int64{id}) +} + +// DeleteIrActionsActWindows deletes existing ir.actions.act_window records. +func (c *Client) DeleteIrActionsActWindows(ids []int64) error { + return c.Delete(IrActionsActWindowModel, ids) +} + +// GetIrActionsActWindow gets ir.actions.act_window existing record. +func (c *Client) GetIrActionsActWindow(id int64) (*IrActionsActWindow, error) { + iaas, err := c.GetIrActionsActWindows([]int64{id}) + if err != nil { + return nil, err + } + return &((*iaas)[0]), nil +} + +// GetIrActionsActWindows gets ir.actions.act_window existing records. +func (c *Client) GetIrActionsActWindows(ids []int64) (*IrActionsActWindows, error) { + iaas := &IrActionsActWindows{} + if err := c.Read(IrActionsActWindowModel, ids, nil, iaas); err != nil { + return nil, err + } + return iaas, nil +} + +// FindIrActionsActWindow finds ir.actions.act_window record by querying it with criteria. +func (c *Client) FindIrActionsActWindow(criteria *Criteria) (*IrActionsActWindow, error) { + iaas := &IrActionsActWindows{} + if err := c.SearchRead(IrActionsActWindowModel, criteria, NewOptions().Limit(1), iaas); err != nil { + return nil, err + } + return &((*iaas)[0]), nil +} + +// FindIrActionsActWindows finds ir.actions.act_window records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsActWindows(criteria *Criteria, options *Options) (*IrActionsActWindows, error) { + iaas := &IrActionsActWindows{} + if err := c.SearchRead(IrActionsActWindowModel, criteria, options, iaas); err != nil { + return nil, err + } + return iaas, nil +} + +// FindIrActionsActWindowIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsActWindowIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrActionsActWindowModel, criteria, options) +} + +// FindIrActionsActWindowId finds record id by querying it with criteria. +func (c *Client) FindIrActionsActWindowId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrActionsActWindowModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_actions_act_window_close.go b/ir_actions_act_window_close.go new file mode 100644 index 0000000..20dd6cf --- /dev/null +++ b/ir_actions_act_window_close.go @@ -0,0 +1,124 @@ +package odoo + +// IrActionsActWindowClose represents ir.actions.act_window_close model. +type IrActionsActWindowClose struct { + BindingModelId *Many2One `xmlrpc:"binding_model_id,omitempty"` + BindingType *Selection `xmlrpc:"binding_type,omitempty"` + BindingViewTypes *String `xmlrpc:"binding_view_types,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Help *String `xmlrpc:"help,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Path *String `xmlrpc:"path,omitempty"` + Type *String `xmlrpc:"type,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + XmlId *String `xmlrpc:"xml_id,omitempty"` +} + +// IrActionsActWindowCloses represents array of ir.actions.act_window_close model. +type IrActionsActWindowCloses []IrActionsActWindowClose + +// IrActionsActWindowCloseModel is the odoo model name. +const IrActionsActWindowCloseModel = "ir.actions.act_window_close" + +// Many2One convert IrActionsActWindowClose to *Many2One. +func (iaa *IrActionsActWindowClose) Many2One() *Many2One { + return NewMany2One(iaa.Id.Get(), "") +} + +// CreateIrActionsActWindowClose creates a new ir.actions.act_window_close model and returns its id. +func (c *Client) CreateIrActionsActWindowClose(iaa *IrActionsActWindowClose) (int64, error) { + ids, err := c.CreateIrActionsActWindowCloses([]*IrActionsActWindowClose{iaa}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrActionsActWindowClose creates a new ir.actions.act_window_close model and returns its id. +func (c *Client) CreateIrActionsActWindowCloses(iaas []*IrActionsActWindowClose) ([]int64, error) { + var vv []interface{} + for _, v := range iaas { + vv = append(vv, v) + } + return c.Create(IrActionsActWindowCloseModel, vv, nil) +} + +// UpdateIrActionsActWindowClose updates an existing ir.actions.act_window_close record. +func (c *Client) UpdateIrActionsActWindowClose(iaa *IrActionsActWindowClose) error { + return c.UpdateIrActionsActWindowCloses([]int64{iaa.Id.Get()}, iaa) +} + +// UpdateIrActionsActWindowCloses updates existing ir.actions.act_window_close records. +// All records (represented by ids) will be updated by iaa values. +func (c *Client) UpdateIrActionsActWindowCloses(ids []int64, iaa *IrActionsActWindowClose) error { + return c.Update(IrActionsActWindowCloseModel, ids, iaa, nil) +} + +// DeleteIrActionsActWindowClose deletes an existing ir.actions.act_window_close record. +func (c *Client) DeleteIrActionsActWindowClose(id int64) error { + return c.DeleteIrActionsActWindowCloses([]int64{id}) +} + +// DeleteIrActionsActWindowCloses deletes existing ir.actions.act_window_close records. +func (c *Client) DeleteIrActionsActWindowCloses(ids []int64) error { + return c.Delete(IrActionsActWindowCloseModel, ids) +} + +// GetIrActionsActWindowClose gets ir.actions.act_window_close existing record. +func (c *Client) GetIrActionsActWindowClose(id int64) (*IrActionsActWindowClose, error) { + iaas, err := c.GetIrActionsActWindowCloses([]int64{id}) + if err != nil { + return nil, err + } + return &((*iaas)[0]), nil +} + +// GetIrActionsActWindowCloses gets ir.actions.act_window_close existing records. +func (c *Client) GetIrActionsActWindowCloses(ids []int64) (*IrActionsActWindowCloses, error) { + iaas := &IrActionsActWindowCloses{} + if err := c.Read(IrActionsActWindowCloseModel, ids, nil, iaas); err != nil { + return nil, err + } + return iaas, nil +} + +// FindIrActionsActWindowClose finds ir.actions.act_window_close record by querying it with criteria. +func (c *Client) FindIrActionsActWindowClose(criteria *Criteria) (*IrActionsActWindowClose, error) { + iaas := &IrActionsActWindowCloses{} + if err := c.SearchRead(IrActionsActWindowCloseModel, criteria, NewOptions().Limit(1), iaas); err != nil { + return nil, err + } + return &((*iaas)[0]), nil +} + +// FindIrActionsActWindowCloses finds ir.actions.act_window_close records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsActWindowCloses(criteria *Criteria, options *Options) (*IrActionsActWindowCloses, error) { + iaas := &IrActionsActWindowCloses{} + if err := c.SearchRead(IrActionsActWindowCloseModel, criteria, options, iaas); err != nil { + return nil, err + } + return iaas, nil +} + +// FindIrActionsActWindowCloseIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsActWindowCloseIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrActionsActWindowCloseModel, criteria, options) +} + +// FindIrActionsActWindowCloseId finds record id by querying it with criteria. +func (c *Client) FindIrActionsActWindowCloseId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrActionsActWindowCloseModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_actions_act_window_view.go b/ir_actions_act_window_view.go new file mode 100644 index 0000000..5057d78 --- /dev/null +++ b/ir_actions_act_window_view.go @@ -0,0 +1,121 @@ +package odoo + +// IrActionsActWindowView represents ir.actions.act_window.view model. +type IrActionsActWindowView struct { + ActWindowId *Many2One `xmlrpc:"act_window_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Multi *Bool `xmlrpc:"multi,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + ViewId *Many2One `xmlrpc:"view_id,omitempty"` + ViewMode *Selection `xmlrpc:"view_mode,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrActionsActWindowViews represents array of ir.actions.act_window.view model. +type IrActionsActWindowViews []IrActionsActWindowView + +// IrActionsActWindowViewModel is the odoo model name. +const IrActionsActWindowViewModel = "ir.actions.act_window.view" + +// Many2One convert IrActionsActWindowView to *Many2One. +func (iaav *IrActionsActWindowView) Many2One() *Many2One { + return NewMany2One(iaav.Id.Get(), "") +} + +// CreateIrActionsActWindowView creates a new ir.actions.act_window.view model and returns its id. +func (c *Client) CreateIrActionsActWindowView(iaav *IrActionsActWindowView) (int64, error) { + ids, err := c.CreateIrActionsActWindowViews([]*IrActionsActWindowView{iaav}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrActionsActWindowView creates a new ir.actions.act_window.view model and returns its id. +func (c *Client) CreateIrActionsActWindowViews(iaavs []*IrActionsActWindowView) ([]int64, error) { + var vv []interface{} + for _, v := range iaavs { + vv = append(vv, v) + } + return c.Create(IrActionsActWindowViewModel, vv, nil) +} + +// UpdateIrActionsActWindowView updates an existing ir.actions.act_window.view record. +func (c *Client) UpdateIrActionsActWindowView(iaav *IrActionsActWindowView) error { + return c.UpdateIrActionsActWindowViews([]int64{iaav.Id.Get()}, iaav) +} + +// UpdateIrActionsActWindowViews updates existing ir.actions.act_window.view records. +// All records (represented by ids) will be updated by iaav values. +func (c *Client) UpdateIrActionsActWindowViews(ids []int64, iaav *IrActionsActWindowView) error { + return c.Update(IrActionsActWindowViewModel, ids, iaav, nil) +} + +// DeleteIrActionsActWindowView deletes an existing ir.actions.act_window.view record. +func (c *Client) DeleteIrActionsActWindowView(id int64) error { + return c.DeleteIrActionsActWindowViews([]int64{id}) +} + +// DeleteIrActionsActWindowViews deletes existing ir.actions.act_window.view records. +func (c *Client) DeleteIrActionsActWindowViews(ids []int64) error { + return c.Delete(IrActionsActWindowViewModel, ids) +} + +// GetIrActionsActWindowView gets ir.actions.act_window.view existing record. +func (c *Client) GetIrActionsActWindowView(id int64) (*IrActionsActWindowView, error) { + iaavs, err := c.GetIrActionsActWindowViews([]int64{id}) + if err != nil { + return nil, err + } + return &((*iaavs)[0]), nil +} + +// GetIrActionsActWindowViews gets ir.actions.act_window.view existing records. +func (c *Client) GetIrActionsActWindowViews(ids []int64) (*IrActionsActWindowViews, error) { + iaavs := &IrActionsActWindowViews{} + if err := c.Read(IrActionsActWindowViewModel, ids, nil, iaavs); err != nil { + return nil, err + } + return iaavs, nil +} + +// FindIrActionsActWindowView finds ir.actions.act_window.view record by querying it with criteria. +func (c *Client) FindIrActionsActWindowView(criteria *Criteria) (*IrActionsActWindowView, error) { + iaavs := &IrActionsActWindowViews{} + if err := c.SearchRead(IrActionsActWindowViewModel, criteria, NewOptions().Limit(1), iaavs); err != nil { + return nil, err + } + return &((*iaavs)[0]), nil +} + +// FindIrActionsActWindowViews finds ir.actions.act_window.view records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsActWindowViews(criteria *Criteria, options *Options) (*IrActionsActWindowViews, error) { + iaavs := &IrActionsActWindowViews{} + if err := c.SearchRead(IrActionsActWindowViewModel, criteria, options, iaavs); err != nil { + return nil, err + } + return iaavs, nil +} + +// FindIrActionsActWindowViewIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsActWindowViewIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrActionsActWindowViewModel, criteria, options) +} + +// FindIrActionsActWindowViewId finds record id by querying it with criteria. +func (c *Client) FindIrActionsActWindowViewId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrActionsActWindowViewModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_actions_actions.go b/ir_actions_actions.go new file mode 100644 index 0000000..6fcd391 --- /dev/null +++ b/ir_actions_actions.go @@ -0,0 +1,124 @@ +package odoo + +// IrActionsActions represents ir.actions.actions model. +type IrActionsActions struct { + BindingModelId *Many2One `xmlrpc:"binding_model_id,omitempty"` + BindingType *Selection `xmlrpc:"binding_type,omitempty"` + BindingViewTypes *String `xmlrpc:"binding_view_types,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Help *String `xmlrpc:"help,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Path *String `xmlrpc:"path,omitempty"` + Type *String `xmlrpc:"type,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + XmlId *String `xmlrpc:"xml_id,omitempty"` +} + +// IrActionsActionss represents array of ir.actions.actions model. +type IrActionsActionss []IrActionsActions + +// IrActionsActionsModel is the odoo model name. +const IrActionsActionsModel = "ir.actions.actions" + +// Many2One convert IrActionsActions to *Many2One. +func (iaa *IrActionsActions) Many2One() *Many2One { + return NewMany2One(iaa.Id.Get(), "") +} + +// CreateIrActionsActions creates a new ir.actions.actions model and returns its id. +func (c *Client) CreateIrActionsActions(iaa *IrActionsActions) (int64, error) { + ids, err := c.CreateIrActionsActionss([]*IrActionsActions{iaa}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrActionsActions creates a new ir.actions.actions model and returns its id. +func (c *Client) CreateIrActionsActionss(iaas []*IrActionsActions) ([]int64, error) { + var vv []interface{} + for _, v := range iaas { + vv = append(vv, v) + } + return c.Create(IrActionsActionsModel, vv, nil) +} + +// UpdateIrActionsActions updates an existing ir.actions.actions record. +func (c *Client) UpdateIrActionsActions(iaa *IrActionsActions) error { + return c.UpdateIrActionsActionss([]int64{iaa.Id.Get()}, iaa) +} + +// UpdateIrActionsActionss updates existing ir.actions.actions records. +// All records (represented by ids) will be updated by iaa values. +func (c *Client) UpdateIrActionsActionss(ids []int64, iaa *IrActionsActions) error { + return c.Update(IrActionsActionsModel, ids, iaa, nil) +} + +// DeleteIrActionsActions deletes an existing ir.actions.actions record. +func (c *Client) DeleteIrActionsActions(id int64) error { + return c.DeleteIrActionsActionss([]int64{id}) +} + +// DeleteIrActionsActionss deletes existing ir.actions.actions records. +func (c *Client) DeleteIrActionsActionss(ids []int64) error { + return c.Delete(IrActionsActionsModel, ids) +} + +// GetIrActionsActions gets ir.actions.actions existing record. +func (c *Client) GetIrActionsActions(id int64) (*IrActionsActions, error) { + iaas, err := c.GetIrActionsActionss([]int64{id}) + if err != nil { + return nil, err + } + return &((*iaas)[0]), nil +} + +// GetIrActionsActionss gets ir.actions.actions existing records. +func (c *Client) GetIrActionsActionss(ids []int64) (*IrActionsActionss, error) { + iaas := &IrActionsActionss{} + if err := c.Read(IrActionsActionsModel, ids, nil, iaas); err != nil { + return nil, err + } + return iaas, nil +} + +// FindIrActionsActions finds ir.actions.actions record by querying it with criteria. +func (c *Client) FindIrActionsActions(criteria *Criteria) (*IrActionsActions, error) { + iaas := &IrActionsActionss{} + if err := c.SearchRead(IrActionsActionsModel, criteria, NewOptions().Limit(1), iaas); err != nil { + return nil, err + } + return &((*iaas)[0]), nil +} + +// FindIrActionsActionss finds ir.actions.actions records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsActionss(criteria *Criteria, options *Options) (*IrActionsActionss, error) { + iaas := &IrActionsActionss{} + if err := c.SearchRead(IrActionsActionsModel, criteria, options, iaas); err != nil { + return nil, err + } + return iaas, nil +} + +// FindIrActionsActionsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsActionsIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrActionsActionsModel, criteria, options) +} + +// FindIrActionsActionsId finds record id by querying it with criteria. +func (c *Client) FindIrActionsActionsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrActionsActionsModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_actions_client.go b/ir_actions_client.go new file mode 100644 index 0000000..f5832c6 --- /dev/null +++ b/ir_actions_client.go @@ -0,0 +1,130 @@ +package odoo + +// IrActionsClient represents ir.actions.client model. +type IrActionsClient struct { + BindingModelId *Many2One `xmlrpc:"binding_model_id,omitempty"` + BindingType *Selection `xmlrpc:"binding_type,omitempty"` + BindingViewTypes *String `xmlrpc:"binding_view_types,omitempty"` + Context *String `xmlrpc:"context,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Help *String `xmlrpc:"help,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Params *String `xmlrpc:"params,omitempty"` + ParamsStore *String `xmlrpc:"params_store,omitempty"` + Path *String `xmlrpc:"path,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + Tag *String `xmlrpc:"tag,omitempty"` + Target *Selection `xmlrpc:"target,omitempty"` + Type *String `xmlrpc:"type,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + XmlId *String `xmlrpc:"xml_id,omitempty"` +} + +// IrActionsClients represents array of ir.actions.client model. +type IrActionsClients []IrActionsClient + +// IrActionsClientModel is the odoo model name. +const IrActionsClientModel = "ir.actions.client" + +// Many2One convert IrActionsClient to *Many2One. +func (iac *IrActionsClient) Many2One() *Many2One { + return NewMany2One(iac.Id.Get(), "") +} + +// CreateIrActionsClient creates a new ir.actions.client model and returns its id. +func (c *Client) CreateIrActionsClient(iac *IrActionsClient) (int64, error) { + ids, err := c.CreateIrActionsClients([]*IrActionsClient{iac}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrActionsClient creates a new ir.actions.client model and returns its id. +func (c *Client) CreateIrActionsClients(iacs []*IrActionsClient) ([]int64, error) { + var vv []interface{} + for _, v := range iacs { + vv = append(vv, v) + } + return c.Create(IrActionsClientModel, vv, nil) +} + +// UpdateIrActionsClient updates an existing ir.actions.client record. +func (c *Client) UpdateIrActionsClient(iac *IrActionsClient) error { + return c.UpdateIrActionsClients([]int64{iac.Id.Get()}, iac) +} + +// UpdateIrActionsClients updates existing ir.actions.client records. +// All records (represented by ids) will be updated by iac values. +func (c *Client) UpdateIrActionsClients(ids []int64, iac *IrActionsClient) error { + return c.Update(IrActionsClientModel, ids, iac, nil) +} + +// DeleteIrActionsClient deletes an existing ir.actions.client record. +func (c *Client) DeleteIrActionsClient(id int64) error { + return c.DeleteIrActionsClients([]int64{id}) +} + +// DeleteIrActionsClients deletes existing ir.actions.client records. +func (c *Client) DeleteIrActionsClients(ids []int64) error { + return c.Delete(IrActionsClientModel, ids) +} + +// GetIrActionsClient gets ir.actions.client existing record. +func (c *Client) GetIrActionsClient(id int64) (*IrActionsClient, error) { + iacs, err := c.GetIrActionsClients([]int64{id}) + if err != nil { + return nil, err + } + return &((*iacs)[0]), nil +} + +// GetIrActionsClients gets ir.actions.client existing records. +func (c *Client) GetIrActionsClients(ids []int64) (*IrActionsClients, error) { + iacs := &IrActionsClients{} + if err := c.Read(IrActionsClientModel, ids, nil, iacs); err != nil { + return nil, err + } + return iacs, nil +} + +// FindIrActionsClient finds ir.actions.client record by querying it with criteria. +func (c *Client) FindIrActionsClient(criteria *Criteria) (*IrActionsClient, error) { + iacs := &IrActionsClients{} + if err := c.SearchRead(IrActionsClientModel, criteria, NewOptions().Limit(1), iacs); err != nil { + return nil, err + } + return &((*iacs)[0]), nil +} + +// FindIrActionsClients finds ir.actions.client records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsClients(criteria *Criteria, options *Options) (*IrActionsClients, error) { + iacs := &IrActionsClients{} + if err := c.SearchRead(IrActionsClientModel, criteria, options, iacs); err != nil { + return nil, err + } + return iacs, nil +} + +// FindIrActionsClientIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsClientIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrActionsClientModel, criteria, options) +} + +// FindIrActionsClientId finds record id by querying it with criteria. +func (c *Client) FindIrActionsClientId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrActionsClientModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_actions_report.go b/ir_actions_report.go new file mode 100644 index 0000000..2dbef79 --- /dev/null +++ b/ir_actions_report.go @@ -0,0 +1,137 @@ +package odoo + +// IrActionsReport represents ir.actions.report model. +type IrActionsReport struct { + Attachment *String `xmlrpc:"attachment,omitempty"` + AttachmentUse *Bool `xmlrpc:"attachment_use,omitempty"` + BindingModelId *Many2One `xmlrpc:"binding_model_id,omitempty"` + BindingType *Selection `xmlrpc:"binding_type,omitempty"` + BindingViewTypes *String `xmlrpc:"binding_view_types,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Domain *String `xmlrpc:"domain,omitempty"` + GroupsId *Relation `xmlrpc:"groups_id,omitempty"` + Help *String `xmlrpc:"help,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsInvoiceReport *Bool `xmlrpc:"is_invoice_report,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + Multi *Bool `xmlrpc:"multi,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PaperformatId *Many2One `xmlrpc:"paperformat_id,omitempty"` + Path *String `xmlrpc:"path,omitempty"` + PrintReportName *String `xmlrpc:"print_report_name,omitempty"` + ReportFile *String `xmlrpc:"report_file,omitempty"` + ReportName *String `xmlrpc:"report_name,omitempty"` + ReportType *Selection `xmlrpc:"report_type,omitempty"` + Type *String `xmlrpc:"type,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + XmlId *String `xmlrpc:"xml_id,omitempty"` +} + +// IrActionsReports represents array of ir.actions.report model. +type IrActionsReports []IrActionsReport + +// IrActionsReportModel is the odoo model name. +const IrActionsReportModel = "ir.actions.report" + +// Many2One convert IrActionsReport to *Many2One. +func (iar *IrActionsReport) Many2One() *Many2One { + return NewMany2One(iar.Id.Get(), "") +} + +// CreateIrActionsReport creates a new ir.actions.report model and returns its id. +func (c *Client) CreateIrActionsReport(iar *IrActionsReport) (int64, error) { + ids, err := c.CreateIrActionsReports([]*IrActionsReport{iar}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrActionsReport creates a new ir.actions.report model and returns its id. +func (c *Client) CreateIrActionsReports(iars []*IrActionsReport) ([]int64, error) { + var vv []interface{} + for _, v := range iars { + vv = append(vv, v) + } + return c.Create(IrActionsReportModel, vv, nil) +} + +// UpdateIrActionsReport updates an existing ir.actions.report record. +func (c *Client) UpdateIrActionsReport(iar *IrActionsReport) error { + return c.UpdateIrActionsReports([]int64{iar.Id.Get()}, iar) +} + +// UpdateIrActionsReports updates existing ir.actions.report records. +// All records (represented by ids) will be updated by iar values. +func (c *Client) UpdateIrActionsReports(ids []int64, iar *IrActionsReport) error { + return c.Update(IrActionsReportModel, ids, iar, nil) +} + +// DeleteIrActionsReport deletes an existing ir.actions.report record. +func (c *Client) DeleteIrActionsReport(id int64) error { + return c.DeleteIrActionsReports([]int64{id}) +} + +// DeleteIrActionsReports deletes existing ir.actions.report records. +func (c *Client) DeleteIrActionsReports(ids []int64) error { + return c.Delete(IrActionsReportModel, ids) +} + +// GetIrActionsReport gets ir.actions.report existing record. +func (c *Client) GetIrActionsReport(id int64) (*IrActionsReport, error) { + iars, err := c.GetIrActionsReports([]int64{id}) + if err != nil { + return nil, err + } + return &((*iars)[0]), nil +} + +// GetIrActionsReports gets ir.actions.report existing records. +func (c *Client) GetIrActionsReports(ids []int64) (*IrActionsReports, error) { + iars := &IrActionsReports{} + if err := c.Read(IrActionsReportModel, ids, nil, iars); err != nil { + return nil, err + } + return iars, nil +} + +// FindIrActionsReport finds ir.actions.report record by querying it with criteria. +func (c *Client) FindIrActionsReport(criteria *Criteria) (*IrActionsReport, error) { + iars := &IrActionsReports{} + if err := c.SearchRead(IrActionsReportModel, criteria, NewOptions().Limit(1), iars); err != nil { + return nil, err + } + return &((*iars)[0]), nil +} + +// FindIrActionsReports finds ir.actions.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsReports(criteria *Criteria, options *Options) (*IrActionsReports, error) { + iars := &IrActionsReports{} + if err := c.SearchRead(IrActionsReportModel, criteria, options, iars); err != nil { + return nil, err + } + return iars, nil +} + +// FindIrActionsReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsReportIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrActionsReportModel, criteria, options) +} + +// FindIrActionsReportId finds record id by querying it with criteria. +func (c *Client) FindIrActionsReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrActionsReportModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_actions_server.go b/ir_actions_server.go new file mode 100644 index 0000000..0d72e27 --- /dev/null +++ b/ir_actions_server.go @@ -0,0 +1,164 @@ +package odoo + +// IrActionsServer represents ir.actions.server model. +type IrActionsServer struct { + ActivityDateDeadlineRange *Int `xmlrpc:"activity_date_deadline_range,omitempty"` + ActivityDateDeadlineRangeType *Selection `xmlrpc:"activity_date_deadline_range_type,omitempty"` + ActivityNote *String `xmlrpc:"activity_note,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserFieldName *String `xmlrpc:"activity_user_field_name,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + ActivityUserType *Selection `xmlrpc:"activity_user_type,omitempty"` + AvailableModelIds *Relation `xmlrpc:"available_model_ids,omitempty"` + BindingModelId *Many2One `xmlrpc:"binding_model_id,omitempty"` + BindingType *Selection `xmlrpc:"binding_type,omitempty"` + BindingViewTypes *String `xmlrpc:"binding_view_types,omitempty"` + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CrudModelId *Many2One `xmlrpc:"crud_model_id,omitempty"` + CrudModelName *String `xmlrpc:"crud_model_name,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EvaluationType *Selection `xmlrpc:"evaluation_type,omitempty"` + GroupsId *Relation `xmlrpc:"groups_id,omitempty"` + Help *String `xmlrpc:"help,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LinkFieldId *Many2One `xmlrpc:"link_field_id,omitempty"` + MailPostAutofollow *Bool `xmlrpc:"mail_post_autofollow,omitempty"` + MailPostMethod *Selection `xmlrpc:"mail_post_method,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + ModelName *String `xmlrpc:"model_name,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + Path *String `xmlrpc:"path,omitempty"` + ResourceRef *String `xmlrpc:"resource_ref,omitempty"` + SelectionValue *Many2One `xmlrpc:"selection_value,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SmsMethod *Selection `xmlrpc:"sms_method,omitempty"` + SmsTemplateId *Many2One `xmlrpc:"sms_template_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TemplateId *Many2One `xmlrpc:"template_id,omitempty"` + Type *String `xmlrpc:"type,omitempty"` + UpdateBooleanValue *Selection `xmlrpc:"update_boolean_value,omitempty"` + UpdateFieldId *Many2One `xmlrpc:"update_field_id,omitempty"` + UpdateFieldType *Selection `xmlrpc:"update_field_type,omitempty"` + UpdateM2MOperation *Selection `xmlrpc:"update_m2m_operation,omitempty"` + UpdatePath *String `xmlrpc:"update_path,omitempty"` + UpdateRelatedModelId *Many2One `xmlrpc:"update_related_model_id,omitempty"` + Usage *Selection `xmlrpc:"usage,omitempty"` + Value *String `xmlrpc:"value,omitempty"` + ValueFieldToShow *Selection `xmlrpc:"value_field_to_show,omitempty"` + WebhookFieldIds *Relation `xmlrpc:"webhook_field_ids,omitempty"` + WebhookSamplePayload *String `xmlrpc:"webhook_sample_payload,omitempty"` + WebhookUrl *String `xmlrpc:"webhook_url,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + XmlId *String `xmlrpc:"xml_id,omitempty"` +} + +// IrActionsServers represents array of ir.actions.server model. +type IrActionsServers []IrActionsServer + +// IrActionsServerModel is the odoo model name. +const IrActionsServerModel = "ir.actions.server" + +// Many2One convert IrActionsServer to *Many2One. +func (ias *IrActionsServer) Many2One() *Many2One { + return NewMany2One(ias.Id.Get(), "") +} + +// CreateIrActionsServer creates a new ir.actions.server model and returns its id. +func (c *Client) CreateIrActionsServer(ias *IrActionsServer) (int64, error) { + ids, err := c.CreateIrActionsServers([]*IrActionsServer{ias}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrActionsServer creates a new ir.actions.server model and returns its id. +func (c *Client) CreateIrActionsServers(iass []*IrActionsServer) ([]int64, error) { + var vv []interface{} + for _, v := range iass { + vv = append(vv, v) + } + return c.Create(IrActionsServerModel, vv, nil) +} + +// UpdateIrActionsServer updates an existing ir.actions.server record. +func (c *Client) UpdateIrActionsServer(ias *IrActionsServer) error { + return c.UpdateIrActionsServers([]int64{ias.Id.Get()}, ias) +} + +// UpdateIrActionsServers updates existing ir.actions.server records. +// All records (represented by ids) will be updated by ias values. +func (c *Client) UpdateIrActionsServers(ids []int64, ias *IrActionsServer) error { + return c.Update(IrActionsServerModel, ids, ias, nil) +} + +// DeleteIrActionsServer deletes an existing ir.actions.server record. +func (c *Client) DeleteIrActionsServer(id int64) error { + return c.DeleteIrActionsServers([]int64{id}) +} + +// DeleteIrActionsServers deletes existing ir.actions.server records. +func (c *Client) DeleteIrActionsServers(ids []int64) error { + return c.Delete(IrActionsServerModel, ids) +} + +// GetIrActionsServer gets ir.actions.server existing record. +func (c *Client) GetIrActionsServer(id int64) (*IrActionsServer, error) { + iass, err := c.GetIrActionsServers([]int64{id}) + if err != nil { + return nil, err + } + return &((*iass)[0]), nil +} + +// GetIrActionsServers gets ir.actions.server existing records. +func (c *Client) GetIrActionsServers(ids []int64) (*IrActionsServers, error) { + iass := &IrActionsServers{} + if err := c.Read(IrActionsServerModel, ids, nil, iass); err != nil { + return nil, err + } + return iass, nil +} + +// FindIrActionsServer finds ir.actions.server record by querying it with criteria. +func (c *Client) FindIrActionsServer(criteria *Criteria) (*IrActionsServer, error) { + iass := &IrActionsServers{} + if err := c.SearchRead(IrActionsServerModel, criteria, NewOptions().Limit(1), iass); err != nil { + return nil, err + } + return &((*iass)[0]), nil +} + +// FindIrActionsServers finds ir.actions.server records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsServers(criteria *Criteria, options *Options) (*IrActionsServers, error) { + iass := &IrActionsServers{} + if err := c.SearchRead(IrActionsServerModel, criteria, options, iass); err != nil { + return nil, err + } + return iass, nil +} + +// FindIrActionsServerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsServerIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrActionsServerModel, criteria, options) +} + +// FindIrActionsServerId finds record id by querying it with criteria. +func (c *Client) FindIrActionsServerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrActionsServerModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_actions_todo.go b/ir_actions_todo.go new file mode 100644 index 0000000..cbf3ff9 --- /dev/null +++ b/ir_actions_todo.go @@ -0,0 +1,120 @@ +package odoo + +// IrActionsTodo represents ir.actions.todo model. +type IrActionsTodo struct { + ActionId *Many2One `xmlrpc:"action_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrActionsTodos represents array of ir.actions.todo model. +type IrActionsTodos []IrActionsTodo + +// IrActionsTodoModel is the odoo model name. +const IrActionsTodoModel = "ir.actions.todo" + +// Many2One convert IrActionsTodo to *Many2One. +func (iat *IrActionsTodo) Many2One() *Many2One { + return NewMany2One(iat.Id.Get(), "") +} + +// CreateIrActionsTodo creates a new ir.actions.todo model and returns its id. +func (c *Client) CreateIrActionsTodo(iat *IrActionsTodo) (int64, error) { + ids, err := c.CreateIrActionsTodos([]*IrActionsTodo{iat}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrActionsTodo creates a new ir.actions.todo model and returns its id. +func (c *Client) CreateIrActionsTodos(iats []*IrActionsTodo) ([]int64, error) { + var vv []interface{} + for _, v := range iats { + vv = append(vv, v) + } + return c.Create(IrActionsTodoModel, vv, nil) +} + +// UpdateIrActionsTodo updates an existing ir.actions.todo record. +func (c *Client) UpdateIrActionsTodo(iat *IrActionsTodo) error { + return c.UpdateIrActionsTodos([]int64{iat.Id.Get()}, iat) +} + +// UpdateIrActionsTodos updates existing ir.actions.todo records. +// All records (represented by ids) will be updated by iat values. +func (c *Client) UpdateIrActionsTodos(ids []int64, iat *IrActionsTodo) error { + return c.Update(IrActionsTodoModel, ids, iat, nil) +} + +// DeleteIrActionsTodo deletes an existing ir.actions.todo record. +func (c *Client) DeleteIrActionsTodo(id int64) error { + return c.DeleteIrActionsTodos([]int64{id}) +} + +// DeleteIrActionsTodos deletes existing ir.actions.todo records. +func (c *Client) DeleteIrActionsTodos(ids []int64) error { + return c.Delete(IrActionsTodoModel, ids) +} + +// GetIrActionsTodo gets ir.actions.todo existing record. +func (c *Client) GetIrActionsTodo(id int64) (*IrActionsTodo, error) { + iats, err := c.GetIrActionsTodos([]int64{id}) + if err != nil { + return nil, err + } + return &((*iats)[0]), nil +} + +// GetIrActionsTodos gets ir.actions.todo existing records. +func (c *Client) GetIrActionsTodos(ids []int64) (*IrActionsTodos, error) { + iats := &IrActionsTodos{} + if err := c.Read(IrActionsTodoModel, ids, nil, iats); err != nil { + return nil, err + } + return iats, nil +} + +// FindIrActionsTodo finds ir.actions.todo record by querying it with criteria. +func (c *Client) FindIrActionsTodo(criteria *Criteria) (*IrActionsTodo, error) { + iats := &IrActionsTodos{} + if err := c.SearchRead(IrActionsTodoModel, criteria, NewOptions().Limit(1), iats); err != nil { + return nil, err + } + return &((*iats)[0]), nil +} + +// FindIrActionsTodos finds ir.actions.todo records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsTodos(criteria *Criteria, options *Options) (*IrActionsTodos, error) { + iats := &IrActionsTodos{} + if err := c.SearchRead(IrActionsTodoModel, criteria, options, iats); err != nil { + return nil, err + } + return iats, nil +} + +// FindIrActionsTodoIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrActionsTodoIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrActionsTodoModel, criteria, options) +} + +// FindIrActionsTodoId finds record id by querying it with criteria. +func (c *Client) FindIrActionsTodoId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrActionsTodoModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_asset.go b/ir_asset.go new file mode 100644 index 0000000..cadc623 --- /dev/null +++ b/ir_asset.go @@ -0,0 +1,123 @@ +package odoo + +// IrAsset represents ir.asset model. +type IrAsset struct { + Active *Bool `xmlrpc:"active,omitempty"` + Bundle *String `xmlrpc:"bundle,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Directive *Selection `xmlrpc:"directive,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Path *String `xmlrpc:"path,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + Target *String `xmlrpc:"target,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrAssets represents array of ir.asset model. +type IrAssets []IrAsset + +// IrAssetModel is the odoo model name. +const IrAssetModel = "ir.asset" + +// Many2One convert IrAsset to *Many2One. +func (ia *IrAsset) Many2One() *Many2One { + return NewMany2One(ia.Id.Get(), "") +} + +// CreateIrAsset creates a new ir.asset model and returns its id. +func (c *Client) CreateIrAsset(ia *IrAsset) (int64, error) { + ids, err := c.CreateIrAssets([]*IrAsset{ia}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrAsset creates a new ir.asset model and returns its id. +func (c *Client) CreateIrAssets(ias []*IrAsset) ([]int64, error) { + var vv []interface{} + for _, v := range ias { + vv = append(vv, v) + } + return c.Create(IrAssetModel, vv, nil) +} + +// UpdateIrAsset updates an existing ir.asset record. +func (c *Client) UpdateIrAsset(ia *IrAsset) error { + return c.UpdateIrAssets([]int64{ia.Id.Get()}, ia) +} + +// UpdateIrAssets updates existing ir.asset records. +// All records (represented by ids) will be updated by ia values. +func (c *Client) UpdateIrAssets(ids []int64, ia *IrAsset) error { + return c.Update(IrAssetModel, ids, ia, nil) +} + +// DeleteIrAsset deletes an existing ir.asset record. +func (c *Client) DeleteIrAsset(id int64) error { + return c.DeleteIrAssets([]int64{id}) +} + +// DeleteIrAssets deletes existing ir.asset records. +func (c *Client) DeleteIrAssets(ids []int64) error { + return c.Delete(IrAssetModel, ids) +} + +// GetIrAsset gets ir.asset existing record. +func (c *Client) GetIrAsset(id int64) (*IrAsset, error) { + ias, err := c.GetIrAssets([]int64{id}) + if err != nil { + return nil, err + } + return &((*ias)[0]), nil +} + +// GetIrAssets gets ir.asset existing records. +func (c *Client) GetIrAssets(ids []int64) (*IrAssets, error) { + ias := &IrAssets{} + if err := c.Read(IrAssetModel, ids, nil, ias); err != nil { + return nil, err + } + return ias, nil +} + +// FindIrAsset finds ir.asset record by querying it with criteria. +func (c *Client) FindIrAsset(criteria *Criteria) (*IrAsset, error) { + ias := &IrAssets{} + if err := c.SearchRead(IrAssetModel, criteria, NewOptions().Limit(1), ias); err != nil { + return nil, err + } + return &((*ias)[0]), nil +} + +// FindIrAssets finds ir.asset records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrAssets(criteria *Criteria, options *Options) (*IrAssets, error) { + ias := &IrAssets{} + if err := c.SearchRead(IrAssetModel, criteria, options, ias); err != nil { + return nil, err + } + return ias, nil +} + +// FindIrAssetIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrAssetIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrAssetModel, criteria, options) +} + +// FindIrAssetId finds record id by querying it with criteria. +func (c *Client) FindIrAssetId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrAssetModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_attachment.go b/ir_attachment.go new file mode 100644 index 0000000..7c63f7c --- /dev/null +++ b/ir_attachment.go @@ -0,0 +1,141 @@ +package odoo + +// IrAttachment represents ir.attachment model. +type IrAttachment struct { + AccessToken *String `xmlrpc:"access_token,omitempty"` + Checksum *String `xmlrpc:"checksum,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Datas *String `xmlrpc:"datas,omitempty"` + DbDatas *String `xmlrpc:"db_datas,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FileSize *Int `xmlrpc:"file_size,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ImageHeight *Int `xmlrpc:"image_height,omitempty"` + ImageSrc *String `xmlrpc:"image_src,omitempty"` + ImageWidth *Int `xmlrpc:"image_width,omitempty"` + IndexContent *String `xmlrpc:"index_content,omitempty"` + LocalUrl *String `xmlrpc:"local_url,omitempty"` + Mimetype *String `xmlrpc:"mimetype,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OriginalId *Many2One `xmlrpc:"original_id,omitempty"` + Public *Bool `xmlrpc:"public,omitempty"` + Raw *String `xmlrpc:"raw,omitempty"` + ResField *String `xmlrpc:"res_field,omitempty"` + ResId *Many2One `xmlrpc:"res_id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + ResName *String `xmlrpc:"res_name,omitempty"` + StoreFname *String `xmlrpc:"store_fname,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + Url *String `xmlrpc:"url,omitempty"` + VoiceIds *Relation `xmlrpc:"voice_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrAttachments represents array of ir.attachment model. +type IrAttachments []IrAttachment + +// IrAttachmentModel is the odoo model name. +const IrAttachmentModel = "ir.attachment" + +// Many2One convert IrAttachment to *Many2One. +func (ia *IrAttachment) Many2One() *Many2One { + return NewMany2One(ia.Id.Get(), "") +} + +// CreateIrAttachment creates a new ir.attachment model and returns its id. +func (c *Client) CreateIrAttachment(ia *IrAttachment) (int64, error) { + ids, err := c.CreateIrAttachments([]*IrAttachment{ia}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrAttachment creates a new ir.attachment model and returns its id. +func (c *Client) CreateIrAttachments(ias []*IrAttachment) ([]int64, error) { + var vv []interface{} + for _, v := range ias { + vv = append(vv, v) + } + return c.Create(IrAttachmentModel, vv, nil) +} + +// UpdateIrAttachment updates an existing ir.attachment record. +func (c *Client) UpdateIrAttachment(ia *IrAttachment) error { + return c.UpdateIrAttachments([]int64{ia.Id.Get()}, ia) +} + +// UpdateIrAttachments updates existing ir.attachment records. +// All records (represented by ids) will be updated by ia values. +func (c *Client) UpdateIrAttachments(ids []int64, ia *IrAttachment) error { + return c.Update(IrAttachmentModel, ids, ia, nil) +} + +// DeleteIrAttachment deletes an existing ir.attachment record. +func (c *Client) DeleteIrAttachment(id int64) error { + return c.DeleteIrAttachments([]int64{id}) +} + +// DeleteIrAttachments deletes existing ir.attachment records. +func (c *Client) DeleteIrAttachments(ids []int64) error { + return c.Delete(IrAttachmentModel, ids) +} + +// GetIrAttachment gets ir.attachment existing record. +func (c *Client) GetIrAttachment(id int64) (*IrAttachment, error) { + ias, err := c.GetIrAttachments([]int64{id}) + if err != nil { + return nil, err + } + return &((*ias)[0]), nil +} + +// GetIrAttachments gets ir.attachment existing records. +func (c *Client) GetIrAttachments(ids []int64) (*IrAttachments, error) { + ias := &IrAttachments{} + if err := c.Read(IrAttachmentModel, ids, nil, ias); err != nil { + return nil, err + } + return ias, nil +} + +// FindIrAttachment finds ir.attachment record by querying it with criteria. +func (c *Client) FindIrAttachment(criteria *Criteria) (*IrAttachment, error) { + ias := &IrAttachments{} + if err := c.SearchRead(IrAttachmentModel, criteria, NewOptions().Limit(1), ias); err != nil { + return nil, err + } + return &((*ias)[0]), nil +} + +// FindIrAttachments finds ir.attachment records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrAttachments(criteria *Criteria, options *Options) (*IrAttachments, error) { + ias := &IrAttachments{} + if err := c.SearchRead(IrAttachmentModel, criteria, options, ias); err != nil { + return nil, err + } + return ias, nil +} + +// FindIrAttachmentIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrAttachmentIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrAttachmentModel, criteria, options) +} + +// FindIrAttachmentId finds record id by querying it with criteria. +func (c *Client) FindIrAttachmentId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrAttachmentModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_config_parameter.go b/ir_config_parameter.go new file mode 100644 index 0000000..4f9d8e1 --- /dev/null +++ b/ir_config_parameter.go @@ -0,0 +1,118 @@ +package odoo + +// IrConfigParameter represents ir.config_parameter model. +type IrConfigParameter struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Key *String `xmlrpc:"key,omitempty"` + Value *String `xmlrpc:"value,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrConfigParameters represents array of ir.config_parameter model. +type IrConfigParameters []IrConfigParameter + +// IrConfigParameterModel is the odoo model name. +const IrConfigParameterModel = "ir.config_parameter" + +// Many2One convert IrConfigParameter to *Many2One. +func (ic *IrConfigParameter) Many2One() *Many2One { + return NewMany2One(ic.Id.Get(), "") +} + +// CreateIrConfigParameter creates a new ir.config_parameter model and returns its id. +func (c *Client) CreateIrConfigParameter(ic *IrConfigParameter) (int64, error) { + ids, err := c.CreateIrConfigParameters([]*IrConfigParameter{ic}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrConfigParameter creates a new ir.config_parameter model and returns its id. +func (c *Client) CreateIrConfigParameters(ics []*IrConfigParameter) ([]int64, error) { + var vv []interface{} + for _, v := range ics { + vv = append(vv, v) + } + return c.Create(IrConfigParameterModel, vv, nil) +} + +// UpdateIrConfigParameter updates an existing ir.config_parameter record. +func (c *Client) UpdateIrConfigParameter(ic *IrConfigParameter) error { + return c.UpdateIrConfigParameters([]int64{ic.Id.Get()}, ic) +} + +// UpdateIrConfigParameters updates existing ir.config_parameter records. +// All records (represented by ids) will be updated by ic values. +func (c *Client) UpdateIrConfigParameters(ids []int64, ic *IrConfigParameter) error { + return c.Update(IrConfigParameterModel, ids, ic, nil) +} + +// DeleteIrConfigParameter deletes an existing ir.config_parameter record. +func (c *Client) DeleteIrConfigParameter(id int64) error { + return c.DeleteIrConfigParameters([]int64{id}) +} + +// DeleteIrConfigParameters deletes existing ir.config_parameter records. +func (c *Client) DeleteIrConfigParameters(ids []int64) error { + return c.Delete(IrConfigParameterModel, ids) +} + +// GetIrConfigParameter gets ir.config_parameter existing record. +func (c *Client) GetIrConfigParameter(id int64) (*IrConfigParameter, error) { + ics, err := c.GetIrConfigParameters([]int64{id}) + if err != nil { + return nil, err + } + return &((*ics)[0]), nil +} + +// GetIrConfigParameters gets ir.config_parameter existing records. +func (c *Client) GetIrConfigParameters(ids []int64) (*IrConfigParameters, error) { + ics := &IrConfigParameters{} + if err := c.Read(IrConfigParameterModel, ids, nil, ics); err != nil { + return nil, err + } + return ics, nil +} + +// FindIrConfigParameter finds ir.config_parameter record by querying it with criteria. +func (c *Client) FindIrConfigParameter(criteria *Criteria) (*IrConfigParameter, error) { + ics := &IrConfigParameters{} + if err := c.SearchRead(IrConfigParameterModel, criteria, NewOptions().Limit(1), ics); err != nil { + return nil, err + } + return &((*ics)[0]), nil +} + +// FindIrConfigParameters finds ir.config_parameter records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrConfigParameters(criteria *Criteria, options *Options) (*IrConfigParameters, error) { + ics := &IrConfigParameters{} + if err := c.SearchRead(IrConfigParameterModel, criteria, options, ics); err != nil { + return nil, err + } + return ics, nil +} + +// FindIrConfigParameterIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrConfigParameterIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrConfigParameterModel, criteria, options) +} + +// FindIrConfigParameterId finds record id by querying it with criteria. +func (c *Client) FindIrConfigParameterId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrConfigParameterModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_cron.go b/ir_cron.go new file mode 100644 index 0000000..7179185 --- /dev/null +++ b/ir_cron.go @@ -0,0 +1,175 @@ +package odoo + +// IrCron represents ir.cron model. +type IrCron struct { + Active *Bool `xmlrpc:"active,omitempty"` + ActivityDateDeadlineRange *Int `xmlrpc:"activity_date_deadline_range,omitempty"` + ActivityDateDeadlineRangeType *Selection `xmlrpc:"activity_date_deadline_range_type,omitempty"` + ActivityNote *String `xmlrpc:"activity_note,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserFieldName *String `xmlrpc:"activity_user_field_name,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + ActivityUserType *Selection `xmlrpc:"activity_user_type,omitempty"` + AvailableModelIds *Relation `xmlrpc:"available_model_ids,omitempty"` + BindingModelId *Many2One `xmlrpc:"binding_model_id,omitempty"` + BindingType *Selection `xmlrpc:"binding_type,omitempty"` + BindingViewTypes *String `xmlrpc:"binding_view_types,omitempty"` + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CronName *String `xmlrpc:"cron_name,omitempty"` + CrudModelId *Many2One `xmlrpc:"crud_model_id,omitempty"` + CrudModelName *String `xmlrpc:"crud_model_name,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EvaluationType *Selection `xmlrpc:"evaluation_type,omitempty"` + FailureCount *Int `xmlrpc:"failure_count,omitempty"` + FirstFailureDate *Time `xmlrpc:"first_failure_date,omitempty"` + GroupsId *Relation `xmlrpc:"groups_id,omitempty"` + Help *String `xmlrpc:"help,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IntervalNumber *Int `xmlrpc:"interval_number,omitempty"` + IntervalType *Selection `xmlrpc:"interval_type,omitempty"` + IrActionsServerId *Many2One `xmlrpc:"ir_actions_server_id,omitempty"` + Lastcall *Time `xmlrpc:"lastcall,omitempty"` + LinkFieldId *Many2One `xmlrpc:"link_field_id,omitempty"` + MailPostAutofollow *Bool `xmlrpc:"mail_post_autofollow,omitempty"` + MailPostMethod *Selection `xmlrpc:"mail_post_method,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + ModelName *String `xmlrpc:"model_name,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Nextcall *Time `xmlrpc:"nextcall,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + Path *String `xmlrpc:"path,omitempty"` + Priority *Int `xmlrpc:"priority,omitempty"` + ResourceRef *String `xmlrpc:"resource_ref,omitempty"` + SelectionValue *Many2One `xmlrpc:"selection_value,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SmsMethod *Selection `xmlrpc:"sms_method,omitempty"` + SmsTemplateId *Many2One `xmlrpc:"sms_template_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TemplateId *Many2One `xmlrpc:"template_id,omitempty"` + Type *String `xmlrpc:"type,omitempty"` + UpdateBooleanValue *Selection `xmlrpc:"update_boolean_value,omitempty"` + UpdateFieldId *Many2One `xmlrpc:"update_field_id,omitempty"` + UpdateFieldType *Selection `xmlrpc:"update_field_type,omitempty"` + UpdateM2MOperation *Selection `xmlrpc:"update_m2m_operation,omitempty"` + UpdatePath *String `xmlrpc:"update_path,omitempty"` + UpdateRelatedModelId *Many2One `xmlrpc:"update_related_model_id,omitempty"` + Usage *Selection `xmlrpc:"usage,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + Value *String `xmlrpc:"value,omitempty"` + ValueFieldToShow *Selection `xmlrpc:"value_field_to_show,omitempty"` + WebhookFieldIds *Relation `xmlrpc:"webhook_field_ids,omitempty"` + WebhookSamplePayload *String `xmlrpc:"webhook_sample_payload,omitempty"` + WebhookUrl *String `xmlrpc:"webhook_url,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + XmlId *String `xmlrpc:"xml_id,omitempty"` +} + +// IrCrons represents array of ir.cron model. +type IrCrons []IrCron + +// IrCronModel is the odoo model name. +const IrCronModel = "ir.cron" + +// Many2One convert IrCron to *Many2One. +func (ic *IrCron) Many2One() *Many2One { + return NewMany2One(ic.Id.Get(), "") +} + +// CreateIrCron creates a new ir.cron model and returns its id. +func (c *Client) CreateIrCron(ic *IrCron) (int64, error) { + ids, err := c.CreateIrCrons([]*IrCron{ic}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrCron creates a new ir.cron model and returns its id. +func (c *Client) CreateIrCrons(ics []*IrCron) ([]int64, error) { + var vv []interface{} + for _, v := range ics { + vv = append(vv, v) + } + return c.Create(IrCronModel, vv, nil) +} + +// UpdateIrCron updates an existing ir.cron record. +func (c *Client) UpdateIrCron(ic *IrCron) error { + return c.UpdateIrCrons([]int64{ic.Id.Get()}, ic) +} + +// UpdateIrCrons updates existing ir.cron records. +// All records (represented by ids) will be updated by ic values. +func (c *Client) UpdateIrCrons(ids []int64, ic *IrCron) error { + return c.Update(IrCronModel, ids, ic, nil) +} + +// DeleteIrCron deletes an existing ir.cron record. +func (c *Client) DeleteIrCron(id int64) error { + return c.DeleteIrCrons([]int64{id}) +} + +// DeleteIrCrons deletes existing ir.cron records. +func (c *Client) DeleteIrCrons(ids []int64) error { + return c.Delete(IrCronModel, ids) +} + +// GetIrCron gets ir.cron existing record. +func (c *Client) GetIrCron(id int64) (*IrCron, error) { + ics, err := c.GetIrCrons([]int64{id}) + if err != nil { + return nil, err + } + return &((*ics)[0]), nil +} + +// GetIrCrons gets ir.cron existing records. +func (c *Client) GetIrCrons(ids []int64) (*IrCrons, error) { + ics := &IrCrons{} + if err := c.Read(IrCronModel, ids, nil, ics); err != nil { + return nil, err + } + return ics, nil +} + +// FindIrCron finds ir.cron record by querying it with criteria. +func (c *Client) FindIrCron(criteria *Criteria) (*IrCron, error) { + ics := &IrCrons{} + if err := c.SearchRead(IrCronModel, criteria, NewOptions().Limit(1), ics); err != nil { + return nil, err + } + return &((*ics)[0]), nil +} + +// FindIrCrons finds ir.cron records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrCrons(criteria *Criteria, options *Options) (*IrCrons, error) { + ics := &IrCrons{} + if err := c.SearchRead(IrCronModel, criteria, options, ics); err != nil { + return nil, err + } + return ics, nil +} + +// FindIrCronIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrCronIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrCronModel, criteria, options) +} + +// FindIrCronId finds record id by querying it with criteria. +func (c *Client) FindIrCronId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrCronModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_cron_progress.go b/ir_cron_progress.go new file mode 100644 index 0000000..e6e2d46 --- /dev/null +++ b/ir_cron_progress.go @@ -0,0 +1,121 @@ +package odoo + +// IrCronProgress represents ir.cron.progress model. +type IrCronProgress struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CronId *Many2One `xmlrpc:"cron_id,omitempty"` + Deactivate *Bool `xmlrpc:"deactivate,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Done *Int `xmlrpc:"done,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Remaining *Int `xmlrpc:"remaining,omitempty"` + TimedOutCounter *Int `xmlrpc:"timed_out_counter,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrCronProgresss represents array of ir.cron.progress model. +type IrCronProgresss []IrCronProgress + +// IrCronProgressModel is the odoo model name. +const IrCronProgressModel = "ir.cron.progress" + +// Many2One convert IrCronProgress to *Many2One. +func (icp *IrCronProgress) Many2One() *Many2One { + return NewMany2One(icp.Id.Get(), "") +} + +// CreateIrCronProgress creates a new ir.cron.progress model and returns its id. +func (c *Client) CreateIrCronProgress(icp *IrCronProgress) (int64, error) { + ids, err := c.CreateIrCronProgresss([]*IrCronProgress{icp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrCronProgress creates a new ir.cron.progress model and returns its id. +func (c *Client) CreateIrCronProgresss(icps []*IrCronProgress) ([]int64, error) { + var vv []interface{} + for _, v := range icps { + vv = append(vv, v) + } + return c.Create(IrCronProgressModel, vv, nil) +} + +// UpdateIrCronProgress updates an existing ir.cron.progress record. +func (c *Client) UpdateIrCronProgress(icp *IrCronProgress) error { + return c.UpdateIrCronProgresss([]int64{icp.Id.Get()}, icp) +} + +// UpdateIrCronProgresss updates existing ir.cron.progress records. +// All records (represented by ids) will be updated by icp values. +func (c *Client) UpdateIrCronProgresss(ids []int64, icp *IrCronProgress) error { + return c.Update(IrCronProgressModel, ids, icp, nil) +} + +// DeleteIrCronProgress deletes an existing ir.cron.progress record. +func (c *Client) DeleteIrCronProgress(id int64) error { + return c.DeleteIrCronProgresss([]int64{id}) +} + +// DeleteIrCronProgresss deletes existing ir.cron.progress records. +func (c *Client) DeleteIrCronProgresss(ids []int64) error { + return c.Delete(IrCronProgressModel, ids) +} + +// GetIrCronProgress gets ir.cron.progress existing record. +func (c *Client) GetIrCronProgress(id int64) (*IrCronProgress, error) { + icps, err := c.GetIrCronProgresss([]int64{id}) + if err != nil { + return nil, err + } + return &((*icps)[0]), nil +} + +// GetIrCronProgresss gets ir.cron.progress existing records. +func (c *Client) GetIrCronProgresss(ids []int64) (*IrCronProgresss, error) { + icps := &IrCronProgresss{} + if err := c.Read(IrCronProgressModel, ids, nil, icps); err != nil { + return nil, err + } + return icps, nil +} + +// FindIrCronProgress finds ir.cron.progress record by querying it with criteria. +func (c *Client) FindIrCronProgress(criteria *Criteria) (*IrCronProgress, error) { + icps := &IrCronProgresss{} + if err := c.SearchRead(IrCronProgressModel, criteria, NewOptions().Limit(1), icps); err != nil { + return nil, err + } + return &((*icps)[0]), nil +} + +// FindIrCronProgresss finds ir.cron.progress records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrCronProgresss(criteria *Criteria, options *Options) (*IrCronProgresss, error) { + icps := &IrCronProgresss{} + if err := c.SearchRead(IrCronProgressModel, criteria, options, icps); err != nil { + return nil, err + } + return icps, nil +} + +// FindIrCronProgressIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrCronProgressIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrCronProgressModel, criteria, options) +} + +// FindIrCronProgressId finds record id by querying it with criteria. +func (c *Client) FindIrCronProgressId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrCronProgressModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_cron_trigger.go b/ir_cron_trigger.go new file mode 100644 index 0000000..73d53e1 --- /dev/null +++ b/ir_cron_trigger.go @@ -0,0 +1,118 @@ +package odoo + +// IrCronTrigger represents ir.cron.trigger model. +type IrCronTrigger struct { + CallAt *Time `xmlrpc:"call_at,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CronId *Many2One `xmlrpc:"cron_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrCronTriggers represents array of ir.cron.trigger model. +type IrCronTriggers []IrCronTrigger + +// IrCronTriggerModel is the odoo model name. +const IrCronTriggerModel = "ir.cron.trigger" + +// Many2One convert IrCronTrigger to *Many2One. +func (ict *IrCronTrigger) Many2One() *Many2One { + return NewMany2One(ict.Id.Get(), "") +} + +// CreateIrCronTrigger creates a new ir.cron.trigger model and returns its id. +func (c *Client) CreateIrCronTrigger(ict *IrCronTrigger) (int64, error) { + ids, err := c.CreateIrCronTriggers([]*IrCronTrigger{ict}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrCronTrigger creates a new ir.cron.trigger model and returns its id. +func (c *Client) CreateIrCronTriggers(icts []*IrCronTrigger) ([]int64, error) { + var vv []interface{} + for _, v := range icts { + vv = append(vv, v) + } + return c.Create(IrCronTriggerModel, vv, nil) +} + +// UpdateIrCronTrigger updates an existing ir.cron.trigger record. +func (c *Client) UpdateIrCronTrigger(ict *IrCronTrigger) error { + return c.UpdateIrCronTriggers([]int64{ict.Id.Get()}, ict) +} + +// UpdateIrCronTriggers updates existing ir.cron.trigger records. +// All records (represented by ids) will be updated by ict values. +func (c *Client) UpdateIrCronTriggers(ids []int64, ict *IrCronTrigger) error { + return c.Update(IrCronTriggerModel, ids, ict, nil) +} + +// DeleteIrCronTrigger deletes an existing ir.cron.trigger record. +func (c *Client) DeleteIrCronTrigger(id int64) error { + return c.DeleteIrCronTriggers([]int64{id}) +} + +// DeleteIrCronTriggers deletes existing ir.cron.trigger records. +func (c *Client) DeleteIrCronTriggers(ids []int64) error { + return c.Delete(IrCronTriggerModel, ids) +} + +// GetIrCronTrigger gets ir.cron.trigger existing record. +func (c *Client) GetIrCronTrigger(id int64) (*IrCronTrigger, error) { + icts, err := c.GetIrCronTriggers([]int64{id}) + if err != nil { + return nil, err + } + return &((*icts)[0]), nil +} + +// GetIrCronTriggers gets ir.cron.trigger existing records. +func (c *Client) GetIrCronTriggers(ids []int64) (*IrCronTriggers, error) { + icts := &IrCronTriggers{} + if err := c.Read(IrCronTriggerModel, ids, nil, icts); err != nil { + return nil, err + } + return icts, nil +} + +// FindIrCronTrigger finds ir.cron.trigger record by querying it with criteria. +func (c *Client) FindIrCronTrigger(criteria *Criteria) (*IrCronTrigger, error) { + icts := &IrCronTriggers{} + if err := c.SearchRead(IrCronTriggerModel, criteria, NewOptions().Limit(1), icts); err != nil { + return nil, err + } + return &((*icts)[0]), nil +} + +// FindIrCronTriggers finds ir.cron.trigger records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrCronTriggers(criteria *Criteria, options *Options) (*IrCronTriggers, error) { + icts := &IrCronTriggers{} + if err := c.SearchRead(IrCronTriggerModel, criteria, options, icts); err != nil { + return nil, err + } + return icts, nil +} + +// FindIrCronTriggerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrCronTriggerIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrCronTriggerModel, criteria, options) +} + +// FindIrCronTriggerId finds record id by querying it with criteria. +func (c *Client) FindIrCronTriggerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrCronTriggerModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_default.go b/ir_default.go new file mode 100644 index 0000000..162f16a --- /dev/null +++ b/ir_default.go @@ -0,0 +1,121 @@ +package odoo + +// IrDefault represents ir.default model. +type IrDefault struct { + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + Condition *String `xmlrpc:"condition,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FieldId *Many2One `xmlrpc:"field_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JsonValue *String `xmlrpc:"json_value,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrDefaults represents array of ir.default model. +type IrDefaults []IrDefault + +// IrDefaultModel is the odoo model name. +const IrDefaultModel = "ir.default" + +// Many2One convert IrDefault to *Many2One. +func (ID *IrDefault) Many2One() *Many2One { + return NewMany2One(ID.Id.Get(), "") +} + +// CreateIrDefault creates a new ir.default model and returns its id. +func (c *Client) CreateIrDefault(ID *IrDefault) (int64, error) { + ids, err := c.CreateIrDefaults([]*IrDefault{ID}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrDefault creates a new ir.default model and returns its id. +func (c *Client) CreateIrDefaults(IDs []*IrDefault) ([]int64, error) { + var vv []interface{} + for _, v := range IDs { + vv = append(vv, v) + } + return c.Create(IrDefaultModel, vv, nil) +} + +// UpdateIrDefault updates an existing ir.default record. +func (c *Client) UpdateIrDefault(ID *IrDefault) error { + return c.UpdateIrDefaults([]int64{ID.Id.Get()}, ID) +} + +// UpdateIrDefaults updates existing ir.default records. +// All records (represented by ids) will be updated by ID values. +func (c *Client) UpdateIrDefaults(ids []int64, ID *IrDefault) error { + return c.Update(IrDefaultModel, ids, ID, nil) +} + +// DeleteIrDefault deletes an existing ir.default record. +func (c *Client) DeleteIrDefault(id int64) error { + return c.DeleteIrDefaults([]int64{id}) +} + +// DeleteIrDefaults deletes existing ir.default records. +func (c *Client) DeleteIrDefaults(ids []int64) error { + return c.Delete(IrDefaultModel, ids) +} + +// GetIrDefault gets ir.default existing record. +func (c *Client) GetIrDefault(id int64) (*IrDefault, error) { + IDs, err := c.GetIrDefaults([]int64{id}) + if err != nil { + return nil, err + } + return &((*IDs)[0]), nil +} + +// GetIrDefaults gets ir.default existing records. +func (c *Client) GetIrDefaults(ids []int64) (*IrDefaults, error) { + IDs := &IrDefaults{} + if err := c.Read(IrDefaultModel, ids, nil, IDs); err != nil { + return nil, err + } + return IDs, nil +} + +// FindIrDefault finds ir.default record by querying it with criteria. +func (c *Client) FindIrDefault(criteria *Criteria) (*IrDefault, error) { + IDs := &IrDefaults{} + if err := c.SearchRead(IrDefaultModel, criteria, NewOptions().Limit(1), IDs); err != nil { + return nil, err + } + return &((*IDs)[0]), nil +} + +// FindIrDefaults finds ir.default records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrDefaults(criteria *Criteria, options *Options) (*IrDefaults, error) { + IDs := &IrDefaults{} + if err := c.SearchRead(IrDefaultModel, criteria, options, IDs); err != nil { + return nil, err + } + return IDs, nil +} + +// FindIrDefaultIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrDefaultIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrDefaultModel, criteria, options) +} + +// FindIrDefaultId finds record id by querying it with criteria. +func (c *Client) FindIrDefaultId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrDefaultModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_demo.go b/ir_demo.go new file mode 100644 index 0000000..60f580e --- /dev/null +++ b/ir_demo.go @@ -0,0 +1,116 @@ +package odoo + +// IrDemo represents ir.demo model. +type IrDemo struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrDemos represents array of ir.demo model. +type IrDemos []IrDemo + +// IrDemoModel is the odoo model name. +const IrDemoModel = "ir.demo" + +// Many2One convert IrDemo to *Many2One. +func (ID *IrDemo) Many2One() *Many2One { + return NewMany2One(ID.Id.Get(), "") +} + +// CreateIrDemo creates a new ir.demo model and returns its id. +func (c *Client) CreateIrDemo(ID *IrDemo) (int64, error) { + ids, err := c.CreateIrDemos([]*IrDemo{ID}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrDemo creates a new ir.demo model and returns its id. +func (c *Client) CreateIrDemos(IDs []*IrDemo) ([]int64, error) { + var vv []interface{} + for _, v := range IDs { + vv = append(vv, v) + } + return c.Create(IrDemoModel, vv, nil) +} + +// UpdateIrDemo updates an existing ir.demo record. +func (c *Client) UpdateIrDemo(ID *IrDemo) error { + return c.UpdateIrDemos([]int64{ID.Id.Get()}, ID) +} + +// UpdateIrDemos updates existing ir.demo records. +// All records (represented by ids) will be updated by ID values. +func (c *Client) UpdateIrDemos(ids []int64, ID *IrDemo) error { + return c.Update(IrDemoModel, ids, ID, nil) +} + +// DeleteIrDemo deletes an existing ir.demo record. +func (c *Client) DeleteIrDemo(id int64) error { + return c.DeleteIrDemos([]int64{id}) +} + +// DeleteIrDemos deletes existing ir.demo records. +func (c *Client) DeleteIrDemos(ids []int64) error { + return c.Delete(IrDemoModel, ids) +} + +// GetIrDemo gets ir.demo existing record. +func (c *Client) GetIrDemo(id int64) (*IrDemo, error) { + IDs, err := c.GetIrDemos([]int64{id}) + if err != nil { + return nil, err + } + return &((*IDs)[0]), nil +} + +// GetIrDemos gets ir.demo existing records. +func (c *Client) GetIrDemos(ids []int64) (*IrDemos, error) { + IDs := &IrDemos{} + if err := c.Read(IrDemoModel, ids, nil, IDs); err != nil { + return nil, err + } + return IDs, nil +} + +// FindIrDemo finds ir.demo record by querying it with criteria. +func (c *Client) FindIrDemo(criteria *Criteria) (*IrDemo, error) { + IDs := &IrDemos{} + if err := c.SearchRead(IrDemoModel, criteria, NewOptions().Limit(1), IDs); err != nil { + return nil, err + } + return &((*IDs)[0]), nil +} + +// FindIrDemos finds ir.demo records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrDemos(criteria *Criteria, options *Options) (*IrDemos, error) { + IDs := &IrDemos{} + if err := c.SearchRead(IrDemoModel, criteria, options, IDs); err != nil { + return nil, err + } + return IDs, nil +} + +// FindIrDemoIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrDemoIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrDemoModel, criteria, options) +} + +// FindIrDemoId finds record id by querying it with criteria. +func (c *Client) FindIrDemoId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrDemoModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_demo_failure.go b/ir_demo_failure.go new file mode 100644 index 0000000..11fe464 --- /dev/null +++ b/ir_demo_failure.go @@ -0,0 +1,119 @@ +package odoo + +// IrDemoFailure represents ir.demo_failure model. +type IrDemoFailure struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Error *String `xmlrpc:"error,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ModuleId *Many2One `xmlrpc:"module_id,omitempty"` + WizardId *Many2One `xmlrpc:"wizard_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrDemoFailures represents array of ir.demo_failure model. +type IrDemoFailures []IrDemoFailure + +// IrDemoFailureModel is the odoo model name. +const IrDemoFailureModel = "ir.demo_failure" + +// Many2One convert IrDemoFailure to *Many2One. +func (ID *IrDemoFailure) Many2One() *Many2One { + return NewMany2One(ID.Id.Get(), "") +} + +// CreateIrDemoFailure creates a new ir.demo_failure model and returns its id. +func (c *Client) CreateIrDemoFailure(ID *IrDemoFailure) (int64, error) { + ids, err := c.CreateIrDemoFailures([]*IrDemoFailure{ID}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrDemoFailure creates a new ir.demo_failure model and returns its id. +func (c *Client) CreateIrDemoFailures(IDs []*IrDemoFailure) ([]int64, error) { + var vv []interface{} + for _, v := range IDs { + vv = append(vv, v) + } + return c.Create(IrDemoFailureModel, vv, nil) +} + +// UpdateIrDemoFailure updates an existing ir.demo_failure record. +func (c *Client) UpdateIrDemoFailure(ID *IrDemoFailure) error { + return c.UpdateIrDemoFailures([]int64{ID.Id.Get()}, ID) +} + +// UpdateIrDemoFailures updates existing ir.demo_failure records. +// All records (represented by ids) will be updated by ID values. +func (c *Client) UpdateIrDemoFailures(ids []int64, ID *IrDemoFailure) error { + return c.Update(IrDemoFailureModel, ids, ID, nil) +} + +// DeleteIrDemoFailure deletes an existing ir.demo_failure record. +func (c *Client) DeleteIrDemoFailure(id int64) error { + return c.DeleteIrDemoFailures([]int64{id}) +} + +// DeleteIrDemoFailures deletes existing ir.demo_failure records. +func (c *Client) DeleteIrDemoFailures(ids []int64) error { + return c.Delete(IrDemoFailureModel, ids) +} + +// GetIrDemoFailure gets ir.demo_failure existing record. +func (c *Client) GetIrDemoFailure(id int64) (*IrDemoFailure, error) { + IDs, err := c.GetIrDemoFailures([]int64{id}) + if err != nil { + return nil, err + } + return &((*IDs)[0]), nil +} + +// GetIrDemoFailures gets ir.demo_failure existing records. +func (c *Client) GetIrDemoFailures(ids []int64) (*IrDemoFailures, error) { + IDs := &IrDemoFailures{} + if err := c.Read(IrDemoFailureModel, ids, nil, IDs); err != nil { + return nil, err + } + return IDs, nil +} + +// FindIrDemoFailure finds ir.demo_failure record by querying it with criteria. +func (c *Client) FindIrDemoFailure(criteria *Criteria) (*IrDemoFailure, error) { + IDs := &IrDemoFailures{} + if err := c.SearchRead(IrDemoFailureModel, criteria, NewOptions().Limit(1), IDs); err != nil { + return nil, err + } + return &((*IDs)[0]), nil +} + +// FindIrDemoFailures finds ir.demo_failure records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrDemoFailures(criteria *Criteria, options *Options) (*IrDemoFailures, error) { + IDs := &IrDemoFailures{} + if err := c.SearchRead(IrDemoFailureModel, criteria, options, IDs); err != nil { + return nil, err + } + return IDs, nil +} + +// FindIrDemoFailureIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrDemoFailureIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrDemoFailureModel, criteria, options) +} + +// FindIrDemoFailureId finds record id by querying it with criteria. +func (c *Client) FindIrDemoFailureId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrDemoFailureModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_demo_failure_wizard.go b/ir_demo_failure_wizard.go new file mode 100644 index 0000000..3cbf0a2 --- /dev/null +++ b/ir_demo_failure_wizard.go @@ -0,0 +1,118 @@ +package odoo + +// IrDemoFailureWizard represents ir.demo_failure.wizard model. +type IrDemoFailureWizard struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FailureIds *Relation `xmlrpc:"failure_ids,omitempty"` + FailuresCount *Int `xmlrpc:"failures_count,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrDemoFailureWizards represents array of ir.demo_failure.wizard model. +type IrDemoFailureWizards []IrDemoFailureWizard + +// IrDemoFailureWizardModel is the odoo model name. +const IrDemoFailureWizardModel = "ir.demo_failure.wizard" + +// Many2One convert IrDemoFailureWizard to *Many2One. +func (idw *IrDemoFailureWizard) Many2One() *Many2One { + return NewMany2One(idw.Id.Get(), "") +} + +// CreateIrDemoFailureWizard creates a new ir.demo_failure.wizard model and returns its id. +func (c *Client) CreateIrDemoFailureWizard(idw *IrDemoFailureWizard) (int64, error) { + ids, err := c.CreateIrDemoFailureWizards([]*IrDemoFailureWizard{idw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrDemoFailureWizard creates a new ir.demo_failure.wizard model and returns its id. +func (c *Client) CreateIrDemoFailureWizards(idws []*IrDemoFailureWizard) ([]int64, error) { + var vv []interface{} + for _, v := range idws { + vv = append(vv, v) + } + return c.Create(IrDemoFailureWizardModel, vv, nil) +} + +// UpdateIrDemoFailureWizard updates an existing ir.demo_failure.wizard record. +func (c *Client) UpdateIrDemoFailureWizard(idw *IrDemoFailureWizard) error { + return c.UpdateIrDemoFailureWizards([]int64{idw.Id.Get()}, idw) +} + +// UpdateIrDemoFailureWizards updates existing ir.demo_failure.wizard records. +// All records (represented by ids) will be updated by idw values. +func (c *Client) UpdateIrDemoFailureWizards(ids []int64, idw *IrDemoFailureWizard) error { + return c.Update(IrDemoFailureWizardModel, ids, idw, nil) +} + +// DeleteIrDemoFailureWizard deletes an existing ir.demo_failure.wizard record. +func (c *Client) DeleteIrDemoFailureWizard(id int64) error { + return c.DeleteIrDemoFailureWizards([]int64{id}) +} + +// DeleteIrDemoFailureWizards deletes existing ir.demo_failure.wizard records. +func (c *Client) DeleteIrDemoFailureWizards(ids []int64) error { + return c.Delete(IrDemoFailureWizardModel, ids) +} + +// GetIrDemoFailureWizard gets ir.demo_failure.wizard existing record. +func (c *Client) GetIrDemoFailureWizard(id int64) (*IrDemoFailureWizard, error) { + idws, err := c.GetIrDemoFailureWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*idws)[0]), nil +} + +// GetIrDemoFailureWizards gets ir.demo_failure.wizard existing records. +func (c *Client) GetIrDemoFailureWizards(ids []int64) (*IrDemoFailureWizards, error) { + idws := &IrDemoFailureWizards{} + if err := c.Read(IrDemoFailureWizardModel, ids, nil, idws); err != nil { + return nil, err + } + return idws, nil +} + +// FindIrDemoFailureWizard finds ir.demo_failure.wizard record by querying it with criteria. +func (c *Client) FindIrDemoFailureWizard(criteria *Criteria) (*IrDemoFailureWizard, error) { + idws := &IrDemoFailureWizards{} + if err := c.SearchRead(IrDemoFailureWizardModel, criteria, NewOptions().Limit(1), idws); err != nil { + return nil, err + } + return &((*idws)[0]), nil +} + +// FindIrDemoFailureWizards finds ir.demo_failure.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrDemoFailureWizards(criteria *Criteria, options *Options) (*IrDemoFailureWizards, error) { + idws := &IrDemoFailureWizards{} + if err := c.SearchRead(IrDemoFailureWizardModel, criteria, options, idws); err != nil { + return nil, err + } + return idws, nil +} + +// FindIrDemoFailureWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrDemoFailureWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrDemoFailureWizardModel, criteria, options) +} + +// FindIrDemoFailureWizardId finds record id by querying it with criteria. +func (c *Client) FindIrDemoFailureWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrDemoFailureWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_embedded_actions.go b/ir_embedded_actions.go new file mode 100644 index 0000000..9b90d1e --- /dev/null +++ b/ir_embedded_actions.go @@ -0,0 +1,131 @@ +package odoo + +// IrEmbeddedActions represents ir.embedded.actions model. +type IrEmbeddedActions struct { + ActionId *Many2One `xmlrpc:"action_id,omitempty"` + Context *String `xmlrpc:"context,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DefaultViewMode *String `xmlrpc:"default_view_mode,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Domain *String `xmlrpc:"domain,omitempty"` + FilterIds *Relation `xmlrpc:"filter_ids,omitempty"` + GroupsIds *Relation `xmlrpc:"groups_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsDeletable *Bool `xmlrpc:"is_deletable,omitempty"` + IsVisible *Bool `xmlrpc:"is_visible,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentActionId *Many2One `xmlrpc:"parent_action_id,omitempty"` + ParentResId *Int `xmlrpc:"parent_res_id,omitempty"` + ParentResModel *String `xmlrpc:"parent_res_model,omitempty"` + PythonMethod *String `xmlrpc:"python_method,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrEmbeddedActionss represents array of ir.embedded.actions model. +type IrEmbeddedActionss []IrEmbeddedActions + +// IrEmbeddedActionsModel is the odoo model name. +const IrEmbeddedActionsModel = "ir.embedded.actions" + +// Many2One convert IrEmbeddedActions to *Many2One. +func (iea *IrEmbeddedActions) Many2One() *Many2One { + return NewMany2One(iea.Id.Get(), "") +} + +// CreateIrEmbeddedActions creates a new ir.embedded.actions model and returns its id. +func (c *Client) CreateIrEmbeddedActions(iea *IrEmbeddedActions) (int64, error) { + ids, err := c.CreateIrEmbeddedActionss([]*IrEmbeddedActions{iea}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrEmbeddedActions creates a new ir.embedded.actions model and returns its id. +func (c *Client) CreateIrEmbeddedActionss(ieas []*IrEmbeddedActions) ([]int64, error) { + var vv []interface{} + for _, v := range ieas { + vv = append(vv, v) + } + return c.Create(IrEmbeddedActionsModel, vv, nil) +} + +// UpdateIrEmbeddedActions updates an existing ir.embedded.actions record. +func (c *Client) UpdateIrEmbeddedActions(iea *IrEmbeddedActions) error { + return c.UpdateIrEmbeddedActionss([]int64{iea.Id.Get()}, iea) +} + +// UpdateIrEmbeddedActionss updates existing ir.embedded.actions records. +// All records (represented by ids) will be updated by iea values. +func (c *Client) UpdateIrEmbeddedActionss(ids []int64, iea *IrEmbeddedActions) error { + return c.Update(IrEmbeddedActionsModel, ids, iea, nil) +} + +// DeleteIrEmbeddedActions deletes an existing ir.embedded.actions record. +func (c *Client) DeleteIrEmbeddedActions(id int64) error { + return c.DeleteIrEmbeddedActionss([]int64{id}) +} + +// DeleteIrEmbeddedActionss deletes existing ir.embedded.actions records. +func (c *Client) DeleteIrEmbeddedActionss(ids []int64) error { + return c.Delete(IrEmbeddedActionsModel, ids) +} + +// GetIrEmbeddedActions gets ir.embedded.actions existing record. +func (c *Client) GetIrEmbeddedActions(id int64) (*IrEmbeddedActions, error) { + ieas, err := c.GetIrEmbeddedActionss([]int64{id}) + if err != nil { + return nil, err + } + return &((*ieas)[0]), nil +} + +// GetIrEmbeddedActionss gets ir.embedded.actions existing records. +func (c *Client) GetIrEmbeddedActionss(ids []int64) (*IrEmbeddedActionss, error) { + ieas := &IrEmbeddedActionss{} + if err := c.Read(IrEmbeddedActionsModel, ids, nil, ieas); err != nil { + return nil, err + } + return ieas, nil +} + +// FindIrEmbeddedActions finds ir.embedded.actions record by querying it with criteria. +func (c *Client) FindIrEmbeddedActions(criteria *Criteria) (*IrEmbeddedActions, error) { + ieas := &IrEmbeddedActionss{} + if err := c.SearchRead(IrEmbeddedActionsModel, criteria, NewOptions().Limit(1), ieas); err != nil { + return nil, err + } + return &((*ieas)[0]), nil +} + +// FindIrEmbeddedActionss finds ir.embedded.actions records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrEmbeddedActionss(criteria *Criteria, options *Options) (*IrEmbeddedActionss, error) { + ieas := &IrEmbeddedActionss{} + if err := c.SearchRead(IrEmbeddedActionsModel, criteria, options, ieas); err != nil { + return nil, err + } + return ieas, nil +} + +// FindIrEmbeddedActionsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrEmbeddedActionsIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrEmbeddedActionsModel, criteria, options) +} + +// FindIrEmbeddedActionsId finds record id by querying it with criteria. +func (c *Client) FindIrEmbeddedActionsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrEmbeddedActionsModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_exports.go b/ir_exports.go new file mode 100644 index 0000000..9c1efc3 --- /dev/null +++ b/ir_exports.go @@ -0,0 +1,119 @@ +package odoo + +// IrExports represents ir.exports model. +type IrExports struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExportFields *Relation `xmlrpc:"export_fields,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Resource *String `xmlrpc:"resource,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrExportss represents array of ir.exports model. +type IrExportss []IrExports + +// IrExportsModel is the odoo model name. +const IrExportsModel = "ir.exports" + +// Many2One convert IrExports to *Many2One. +func (ie *IrExports) Many2One() *Many2One { + return NewMany2One(ie.Id.Get(), "") +} + +// CreateIrExports creates a new ir.exports model and returns its id. +func (c *Client) CreateIrExports(ie *IrExports) (int64, error) { + ids, err := c.CreateIrExportss([]*IrExports{ie}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrExports creates a new ir.exports model and returns its id. +func (c *Client) CreateIrExportss(ies []*IrExports) ([]int64, error) { + var vv []interface{} + for _, v := range ies { + vv = append(vv, v) + } + return c.Create(IrExportsModel, vv, nil) +} + +// UpdateIrExports updates an existing ir.exports record. +func (c *Client) UpdateIrExports(ie *IrExports) error { + return c.UpdateIrExportss([]int64{ie.Id.Get()}, ie) +} + +// UpdateIrExportss updates existing ir.exports records. +// All records (represented by ids) will be updated by ie values. +func (c *Client) UpdateIrExportss(ids []int64, ie *IrExports) error { + return c.Update(IrExportsModel, ids, ie, nil) +} + +// DeleteIrExports deletes an existing ir.exports record. +func (c *Client) DeleteIrExports(id int64) error { + return c.DeleteIrExportss([]int64{id}) +} + +// DeleteIrExportss deletes existing ir.exports records. +func (c *Client) DeleteIrExportss(ids []int64) error { + return c.Delete(IrExportsModel, ids) +} + +// GetIrExports gets ir.exports existing record. +func (c *Client) GetIrExports(id int64) (*IrExports, error) { + ies, err := c.GetIrExportss([]int64{id}) + if err != nil { + return nil, err + } + return &((*ies)[0]), nil +} + +// GetIrExportss gets ir.exports existing records. +func (c *Client) GetIrExportss(ids []int64) (*IrExportss, error) { + ies := &IrExportss{} + if err := c.Read(IrExportsModel, ids, nil, ies); err != nil { + return nil, err + } + return ies, nil +} + +// FindIrExports finds ir.exports record by querying it with criteria. +func (c *Client) FindIrExports(criteria *Criteria) (*IrExports, error) { + ies := &IrExportss{} + if err := c.SearchRead(IrExportsModel, criteria, NewOptions().Limit(1), ies); err != nil { + return nil, err + } + return &((*ies)[0]), nil +} + +// FindIrExportss finds ir.exports records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrExportss(criteria *Criteria, options *Options) (*IrExportss, error) { + ies := &IrExportss{} + if err := c.SearchRead(IrExportsModel, criteria, options, ies); err != nil { + return nil, err + } + return ies, nil +} + +// FindIrExportsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrExportsIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrExportsModel, criteria, options) +} + +// FindIrExportsId finds record id by querying it with criteria. +func (c *Client) FindIrExportsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrExportsModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_exports_line.go b/ir_exports_line.go new file mode 100644 index 0000000..e72cbdd --- /dev/null +++ b/ir_exports_line.go @@ -0,0 +1,118 @@ +package odoo + +// IrExportsLine represents ir.exports.line model. +type IrExportsLine struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExportId *Many2One `xmlrpc:"export_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrExportsLines represents array of ir.exports.line model. +type IrExportsLines []IrExportsLine + +// IrExportsLineModel is the odoo model name. +const IrExportsLineModel = "ir.exports.line" + +// Many2One convert IrExportsLine to *Many2One. +func (iel *IrExportsLine) Many2One() *Many2One { + return NewMany2One(iel.Id.Get(), "") +} + +// CreateIrExportsLine creates a new ir.exports.line model and returns its id. +func (c *Client) CreateIrExportsLine(iel *IrExportsLine) (int64, error) { + ids, err := c.CreateIrExportsLines([]*IrExportsLine{iel}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrExportsLine creates a new ir.exports.line model and returns its id. +func (c *Client) CreateIrExportsLines(iels []*IrExportsLine) ([]int64, error) { + var vv []interface{} + for _, v := range iels { + vv = append(vv, v) + } + return c.Create(IrExportsLineModel, vv, nil) +} + +// UpdateIrExportsLine updates an existing ir.exports.line record. +func (c *Client) UpdateIrExportsLine(iel *IrExportsLine) error { + return c.UpdateIrExportsLines([]int64{iel.Id.Get()}, iel) +} + +// UpdateIrExportsLines updates existing ir.exports.line records. +// All records (represented by ids) will be updated by iel values. +func (c *Client) UpdateIrExportsLines(ids []int64, iel *IrExportsLine) error { + return c.Update(IrExportsLineModel, ids, iel, nil) +} + +// DeleteIrExportsLine deletes an existing ir.exports.line record. +func (c *Client) DeleteIrExportsLine(id int64) error { + return c.DeleteIrExportsLines([]int64{id}) +} + +// DeleteIrExportsLines deletes existing ir.exports.line records. +func (c *Client) DeleteIrExportsLines(ids []int64) error { + return c.Delete(IrExportsLineModel, ids) +} + +// GetIrExportsLine gets ir.exports.line existing record. +func (c *Client) GetIrExportsLine(id int64) (*IrExportsLine, error) { + iels, err := c.GetIrExportsLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*iels)[0]), nil +} + +// GetIrExportsLines gets ir.exports.line existing records. +func (c *Client) GetIrExportsLines(ids []int64) (*IrExportsLines, error) { + iels := &IrExportsLines{} + if err := c.Read(IrExportsLineModel, ids, nil, iels); err != nil { + return nil, err + } + return iels, nil +} + +// FindIrExportsLine finds ir.exports.line record by querying it with criteria. +func (c *Client) FindIrExportsLine(criteria *Criteria) (*IrExportsLine, error) { + iels := &IrExportsLines{} + if err := c.SearchRead(IrExportsLineModel, criteria, NewOptions().Limit(1), iels); err != nil { + return nil, err + } + return &((*iels)[0]), nil +} + +// FindIrExportsLines finds ir.exports.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrExportsLines(criteria *Criteria, options *Options) (*IrExportsLines, error) { + iels := &IrExportsLines{} + if err := c.SearchRead(IrExportsLineModel, criteria, options, iels); err != nil { + return nil, err + } + return iels, nil +} + +// FindIrExportsLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrExportsLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrExportsLineModel, criteria, options) +} + +// FindIrExportsLineId finds record id by querying it with criteria. +func (c *Client) FindIrExportsLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrExportsLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_filters.go b/ir_filters.go new file mode 100644 index 0000000..d8c2c4a --- /dev/null +++ b/ir_filters.go @@ -0,0 +1,127 @@ +package odoo + +// IrFilters represents ir.filters model. +type IrFilters struct { + ActionId *Many2One `xmlrpc:"action_id,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + Context *String `xmlrpc:"context,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Domain *String `xmlrpc:"domain,omitempty"` + EmbeddedActionId *Many2One `xmlrpc:"embedded_action_id,omitempty"` + EmbeddedParentResId *Int `xmlrpc:"embedded_parent_res_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsDefault *Bool `xmlrpc:"is_default,omitempty"` + ModelId *Selection `xmlrpc:"model_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sort *String `xmlrpc:"sort,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrFilterss represents array of ir.filters model. +type IrFilterss []IrFilters + +// IrFiltersModel is the odoo model name. +const IrFiltersModel = "ir.filters" + +// Many2One convert IrFilters to *Many2One. +func (IF *IrFilters) Many2One() *Many2One { + return NewMany2One(IF.Id.Get(), "") +} + +// CreateIrFilters creates a new ir.filters model and returns its id. +func (c *Client) CreateIrFilters(IF *IrFilters) (int64, error) { + ids, err := c.CreateIrFilterss([]*IrFilters{IF}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrFilters creates a new ir.filters model and returns its id. +func (c *Client) CreateIrFilterss(IFs []*IrFilters) ([]int64, error) { + var vv []interface{} + for _, v := range IFs { + vv = append(vv, v) + } + return c.Create(IrFiltersModel, vv, nil) +} + +// UpdateIrFilters updates an existing ir.filters record. +func (c *Client) UpdateIrFilters(IF *IrFilters) error { + return c.UpdateIrFilterss([]int64{IF.Id.Get()}, IF) +} + +// UpdateIrFilterss updates existing ir.filters records. +// All records (represented by ids) will be updated by IF values. +func (c *Client) UpdateIrFilterss(ids []int64, IF *IrFilters) error { + return c.Update(IrFiltersModel, ids, IF, nil) +} + +// DeleteIrFilters deletes an existing ir.filters record. +func (c *Client) DeleteIrFilters(id int64) error { + return c.DeleteIrFilterss([]int64{id}) +} + +// DeleteIrFilterss deletes existing ir.filters records. +func (c *Client) DeleteIrFilterss(ids []int64) error { + return c.Delete(IrFiltersModel, ids) +} + +// GetIrFilters gets ir.filters existing record. +func (c *Client) GetIrFilters(id int64) (*IrFilters, error) { + IFs, err := c.GetIrFilterss([]int64{id}) + if err != nil { + return nil, err + } + return &((*IFs)[0]), nil +} + +// GetIrFilterss gets ir.filters existing records. +func (c *Client) GetIrFilterss(ids []int64) (*IrFilterss, error) { + IFs := &IrFilterss{} + if err := c.Read(IrFiltersModel, ids, nil, IFs); err != nil { + return nil, err + } + return IFs, nil +} + +// FindIrFilters finds ir.filters record by querying it with criteria. +func (c *Client) FindIrFilters(criteria *Criteria) (*IrFilters, error) { + IFs := &IrFilterss{} + if err := c.SearchRead(IrFiltersModel, criteria, NewOptions().Limit(1), IFs); err != nil { + return nil, err + } + return &((*IFs)[0]), nil +} + +// FindIrFilterss finds ir.filters records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrFilterss(criteria *Criteria, options *Options) (*IrFilterss, error) { + IFs := &IrFilterss{} + if err := c.SearchRead(IrFiltersModel, criteria, options, IFs); err != nil { + return nil, err + } + return IFs, nil +} + +// FindIrFiltersIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrFiltersIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrFiltersModel, criteria, options) +} + +// FindIrFiltersId finds record id by querying it with criteria. +func (c *Client) FindIrFiltersId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrFiltersModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_logging.go b/ir_logging.go new file mode 100644 index 0000000..8b35ce2 --- /dev/null +++ b/ir_logging.go @@ -0,0 +1,124 @@ +package odoo + +// IrLogging represents ir.logging model. +type IrLogging struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Int `xmlrpc:"create_uid,omitempty"` + Dbname *String `xmlrpc:"dbname,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Func *String `xmlrpc:"func,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Level *String `xmlrpc:"level,omitempty"` + Line *String `xmlrpc:"line,omitempty"` + Message *String `xmlrpc:"message,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Path *String `xmlrpc:"path,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Int `xmlrpc:"write_uid,omitempty"` +} + +// IrLoggings represents array of ir.logging model. +type IrLoggings []IrLogging + +// IrLoggingModel is the odoo model name. +const IrLoggingModel = "ir.logging" + +// Many2One convert IrLogging to *Many2One. +func (il *IrLogging) Many2One() *Many2One { + return NewMany2One(il.Id.Get(), "") +} + +// CreateIrLogging creates a new ir.logging model and returns its id. +func (c *Client) CreateIrLogging(il *IrLogging) (int64, error) { + ids, err := c.CreateIrLoggings([]*IrLogging{il}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrLogging creates a new ir.logging model and returns its id. +func (c *Client) CreateIrLoggings(ils []*IrLogging) ([]int64, error) { + var vv []interface{} + for _, v := range ils { + vv = append(vv, v) + } + return c.Create(IrLoggingModel, vv, nil) +} + +// UpdateIrLogging updates an existing ir.logging record. +func (c *Client) UpdateIrLogging(il *IrLogging) error { + return c.UpdateIrLoggings([]int64{il.Id.Get()}, il) +} + +// UpdateIrLoggings updates existing ir.logging records. +// All records (represented by ids) will be updated by il values. +func (c *Client) UpdateIrLoggings(ids []int64, il *IrLogging) error { + return c.Update(IrLoggingModel, ids, il, nil) +} + +// DeleteIrLogging deletes an existing ir.logging record. +func (c *Client) DeleteIrLogging(id int64) error { + return c.DeleteIrLoggings([]int64{id}) +} + +// DeleteIrLoggings deletes existing ir.logging records. +func (c *Client) DeleteIrLoggings(ids []int64) error { + return c.Delete(IrLoggingModel, ids) +} + +// GetIrLogging gets ir.logging existing record. +func (c *Client) GetIrLogging(id int64) (*IrLogging, error) { + ils, err := c.GetIrLoggings([]int64{id}) + if err != nil { + return nil, err + } + return &((*ils)[0]), nil +} + +// GetIrLoggings gets ir.logging existing records. +func (c *Client) GetIrLoggings(ids []int64) (*IrLoggings, error) { + ils := &IrLoggings{} + if err := c.Read(IrLoggingModel, ids, nil, ils); err != nil { + return nil, err + } + return ils, nil +} + +// FindIrLogging finds ir.logging record by querying it with criteria. +func (c *Client) FindIrLogging(criteria *Criteria) (*IrLogging, error) { + ils := &IrLoggings{} + if err := c.SearchRead(IrLoggingModel, criteria, NewOptions().Limit(1), ils); err != nil { + return nil, err + } + return &((*ils)[0]), nil +} + +// FindIrLoggings finds ir.logging records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrLoggings(criteria *Criteria, options *Options) (*IrLoggings, error) { + ils := &IrLoggings{} + if err := c.SearchRead(IrLoggingModel, criteria, options, ils); err != nil { + return nil, err + } + return ils, nil +} + +// FindIrLoggingIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrLoggingIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrLoggingModel, criteria, options) +} + +// FindIrLoggingId finds record id by querying it with criteria. +func (c *Client) FindIrLoggingId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrLoggingModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_mail_server.go b/ir_mail_server.go new file mode 100644 index 0000000..4d23bc5 --- /dev/null +++ b/ir_mail_server.go @@ -0,0 +1,137 @@ +package odoo + +// IrMailServer represents ir.mail_server model. +type IrMailServer struct { + Active *Bool `xmlrpc:"active,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FromFilter *String `xmlrpc:"from_filter,omitempty"` + GoogleGmailAccessToken *String `xmlrpc:"google_gmail_access_token,omitempty"` + GoogleGmailAccessTokenExpiration *Int `xmlrpc:"google_gmail_access_token_expiration,omitempty"` + GoogleGmailAuthorizationCode *String `xmlrpc:"google_gmail_authorization_code,omitempty"` + GoogleGmailRefreshToken *String `xmlrpc:"google_gmail_refresh_token,omitempty"` + GoogleGmailUri *String `xmlrpc:"google_gmail_uri,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MailTemplateIds *Relation `xmlrpc:"mail_template_ids,omitempty"` + MaxEmailSize *Float `xmlrpc:"max_email_size,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SmtpAuthentication *Selection `xmlrpc:"smtp_authentication,omitempty"` + SmtpAuthenticationInfo *String `xmlrpc:"smtp_authentication_info,omitempty"` + SmtpDebug *Bool `xmlrpc:"smtp_debug,omitempty"` + SmtpEncryption *Selection `xmlrpc:"smtp_encryption,omitempty"` + SmtpHost *String `xmlrpc:"smtp_host,omitempty"` + SmtpPass *String `xmlrpc:"smtp_pass,omitempty"` + SmtpPort *Int `xmlrpc:"smtp_port,omitempty"` + SmtpSslCertificate *String `xmlrpc:"smtp_ssl_certificate,omitempty"` + SmtpSslPrivateKey *String `xmlrpc:"smtp_ssl_private_key,omitempty"` + SmtpUser *String `xmlrpc:"smtp_user,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrMailServers represents array of ir.mail_server model. +type IrMailServers []IrMailServer + +// IrMailServerModel is the odoo model name. +const IrMailServerModel = "ir.mail_server" + +// Many2One convert IrMailServer to *Many2One. +func (im *IrMailServer) Many2One() *Many2One { + return NewMany2One(im.Id.Get(), "") +} + +// CreateIrMailServer creates a new ir.mail_server model and returns its id. +func (c *Client) CreateIrMailServer(im *IrMailServer) (int64, error) { + ids, err := c.CreateIrMailServers([]*IrMailServer{im}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrMailServer creates a new ir.mail_server model and returns its id. +func (c *Client) CreateIrMailServers(ims []*IrMailServer) ([]int64, error) { + var vv []interface{} + for _, v := range ims { + vv = append(vv, v) + } + return c.Create(IrMailServerModel, vv, nil) +} + +// UpdateIrMailServer updates an existing ir.mail_server record. +func (c *Client) UpdateIrMailServer(im *IrMailServer) error { + return c.UpdateIrMailServers([]int64{im.Id.Get()}, im) +} + +// UpdateIrMailServers updates existing ir.mail_server records. +// All records (represented by ids) will be updated by im values. +func (c *Client) UpdateIrMailServers(ids []int64, im *IrMailServer) error { + return c.Update(IrMailServerModel, ids, im, nil) +} + +// DeleteIrMailServer deletes an existing ir.mail_server record. +func (c *Client) DeleteIrMailServer(id int64) error { + return c.DeleteIrMailServers([]int64{id}) +} + +// DeleteIrMailServers deletes existing ir.mail_server records. +func (c *Client) DeleteIrMailServers(ids []int64) error { + return c.Delete(IrMailServerModel, ids) +} + +// GetIrMailServer gets ir.mail_server existing record. +func (c *Client) GetIrMailServer(id int64) (*IrMailServer, error) { + ims, err := c.GetIrMailServers([]int64{id}) + if err != nil { + return nil, err + } + return &((*ims)[0]), nil +} + +// GetIrMailServers gets ir.mail_server existing records. +func (c *Client) GetIrMailServers(ids []int64) (*IrMailServers, error) { + ims := &IrMailServers{} + if err := c.Read(IrMailServerModel, ids, nil, ims); err != nil { + return nil, err + } + return ims, nil +} + +// FindIrMailServer finds ir.mail_server record by querying it with criteria. +func (c *Client) FindIrMailServer(criteria *Criteria) (*IrMailServer, error) { + ims := &IrMailServers{} + if err := c.SearchRead(IrMailServerModel, criteria, NewOptions().Limit(1), ims); err != nil { + return nil, err + } + return &((*ims)[0]), nil +} + +// FindIrMailServers finds ir.mail_server records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrMailServers(criteria *Criteria, options *Options) (*IrMailServers, error) { + ims := &IrMailServers{} + if err := c.SearchRead(IrMailServerModel, criteria, options, ims); err != nil { + return nil, err + } + return ims, nil +} + +// FindIrMailServerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrMailServerIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrMailServerModel, criteria, options) +} + +// FindIrMailServerId finds record id by querying it with criteria. +func (c *Client) FindIrMailServerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrMailServerModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_model_access.go b/ir_model_access.go new file mode 100644 index 0000000..f880f6a --- /dev/null +++ b/ir_model_access.go @@ -0,0 +1,124 @@ +package odoo + +// IrModelAccess represents ir.model.access model. +type IrModelAccess struct { + Active *Bool `xmlrpc:"active,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + GroupId *Many2One `xmlrpc:"group_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PermCreate *Bool `xmlrpc:"perm_create,omitempty"` + PermRead *Bool `xmlrpc:"perm_read,omitempty"` + PermUnlink *Bool `xmlrpc:"perm_unlink,omitempty"` + PermWrite *Bool `xmlrpc:"perm_write,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrModelAccesss represents array of ir.model.access model. +type IrModelAccesss []IrModelAccess + +// IrModelAccessModel is the odoo model name. +const IrModelAccessModel = "ir.model.access" + +// Many2One convert IrModelAccess to *Many2One. +func (ima *IrModelAccess) Many2One() *Many2One { + return NewMany2One(ima.Id.Get(), "") +} + +// CreateIrModelAccess creates a new ir.model.access model and returns its id. +func (c *Client) CreateIrModelAccess(ima *IrModelAccess) (int64, error) { + ids, err := c.CreateIrModelAccesss([]*IrModelAccess{ima}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrModelAccess creates a new ir.model.access model and returns its id. +func (c *Client) CreateIrModelAccesss(imas []*IrModelAccess) ([]int64, error) { + var vv []interface{} + for _, v := range imas { + vv = append(vv, v) + } + return c.Create(IrModelAccessModel, vv, nil) +} + +// UpdateIrModelAccess updates an existing ir.model.access record. +func (c *Client) UpdateIrModelAccess(ima *IrModelAccess) error { + return c.UpdateIrModelAccesss([]int64{ima.Id.Get()}, ima) +} + +// UpdateIrModelAccesss updates existing ir.model.access records. +// All records (represented by ids) will be updated by ima values. +func (c *Client) UpdateIrModelAccesss(ids []int64, ima *IrModelAccess) error { + return c.Update(IrModelAccessModel, ids, ima, nil) +} + +// DeleteIrModelAccess deletes an existing ir.model.access record. +func (c *Client) DeleteIrModelAccess(id int64) error { + return c.DeleteIrModelAccesss([]int64{id}) +} + +// DeleteIrModelAccesss deletes existing ir.model.access records. +func (c *Client) DeleteIrModelAccesss(ids []int64) error { + return c.Delete(IrModelAccessModel, ids) +} + +// GetIrModelAccess gets ir.model.access existing record. +func (c *Client) GetIrModelAccess(id int64) (*IrModelAccess, error) { + imas, err := c.GetIrModelAccesss([]int64{id}) + if err != nil { + return nil, err + } + return &((*imas)[0]), nil +} + +// GetIrModelAccesss gets ir.model.access existing records. +func (c *Client) GetIrModelAccesss(ids []int64) (*IrModelAccesss, error) { + imas := &IrModelAccesss{} + if err := c.Read(IrModelAccessModel, ids, nil, imas); err != nil { + return nil, err + } + return imas, nil +} + +// FindIrModelAccess finds ir.model.access record by querying it with criteria. +func (c *Client) FindIrModelAccess(criteria *Criteria) (*IrModelAccess, error) { + imas := &IrModelAccesss{} + if err := c.SearchRead(IrModelAccessModel, criteria, NewOptions().Limit(1), imas); err != nil { + return nil, err + } + return &((*imas)[0]), nil +} + +// FindIrModelAccesss finds ir.model.access records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModelAccesss(criteria *Criteria, options *Options) (*IrModelAccesss, error) { + imas := &IrModelAccesss{} + if err := c.SearchRead(IrModelAccessModel, criteria, options, imas); err != nil { + return nil, err + } + return imas, nil +} + +// FindIrModelAccessIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModelAccessIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrModelAccessModel, criteria, options) +} + +// FindIrModelAccessId finds record id by querying it with criteria. +func (c *Client) FindIrModelAccessId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrModelAccessModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_model_constraint.go b/ir_model_constraint.go new file mode 100644 index 0000000..d811cce --- /dev/null +++ b/ir_model_constraint.go @@ -0,0 +1,122 @@ +package odoo + +// IrModelConstraint represents ir.model.constraint model. +type IrModelConstraint struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Definition *String `xmlrpc:"definition,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Message *String `xmlrpc:"message,omitempty"` + Model *Many2One `xmlrpc:"model,omitempty"` + Module *Many2One `xmlrpc:"module,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Type *String `xmlrpc:"type,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrModelConstraints represents array of ir.model.constraint model. +type IrModelConstraints []IrModelConstraint + +// IrModelConstraintModel is the odoo model name. +const IrModelConstraintModel = "ir.model.constraint" + +// Many2One convert IrModelConstraint to *Many2One. +func (imc *IrModelConstraint) Many2One() *Many2One { + return NewMany2One(imc.Id.Get(), "") +} + +// CreateIrModelConstraint creates a new ir.model.constraint model and returns its id. +func (c *Client) CreateIrModelConstraint(imc *IrModelConstraint) (int64, error) { + ids, err := c.CreateIrModelConstraints([]*IrModelConstraint{imc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrModelConstraint creates a new ir.model.constraint model and returns its id. +func (c *Client) CreateIrModelConstraints(imcs []*IrModelConstraint) ([]int64, error) { + var vv []interface{} + for _, v := range imcs { + vv = append(vv, v) + } + return c.Create(IrModelConstraintModel, vv, nil) +} + +// UpdateIrModelConstraint updates an existing ir.model.constraint record. +func (c *Client) UpdateIrModelConstraint(imc *IrModelConstraint) error { + return c.UpdateIrModelConstraints([]int64{imc.Id.Get()}, imc) +} + +// UpdateIrModelConstraints updates existing ir.model.constraint records. +// All records (represented by ids) will be updated by imc values. +func (c *Client) UpdateIrModelConstraints(ids []int64, imc *IrModelConstraint) error { + return c.Update(IrModelConstraintModel, ids, imc, nil) +} + +// DeleteIrModelConstraint deletes an existing ir.model.constraint record. +func (c *Client) DeleteIrModelConstraint(id int64) error { + return c.DeleteIrModelConstraints([]int64{id}) +} + +// DeleteIrModelConstraints deletes existing ir.model.constraint records. +func (c *Client) DeleteIrModelConstraints(ids []int64) error { + return c.Delete(IrModelConstraintModel, ids) +} + +// GetIrModelConstraint gets ir.model.constraint existing record. +func (c *Client) GetIrModelConstraint(id int64) (*IrModelConstraint, error) { + imcs, err := c.GetIrModelConstraints([]int64{id}) + if err != nil { + return nil, err + } + return &((*imcs)[0]), nil +} + +// GetIrModelConstraints gets ir.model.constraint existing records. +func (c *Client) GetIrModelConstraints(ids []int64) (*IrModelConstraints, error) { + imcs := &IrModelConstraints{} + if err := c.Read(IrModelConstraintModel, ids, nil, imcs); err != nil { + return nil, err + } + return imcs, nil +} + +// FindIrModelConstraint finds ir.model.constraint record by querying it with criteria. +func (c *Client) FindIrModelConstraint(criteria *Criteria) (*IrModelConstraint, error) { + imcs := &IrModelConstraints{} + if err := c.SearchRead(IrModelConstraintModel, criteria, NewOptions().Limit(1), imcs); err != nil { + return nil, err + } + return &((*imcs)[0]), nil +} + +// FindIrModelConstraints finds ir.model.constraint records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModelConstraints(criteria *Criteria, options *Options) (*IrModelConstraints, error) { + imcs := &IrModelConstraints{} + if err := c.SearchRead(IrModelConstraintModel, criteria, options, imcs); err != nil { + return nil, err + } + return imcs, nil +} + +// FindIrModelConstraintIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModelConstraintIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrModelConstraintModel, criteria, options) +} + +// FindIrModelConstraintId finds record id by querying it with criteria. +func (c *Client) FindIrModelConstraintId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrModelConstraintModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_model_data.go b/ir_model_data.go new file mode 100644 index 0000000..c2d6412 --- /dev/null +++ b/ir_model_data.go @@ -0,0 +1,123 @@ +package odoo + +// IrModelData represents ir.model.data model. +type IrModelData struct { + CompleteName *String `xmlrpc:"complete_name,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + Module *String `xmlrpc:"module,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Noupdate *Bool `xmlrpc:"noupdate,omitempty"` + Reference *String `xmlrpc:"reference,omitempty"` + ResId *Many2One `xmlrpc:"res_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrModelDatas represents array of ir.model.data model. +type IrModelDatas []IrModelData + +// IrModelDataModel is the odoo model name. +const IrModelDataModel = "ir.model.data" + +// Many2One convert IrModelData to *Many2One. +func (imd *IrModelData) Many2One() *Many2One { + return NewMany2One(imd.Id.Get(), "") +} + +// CreateIrModelData creates a new ir.model.data model and returns its id. +func (c *Client) CreateIrModelData(imd *IrModelData) (int64, error) { + ids, err := c.CreateIrModelDatas([]*IrModelData{imd}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrModelData creates a new ir.model.data model and returns its id. +func (c *Client) CreateIrModelDatas(imds []*IrModelData) ([]int64, error) { + var vv []interface{} + for _, v := range imds { + vv = append(vv, v) + } + return c.Create(IrModelDataModel, vv, nil) +} + +// UpdateIrModelData updates an existing ir.model.data record. +func (c *Client) UpdateIrModelData(imd *IrModelData) error { + return c.UpdateIrModelDatas([]int64{imd.Id.Get()}, imd) +} + +// UpdateIrModelDatas updates existing ir.model.data records. +// All records (represented by ids) will be updated by imd values. +func (c *Client) UpdateIrModelDatas(ids []int64, imd *IrModelData) error { + return c.Update(IrModelDataModel, ids, imd, nil) +} + +// DeleteIrModelData deletes an existing ir.model.data record. +func (c *Client) DeleteIrModelData(id int64) error { + return c.DeleteIrModelDatas([]int64{id}) +} + +// DeleteIrModelDatas deletes existing ir.model.data records. +func (c *Client) DeleteIrModelDatas(ids []int64) error { + return c.Delete(IrModelDataModel, ids) +} + +// GetIrModelData gets ir.model.data existing record. +func (c *Client) GetIrModelData(id int64) (*IrModelData, error) { + imds, err := c.GetIrModelDatas([]int64{id}) + if err != nil { + return nil, err + } + return &((*imds)[0]), nil +} + +// GetIrModelDatas gets ir.model.data existing records. +func (c *Client) GetIrModelDatas(ids []int64) (*IrModelDatas, error) { + imds := &IrModelDatas{} + if err := c.Read(IrModelDataModel, ids, nil, imds); err != nil { + return nil, err + } + return imds, nil +} + +// FindIrModelData finds ir.model.data record by querying it with criteria. +func (c *Client) FindIrModelData(criteria *Criteria) (*IrModelData, error) { + imds := &IrModelDatas{} + if err := c.SearchRead(IrModelDataModel, criteria, NewOptions().Limit(1), imds); err != nil { + return nil, err + } + return &((*imds)[0]), nil +} + +// FindIrModelDatas finds ir.model.data records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModelDatas(criteria *Criteria, options *Options) (*IrModelDatas, error) { + imds := &IrModelDatas{} + if err := c.SearchRead(IrModelDataModel, criteria, options, imds); err != nil { + return nil, err + } + return imds, nil +} + +// FindIrModelDataIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModelDataIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrModelDataModel, criteria, options) +} + +// FindIrModelDataId finds record id by querying it with criteria. +func (c *Client) FindIrModelDataId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrModelDataModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_model_fields_selection.go b/ir_model_fields_selection.go new file mode 100644 index 0000000..ef1e7fe --- /dev/null +++ b/ir_model_fields_selection.go @@ -0,0 +1,120 @@ +package odoo + +// IrModelFieldsSelection represents ir.model.fields.selection model. +type IrModelFieldsSelection struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FieldId *Many2One `xmlrpc:"field_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + Value *String `xmlrpc:"value,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrModelFieldsSelections represents array of ir.model.fields.selection model. +type IrModelFieldsSelections []IrModelFieldsSelection + +// IrModelFieldsSelectionModel is the odoo model name. +const IrModelFieldsSelectionModel = "ir.model.fields.selection" + +// Many2One convert IrModelFieldsSelection to *Many2One. +func (imfs *IrModelFieldsSelection) Many2One() *Many2One { + return NewMany2One(imfs.Id.Get(), "") +} + +// CreateIrModelFieldsSelection creates a new ir.model.fields.selection model and returns its id. +func (c *Client) CreateIrModelFieldsSelection(imfs *IrModelFieldsSelection) (int64, error) { + ids, err := c.CreateIrModelFieldsSelections([]*IrModelFieldsSelection{imfs}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrModelFieldsSelection creates a new ir.model.fields.selection model and returns its id. +func (c *Client) CreateIrModelFieldsSelections(imfss []*IrModelFieldsSelection) ([]int64, error) { + var vv []interface{} + for _, v := range imfss { + vv = append(vv, v) + } + return c.Create(IrModelFieldsSelectionModel, vv, nil) +} + +// UpdateIrModelFieldsSelection updates an existing ir.model.fields.selection record. +func (c *Client) UpdateIrModelFieldsSelection(imfs *IrModelFieldsSelection) error { + return c.UpdateIrModelFieldsSelections([]int64{imfs.Id.Get()}, imfs) +} + +// UpdateIrModelFieldsSelections updates existing ir.model.fields.selection records. +// All records (represented by ids) will be updated by imfs values. +func (c *Client) UpdateIrModelFieldsSelections(ids []int64, imfs *IrModelFieldsSelection) error { + return c.Update(IrModelFieldsSelectionModel, ids, imfs, nil) +} + +// DeleteIrModelFieldsSelection deletes an existing ir.model.fields.selection record. +func (c *Client) DeleteIrModelFieldsSelection(id int64) error { + return c.DeleteIrModelFieldsSelections([]int64{id}) +} + +// DeleteIrModelFieldsSelections deletes existing ir.model.fields.selection records. +func (c *Client) DeleteIrModelFieldsSelections(ids []int64) error { + return c.Delete(IrModelFieldsSelectionModel, ids) +} + +// GetIrModelFieldsSelection gets ir.model.fields.selection existing record. +func (c *Client) GetIrModelFieldsSelection(id int64) (*IrModelFieldsSelection, error) { + imfss, err := c.GetIrModelFieldsSelections([]int64{id}) + if err != nil { + return nil, err + } + return &((*imfss)[0]), nil +} + +// GetIrModelFieldsSelections gets ir.model.fields.selection existing records. +func (c *Client) GetIrModelFieldsSelections(ids []int64) (*IrModelFieldsSelections, error) { + imfss := &IrModelFieldsSelections{} + if err := c.Read(IrModelFieldsSelectionModel, ids, nil, imfss); err != nil { + return nil, err + } + return imfss, nil +} + +// FindIrModelFieldsSelection finds ir.model.fields.selection record by querying it with criteria. +func (c *Client) FindIrModelFieldsSelection(criteria *Criteria) (*IrModelFieldsSelection, error) { + imfss := &IrModelFieldsSelections{} + if err := c.SearchRead(IrModelFieldsSelectionModel, criteria, NewOptions().Limit(1), imfss); err != nil { + return nil, err + } + return &((*imfss)[0]), nil +} + +// FindIrModelFieldsSelections finds ir.model.fields.selection records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModelFieldsSelections(criteria *Criteria, options *Options) (*IrModelFieldsSelections, error) { + imfss := &IrModelFieldsSelections{} + if err := c.SearchRead(IrModelFieldsSelectionModel, criteria, options, imfss); err != nil { + return nil, err + } + return imfss, nil +} + +// FindIrModelFieldsSelectionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModelFieldsSelectionIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrModelFieldsSelectionModel, criteria, options) +} + +// FindIrModelFieldsSelectionId finds record id by querying it with criteria. +func (c *Client) FindIrModelFieldsSelectionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrModelFieldsSelectionModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_model_inherit.go b/ir_model_inherit.go new file mode 100644 index 0000000..10db925 --- /dev/null +++ b/ir_model_inherit.go @@ -0,0 +1,115 @@ +package odoo + +// IrModelInherit represents ir.model.inherit model. +type IrModelInherit struct { + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + ParentFieldId *Many2One `xmlrpc:"parent_field_id,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` +} + +// IrModelInherits represents array of ir.model.inherit model. +type IrModelInherits []IrModelInherit + +// IrModelInheritModel is the odoo model name. +const IrModelInheritModel = "ir.model.inherit" + +// Many2One convert IrModelInherit to *Many2One. +func (imi *IrModelInherit) Many2One() *Many2One { + return NewMany2One(imi.Id.Get(), "") +} + +// CreateIrModelInherit creates a new ir.model.inherit model and returns its id. +func (c *Client) CreateIrModelInherit(imi *IrModelInherit) (int64, error) { + ids, err := c.CreateIrModelInherits([]*IrModelInherit{imi}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrModelInherit creates a new ir.model.inherit model and returns its id. +func (c *Client) CreateIrModelInherits(imis []*IrModelInherit) ([]int64, error) { + var vv []interface{} + for _, v := range imis { + vv = append(vv, v) + } + return c.Create(IrModelInheritModel, vv, nil) +} + +// UpdateIrModelInherit updates an existing ir.model.inherit record. +func (c *Client) UpdateIrModelInherit(imi *IrModelInherit) error { + return c.UpdateIrModelInherits([]int64{imi.Id.Get()}, imi) +} + +// UpdateIrModelInherits updates existing ir.model.inherit records. +// All records (represented by ids) will be updated by imi values. +func (c *Client) UpdateIrModelInherits(ids []int64, imi *IrModelInherit) error { + return c.Update(IrModelInheritModel, ids, imi, nil) +} + +// DeleteIrModelInherit deletes an existing ir.model.inherit record. +func (c *Client) DeleteIrModelInherit(id int64) error { + return c.DeleteIrModelInherits([]int64{id}) +} + +// DeleteIrModelInherits deletes existing ir.model.inherit records. +func (c *Client) DeleteIrModelInherits(ids []int64) error { + return c.Delete(IrModelInheritModel, ids) +} + +// GetIrModelInherit gets ir.model.inherit existing record. +func (c *Client) GetIrModelInherit(id int64) (*IrModelInherit, error) { + imis, err := c.GetIrModelInherits([]int64{id}) + if err != nil { + return nil, err + } + return &((*imis)[0]), nil +} + +// GetIrModelInherits gets ir.model.inherit existing records. +func (c *Client) GetIrModelInherits(ids []int64) (*IrModelInherits, error) { + imis := &IrModelInherits{} + if err := c.Read(IrModelInheritModel, ids, nil, imis); err != nil { + return nil, err + } + return imis, nil +} + +// FindIrModelInherit finds ir.model.inherit record by querying it with criteria. +func (c *Client) FindIrModelInherit(criteria *Criteria) (*IrModelInherit, error) { + imis := &IrModelInherits{} + if err := c.SearchRead(IrModelInheritModel, criteria, NewOptions().Limit(1), imis); err != nil { + return nil, err + } + return &((*imis)[0]), nil +} + +// FindIrModelInherits finds ir.model.inherit records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModelInherits(criteria *Criteria, options *Options) (*IrModelInherits, error) { + imis := &IrModelInherits{} + if err := c.SearchRead(IrModelInheritModel, criteria, options, imis); err != nil { + return nil, err + } + return imis, nil +} + +// FindIrModelInheritIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModelInheritIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrModelInheritModel, criteria, options) +} + +// FindIrModelInheritId finds record id by querying it with criteria. +func (c *Client) FindIrModelInheritId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrModelInheritModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_model_relation.go b/ir_model_relation.go new file mode 100644 index 0000000..42db6f6 --- /dev/null +++ b/ir_model_relation.go @@ -0,0 +1,119 @@ +package odoo + +// IrModelRelation represents ir.model.relation model. +type IrModelRelation struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Model *Many2One `xmlrpc:"model,omitempty"` + Module *Many2One `xmlrpc:"module,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrModelRelations represents array of ir.model.relation model. +type IrModelRelations []IrModelRelation + +// IrModelRelationModel is the odoo model name. +const IrModelRelationModel = "ir.model.relation" + +// Many2One convert IrModelRelation to *Many2One. +func (imr *IrModelRelation) Many2One() *Many2One { + return NewMany2One(imr.Id.Get(), "") +} + +// CreateIrModelRelation creates a new ir.model.relation model and returns its id. +func (c *Client) CreateIrModelRelation(imr *IrModelRelation) (int64, error) { + ids, err := c.CreateIrModelRelations([]*IrModelRelation{imr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrModelRelation creates a new ir.model.relation model and returns its id. +func (c *Client) CreateIrModelRelations(imrs []*IrModelRelation) ([]int64, error) { + var vv []interface{} + for _, v := range imrs { + vv = append(vv, v) + } + return c.Create(IrModelRelationModel, vv, nil) +} + +// UpdateIrModelRelation updates an existing ir.model.relation record. +func (c *Client) UpdateIrModelRelation(imr *IrModelRelation) error { + return c.UpdateIrModelRelations([]int64{imr.Id.Get()}, imr) +} + +// UpdateIrModelRelations updates existing ir.model.relation records. +// All records (represented by ids) will be updated by imr values. +func (c *Client) UpdateIrModelRelations(ids []int64, imr *IrModelRelation) error { + return c.Update(IrModelRelationModel, ids, imr, nil) +} + +// DeleteIrModelRelation deletes an existing ir.model.relation record. +func (c *Client) DeleteIrModelRelation(id int64) error { + return c.DeleteIrModelRelations([]int64{id}) +} + +// DeleteIrModelRelations deletes existing ir.model.relation records. +func (c *Client) DeleteIrModelRelations(ids []int64) error { + return c.Delete(IrModelRelationModel, ids) +} + +// GetIrModelRelation gets ir.model.relation existing record. +func (c *Client) GetIrModelRelation(id int64) (*IrModelRelation, error) { + imrs, err := c.GetIrModelRelations([]int64{id}) + if err != nil { + return nil, err + } + return &((*imrs)[0]), nil +} + +// GetIrModelRelations gets ir.model.relation existing records. +func (c *Client) GetIrModelRelations(ids []int64) (*IrModelRelations, error) { + imrs := &IrModelRelations{} + if err := c.Read(IrModelRelationModel, ids, nil, imrs); err != nil { + return nil, err + } + return imrs, nil +} + +// FindIrModelRelation finds ir.model.relation record by querying it with criteria. +func (c *Client) FindIrModelRelation(criteria *Criteria) (*IrModelRelation, error) { + imrs := &IrModelRelations{} + if err := c.SearchRead(IrModelRelationModel, criteria, NewOptions().Limit(1), imrs); err != nil { + return nil, err + } + return &((*imrs)[0]), nil +} + +// FindIrModelRelations finds ir.model.relation records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModelRelations(criteria *Criteria, options *Options) (*IrModelRelations, error) { + imrs := &IrModelRelations{} + if err := c.SearchRead(IrModelRelationModel, criteria, options, imrs); err != nil { + return nil, err + } + return imrs, nil +} + +// FindIrModelRelationIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModelRelationIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrModelRelationModel, criteria, options) +} + +// FindIrModelRelationId finds record id by querying it with criteria. +func (c *Client) FindIrModelRelationId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrModelRelationModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_module_category.go b/ir_module_category.go new file mode 100644 index 0000000..fb9a152 --- /dev/null +++ b/ir_module_category.go @@ -0,0 +1,125 @@ +package odoo + +// IrModuleCategory represents ir.module.category model. +type IrModuleCategory struct { + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Exclusive *Bool `xmlrpc:"exclusive,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ModuleIds *Relation `xmlrpc:"module_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + Visible *Bool `xmlrpc:"visible,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + XmlId *String `xmlrpc:"xml_id,omitempty"` +} + +// IrModuleCategorys represents array of ir.module.category model. +type IrModuleCategorys []IrModuleCategory + +// IrModuleCategoryModel is the odoo model name. +const IrModuleCategoryModel = "ir.module.category" + +// Many2One convert IrModuleCategory to *Many2One. +func (imc *IrModuleCategory) Many2One() *Many2One { + return NewMany2One(imc.Id.Get(), "") +} + +// CreateIrModuleCategory creates a new ir.module.category model and returns its id. +func (c *Client) CreateIrModuleCategory(imc *IrModuleCategory) (int64, error) { + ids, err := c.CreateIrModuleCategorys([]*IrModuleCategory{imc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrModuleCategory creates a new ir.module.category model and returns its id. +func (c *Client) CreateIrModuleCategorys(imcs []*IrModuleCategory) ([]int64, error) { + var vv []interface{} + for _, v := range imcs { + vv = append(vv, v) + } + return c.Create(IrModuleCategoryModel, vv, nil) +} + +// UpdateIrModuleCategory updates an existing ir.module.category record. +func (c *Client) UpdateIrModuleCategory(imc *IrModuleCategory) error { + return c.UpdateIrModuleCategorys([]int64{imc.Id.Get()}, imc) +} + +// UpdateIrModuleCategorys updates existing ir.module.category records. +// All records (represented by ids) will be updated by imc values. +func (c *Client) UpdateIrModuleCategorys(ids []int64, imc *IrModuleCategory) error { + return c.Update(IrModuleCategoryModel, ids, imc, nil) +} + +// DeleteIrModuleCategory deletes an existing ir.module.category record. +func (c *Client) DeleteIrModuleCategory(id int64) error { + return c.DeleteIrModuleCategorys([]int64{id}) +} + +// DeleteIrModuleCategorys deletes existing ir.module.category records. +func (c *Client) DeleteIrModuleCategorys(ids []int64) error { + return c.Delete(IrModuleCategoryModel, ids) +} + +// GetIrModuleCategory gets ir.module.category existing record. +func (c *Client) GetIrModuleCategory(id int64) (*IrModuleCategory, error) { + imcs, err := c.GetIrModuleCategorys([]int64{id}) + if err != nil { + return nil, err + } + return &((*imcs)[0]), nil +} + +// GetIrModuleCategorys gets ir.module.category existing records. +func (c *Client) GetIrModuleCategorys(ids []int64) (*IrModuleCategorys, error) { + imcs := &IrModuleCategorys{} + if err := c.Read(IrModuleCategoryModel, ids, nil, imcs); err != nil { + return nil, err + } + return imcs, nil +} + +// FindIrModuleCategory finds ir.module.category record by querying it with criteria. +func (c *Client) FindIrModuleCategory(criteria *Criteria) (*IrModuleCategory, error) { + imcs := &IrModuleCategorys{} + if err := c.SearchRead(IrModuleCategoryModel, criteria, NewOptions().Limit(1), imcs); err != nil { + return nil, err + } + return &((*imcs)[0]), nil +} + +// FindIrModuleCategorys finds ir.module.category records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModuleCategorys(criteria *Criteria, options *Options) (*IrModuleCategorys, error) { + imcs := &IrModuleCategorys{} + if err := c.SearchRead(IrModuleCategoryModel, criteria, options, imcs); err != nil { + return nil, err + } + return imcs, nil +} + +// FindIrModuleCategoryIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModuleCategoryIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrModuleCategoryModel, criteria, options) +} + +// FindIrModuleCategoryId finds record id by querying it with criteria. +func (c *Client) FindIrModuleCategoryId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrModuleCategoryModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_module_module.go b/ir_module_module.go new file mode 100644 index 0000000..3e75336 --- /dev/null +++ b/ir_module_module.go @@ -0,0 +1,150 @@ +package odoo + +// IrModuleModule represents ir.module.module model. +type IrModuleModule struct { + AccountTemplates *String `xmlrpc:"account_templates,omitempty"` + Application *Bool `xmlrpc:"application,omitempty"` + Author *String `xmlrpc:"author,omitempty"` + AutoInstall *Bool `xmlrpc:"auto_install,omitempty"` + CategoryId *Many2One `xmlrpc:"category_id,omitempty"` + Contributors *String `xmlrpc:"contributors,omitempty"` + CountryIds *Relation `xmlrpc:"country_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Demo *Bool `xmlrpc:"demo,omitempty"` + DependenciesId *Relation `xmlrpc:"dependencies_id,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DescriptionHtml *String `xmlrpc:"description_html,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExclusionIds *Relation `xmlrpc:"exclusion_ids,omitempty"` + HasIap *Bool `xmlrpc:"has_iap,omitempty"` + Icon *String `xmlrpc:"icon,omitempty"` + IconFlag *String `xmlrpc:"icon_flag,omitempty"` + IconImage *String `xmlrpc:"icon_image,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Imported *Bool `xmlrpc:"imported,omitempty"` + InstalledVersion *String `xmlrpc:"installed_version,omitempty"` + LatestVersion *String `xmlrpc:"latest_version,omitempty"` + License *Selection `xmlrpc:"license,omitempty"` + Maintainer *String `xmlrpc:"maintainer,omitempty"` + MenusByModule *String `xmlrpc:"menus_by_module,omitempty"` + ModuleType *Selection `xmlrpc:"module_type,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PublishedVersion *String `xmlrpc:"published_version,omitempty"` + ReportsByModule *String `xmlrpc:"reports_by_module,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + Shortdesc *String `xmlrpc:"shortdesc,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + Summary *String `xmlrpc:"summary,omitempty"` + ToBuy *Bool `xmlrpc:"to_buy,omitempty"` + Url *String `xmlrpc:"url,omitempty"` + ViewsByModule *String `xmlrpc:"views_by_module,omitempty"` + Website *String `xmlrpc:"website,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrModuleModules represents array of ir.module.module model. +type IrModuleModules []IrModuleModule + +// IrModuleModuleModel is the odoo model name. +const IrModuleModuleModel = "ir.module.module" + +// Many2One convert IrModuleModule to *Many2One. +func (imm *IrModuleModule) Many2One() *Many2One { + return NewMany2One(imm.Id.Get(), "") +} + +// CreateIrModuleModule creates a new ir.module.module model and returns its id. +func (c *Client) CreateIrModuleModule(imm *IrModuleModule) (int64, error) { + ids, err := c.CreateIrModuleModules([]*IrModuleModule{imm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrModuleModule creates a new ir.module.module model and returns its id. +func (c *Client) CreateIrModuleModules(imms []*IrModuleModule) ([]int64, error) { + var vv []interface{} + for _, v := range imms { + vv = append(vv, v) + } + return c.Create(IrModuleModuleModel, vv, nil) +} + +// UpdateIrModuleModule updates an existing ir.module.module record. +func (c *Client) UpdateIrModuleModule(imm *IrModuleModule) error { + return c.UpdateIrModuleModules([]int64{imm.Id.Get()}, imm) +} + +// UpdateIrModuleModules updates existing ir.module.module records. +// All records (represented by ids) will be updated by imm values. +func (c *Client) UpdateIrModuleModules(ids []int64, imm *IrModuleModule) error { + return c.Update(IrModuleModuleModel, ids, imm, nil) +} + +// DeleteIrModuleModule deletes an existing ir.module.module record. +func (c *Client) DeleteIrModuleModule(id int64) error { + return c.DeleteIrModuleModules([]int64{id}) +} + +// DeleteIrModuleModules deletes existing ir.module.module records. +func (c *Client) DeleteIrModuleModules(ids []int64) error { + return c.Delete(IrModuleModuleModel, ids) +} + +// GetIrModuleModule gets ir.module.module existing record. +func (c *Client) GetIrModuleModule(id int64) (*IrModuleModule, error) { + imms, err := c.GetIrModuleModules([]int64{id}) + if err != nil { + return nil, err + } + return &((*imms)[0]), nil +} + +// GetIrModuleModules gets ir.module.module existing records. +func (c *Client) GetIrModuleModules(ids []int64) (*IrModuleModules, error) { + imms := &IrModuleModules{} + if err := c.Read(IrModuleModuleModel, ids, nil, imms); err != nil { + return nil, err + } + return imms, nil +} + +// FindIrModuleModule finds ir.module.module record by querying it with criteria. +func (c *Client) FindIrModuleModule(criteria *Criteria) (*IrModuleModule, error) { + imms := &IrModuleModules{} + if err := c.SearchRead(IrModuleModuleModel, criteria, NewOptions().Limit(1), imms); err != nil { + return nil, err + } + return &((*imms)[0]), nil +} + +// FindIrModuleModules finds ir.module.module records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModuleModules(criteria *Criteria, options *Options) (*IrModuleModules, error) { + imms := &IrModuleModules{} + if err := c.SearchRead(IrModuleModuleModel, criteria, options, imms); err != nil { + return nil, err + } + return imms, nil +} + +// FindIrModuleModuleIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModuleModuleIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrModuleModuleModel, criteria, options) +} + +// FindIrModuleModuleId finds record id by querying it with criteria. +func (c *Client) FindIrModuleModuleId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrModuleModuleModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_module_module_dependency.go b/ir_module_module_dependency.go new file mode 100644 index 0000000..b23c206 --- /dev/null +++ b/ir_module_module_dependency.go @@ -0,0 +1,117 @@ +package odoo + +// IrModuleModuleDependency represents ir.module.module.dependency model. +type IrModuleModuleDependency struct { + AutoInstallRequired *Bool `xmlrpc:"auto_install_required,omitempty"` + DependId *Many2One `xmlrpc:"depend_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ModuleId *Many2One `xmlrpc:"module_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` +} + +// IrModuleModuleDependencys represents array of ir.module.module.dependency model. +type IrModuleModuleDependencys []IrModuleModuleDependency + +// IrModuleModuleDependencyModel is the odoo model name. +const IrModuleModuleDependencyModel = "ir.module.module.dependency" + +// Many2One convert IrModuleModuleDependency to *Many2One. +func (immd *IrModuleModuleDependency) Many2One() *Many2One { + return NewMany2One(immd.Id.Get(), "") +} + +// CreateIrModuleModuleDependency creates a new ir.module.module.dependency model and returns its id. +func (c *Client) CreateIrModuleModuleDependency(immd *IrModuleModuleDependency) (int64, error) { + ids, err := c.CreateIrModuleModuleDependencys([]*IrModuleModuleDependency{immd}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrModuleModuleDependency creates a new ir.module.module.dependency model and returns its id. +func (c *Client) CreateIrModuleModuleDependencys(immds []*IrModuleModuleDependency) ([]int64, error) { + var vv []interface{} + for _, v := range immds { + vv = append(vv, v) + } + return c.Create(IrModuleModuleDependencyModel, vv, nil) +} + +// UpdateIrModuleModuleDependency updates an existing ir.module.module.dependency record. +func (c *Client) UpdateIrModuleModuleDependency(immd *IrModuleModuleDependency) error { + return c.UpdateIrModuleModuleDependencys([]int64{immd.Id.Get()}, immd) +} + +// UpdateIrModuleModuleDependencys updates existing ir.module.module.dependency records. +// All records (represented by ids) will be updated by immd values. +func (c *Client) UpdateIrModuleModuleDependencys(ids []int64, immd *IrModuleModuleDependency) error { + return c.Update(IrModuleModuleDependencyModel, ids, immd, nil) +} + +// DeleteIrModuleModuleDependency deletes an existing ir.module.module.dependency record. +func (c *Client) DeleteIrModuleModuleDependency(id int64) error { + return c.DeleteIrModuleModuleDependencys([]int64{id}) +} + +// DeleteIrModuleModuleDependencys deletes existing ir.module.module.dependency records. +func (c *Client) DeleteIrModuleModuleDependencys(ids []int64) error { + return c.Delete(IrModuleModuleDependencyModel, ids) +} + +// GetIrModuleModuleDependency gets ir.module.module.dependency existing record. +func (c *Client) GetIrModuleModuleDependency(id int64) (*IrModuleModuleDependency, error) { + immds, err := c.GetIrModuleModuleDependencys([]int64{id}) + if err != nil { + return nil, err + } + return &((*immds)[0]), nil +} + +// GetIrModuleModuleDependencys gets ir.module.module.dependency existing records. +func (c *Client) GetIrModuleModuleDependencys(ids []int64) (*IrModuleModuleDependencys, error) { + immds := &IrModuleModuleDependencys{} + if err := c.Read(IrModuleModuleDependencyModel, ids, nil, immds); err != nil { + return nil, err + } + return immds, nil +} + +// FindIrModuleModuleDependency finds ir.module.module.dependency record by querying it with criteria. +func (c *Client) FindIrModuleModuleDependency(criteria *Criteria) (*IrModuleModuleDependency, error) { + immds := &IrModuleModuleDependencys{} + if err := c.SearchRead(IrModuleModuleDependencyModel, criteria, NewOptions().Limit(1), immds); err != nil { + return nil, err + } + return &((*immds)[0]), nil +} + +// FindIrModuleModuleDependencys finds ir.module.module.dependency records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModuleModuleDependencys(criteria *Criteria, options *Options) (*IrModuleModuleDependencys, error) { + immds := &IrModuleModuleDependencys{} + if err := c.SearchRead(IrModuleModuleDependencyModel, criteria, options, immds); err != nil { + return nil, err + } + return immds, nil +} + +// FindIrModuleModuleDependencyIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModuleModuleDependencyIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrModuleModuleDependencyModel, criteria, options) +} + +// FindIrModuleModuleDependencyId finds record id by querying it with criteria. +func (c *Client) FindIrModuleModuleDependencyId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrModuleModuleDependencyModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_module_module_exclusion.go b/ir_module_module_exclusion.go new file mode 100644 index 0000000..b507525 --- /dev/null +++ b/ir_module_module_exclusion.go @@ -0,0 +1,120 @@ +package odoo + +// IrModuleModuleExclusion represents ir.module.module.exclusion model. +type IrModuleModuleExclusion struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExclusionId *Many2One `xmlrpc:"exclusion_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ModuleId *Many2One `xmlrpc:"module_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrModuleModuleExclusions represents array of ir.module.module.exclusion model. +type IrModuleModuleExclusions []IrModuleModuleExclusion + +// IrModuleModuleExclusionModel is the odoo model name. +const IrModuleModuleExclusionModel = "ir.module.module.exclusion" + +// Many2One convert IrModuleModuleExclusion to *Many2One. +func (imme *IrModuleModuleExclusion) Many2One() *Many2One { + return NewMany2One(imme.Id.Get(), "") +} + +// CreateIrModuleModuleExclusion creates a new ir.module.module.exclusion model and returns its id. +func (c *Client) CreateIrModuleModuleExclusion(imme *IrModuleModuleExclusion) (int64, error) { + ids, err := c.CreateIrModuleModuleExclusions([]*IrModuleModuleExclusion{imme}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrModuleModuleExclusion creates a new ir.module.module.exclusion model and returns its id. +func (c *Client) CreateIrModuleModuleExclusions(immes []*IrModuleModuleExclusion) ([]int64, error) { + var vv []interface{} + for _, v := range immes { + vv = append(vv, v) + } + return c.Create(IrModuleModuleExclusionModel, vv, nil) +} + +// UpdateIrModuleModuleExclusion updates an existing ir.module.module.exclusion record. +func (c *Client) UpdateIrModuleModuleExclusion(imme *IrModuleModuleExclusion) error { + return c.UpdateIrModuleModuleExclusions([]int64{imme.Id.Get()}, imme) +} + +// UpdateIrModuleModuleExclusions updates existing ir.module.module.exclusion records. +// All records (represented by ids) will be updated by imme values. +func (c *Client) UpdateIrModuleModuleExclusions(ids []int64, imme *IrModuleModuleExclusion) error { + return c.Update(IrModuleModuleExclusionModel, ids, imme, nil) +} + +// DeleteIrModuleModuleExclusion deletes an existing ir.module.module.exclusion record. +func (c *Client) DeleteIrModuleModuleExclusion(id int64) error { + return c.DeleteIrModuleModuleExclusions([]int64{id}) +} + +// DeleteIrModuleModuleExclusions deletes existing ir.module.module.exclusion records. +func (c *Client) DeleteIrModuleModuleExclusions(ids []int64) error { + return c.Delete(IrModuleModuleExclusionModel, ids) +} + +// GetIrModuleModuleExclusion gets ir.module.module.exclusion existing record. +func (c *Client) GetIrModuleModuleExclusion(id int64) (*IrModuleModuleExclusion, error) { + immes, err := c.GetIrModuleModuleExclusions([]int64{id}) + if err != nil { + return nil, err + } + return &((*immes)[0]), nil +} + +// GetIrModuleModuleExclusions gets ir.module.module.exclusion existing records. +func (c *Client) GetIrModuleModuleExclusions(ids []int64) (*IrModuleModuleExclusions, error) { + immes := &IrModuleModuleExclusions{} + if err := c.Read(IrModuleModuleExclusionModel, ids, nil, immes); err != nil { + return nil, err + } + return immes, nil +} + +// FindIrModuleModuleExclusion finds ir.module.module.exclusion record by querying it with criteria. +func (c *Client) FindIrModuleModuleExclusion(criteria *Criteria) (*IrModuleModuleExclusion, error) { + immes := &IrModuleModuleExclusions{} + if err := c.SearchRead(IrModuleModuleExclusionModel, criteria, NewOptions().Limit(1), immes); err != nil { + return nil, err + } + return &((*immes)[0]), nil +} + +// FindIrModuleModuleExclusions finds ir.module.module.exclusion records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModuleModuleExclusions(criteria *Criteria, options *Options) (*IrModuleModuleExclusions, error) { + immes := &IrModuleModuleExclusions{} + if err := c.SearchRead(IrModuleModuleExclusionModel, criteria, options, immes); err != nil { + return nil, err + } + return immes, nil +} + +// FindIrModuleModuleExclusionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrModuleModuleExclusionIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrModuleModuleExclusionModel, criteria, options) +} + +// FindIrModuleModuleExclusionId finds record id by querying it with criteria. +func (c *Client) FindIrModuleModuleExclusionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrModuleModuleExclusionModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_profile.go b/ir_profile.go new file mode 100644 index 0000000..8c0bc15 --- /dev/null +++ b/ir_profile.go @@ -0,0 +1,125 @@ +package odoo + +// IrProfile represents ir.profile model. +type IrProfile struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Duration *Float `xmlrpc:"duration,omitempty"` + EntryCount *Int `xmlrpc:"entry_count,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InitStackTrace *String `xmlrpc:"init_stack_trace,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Qweb *String `xmlrpc:"qweb,omitempty"` + Session *String `xmlrpc:"session,omitempty"` + Speedscope *String `xmlrpc:"speedscope,omitempty"` + SpeedscopeUrl *String `xmlrpc:"speedscope_url,omitempty"` + Sql *String `xmlrpc:"sql,omitempty"` + SqlCount *Int `xmlrpc:"sql_count,omitempty"` + TracesAsync *String `xmlrpc:"traces_async,omitempty"` + TracesSync *String `xmlrpc:"traces_sync,omitempty"` +} + +// IrProfiles represents array of ir.profile model. +type IrProfiles []IrProfile + +// IrProfileModel is the odoo model name. +const IrProfileModel = "ir.profile" + +// Many2One convert IrProfile to *Many2One. +func (ip *IrProfile) Many2One() *Many2One { + return NewMany2One(ip.Id.Get(), "") +} + +// CreateIrProfile creates a new ir.profile model and returns its id. +func (c *Client) CreateIrProfile(ip *IrProfile) (int64, error) { + ids, err := c.CreateIrProfiles([]*IrProfile{ip}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrProfile creates a new ir.profile model and returns its id. +func (c *Client) CreateIrProfiles(ips []*IrProfile) ([]int64, error) { + var vv []interface{} + for _, v := range ips { + vv = append(vv, v) + } + return c.Create(IrProfileModel, vv, nil) +} + +// UpdateIrProfile updates an existing ir.profile record. +func (c *Client) UpdateIrProfile(ip *IrProfile) error { + return c.UpdateIrProfiles([]int64{ip.Id.Get()}, ip) +} + +// UpdateIrProfiles updates existing ir.profile records. +// All records (represented by ids) will be updated by ip values. +func (c *Client) UpdateIrProfiles(ids []int64, ip *IrProfile) error { + return c.Update(IrProfileModel, ids, ip, nil) +} + +// DeleteIrProfile deletes an existing ir.profile record. +func (c *Client) DeleteIrProfile(id int64) error { + return c.DeleteIrProfiles([]int64{id}) +} + +// DeleteIrProfiles deletes existing ir.profile records. +func (c *Client) DeleteIrProfiles(ids []int64) error { + return c.Delete(IrProfileModel, ids) +} + +// GetIrProfile gets ir.profile existing record. +func (c *Client) GetIrProfile(id int64) (*IrProfile, error) { + ips, err := c.GetIrProfiles([]int64{id}) + if err != nil { + return nil, err + } + return &((*ips)[0]), nil +} + +// GetIrProfiles gets ir.profile existing records. +func (c *Client) GetIrProfiles(ids []int64) (*IrProfiles, error) { + ips := &IrProfiles{} + if err := c.Read(IrProfileModel, ids, nil, ips); err != nil { + return nil, err + } + return ips, nil +} + +// FindIrProfile finds ir.profile record by querying it with criteria. +func (c *Client) FindIrProfile(criteria *Criteria) (*IrProfile, error) { + ips := &IrProfiles{} + if err := c.SearchRead(IrProfileModel, criteria, NewOptions().Limit(1), ips); err != nil { + return nil, err + } + return &((*ips)[0]), nil +} + +// FindIrProfiles finds ir.profile records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrProfiles(criteria *Criteria, options *Options) (*IrProfiles, error) { + ips := &IrProfiles{} + if err := c.SearchRead(IrProfileModel, criteria, options, ips); err != nil { + return nil, err + } + return ips, nil +} + +// FindIrProfileIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrProfileIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrProfileModel, criteria, options) +} + +// FindIrProfileId finds record id by querying it with criteria. +func (c *Client) FindIrProfileId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrProfileModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_rule.go b/ir_rule.go new file mode 100644 index 0000000..609f3c9 --- /dev/null +++ b/ir_rule.go @@ -0,0 +1,126 @@ +package odoo + +// IrRule represents ir.rule model. +type IrRule struct { + Active *Bool `xmlrpc:"active,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DomainForce *String `xmlrpc:"domain_force,omitempty"` + Global *Bool `xmlrpc:"global,omitempty"` + Groups *Relation `xmlrpc:"groups,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PermCreate *Bool `xmlrpc:"perm_create,omitempty"` + PermRead *Bool `xmlrpc:"perm_read,omitempty"` + PermUnlink *Bool `xmlrpc:"perm_unlink,omitempty"` + PermWrite *Bool `xmlrpc:"perm_write,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrRules represents array of ir.rule model. +type IrRules []IrRule + +// IrRuleModel is the odoo model name. +const IrRuleModel = "ir.rule" + +// Many2One convert IrRule to *Many2One. +func (ir *IrRule) Many2One() *Many2One { + return NewMany2One(ir.Id.Get(), "") +} + +// CreateIrRule creates a new ir.rule model and returns its id. +func (c *Client) CreateIrRule(ir *IrRule) (int64, error) { + ids, err := c.CreateIrRules([]*IrRule{ir}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrRule creates a new ir.rule model and returns its id. +func (c *Client) CreateIrRules(irs []*IrRule) ([]int64, error) { + var vv []interface{} + for _, v := range irs { + vv = append(vv, v) + } + return c.Create(IrRuleModel, vv, nil) +} + +// UpdateIrRule updates an existing ir.rule record. +func (c *Client) UpdateIrRule(ir *IrRule) error { + return c.UpdateIrRules([]int64{ir.Id.Get()}, ir) +} + +// UpdateIrRules updates existing ir.rule records. +// All records (represented by ids) will be updated by ir values. +func (c *Client) UpdateIrRules(ids []int64, ir *IrRule) error { + return c.Update(IrRuleModel, ids, ir, nil) +} + +// DeleteIrRule deletes an existing ir.rule record. +func (c *Client) DeleteIrRule(id int64) error { + return c.DeleteIrRules([]int64{id}) +} + +// DeleteIrRules deletes existing ir.rule records. +func (c *Client) DeleteIrRules(ids []int64) error { + return c.Delete(IrRuleModel, ids) +} + +// GetIrRule gets ir.rule existing record. +func (c *Client) GetIrRule(id int64) (*IrRule, error) { + irs, err := c.GetIrRules([]int64{id}) + if err != nil { + return nil, err + } + return &((*irs)[0]), nil +} + +// GetIrRules gets ir.rule existing records. +func (c *Client) GetIrRules(ids []int64) (*IrRules, error) { + irs := &IrRules{} + if err := c.Read(IrRuleModel, ids, nil, irs); err != nil { + return nil, err + } + return irs, nil +} + +// FindIrRule finds ir.rule record by querying it with criteria. +func (c *Client) FindIrRule(criteria *Criteria) (*IrRule, error) { + irs := &IrRules{} + if err := c.SearchRead(IrRuleModel, criteria, NewOptions().Limit(1), irs); err != nil { + return nil, err + } + return &((*irs)[0]), nil +} + +// FindIrRules finds ir.rule records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrRules(criteria *Criteria, options *Options) (*IrRules, error) { + irs := &IrRules{} + if err := c.SearchRead(IrRuleModel, criteria, options, irs); err != nil { + return nil, err + } + return irs, nil +} + +// FindIrRuleIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrRuleIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrRuleModel, criteria, options) +} + +// FindIrRuleId finds record id by querying it with criteria. +func (c *Client) FindIrRuleId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrRuleModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_sequence.go b/ir_sequence.go new file mode 100644 index 0000000..118cd30 --- /dev/null +++ b/ir_sequence.go @@ -0,0 +1,129 @@ +package odoo + +// IrSequence represents ir.sequence model. +type IrSequence struct { + Active *Bool `xmlrpc:"active,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateRangeIds *Relation `xmlrpc:"date_range_ids,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Implementation *Selection `xmlrpc:"implementation,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NumberIncrement *Int `xmlrpc:"number_increment,omitempty"` + NumberNext *Int `xmlrpc:"number_next,omitempty"` + NumberNextActual *Int `xmlrpc:"number_next_actual,omitempty"` + Padding *Int `xmlrpc:"padding,omitempty"` + Prefix *String `xmlrpc:"prefix,omitempty"` + Suffix *String `xmlrpc:"suffix,omitempty"` + UseDateRange *Bool `xmlrpc:"use_date_range,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrSequences represents array of ir.sequence model. +type IrSequences []IrSequence + +// IrSequenceModel is the odoo model name. +const IrSequenceModel = "ir.sequence" + +// Many2One convert IrSequence to *Many2One. +func (is *IrSequence) Many2One() *Many2One { + return NewMany2One(is.Id.Get(), "") +} + +// CreateIrSequence creates a new ir.sequence model and returns its id. +func (c *Client) CreateIrSequence(is *IrSequence) (int64, error) { + ids, err := c.CreateIrSequences([]*IrSequence{is}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrSequence creates a new ir.sequence model and returns its id. +func (c *Client) CreateIrSequences(iss []*IrSequence) ([]int64, error) { + var vv []interface{} + for _, v := range iss { + vv = append(vv, v) + } + return c.Create(IrSequenceModel, vv, nil) +} + +// UpdateIrSequence updates an existing ir.sequence record. +func (c *Client) UpdateIrSequence(is *IrSequence) error { + return c.UpdateIrSequences([]int64{is.Id.Get()}, is) +} + +// UpdateIrSequences updates existing ir.sequence records. +// All records (represented by ids) will be updated by is values. +func (c *Client) UpdateIrSequences(ids []int64, is *IrSequence) error { + return c.Update(IrSequenceModel, ids, is, nil) +} + +// DeleteIrSequence deletes an existing ir.sequence record. +func (c *Client) DeleteIrSequence(id int64) error { + return c.DeleteIrSequences([]int64{id}) +} + +// DeleteIrSequences deletes existing ir.sequence records. +func (c *Client) DeleteIrSequences(ids []int64) error { + return c.Delete(IrSequenceModel, ids) +} + +// GetIrSequence gets ir.sequence existing record. +func (c *Client) GetIrSequence(id int64) (*IrSequence, error) { + iss, err := c.GetIrSequences([]int64{id}) + if err != nil { + return nil, err + } + return &((*iss)[0]), nil +} + +// GetIrSequences gets ir.sequence existing records. +func (c *Client) GetIrSequences(ids []int64) (*IrSequences, error) { + iss := &IrSequences{} + if err := c.Read(IrSequenceModel, ids, nil, iss); err != nil { + return nil, err + } + return iss, nil +} + +// FindIrSequence finds ir.sequence record by querying it with criteria. +func (c *Client) FindIrSequence(criteria *Criteria) (*IrSequence, error) { + iss := &IrSequences{} + if err := c.SearchRead(IrSequenceModel, criteria, NewOptions().Limit(1), iss); err != nil { + return nil, err + } + return &((*iss)[0]), nil +} + +// FindIrSequences finds ir.sequence records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrSequences(criteria *Criteria, options *Options) (*IrSequences, error) { + iss := &IrSequences{} + if err := c.SearchRead(IrSequenceModel, criteria, options, iss); err != nil { + return nil, err + } + return iss, nil +} + +// FindIrSequenceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrSequenceIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrSequenceModel, criteria, options) +} + +// FindIrSequenceId finds record id by querying it with criteria. +func (c *Client) FindIrSequenceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrSequenceModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_sequence_date_range.go b/ir_sequence_date_range.go new file mode 100644 index 0000000..74be4d2 --- /dev/null +++ b/ir_sequence_date_range.go @@ -0,0 +1,121 @@ +package odoo + +// IrSequenceDateRange represents ir.sequence.date_range model. +type IrSequenceDateRange struct { + 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"` + NumberNext *Int `xmlrpc:"number_next,omitempty"` + NumberNextActual *Int `xmlrpc:"number_next_actual,omitempty"` + SequenceId *Many2One `xmlrpc:"sequence_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrSequenceDateRanges represents array of ir.sequence.date_range model. +type IrSequenceDateRanges []IrSequenceDateRange + +// IrSequenceDateRangeModel is the odoo model name. +const IrSequenceDateRangeModel = "ir.sequence.date_range" + +// Many2One convert IrSequenceDateRange to *Many2One. +func (isd *IrSequenceDateRange) Many2One() *Many2One { + return NewMany2One(isd.Id.Get(), "") +} + +// CreateIrSequenceDateRange creates a new ir.sequence.date_range model and returns its id. +func (c *Client) CreateIrSequenceDateRange(isd *IrSequenceDateRange) (int64, error) { + ids, err := c.CreateIrSequenceDateRanges([]*IrSequenceDateRange{isd}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrSequenceDateRange creates a new ir.sequence.date_range model and returns its id. +func (c *Client) CreateIrSequenceDateRanges(isds []*IrSequenceDateRange) ([]int64, error) { + var vv []interface{} + for _, v := range isds { + vv = append(vv, v) + } + return c.Create(IrSequenceDateRangeModel, vv, nil) +} + +// UpdateIrSequenceDateRange updates an existing ir.sequence.date_range record. +func (c *Client) UpdateIrSequenceDateRange(isd *IrSequenceDateRange) error { + return c.UpdateIrSequenceDateRanges([]int64{isd.Id.Get()}, isd) +} + +// UpdateIrSequenceDateRanges updates existing ir.sequence.date_range records. +// All records (represented by ids) will be updated by isd values. +func (c *Client) UpdateIrSequenceDateRanges(ids []int64, isd *IrSequenceDateRange) error { + return c.Update(IrSequenceDateRangeModel, ids, isd, nil) +} + +// DeleteIrSequenceDateRange deletes an existing ir.sequence.date_range record. +func (c *Client) DeleteIrSequenceDateRange(id int64) error { + return c.DeleteIrSequenceDateRanges([]int64{id}) +} + +// DeleteIrSequenceDateRanges deletes existing ir.sequence.date_range records. +func (c *Client) DeleteIrSequenceDateRanges(ids []int64) error { + return c.Delete(IrSequenceDateRangeModel, ids) +} + +// GetIrSequenceDateRange gets ir.sequence.date_range existing record. +func (c *Client) GetIrSequenceDateRange(id int64) (*IrSequenceDateRange, error) { + isds, err := c.GetIrSequenceDateRanges([]int64{id}) + if err != nil { + return nil, err + } + return &((*isds)[0]), nil +} + +// GetIrSequenceDateRanges gets ir.sequence.date_range existing records. +func (c *Client) GetIrSequenceDateRanges(ids []int64) (*IrSequenceDateRanges, error) { + isds := &IrSequenceDateRanges{} + if err := c.Read(IrSequenceDateRangeModel, ids, nil, isds); err != nil { + return nil, err + } + return isds, nil +} + +// FindIrSequenceDateRange finds ir.sequence.date_range record by querying it with criteria. +func (c *Client) FindIrSequenceDateRange(criteria *Criteria) (*IrSequenceDateRange, error) { + isds := &IrSequenceDateRanges{} + if err := c.SearchRead(IrSequenceDateRangeModel, criteria, NewOptions().Limit(1), isds); err != nil { + return nil, err + } + return &((*isds)[0]), nil +} + +// FindIrSequenceDateRanges finds ir.sequence.date_range records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrSequenceDateRanges(criteria *Criteria, options *Options) (*IrSequenceDateRanges, error) { + isds := &IrSequenceDateRanges{} + if err := c.SearchRead(IrSequenceDateRangeModel, criteria, options, isds); err != nil { + return nil, err + } + return isds, nil +} + +// FindIrSequenceDateRangeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrSequenceDateRangeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrSequenceDateRangeModel, criteria, options) +} + +// FindIrSequenceDateRangeId finds record id by querying it with criteria. +func (c *Client) FindIrSequenceDateRangeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrSequenceDateRangeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_ui_menu.go b/ir_ui_menu.go new file mode 100644 index 0000000..3582f63 --- /dev/null +++ b/ir_ui_menu.go @@ -0,0 +1,127 @@ +package odoo + +// IrUiMenu represents ir.ui.menu model. +type IrUiMenu struct { + Action *String `xmlrpc:"action,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ChildId *Relation `xmlrpc:"child_id,omitempty"` + CompleteName *String `xmlrpc:"complete_name,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + GroupsId *Relation `xmlrpc:"groups_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + ParentPath *String `xmlrpc:"parent_path,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WebIcon *String `xmlrpc:"web_icon,omitempty"` + WebIconData *String `xmlrpc:"web_icon_data,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrUiMenus represents array of ir.ui.menu model. +type IrUiMenus []IrUiMenu + +// IrUiMenuModel is the odoo model name. +const IrUiMenuModel = "ir.ui.menu" + +// Many2One convert IrUiMenu to *Many2One. +func (ium *IrUiMenu) Many2One() *Many2One { + return NewMany2One(ium.Id.Get(), "") +} + +// CreateIrUiMenu creates a new ir.ui.menu model and returns its id. +func (c *Client) CreateIrUiMenu(ium *IrUiMenu) (int64, error) { + ids, err := c.CreateIrUiMenus([]*IrUiMenu{ium}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrUiMenu creates a new ir.ui.menu model and returns its id. +func (c *Client) CreateIrUiMenus(iums []*IrUiMenu) ([]int64, error) { + var vv []interface{} + for _, v := range iums { + vv = append(vv, v) + } + return c.Create(IrUiMenuModel, vv, nil) +} + +// UpdateIrUiMenu updates an existing ir.ui.menu record. +func (c *Client) UpdateIrUiMenu(ium *IrUiMenu) error { + return c.UpdateIrUiMenus([]int64{ium.Id.Get()}, ium) +} + +// UpdateIrUiMenus updates existing ir.ui.menu records. +// All records (represented by ids) will be updated by ium values. +func (c *Client) UpdateIrUiMenus(ids []int64, ium *IrUiMenu) error { + return c.Update(IrUiMenuModel, ids, ium, nil) +} + +// DeleteIrUiMenu deletes an existing ir.ui.menu record. +func (c *Client) DeleteIrUiMenu(id int64) error { + return c.DeleteIrUiMenus([]int64{id}) +} + +// DeleteIrUiMenus deletes existing ir.ui.menu records. +func (c *Client) DeleteIrUiMenus(ids []int64) error { + return c.Delete(IrUiMenuModel, ids) +} + +// GetIrUiMenu gets ir.ui.menu existing record. +func (c *Client) GetIrUiMenu(id int64) (*IrUiMenu, error) { + iums, err := c.GetIrUiMenus([]int64{id}) + if err != nil { + return nil, err + } + return &((*iums)[0]), nil +} + +// GetIrUiMenus gets ir.ui.menu existing records. +func (c *Client) GetIrUiMenus(ids []int64) (*IrUiMenus, error) { + iums := &IrUiMenus{} + if err := c.Read(IrUiMenuModel, ids, nil, iums); err != nil { + return nil, err + } + return iums, nil +} + +// FindIrUiMenu finds ir.ui.menu record by querying it with criteria. +func (c *Client) FindIrUiMenu(criteria *Criteria) (*IrUiMenu, error) { + iums := &IrUiMenus{} + if err := c.SearchRead(IrUiMenuModel, criteria, NewOptions().Limit(1), iums); err != nil { + return nil, err + } + return &((*iums)[0]), nil +} + +// FindIrUiMenus finds ir.ui.menu records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrUiMenus(criteria *Criteria, options *Options) (*IrUiMenus, error) { + iums := &IrUiMenus{} + if err := c.SearchRead(IrUiMenuModel, criteria, options, iums); err != nil { + return nil, err + } + return iums, nil +} + +// FindIrUiMenuIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrUiMenuIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrUiMenuModel, criteria, options) +} + +// FindIrUiMenuId finds record id by querying it with criteria. +func (c *Client) FindIrUiMenuId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrUiMenuModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_ui_view.go b/ir_ui_view.go new file mode 100644 index 0000000..782f12f --- /dev/null +++ b/ir_ui_view.go @@ -0,0 +1,137 @@ +package odoo + +// IrUiView represents ir.ui.view model. +type IrUiView struct { + Active *Bool `xmlrpc:"active,omitempty"` + Arch *String `xmlrpc:"arch,omitempty"` + ArchBase *String `xmlrpc:"arch_base,omitempty"` + ArchDb *String `xmlrpc:"arch_db,omitempty"` + ArchFs *String `xmlrpc:"arch_fs,omitempty"` + ArchPrev *String `xmlrpc:"arch_prev,omitempty"` + ArchUpdated *Bool `xmlrpc:"arch_updated,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CustomizeShow *Bool `xmlrpc:"customize_show,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + GroupsId *Relation `xmlrpc:"groups_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InheritChildrenIds *Relation `xmlrpc:"inherit_children_ids,omitempty"` + InheritId *Many2One `xmlrpc:"inherit_id,omitempty"` + Key *String `xmlrpc:"key,omitempty"` + Mode *Selection `xmlrpc:"mode,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + ModelDataId *Many2One `xmlrpc:"model_data_id,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Priority *Int `xmlrpc:"priority,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + WarningInfo *String `xmlrpc:"warning_info,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + XmlId *String `xmlrpc:"xml_id,omitempty"` +} + +// IrUiViews represents array of ir.ui.view model. +type IrUiViews []IrUiView + +// IrUiViewModel is the odoo model name. +const IrUiViewModel = "ir.ui.view" + +// Many2One convert IrUiView to *Many2One. +func (iuv *IrUiView) Many2One() *Many2One { + return NewMany2One(iuv.Id.Get(), "") +} + +// CreateIrUiView creates a new ir.ui.view model and returns its id. +func (c *Client) CreateIrUiView(iuv *IrUiView) (int64, error) { + ids, err := c.CreateIrUiViews([]*IrUiView{iuv}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrUiView creates a new ir.ui.view model and returns its id. +func (c *Client) CreateIrUiViews(iuvs []*IrUiView) ([]int64, error) { + var vv []interface{} + for _, v := range iuvs { + vv = append(vv, v) + } + return c.Create(IrUiViewModel, vv, nil) +} + +// UpdateIrUiView updates an existing ir.ui.view record. +func (c *Client) UpdateIrUiView(iuv *IrUiView) error { + return c.UpdateIrUiViews([]int64{iuv.Id.Get()}, iuv) +} + +// UpdateIrUiViews updates existing ir.ui.view records. +// All records (represented by ids) will be updated by iuv values. +func (c *Client) UpdateIrUiViews(ids []int64, iuv *IrUiView) error { + return c.Update(IrUiViewModel, ids, iuv, nil) +} + +// DeleteIrUiView deletes an existing ir.ui.view record. +func (c *Client) DeleteIrUiView(id int64) error { + return c.DeleteIrUiViews([]int64{id}) +} + +// DeleteIrUiViews deletes existing ir.ui.view records. +func (c *Client) DeleteIrUiViews(ids []int64) error { + return c.Delete(IrUiViewModel, ids) +} + +// GetIrUiView gets ir.ui.view existing record. +func (c *Client) GetIrUiView(id int64) (*IrUiView, error) { + iuvs, err := c.GetIrUiViews([]int64{id}) + if err != nil { + return nil, err + } + return &((*iuvs)[0]), nil +} + +// GetIrUiViews gets ir.ui.view existing records. +func (c *Client) GetIrUiViews(ids []int64) (*IrUiViews, error) { + iuvs := &IrUiViews{} + if err := c.Read(IrUiViewModel, ids, nil, iuvs); err != nil { + return nil, err + } + return iuvs, nil +} + +// FindIrUiView finds ir.ui.view record by querying it with criteria. +func (c *Client) FindIrUiView(criteria *Criteria) (*IrUiView, error) { + iuvs := &IrUiViews{} + if err := c.SearchRead(IrUiViewModel, criteria, NewOptions().Limit(1), iuvs); err != nil { + return nil, err + } + return &((*iuvs)[0]), nil +} + +// FindIrUiViews finds ir.ui.view records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrUiViews(criteria *Criteria, options *Options) (*IrUiViews, error) { + iuvs := &IrUiViews{} + if err := c.SearchRead(IrUiViewModel, criteria, options, iuvs); err != nil { + return nil, err + } + return iuvs, nil +} + +// FindIrUiViewIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrUiViewIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrUiViewModel, criteria, options) +} + +// FindIrUiViewId finds record id by querying it with criteria. +func (c *Client) FindIrUiViewId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrUiViewModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/ir_ui_view_custom.go b/ir_ui_view_custom.go new file mode 100644 index 0000000..10c8304 --- /dev/null +++ b/ir_ui_view_custom.go @@ -0,0 +1,119 @@ +package odoo + +// IrUiViewCustom represents ir.ui.view.custom model. +type IrUiViewCustom struct { + Arch *String `xmlrpc:"arch,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + RefId *Many2One `xmlrpc:"ref_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// IrUiViewCustoms represents array of ir.ui.view.custom model. +type IrUiViewCustoms []IrUiViewCustom + +// IrUiViewCustomModel is the odoo model name. +const IrUiViewCustomModel = "ir.ui.view.custom" + +// Many2One convert IrUiViewCustom to *Many2One. +func (iuvc *IrUiViewCustom) Many2One() *Many2One { + return NewMany2One(iuvc.Id.Get(), "") +} + +// CreateIrUiViewCustom creates a new ir.ui.view.custom model and returns its id. +func (c *Client) CreateIrUiViewCustom(iuvc *IrUiViewCustom) (int64, error) { + ids, err := c.CreateIrUiViewCustoms([]*IrUiViewCustom{iuvc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateIrUiViewCustom creates a new ir.ui.view.custom model and returns its id. +func (c *Client) CreateIrUiViewCustoms(iuvcs []*IrUiViewCustom) ([]int64, error) { + var vv []interface{} + for _, v := range iuvcs { + vv = append(vv, v) + } + return c.Create(IrUiViewCustomModel, vv, nil) +} + +// UpdateIrUiViewCustom updates an existing ir.ui.view.custom record. +func (c *Client) UpdateIrUiViewCustom(iuvc *IrUiViewCustom) error { + return c.UpdateIrUiViewCustoms([]int64{iuvc.Id.Get()}, iuvc) +} + +// UpdateIrUiViewCustoms updates existing ir.ui.view.custom records. +// All records (represented by ids) will be updated by iuvc values. +func (c *Client) UpdateIrUiViewCustoms(ids []int64, iuvc *IrUiViewCustom) error { + return c.Update(IrUiViewCustomModel, ids, iuvc, nil) +} + +// DeleteIrUiViewCustom deletes an existing ir.ui.view.custom record. +func (c *Client) DeleteIrUiViewCustom(id int64) error { + return c.DeleteIrUiViewCustoms([]int64{id}) +} + +// DeleteIrUiViewCustoms deletes existing ir.ui.view.custom records. +func (c *Client) DeleteIrUiViewCustoms(ids []int64) error { + return c.Delete(IrUiViewCustomModel, ids) +} + +// GetIrUiViewCustom gets ir.ui.view.custom existing record. +func (c *Client) GetIrUiViewCustom(id int64) (*IrUiViewCustom, error) { + iuvcs, err := c.GetIrUiViewCustoms([]int64{id}) + if err != nil { + return nil, err + } + return &((*iuvcs)[0]), nil +} + +// GetIrUiViewCustoms gets ir.ui.view.custom existing records. +func (c *Client) GetIrUiViewCustoms(ids []int64) (*IrUiViewCustoms, error) { + iuvcs := &IrUiViewCustoms{} + if err := c.Read(IrUiViewCustomModel, ids, nil, iuvcs); err != nil { + return nil, err + } + return iuvcs, nil +} + +// FindIrUiViewCustom finds ir.ui.view.custom record by querying it with criteria. +func (c *Client) FindIrUiViewCustom(criteria *Criteria) (*IrUiViewCustom, error) { + iuvcs := &IrUiViewCustoms{} + if err := c.SearchRead(IrUiViewCustomModel, criteria, NewOptions().Limit(1), iuvcs); err != nil { + return nil, err + } + return &((*iuvcs)[0]), nil +} + +// FindIrUiViewCustoms finds ir.ui.view.custom records by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrUiViewCustoms(criteria *Criteria, options *Options) (*IrUiViewCustoms, error) { + iuvcs := &IrUiViewCustoms{} + if err := c.SearchRead(IrUiViewCustomModel, criteria, options, iuvcs); err != nil { + return nil, err + } + return iuvcs, nil +} + +// FindIrUiViewCustomIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindIrUiViewCustomIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(IrUiViewCustomModel, criteria, options) +} + +// FindIrUiViewCustomId finds record id by querying it with criteria. +func (c *Client) FindIrUiViewCustomId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(IrUiViewCustomModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/l10n_ch_qr_invoice_wizard.go b/l10n_ch_qr_invoice_wizard.go new file mode 100644 index 0000000..eaa0a17 --- /dev/null +++ b/l10n_ch_qr_invoice_wizard.go @@ -0,0 +1,120 @@ +package odoo + +// L10NChQrInvoiceWizard represents l10n_ch.qr_invoice.wizard model. +type L10NChQrInvoiceWizard struct { + ClassicInvText *String `xmlrpc:"classic_inv_text,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + NbClassicInv *Int `xmlrpc:"nb_classic_inv,omitempty"` + NbQrInv *Int `xmlrpc:"nb_qr_inv,omitempty"` + QrInvText *String `xmlrpc:"qr_inv_text,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// L10NChQrInvoiceWizards represents array of l10n_ch.qr_invoice.wizard model. +type L10NChQrInvoiceWizards []L10NChQrInvoiceWizard + +// L10NChQrInvoiceWizardModel is the odoo model name. +const L10NChQrInvoiceWizardModel = "l10n_ch.qr_invoice.wizard" + +// Many2One convert L10NChQrInvoiceWizard to *Many2One. +func (lqw *L10NChQrInvoiceWizard) Many2One() *Many2One { + return NewMany2One(lqw.Id.Get(), "") +} + +// CreateL10NChQrInvoiceWizard creates a new l10n_ch.qr_invoice.wizard model and returns its id. +func (c *Client) CreateL10NChQrInvoiceWizard(lqw *L10NChQrInvoiceWizard) (int64, error) { + ids, err := c.CreateL10NChQrInvoiceWizards([]*L10NChQrInvoiceWizard{lqw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateL10NChQrInvoiceWizard creates a new l10n_ch.qr_invoice.wizard model and returns its id. +func (c *Client) CreateL10NChQrInvoiceWizards(lqws []*L10NChQrInvoiceWizard) ([]int64, error) { + var vv []interface{} + for _, v := range lqws { + vv = append(vv, v) + } + return c.Create(L10NChQrInvoiceWizardModel, vv, nil) +} + +// UpdateL10NChQrInvoiceWizard updates an existing l10n_ch.qr_invoice.wizard record. +func (c *Client) UpdateL10NChQrInvoiceWizard(lqw *L10NChQrInvoiceWizard) error { + return c.UpdateL10NChQrInvoiceWizards([]int64{lqw.Id.Get()}, lqw) +} + +// UpdateL10NChQrInvoiceWizards updates existing l10n_ch.qr_invoice.wizard records. +// All records (represented by ids) will be updated by lqw values. +func (c *Client) UpdateL10NChQrInvoiceWizards(ids []int64, lqw *L10NChQrInvoiceWizard) error { + return c.Update(L10NChQrInvoiceWizardModel, ids, lqw, nil) +} + +// DeleteL10NChQrInvoiceWizard deletes an existing l10n_ch.qr_invoice.wizard record. +func (c *Client) DeleteL10NChQrInvoiceWizard(id int64) error { + return c.DeleteL10NChQrInvoiceWizards([]int64{id}) +} + +// DeleteL10NChQrInvoiceWizards deletes existing l10n_ch.qr_invoice.wizard records. +func (c *Client) DeleteL10NChQrInvoiceWizards(ids []int64) error { + return c.Delete(L10NChQrInvoiceWizardModel, ids) +} + +// GetL10NChQrInvoiceWizard gets l10n_ch.qr_invoice.wizard existing record. +func (c *Client) GetL10NChQrInvoiceWizard(id int64) (*L10NChQrInvoiceWizard, error) { + lqws, err := c.GetL10NChQrInvoiceWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*lqws)[0]), nil +} + +// GetL10NChQrInvoiceWizards gets l10n_ch.qr_invoice.wizard existing records. +func (c *Client) GetL10NChQrInvoiceWizards(ids []int64) (*L10NChQrInvoiceWizards, error) { + lqws := &L10NChQrInvoiceWizards{} + if err := c.Read(L10NChQrInvoiceWizardModel, ids, nil, lqws); err != nil { + return nil, err + } + return lqws, nil +} + +// FindL10NChQrInvoiceWizard finds l10n_ch.qr_invoice.wizard record by querying it with criteria. +func (c *Client) FindL10NChQrInvoiceWizard(criteria *Criteria) (*L10NChQrInvoiceWizard, error) { + lqws := &L10NChQrInvoiceWizards{} + if err := c.SearchRead(L10NChQrInvoiceWizardModel, criteria, NewOptions().Limit(1), lqws); err != nil { + return nil, err + } + return &((*lqws)[0]), nil +} + +// FindL10NChQrInvoiceWizards finds l10n_ch.qr_invoice.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindL10NChQrInvoiceWizards(criteria *Criteria, options *Options) (*L10NChQrInvoiceWizards, error) { + lqws := &L10NChQrInvoiceWizards{} + if err := c.SearchRead(L10NChQrInvoiceWizardModel, criteria, options, lqws); err != nil { + return nil, err + } + return lqws, nil +} + +// FindL10NChQrInvoiceWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindL10NChQrInvoiceWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(L10NChQrInvoiceWizardModel, criteria, options) +} + +// FindL10NChQrInvoiceWizardId finds record id by querying it with criteria. +func (c *Client) FindL10NChQrInvoiceWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(L10NChQrInvoiceWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_activity.go b/mail_activity.go new file mode 100644 index 0000000..a605891 --- /dev/null +++ b/mail_activity.go @@ -0,0 +1,142 @@ +package odoo + +// MailActivity represents mail.activity model. +type MailActivity struct { + Active *Bool `xmlrpc:"active,omitempty"` + ActivityCategory *Selection `xmlrpc:"activity_category,omitempty"` + ActivityDecoration *Selection `xmlrpc:"activity_decoration,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + Automated *Bool `xmlrpc:"automated,omitempty"` + CalendarEventId *Many2One `xmlrpc:"calendar_event_id,omitempty"` + CanWrite *Bool `xmlrpc:"can_write,omitempty"` + ChainingType *Selection `xmlrpc:"chaining_type,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateDeadline *Time `xmlrpc:"date_deadline,omitempty"` + DateDone *Time `xmlrpc:"date_done,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasRecommendedActivities *Bool `xmlrpc:"has_recommended_activities,omitempty"` + Icon *String `xmlrpc:"icon,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MailTemplateIds *Relation `xmlrpc:"mail_template_ids,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + PreviousActivityTypeId *Many2One `xmlrpc:"previous_activity_type_id,omitempty"` + RecommendedActivityTypeId *Many2One `xmlrpc:"recommended_activity_type_id,omitempty"` + RequestPartnerId *Many2One `xmlrpc:"request_partner_id,omitempty"` + ResId *Many2One `xmlrpc:"res_id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + ResModelId *Many2One `xmlrpc:"res_model_id,omitempty"` + ResName *String `xmlrpc:"res_name,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + Summary *String `xmlrpc:"summary,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + UserTz *Selection `xmlrpc:"user_tz,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailActivitys represents array of mail.activity model. +type MailActivitys []MailActivity + +// MailActivityModel is the odoo model name. +const MailActivityModel = "mail.activity" + +// Many2One convert MailActivity to *Many2One. +func (ma *MailActivity) Many2One() *Many2One { + return NewMany2One(ma.Id.Get(), "") +} + +// CreateMailActivity creates a new mail.activity model and returns its id. +func (c *Client) CreateMailActivity(ma *MailActivity) (int64, error) { + ids, err := c.CreateMailActivitys([]*MailActivity{ma}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailActivity creates a new mail.activity model and returns its id. +func (c *Client) CreateMailActivitys(mas []*MailActivity) ([]int64, error) { + var vv []interface{} + for _, v := range mas { + vv = append(vv, v) + } + return c.Create(MailActivityModel, vv, nil) +} + +// UpdateMailActivity updates an existing mail.activity record. +func (c *Client) UpdateMailActivity(ma *MailActivity) error { + return c.UpdateMailActivitys([]int64{ma.Id.Get()}, ma) +} + +// UpdateMailActivitys updates existing mail.activity records. +// All records (represented by ids) will be updated by ma values. +func (c *Client) UpdateMailActivitys(ids []int64, ma *MailActivity) error { + return c.Update(MailActivityModel, ids, ma, nil) +} + +// DeleteMailActivity deletes an existing mail.activity record. +func (c *Client) DeleteMailActivity(id int64) error { + return c.DeleteMailActivitys([]int64{id}) +} + +// DeleteMailActivitys deletes existing mail.activity records. +func (c *Client) DeleteMailActivitys(ids []int64) error { + return c.Delete(MailActivityModel, ids) +} + +// GetMailActivity gets mail.activity existing record. +func (c *Client) GetMailActivity(id int64) (*MailActivity, error) { + mas, err := c.GetMailActivitys([]int64{id}) + if err != nil { + return nil, err + } + return &((*mas)[0]), nil +} + +// GetMailActivitys gets mail.activity existing records. +func (c *Client) GetMailActivitys(ids []int64) (*MailActivitys, error) { + mas := &MailActivitys{} + if err := c.Read(MailActivityModel, ids, nil, mas); err != nil { + return nil, err + } + return mas, nil +} + +// FindMailActivity finds mail.activity record by querying it with criteria. +func (c *Client) FindMailActivity(criteria *Criteria) (*MailActivity, error) { + mas := &MailActivitys{} + if err := c.SearchRead(MailActivityModel, criteria, NewOptions().Limit(1), mas); err != nil { + return nil, err + } + return &((*mas)[0]), nil +} + +// FindMailActivitys finds mail.activity records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailActivitys(criteria *Criteria, options *Options) (*MailActivitys, error) { + mas := &MailActivitys{} + if err := c.SearchRead(MailActivityModel, criteria, options, mas); err != nil { + return nil, err + } + return mas, nil +} + +// FindMailActivityIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailActivityIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailActivityModel, criteria, options) +} + +// FindMailActivityId finds record id by querying it with criteria. +func (c *Client) FindMailActivityId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailActivityModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_activity_plan.go b/mail_activity_plan.go new file mode 100644 index 0000000..652e20a --- /dev/null +++ b/mail_activity_plan.go @@ -0,0 +1,126 @@ +package odoo + +// MailActivityPlan represents mail.activity.plan model. +type MailActivityPlan struct { + Active *Bool `xmlrpc:"active,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DepartmentAssignable *Bool `xmlrpc:"department_assignable,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasUserOnDemand *Bool `xmlrpc:"has_user_on_demand,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ResModel *Selection `xmlrpc:"res_model,omitempty"` + ResModelId *Many2One `xmlrpc:"res_model_id,omitempty"` + StepsCount *Int `xmlrpc:"steps_count,omitempty"` + TemplateIds *Relation `xmlrpc:"template_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailActivityPlans represents array of mail.activity.plan model. +type MailActivityPlans []MailActivityPlan + +// MailActivityPlanModel is the odoo model name. +const MailActivityPlanModel = "mail.activity.plan" + +// Many2One convert MailActivityPlan to *Many2One. +func (MAP *MailActivityPlan) Many2One() *Many2One { + return NewMany2One(MAP.Id.Get(), "") +} + +// CreateMailActivityPlan creates a new mail.activity.plan model and returns its id. +func (c *Client) CreateMailActivityPlan(MAP *MailActivityPlan) (int64, error) { + ids, err := c.CreateMailActivityPlans([]*MailActivityPlan{MAP}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailActivityPlan creates a new mail.activity.plan model and returns its id. +func (c *Client) CreateMailActivityPlans(MAPs []*MailActivityPlan) ([]int64, error) { + var vv []interface{} + for _, v := range MAPs { + vv = append(vv, v) + } + return c.Create(MailActivityPlanModel, vv, nil) +} + +// UpdateMailActivityPlan updates an existing mail.activity.plan record. +func (c *Client) UpdateMailActivityPlan(MAP *MailActivityPlan) error { + return c.UpdateMailActivityPlans([]int64{MAP.Id.Get()}, MAP) +} + +// UpdateMailActivityPlans updates existing mail.activity.plan records. +// All records (represented by ids) will be updated by MAP values. +func (c *Client) UpdateMailActivityPlans(ids []int64, MAP *MailActivityPlan) error { + return c.Update(MailActivityPlanModel, ids, MAP, nil) +} + +// DeleteMailActivityPlan deletes an existing mail.activity.plan record. +func (c *Client) DeleteMailActivityPlan(id int64) error { + return c.DeleteMailActivityPlans([]int64{id}) +} + +// DeleteMailActivityPlans deletes existing mail.activity.plan records. +func (c *Client) DeleteMailActivityPlans(ids []int64) error { + return c.Delete(MailActivityPlanModel, ids) +} + +// GetMailActivityPlan gets mail.activity.plan existing record. +func (c *Client) GetMailActivityPlan(id int64) (*MailActivityPlan, error) { + MAPs, err := c.GetMailActivityPlans([]int64{id}) + if err != nil { + return nil, err + } + return &((*MAPs)[0]), nil +} + +// GetMailActivityPlans gets mail.activity.plan existing records. +func (c *Client) GetMailActivityPlans(ids []int64) (*MailActivityPlans, error) { + MAPs := &MailActivityPlans{} + if err := c.Read(MailActivityPlanModel, ids, nil, MAPs); err != nil { + return nil, err + } + return MAPs, nil +} + +// FindMailActivityPlan finds mail.activity.plan record by querying it with criteria. +func (c *Client) FindMailActivityPlan(criteria *Criteria) (*MailActivityPlan, error) { + MAPs := &MailActivityPlans{} + if err := c.SearchRead(MailActivityPlanModel, criteria, NewOptions().Limit(1), MAPs); err != nil { + return nil, err + } + return &((*MAPs)[0]), nil +} + +// FindMailActivityPlans finds mail.activity.plan records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailActivityPlans(criteria *Criteria, options *Options) (*MailActivityPlans, error) { + MAPs := &MailActivityPlans{} + if err := c.SearchRead(MailActivityPlanModel, criteria, options, MAPs); err != nil { + return nil, err + } + return MAPs, nil +} + +// FindMailActivityPlanIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailActivityPlanIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailActivityPlanModel, criteria, options) +} + +// FindMailActivityPlanId finds record id by querying it with criteria. +func (c *Client) FindMailActivityPlanId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailActivityPlanModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_activity_plan_template.go b/mail_activity_plan_template.go new file mode 100644 index 0000000..65f97d0 --- /dev/null +++ b/mail_activity_plan_template.go @@ -0,0 +1,129 @@ +package odoo + +// MailActivityPlanTemplate represents mail.activity.plan.template model. +type MailActivityPlanTemplate struct { + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DelayCount *Int `xmlrpc:"delay_count,omitempty"` + DelayFrom *Selection `xmlrpc:"delay_from,omitempty"` + DelayUnit *Selection `xmlrpc:"delay_unit,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Icon *String `xmlrpc:"icon,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + PlanId *Many2One `xmlrpc:"plan_id,omitempty"` + ResModel *Selection `xmlrpc:"res_model,omitempty"` + ResponsibleId *Many2One `xmlrpc:"responsible_id,omitempty"` + ResponsibleType *Selection `xmlrpc:"responsible_type,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + Summary *String `xmlrpc:"summary,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailActivityPlanTemplates represents array of mail.activity.plan.template model. +type MailActivityPlanTemplates []MailActivityPlanTemplate + +// MailActivityPlanTemplateModel is the odoo model name. +const MailActivityPlanTemplateModel = "mail.activity.plan.template" + +// Many2One convert MailActivityPlanTemplate to *Many2One. +func (mapt *MailActivityPlanTemplate) Many2One() *Many2One { + return NewMany2One(mapt.Id.Get(), "") +} + +// CreateMailActivityPlanTemplate creates a new mail.activity.plan.template model and returns its id. +func (c *Client) CreateMailActivityPlanTemplate(mapt *MailActivityPlanTemplate) (int64, error) { + ids, err := c.CreateMailActivityPlanTemplates([]*MailActivityPlanTemplate{mapt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailActivityPlanTemplate creates a new mail.activity.plan.template model and returns its id. +func (c *Client) CreateMailActivityPlanTemplates(mapts []*MailActivityPlanTemplate) ([]int64, error) { + var vv []interface{} + for _, v := range mapts { + vv = append(vv, v) + } + return c.Create(MailActivityPlanTemplateModel, vv, nil) +} + +// UpdateMailActivityPlanTemplate updates an existing mail.activity.plan.template record. +func (c *Client) UpdateMailActivityPlanTemplate(mapt *MailActivityPlanTemplate) error { + return c.UpdateMailActivityPlanTemplates([]int64{mapt.Id.Get()}, mapt) +} + +// UpdateMailActivityPlanTemplates updates existing mail.activity.plan.template records. +// All records (represented by ids) will be updated by mapt values. +func (c *Client) UpdateMailActivityPlanTemplates(ids []int64, mapt *MailActivityPlanTemplate) error { + return c.Update(MailActivityPlanTemplateModel, ids, mapt, nil) +} + +// DeleteMailActivityPlanTemplate deletes an existing mail.activity.plan.template record. +func (c *Client) DeleteMailActivityPlanTemplate(id int64) error { + return c.DeleteMailActivityPlanTemplates([]int64{id}) +} + +// DeleteMailActivityPlanTemplates deletes existing mail.activity.plan.template records. +func (c *Client) DeleteMailActivityPlanTemplates(ids []int64) error { + return c.Delete(MailActivityPlanTemplateModel, ids) +} + +// GetMailActivityPlanTemplate gets mail.activity.plan.template existing record. +func (c *Client) GetMailActivityPlanTemplate(id int64) (*MailActivityPlanTemplate, error) { + mapts, err := c.GetMailActivityPlanTemplates([]int64{id}) + if err != nil { + return nil, err + } + return &((*mapts)[0]), nil +} + +// GetMailActivityPlanTemplates gets mail.activity.plan.template existing records. +func (c *Client) GetMailActivityPlanTemplates(ids []int64) (*MailActivityPlanTemplates, error) { + mapts := &MailActivityPlanTemplates{} + if err := c.Read(MailActivityPlanTemplateModel, ids, nil, mapts); err != nil { + return nil, err + } + return mapts, nil +} + +// FindMailActivityPlanTemplate finds mail.activity.plan.template record by querying it with criteria. +func (c *Client) FindMailActivityPlanTemplate(criteria *Criteria) (*MailActivityPlanTemplate, error) { + mapts := &MailActivityPlanTemplates{} + if err := c.SearchRead(MailActivityPlanTemplateModel, criteria, NewOptions().Limit(1), mapts); err != nil { + return nil, err + } + return &((*mapts)[0]), nil +} + +// FindMailActivityPlanTemplates finds mail.activity.plan.template records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailActivityPlanTemplates(criteria *Criteria, options *Options) (*MailActivityPlanTemplates, error) { + mapts := &MailActivityPlanTemplates{} + if err := c.SearchRead(MailActivityPlanTemplateModel, criteria, options, mapts); err != nil { + return nil, err + } + return mapts, nil +} + +// FindMailActivityPlanTemplateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailActivityPlanTemplateIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailActivityPlanTemplateModel, criteria, options) +} + +// FindMailActivityPlanTemplateId finds record id by querying it with criteria. +func (c *Client) FindMailActivityPlanTemplateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailActivityPlanTemplateModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_activity_schedule.go b/mail_activity_schedule.go new file mode 100644 index 0000000..a3981a0 --- /dev/null +++ b/mail_activity_schedule.go @@ -0,0 +1,138 @@ +package odoo + +// MailActivitySchedule represents mail.activity.schedule model. +type MailActivitySchedule struct { + ActivityCategory *Selection `xmlrpc:"activity_category,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + ChainingType *Selection `xmlrpc:"chaining_type,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateDeadline *Time `xmlrpc:"date_deadline,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Error *String `xmlrpc:"error,omitempty"` + HasError *Bool `xmlrpc:"has_error,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsBatchMode *Bool `xmlrpc:"is_batch_mode,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + PlanAvailableIds *Relation `xmlrpc:"plan_available_ids,omitempty"` + PlanDate *Time `xmlrpc:"plan_date,omitempty"` + PlanDepartmentFilterable *Bool `xmlrpc:"plan_department_filterable,omitempty"` + PlanHasUserOnDemand *Bool `xmlrpc:"plan_has_user_on_demand,omitempty"` + PlanId *Many2One `xmlrpc:"plan_id,omitempty"` + PlanOnDemandUserId *Many2One `xmlrpc:"plan_on_demand_user_id,omitempty"` + PlanSummary *String `xmlrpc:"plan_summary,omitempty"` + ResIds *String `xmlrpc:"res_ids,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + ResModelId *Many2One `xmlrpc:"res_model_id,omitempty"` + Summary *String `xmlrpc:"summary,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailActivitySchedules represents array of mail.activity.schedule model. +type MailActivitySchedules []MailActivitySchedule + +// MailActivityScheduleModel is the odoo model name. +const MailActivityScheduleModel = "mail.activity.schedule" + +// Many2One convert MailActivitySchedule to *Many2One. +func (mas *MailActivitySchedule) Many2One() *Many2One { + return NewMany2One(mas.Id.Get(), "") +} + +// CreateMailActivitySchedule creates a new mail.activity.schedule model and returns its id. +func (c *Client) CreateMailActivitySchedule(mas *MailActivitySchedule) (int64, error) { + ids, err := c.CreateMailActivitySchedules([]*MailActivitySchedule{mas}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailActivitySchedule creates a new mail.activity.schedule model and returns its id. +func (c *Client) CreateMailActivitySchedules(mass []*MailActivitySchedule) ([]int64, error) { + var vv []interface{} + for _, v := range mass { + vv = append(vv, v) + } + return c.Create(MailActivityScheduleModel, vv, nil) +} + +// UpdateMailActivitySchedule updates an existing mail.activity.schedule record. +func (c *Client) UpdateMailActivitySchedule(mas *MailActivitySchedule) error { + return c.UpdateMailActivitySchedules([]int64{mas.Id.Get()}, mas) +} + +// UpdateMailActivitySchedules updates existing mail.activity.schedule records. +// All records (represented by ids) will be updated by mas values. +func (c *Client) UpdateMailActivitySchedules(ids []int64, mas *MailActivitySchedule) error { + return c.Update(MailActivityScheduleModel, ids, mas, nil) +} + +// DeleteMailActivitySchedule deletes an existing mail.activity.schedule record. +func (c *Client) DeleteMailActivitySchedule(id int64) error { + return c.DeleteMailActivitySchedules([]int64{id}) +} + +// DeleteMailActivitySchedules deletes existing mail.activity.schedule records. +func (c *Client) DeleteMailActivitySchedules(ids []int64) error { + return c.Delete(MailActivityScheduleModel, ids) +} + +// GetMailActivitySchedule gets mail.activity.schedule existing record. +func (c *Client) GetMailActivitySchedule(id int64) (*MailActivitySchedule, error) { + mass, err := c.GetMailActivitySchedules([]int64{id}) + if err != nil { + return nil, err + } + return &((*mass)[0]), nil +} + +// GetMailActivitySchedules gets mail.activity.schedule existing records. +func (c *Client) GetMailActivitySchedules(ids []int64) (*MailActivitySchedules, error) { + mass := &MailActivitySchedules{} + if err := c.Read(MailActivityScheduleModel, ids, nil, mass); err != nil { + return nil, err + } + return mass, nil +} + +// FindMailActivitySchedule finds mail.activity.schedule record by querying it with criteria. +func (c *Client) FindMailActivitySchedule(criteria *Criteria) (*MailActivitySchedule, error) { + mass := &MailActivitySchedules{} + if err := c.SearchRead(MailActivityScheduleModel, criteria, NewOptions().Limit(1), mass); err != nil { + return nil, err + } + return &((*mass)[0]), nil +} + +// FindMailActivitySchedules finds mail.activity.schedule records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailActivitySchedules(criteria *Criteria, options *Options) (*MailActivitySchedules, error) { + mass := &MailActivitySchedules{} + if err := c.SearchRead(MailActivityScheduleModel, criteria, options, mass); err != nil { + return nil, err + } + return mass, nil +} + +// FindMailActivityScheduleIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailActivityScheduleIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailActivityScheduleModel, criteria, options) +} + +// FindMailActivityScheduleId finds record id by querying it with criteria. +func (c *Client) FindMailActivityScheduleId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailActivityScheduleModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_activity_todo_create.go b/mail_activity_todo_create.go new file mode 100644 index 0000000..7f1706f --- /dev/null +++ b/mail_activity_todo_create.go @@ -0,0 +1,120 @@ +package odoo + +// MailActivityTodoCreate represents mail.activity.todo.create model. +type MailActivityTodoCreate struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateDeadline *Time `xmlrpc:"date_deadline,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + Summary *String `xmlrpc:"summary,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailActivityTodoCreates represents array of mail.activity.todo.create model. +type MailActivityTodoCreates []MailActivityTodoCreate + +// MailActivityTodoCreateModel is the odoo model name. +const MailActivityTodoCreateModel = "mail.activity.todo.create" + +// Many2One convert MailActivityTodoCreate to *Many2One. +func (matc *MailActivityTodoCreate) Many2One() *Many2One { + return NewMany2One(matc.Id.Get(), "") +} + +// CreateMailActivityTodoCreate creates a new mail.activity.todo.create model and returns its id. +func (c *Client) CreateMailActivityTodoCreate(matc *MailActivityTodoCreate) (int64, error) { + ids, err := c.CreateMailActivityTodoCreates([]*MailActivityTodoCreate{matc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailActivityTodoCreate creates a new mail.activity.todo.create model and returns its id. +func (c *Client) CreateMailActivityTodoCreates(matcs []*MailActivityTodoCreate) ([]int64, error) { + var vv []interface{} + for _, v := range matcs { + vv = append(vv, v) + } + return c.Create(MailActivityTodoCreateModel, vv, nil) +} + +// UpdateMailActivityTodoCreate updates an existing mail.activity.todo.create record. +func (c *Client) UpdateMailActivityTodoCreate(matc *MailActivityTodoCreate) error { + return c.UpdateMailActivityTodoCreates([]int64{matc.Id.Get()}, matc) +} + +// UpdateMailActivityTodoCreates updates existing mail.activity.todo.create records. +// All records (represented by ids) will be updated by matc values. +func (c *Client) UpdateMailActivityTodoCreates(ids []int64, matc *MailActivityTodoCreate) error { + return c.Update(MailActivityTodoCreateModel, ids, matc, nil) +} + +// DeleteMailActivityTodoCreate deletes an existing mail.activity.todo.create record. +func (c *Client) DeleteMailActivityTodoCreate(id int64) error { + return c.DeleteMailActivityTodoCreates([]int64{id}) +} + +// DeleteMailActivityTodoCreates deletes existing mail.activity.todo.create records. +func (c *Client) DeleteMailActivityTodoCreates(ids []int64) error { + return c.Delete(MailActivityTodoCreateModel, ids) +} + +// GetMailActivityTodoCreate gets mail.activity.todo.create existing record. +func (c *Client) GetMailActivityTodoCreate(id int64) (*MailActivityTodoCreate, error) { + matcs, err := c.GetMailActivityTodoCreates([]int64{id}) + if err != nil { + return nil, err + } + return &((*matcs)[0]), nil +} + +// GetMailActivityTodoCreates gets mail.activity.todo.create existing records. +func (c *Client) GetMailActivityTodoCreates(ids []int64) (*MailActivityTodoCreates, error) { + matcs := &MailActivityTodoCreates{} + if err := c.Read(MailActivityTodoCreateModel, ids, nil, matcs); err != nil { + return nil, err + } + return matcs, nil +} + +// FindMailActivityTodoCreate finds mail.activity.todo.create record by querying it with criteria. +func (c *Client) FindMailActivityTodoCreate(criteria *Criteria) (*MailActivityTodoCreate, error) { + matcs := &MailActivityTodoCreates{} + if err := c.SearchRead(MailActivityTodoCreateModel, criteria, NewOptions().Limit(1), matcs); err != nil { + return nil, err + } + return &((*matcs)[0]), nil +} + +// FindMailActivityTodoCreates finds mail.activity.todo.create records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailActivityTodoCreates(criteria *Criteria, options *Options) (*MailActivityTodoCreates, error) { + matcs := &MailActivityTodoCreates{} + if err := c.SearchRead(MailActivityTodoCreateModel, criteria, options, matcs); err != nil { + return nil, err + } + return matcs, nil +} + +// FindMailActivityTodoCreateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailActivityTodoCreateIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailActivityTodoCreateModel, criteria, options) +} + +// FindMailActivityTodoCreateId finds record id by querying it with criteria. +func (c *Client) FindMailActivityTodoCreateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailActivityTodoCreateModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_activity_type.go b/mail_activity_type.go new file mode 100644 index 0000000..a99a0e9 --- /dev/null +++ b/mail_activity_type.go @@ -0,0 +1,138 @@ +package odoo + +// MailActivityType represents mail.activity.type model. +type MailActivityType struct { + Active *Bool `xmlrpc:"active,omitempty"` + Category *Selection `xmlrpc:"category,omitempty"` + ChainingType *Selection `xmlrpc:"chaining_type,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DecorationType *Selection `xmlrpc:"decoration_type,omitempty"` + DefaultNote *String `xmlrpc:"default_note,omitempty"` + DefaultUserId *Many2One `xmlrpc:"default_user_id,omitempty"` + DelayCount *Int `xmlrpc:"delay_count,omitempty"` + DelayFrom *Selection `xmlrpc:"delay_from,omitempty"` + DelayLabel *String `xmlrpc:"delay_label,omitempty"` + DelayUnit *Selection `xmlrpc:"delay_unit,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Icon *String `xmlrpc:"icon,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InitialResModel *Selection `xmlrpc:"initial_res_model,omitempty"` + KeepDone *Bool `xmlrpc:"keep_done,omitempty"` + MailTemplateIds *Relation `xmlrpc:"mail_template_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PreviousTypeIds *Relation `xmlrpc:"previous_type_ids,omitempty"` + ResModel *Selection `xmlrpc:"res_model,omitempty"` + ResModelChange *Bool `xmlrpc:"res_model_change,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SuggestedNextTypeIds *Relation `xmlrpc:"suggested_next_type_ids,omitempty"` + Summary *String `xmlrpc:"summary,omitempty"` + TriggeredNextTypeId *Many2One `xmlrpc:"triggered_next_type_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailActivityTypes represents array of mail.activity.type model. +type MailActivityTypes []MailActivityType + +// MailActivityTypeModel is the odoo model name. +const MailActivityTypeModel = "mail.activity.type" + +// Many2One convert MailActivityType to *Many2One. +func (mat *MailActivityType) Many2One() *Many2One { + return NewMany2One(mat.Id.Get(), "") +} + +// CreateMailActivityType creates a new mail.activity.type model and returns its id. +func (c *Client) CreateMailActivityType(mat *MailActivityType) (int64, error) { + ids, err := c.CreateMailActivityTypes([]*MailActivityType{mat}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailActivityType creates a new mail.activity.type model and returns its id. +func (c *Client) CreateMailActivityTypes(mats []*MailActivityType) ([]int64, error) { + var vv []interface{} + for _, v := range mats { + vv = append(vv, v) + } + return c.Create(MailActivityTypeModel, vv, nil) +} + +// UpdateMailActivityType updates an existing mail.activity.type record. +func (c *Client) UpdateMailActivityType(mat *MailActivityType) error { + return c.UpdateMailActivityTypes([]int64{mat.Id.Get()}, mat) +} + +// UpdateMailActivityTypes updates existing mail.activity.type records. +// All records (represented by ids) will be updated by mat values. +func (c *Client) UpdateMailActivityTypes(ids []int64, mat *MailActivityType) error { + return c.Update(MailActivityTypeModel, ids, mat, nil) +} + +// DeleteMailActivityType deletes an existing mail.activity.type record. +func (c *Client) DeleteMailActivityType(id int64) error { + return c.DeleteMailActivityTypes([]int64{id}) +} + +// DeleteMailActivityTypes deletes existing mail.activity.type records. +func (c *Client) DeleteMailActivityTypes(ids []int64) error { + return c.Delete(MailActivityTypeModel, ids) +} + +// GetMailActivityType gets mail.activity.type existing record. +func (c *Client) GetMailActivityType(id int64) (*MailActivityType, error) { + mats, err := c.GetMailActivityTypes([]int64{id}) + if err != nil { + return nil, err + } + return &((*mats)[0]), nil +} + +// GetMailActivityTypes gets mail.activity.type existing records. +func (c *Client) GetMailActivityTypes(ids []int64) (*MailActivityTypes, error) { + mats := &MailActivityTypes{} + if err := c.Read(MailActivityTypeModel, ids, nil, mats); err != nil { + return nil, err + } + return mats, nil +} + +// FindMailActivityType finds mail.activity.type record by querying it with criteria. +func (c *Client) FindMailActivityType(criteria *Criteria) (*MailActivityType, error) { + mats := &MailActivityTypes{} + if err := c.SearchRead(MailActivityTypeModel, criteria, NewOptions().Limit(1), mats); err != nil { + return nil, err + } + return &((*mats)[0]), nil +} + +// FindMailActivityTypes finds mail.activity.type records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailActivityTypes(criteria *Criteria, options *Options) (*MailActivityTypes, error) { + mats := &MailActivityTypes{} + if err := c.SearchRead(MailActivityTypeModel, criteria, options, mats); err != nil { + return nil, err + } + return mats, nil +} + +// FindMailActivityTypeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailActivityTypeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailActivityTypeModel, criteria, options) +} + +// FindMailActivityTypeId finds record id by querying it with criteria. +func (c *Client) FindMailActivityTypeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailActivityTypeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_alias.go b/mail_alias.go new file mode 100644 index 0000000..70f965b --- /dev/null +++ b/mail_alias.go @@ -0,0 +1,129 @@ +package odoo + +// MailAlias represents mail.alias model. +type MailAlias struct { + AliasBouncedContent *String `xmlrpc:"alias_bounced_content,omitempty"` + AliasContact *Selection `xmlrpc:"alias_contact,omitempty"` + AliasDefaults *String `xmlrpc:"alias_defaults,omitempty"` + AliasDomain *String `xmlrpc:"alias_domain,omitempty"` + AliasDomainId *Many2One `xmlrpc:"alias_domain_id,omitempty"` + AliasForceThreadId *Int `xmlrpc:"alias_force_thread_id,omitempty"` + AliasFullName *String `xmlrpc:"alias_full_name,omitempty"` + AliasIncomingLocal *Bool `xmlrpc:"alias_incoming_local,omitempty"` + AliasModelId *Many2One `xmlrpc:"alias_model_id,omitempty"` + AliasName *String `xmlrpc:"alias_name,omitempty"` + AliasParentModelId *Many2One `xmlrpc:"alias_parent_model_id,omitempty"` + AliasParentThreadId *Int `xmlrpc:"alias_parent_thread_id,omitempty"` + AliasStatus *Selection `xmlrpc:"alias_status,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailAliass represents array of mail.alias model. +type MailAliass []MailAlias + +// MailAliasModel is the odoo model name. +const MailAliasModel = "mail.alias" + +// Many2One convert MailAlias to *Many2One. +func (ma *MailAlias) Many2One() *Many2One { + return NewMany2One(ma.Id.Get(), "") +} + +// CreateMailAlias creates a new mail.alias model and returns its id. +func (c *Client) CreateMailAlias(ma *MailAlias) (int64, error) { + ids, err := c.CreateMailAliass([]*MailAlias{ma}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailAlias creates a new mail.alias model and returns its id. +func (c *Client) CreateMailAliass(mas []*MailAlias) ([]int64, error) { + var vv []interface{} + for _, v := range mas { + vv = append(vv, v) + } + return c.Create(MailAliasModel, vv, nil) +} + +// UpdateMailAlias updates an existing mail.alias record. +func (c *Client) UpdateMailAlias(ma *MailAlias) error { + return c.UpdateMailAliass([]int64{ma.Id.Get()}, ma) +} + +// UpdateMailAliass updates existing mail.alias records. +// All records (represented by ids) will be updated by ma values. +func (c *Client) UpdateMailAliass(ids []int64, ma *MailAlias) error { + return c.Update(MailAliasModel, ids, ma, nil) +} + +// DeleteMailAlias deletes an existing mail.alias record. +func (c *Client) DeleteMailAlias(id int64) error { + return c.DeleteMailAliass([]int64{id}) +} + +// DeleteMailAliass deletes existing mail.alias records. +func (c *Client) DeleteMailAliass(ids []int64) error { + return c.Delete(MailAliasModel, ids) +} + +// GetMailAlias gets mail.alias existing record. +func (c *Client) GetMailAlias(id int64) (*MailAlias, error) { + mas, err := c.GetMailAliass([]int64{id}) + if err != nil { + return nil, err + } + return &((*mas)[0]), nil +} + +// GetMailAliass gets mail.alias existing records. +func (c *Client) GetMailAliass(ids []int64) (*MailAliass, error) { + mas := &MailAliass{} + if err := c.Read(MailAliasModel, ids, nil, mas); err != nil { + return nil, err + } + return mas, nil +} + +// FindMailAlias finds mail.alias record by querying it with criteria. +func (c *Client) FindMailAlias(criteria *Criteria) (*MailAlias, error) { + mas := &MailAliass{} + if err := c.SearchRead(MailAliasModel, criteria, NewOptions().Limit(1), mas); err != nil { + return nil, err + } + return &((*mas)[0]), nil +} + +// FindMailAliass finds mail.alias records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailAliass(criteria *Criteria, options *Options) (*MailAliass, error) { + mas := &MailAliass{} + if err := c.SearchRead(MailAliasModel, criteria, options, mas); err != nil { + return nil, err + } + return mas, nil +} + +// FindMailAliasIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailAliasIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailAliasModel, criteria, options) +} + +// FindMailAliasId finds record id by querying it with criteria. +func (c *Client) FindMailAliasId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailAliasModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_alias_domain.go b/mail_alias_domain.go new file mode 100644 index 0000000..f696685 --- /dev/null +++ b/mail_alias_domain.go @@ -0,0 +1,125 @@ +package odoo + +// MailAliasDomain represents mail.alias.domain model. +type MailAliasDomain struct { + BounceAlias *String `xmlrpc:"bounce_alias,omitempty"` + BounceEmail *String `xmlrpc:"bounce_email,omitempty"` + CatchallAlias *String `xmlrpc:"catchall_alias,omitempty"` + CatchallEmail *String `xmlrpc:"catchall_email,omitempty"` + CompanyIds *Relation `xmlrpc:"company_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DefaultFrom *String `xmlrpc:"default_from,omitempty"` + DefaultFromEmail *String `xmlrpc:"default_from_email,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailAliasDomains represents array of mail.alias.domain model. +type MailAliasDomains []MailAliasDomain + +// MailAliasDomainModel is the odoo model name. +const MailAliasDomainModel = "mail.alias.domain" + +// Many2One convert MailAliasDomain to *Many2One. +func (mad *MailAliasDomain) Many2One() *Many2One { + return NewMany2One(mad.Id.Get(), "") +} + +// CreateMailAliasDomain creates a new mail.alias.domain model and returns its id. +func (c *Client) CreateMailAliasDomain(mad *MailAliasDomain) (int64, error) { + ids, err := c.CreateMailAliasDomains([]*MailAliasDomain{mad}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailAliasDomain creates a new mail.alias.domain model and returns its id. +func (c *Client) CreateMailAliasDomains(mads []*MailAliasDomain) ([]int64, error) { + var vv []interface{} + for _, v := range mads { + vv = append(vv, v) + } + return c.Create(MailAliasDomainModel, vv, nil) +} + +// UpdateMailAliasDomain updates an existing mail.alias.domain record. +func (c *Client) UpdateMailAliasDomain(mad *MailAliasDomain) error { + return c.UpdateMailAliasDomains([]int64{mad.Id.Get()}, mad) +} + +// UpdateMailAliasDomains updates existing mail.alias.domain records. +// All records (represented by ids) will be updated by mad values. +func (c *Client) UpdateMailAliasDomains(ids []int64, mad *MailAliasDomain) error { + return c.Update(MailAliasDomainModel, ids, mad, nil) +} + +// DeleteMailAliasDomain deletes an existing mail.alias.domain record. +func (c *Client) DeleteMailAliasDomain(id int64) error { + return c.DeleteMailAliasDomains([]int64{id}) +} + +// DeleteMailAliasDomains deletes existing mail.alias.domain records. +func (c *Client) DeleteMailAliasDomains(ids []int64) error { + return c.Delete(MailAliasDomainModel, ids) +} + +// GetMailAliasDomain gets mail.alias.domain existing record. +func (c *Client) GetMailAliasDomain(id int64) (*MailAliasDomain, error) { + mads, err := c.GetMailAliasDomains([]int64{id}) + if err != nil { + return nil, err + } + return &((*mads)[0]), nil +} + +// GetMailAliasDomains gets mail.alias.domain existing records. +func (c *Client) GetMailAliasDomains(ids []int64) (*MailAliasDomains, error) { + mads := &MailAliasDomains{} + if err := c.Read(MailAliasDomainModel, ids, nil, mads); err != nil { + return nil, err + } + return mads, nil +} + +// FindMailAliasDomain finds mail.alias.domain record by querying it with criteria. +func (c *Client) FindMailAliasDomain(criteria *Criteria) (*MailAliasDomain, error) { + mads := &MailAliasDomains{} + if err := c.SearchRead(MailAliasDomainModel, criteria, NewOptions().Limit(1), mads); err != nil { + return nil, err + } + return &((*mads)[0]), nil +} + +// FindMailAliasDomains finds mail.alias.domain records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailAliasDomains(criteria *Criteria, options *Options) (*MailAliasDomains, error) { + mads := &MailAliasDomains{} + if err := c.SearchRead(MailAliasDomainModel, criteria, options, mads); err != nil { + return nil, err + } + return mads, nil +} + +// FindMailAliasDomainIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailAliasDomainIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailAliasDomainModel, criteria, options) +} + +// FindMailAliasDomainId finds record id by querying it with criteria. +func (c *Client) FindMailAliasDomainId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailAliasDomainModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_blacklist.go b/mail_blacklist.go new file mode 100644 index 0000000..cfcde56 --- /dev/null +++ b/mail_blacklist.go @@ -0,0 +1,131 @@ +package odoo + +// MailBlacklist represents mail.blacklist model. +type MailBlacklist struct { + Active *Bool `xmlrpc:"active,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailBlacklists represents array of mail.blacklist model. +type MailBlacklists []MailBlacklist + +// MailBlacklistModel is the odoo model name. +const MailBlacklistModel = "mail.blacklist" + +// Many2One convert MailBlacklist to *Many2One. +func (mb *MailBlacklist) Many2One() *Many2One { + return NewMany2One(mb.Id.Get(), "") +} + +// CreateMailBlacklist creates a new mail.blacklist model and returns its id. +func (c *Client) CreateMailBlacklist(mb *MailBlacklist) (int64, error) { + ids, err := c.CreateMailBlacklists([]*MailBlacklist{mb}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailBlacklist creates a new mail.blacklist model and returns its id. +func (c *Client) CreateMailBlacklists(mbs []*MailBlacklist) ([]int64, error) { + var vv []interface{} + for _, v := range mbs { + vv = append(vv, v) + } + return c.Create(MailBlacklistModel, vv, nil) +} + +// UpdateMailBlacklist updates an existing mail.blacklist record. +func (c *Client) UpdateMailBlacklist(mb *MailBlacklist) error { + return c.UpdateMailBlacklists([]int64{mb.Id.Get()}, mb) +} + +// UpdateMailBlacklists updates existing mail.blacklist records. +// All records (represented by ids) will be updated by mb values. +func (c *Client) UpdateMailBlacklists(ids []int64, mb *MailBlacklist) error { + return c.Update(MailBlacklistModel, ids, mb, nil) +} + +// DeleteMailBlacklist deletes an existing mail.blacklist record. +func (c *Client) DeleteMailBlacklist(id int64) error { + return c.DeleteMailBlacklists([]int64{id}) +} + +// DeleteMailBlacklists deletes existing mail.blacklist records. +func (c *Client) DeleteMailBlacklists(ids []int64) error { + return c.Delete(MailBlacklistModel, ids) +} + +// GetMailBlacklist gets mail.blacklist existing record. +func (c *Client) GetMailBlacklist(id int64) (*MailBlacklist, error) { + mbs, err := c.GetMailBlacklists([]int64{id}) + if err != nil { + return nil, err + } + return &((*mbs)[0]), nil +} + +// GetMailBlacklists gets mail.blacklist existing records. +func (c *Client) GetMailBlacklists(ids []int64) (*MailBlacklists, error) { + mbs := &MailBlacklists{} + if err := c.Read(MailBlacklistModel, ids, nil, mbs); err != nil { + return nil, err + } + return mbs, nil +} + +// FindMailBlacklist finds mail.blacklist record by querying it with criteria. +func (c *Client) FindMailBlacklist(criteria *Criteria) (*MailBlacklist, error) { + mbs := &MailBlacklists{} + if err := c.SearchRead(MailBlacklistModel, criteria, NewOptions().Limit(1), mbs); err != nil { + return nil, err + } + return &((*mbs)[0]), nil +} + +// FindMailBlacklists finds mail.blacklist records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailBlacklists(criteria *Criteria, options *Options) (*MailBlacklists, error) { + mbs := &MailBlacklists{} + if err := c.SearchRead(MailBlacklistModel, criteria, options, mbs); err != nil { + return nil, err + } + return mbs, nil +} + +// FindMailBlacklistIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailBlacklistIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailBlacklistModel, criteria, options) +} + +// FindMailBlacklistId finds record id by querying it with criteria. +func (c *Client) FindMailBlacklistId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailBlacklistModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_blacklist_remove.go b/mail_blacklist_remove.go new file mode 100644 index 0000000..725fcc9 --- /dev/null +++ b/mail_blacklist_remove.go @@ -0,0 +1,118 @@ +package odoo + +// MailBlacklistRemove represents mail.blacklist.remove model. +type MailBlacklistRemove struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Reason *String `xmlrpc:"reason,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailBlacklistRemoves represents array of mail.blacklist.remove model. +type MailBlacklistRemoves []MailBlacklistRemove + +// MailBlacklistRemoveModel is the odoo model name. +const MailBlacklistRemoveModel = "mail.blacklist.remove" + +// Many2One convert MailBlacklistRemove to *Many2One. +func (mbr *MailBlacklistRemove) Many2One() *Many2One { + return NewMany2One(mbr.Id.Get(), "") +} + +// CreateMailBlacklistRemove creates a new mail.blacklist.remove model and returns its id. +func (c *Client) CreateMailBlacklistRemove(mbr *MailBlacklistRemove) (int64, error) { + ids, err := c.CreateMailBlacklistRemoves([]*MailBlacklistRemove{mbr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailBlacklistRemove creates a new mail.blacklist.remove model and returns its id. +func (c *Client) CreateMailBlacklistRemoves(mbrs []*MailBlacklistRemove) ([]int64, error) { + var vv []interface{} + for _, v := range mbrs { + vv = append(vv, v) + } + return c.Create(MailBlacklistRemoveModel, vv, nil) +} + +// UpdateMailBlacklistRemove updates an existing mail.blacklist.remove record. +func (c *Client) UpdateMailBlacklistRemove(mbr *MailBlacklistRemove) error { + return c.UpdateMailBlacklistRemoves([]int64{mbr.Id.Get()}, mbr) +} + +// UpdateMailBlacklistRemoves updates existing mail.blacklist.remove records. +// All records (represented by ids) will be updated by mbr values. +func (c *Client) UpdateMailBlacklistRemoves(ids []int64, mbr *MailBlacklistRemove) error { + return c.Update(MailBlacklistRemoveModel, ids, mbr, nil) +} + +// DeleteMailBlacklistRemove deletes an existing mail.blacklist.remove record. +func (c *Client) DeleteMailBlacklistRemove(id int64) error { + return c.DeleteMailBlacklistRemoves([]int64{id}) +} + +// DeleteMailBlacklistRemoves deletes existing mail.blacklist.remove records. +func (c *Client) DeleteMailBlacklistRemoves(ids []int64) error { + return c.Delete(MailBlacklistRemoveModel, ids) +} + +// GetMailBlacklistRemove gets mail.blacklist.remove existing record. +func (c *Client) GetMailBlacklistRemove(id int64) (*MailBlacklistRemove, error) { + mbrs, err := c.GetMailBlacklistRemoves([]int64{id}) + if err != nil { + return nil, err + } + return &((*mbrs)[0]), nil +} + +// GetMailBlacklistRemoves gets mail.blacklist.remove existing records. +func (c *Client) GetMailBlacklistRemoves(ids []int64) (*MailBlacklistRemoves, error) { + mbrs := &MailBlacklistRemoves{} + if err := c.Read(MailBlacklistRemoveModel, ids, nil, mbrs); err != nil { + return nil, err + } + return mbrs, nil +} + +// FindMailBlacklistRemove finds mail.blacklist.remove record by querying it with criteria. +func (c *Client) FindMailBlacklistRemove(criteria *Criteria) (*MailBlacklistRemove, error) { + mbrs := &MailBlacklistRemoves{} + if err := c.SearchRead(MailBlacklistRemoveModel, criteria, NewOptions().Limit(1), mbrs); err != nil { + return nil, err + } + return &((*mbrs)[0]), nil +} + +// FindMailBlacklistRemoves finds mail.blacklist.remove records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailBlacklistRemoves(criteria *Criteria, options *Options) (*MailBlacklistRemoves, error) { + mbrs := &MailBlacklistRemoves{} + if err := c.SearchRead(MailBlacklistRemoveModel, criteria, options, mbrs); err != nil { + return nil, err + } + return mbrs, nil +} + +// FindMailBlacklistRemoveIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailBlacklistRemoveIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailBlacklistRemoveModel, criteria, options) +} + +// FindMailBlacklistRemoveId finds record id by querying it with criteria. +func (c *Client) FindMailBlacklistRemoveId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailBlacklistRemoveModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_canned_response.go b/mail_canned_response.go new file mode 100644 index 0000000..678a7e2 --- /dev/null +++ b/mail_canned_response.go @@ -0,0 +1,123 @@ +package odoo + +// MailCannedResponse represents mail.canned.response model. +type MailCannedResponse struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + GroupIds *Relation `xmlrpc:"group_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsEditable *Bool `xmlrpc:"is_editable,omitempty"` + IsShared *Bool `xmlrpc:"is_shared,omitempty"` + LastUsed *Time `xmlrpc:"last_used,omitempty"` + Source *String `xmlrpc:"source,omitempty"` + Substitution *String `xmlrpc:"substitution,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailCannedResponses represents array of mail.canned.response model. +type MailCannedResponses []MailCannedResponse + +// MailCannedResponseModel is the odoo model name. +const MailCannedResponseModel = "mail.canned.response" + +// Many2One convert MailCannedResponse to *Many2One. +func (mcr *MailCannedResponse) Many2One() *Many2One { + return NewMany2One(mcr.Id.Get(), "") +} + +// CreateMailCannedResponse creates a new mail.canned.response model and returns its id. +func (c *Client) CreateMailCannedResponse(mcr *MailCannedResponse) (int64, error) { + ids, err := c.CreateMailCannedResponses([]*MailCannedResponse{mcr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailCannedResponse creates a new mail.canned.response model and returns its id. +func (c *Client) CreateMailCannedResponses(mcrs []*MailCannedResponse) ([]int64, error) { + var vv []interface{} + for _, v := range mcrs { + vv = append(vv, v) + } + return c.Create(MailCannedResponseModel, vv, nil) +} + +// UpdateMailCannedResponse updates an existing mail.canned.response record. +func (c *Client) UpdateMailCannedResponse(mcr *MailCannedResponse) error { + return c.UpdateMailCannedResponses([]int64{mcr.Id.Get()}, mcr) +} + +// UpdateMailCannedResponses updates existing mail.canned.response records. +// All records (represented by ids) will be updated by mcr values. +func (c *Client) UpdateMailCannedResponses(ids []int64, mcr *MailCannedResponse) error { + return c.Update(MailCannedResponseModel, ids, mcr, nil) +} + +// DeleteMailCannedResponse deletes an existing mail.canned.response record. +func (c *Client) DeleteMailCannedResponse(id int64) error { + return c.DeleteMailCannedResponses([]int64{id}) +} + +// DeleteMailCannedResponses deletes existing mail.canned.response records. +func (c *Client) DeleteMailCannedResponses(ids []int64) error { + return c.Delete(MailCannedResponseModel, ids) +} + +// GetMailCannedResponse gets mail.canned.response existing record. +func (c *Client) GetMailCannedResponse(id int64) (*MailCannedResponse, error) { + mcrs, err := c.GetMailCannedResponses([]int64{id}) + if err != nil { + return nil, err + } + return &((*mcrs)[0]), nil +} + +// GetMailCannedResponses gets mail.canned.response existing records. +func (c *Client) GetMailCannedResponses(ids []int64) (*MailCannedResponses, error) { + mcrs := &MailCannedResponses{} + if err := c.Read(MailCannedResponseModel, ids, nil, mcrs); err != nil { + return nil, err + } + return mcrs, nil +} + +// FindMailCannedResponse finds mail.canned.response record by querying it with criteria. +func (c *Client) FindMailCannedResponse(criteria *Criteria) (*MailCannedResponse, error) { + mcrs := &MailCannedResponses{} + if err := c.SearchRead(MailCannedResponseModel, criteria, NewOptions().Limit(1), mcrs); err != nil { + return nil, err + } + return &((*mcrs)[0]), nil +} + +// FindMailCannedResponses finds mail.canned.response records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailCannedResponses(criteria *Criteria, options *Options) (*MailCannedResponses, error) { + mcrs := &MailCannedResponses{} + if err := c.SearchRead(MailCannedResponseModel, criteria, options, mcrs); err != nil { + return nil, err + } + return mcrs, nil +} + +// FindMailCannedResponseIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailCannedResponseIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailCannedResponseModel, criteria, options) +} + +// FindMailCannedResponseId finds record id by querying it with criteria. +func (c *Client) FindMailCannedResponseId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailCannedResponseModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_compose_message.go b/mail_compose_message.go new file mode 100644 index 0000000..6544d27 --- /dev/null +++ b/mail_compose_message.go @@ -0,0 +1,155 @@ +package odoo + +// MailComposeMessage represents mail.compose.message model. +type MailComposeMessage struct { + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + AuthorId *Many2One `xmlrpc:"author_id,omitempty"` + AutoDelete *Bool `xmlrpc:"auto_delete,omitempty"` + AutoDeleteKeepLog *Bool `xmlrpc:"auto_delete_keep_log,omitempty"` + Body *String `xmlrpc:"body,omitempty"` + BodyHasTemplateValue *Bool `xmlrpc:"body_has_template_value,omitempty"` + CanEditBody *Bool `xmlrpc:"can_edit_body,omitempty"` + CompositionBatch *Bool `xmlrpc:"composition_batch,omitempty"` + CompositionMode *Selection `xmlrpc:"composition_mode,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmailAddSignature *Bool `xmlrpc:"email_add_signature,omitempty"` + EmailFrom *String `xmlrpc:"email_from,omitempty"` + EmailLayoutXmlid *String `xmlrpc:"email_layout_xmlid,omitempty"` + ForceSend *Bool `xmlrpc:"force_send,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsMailTemplateEditor *Bool `xmlrpc:"is_mail_template_editor,omitempty"` + Lang *String `xmlrpc:"lang,omitempty"` + MailActivityTypeId *Many2One `xmlrpc:"mail_activity_type_id,omitempty"` + MailServerId *Many2One `xmlrpc:"mail_server_id,omitempty"` + MessageType *Selection `xmlrpc:"message_type,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + ModelIsThread *Bool `xmlrpc:"model_is_thread,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + RecordAliasDomainId *Many2One `xmlrpc:"record_alias_domain_id,omitempty"` + RecordCompanyId *Many2One `xmlrpc:"record_company_id,omitempty"` + RecordName *String `xmlrpc:"record_name,omitempty"` + RenderModel *String `xmlrpc:"render_model,omitempty"` + ReplyTo *String `xmlrpc:"reply_to,omitempty"` + ReplyToForceNew *Bool `xmlrpc:"reply_to_force_new,omitempty"` + ReplyToMode *Selection `xmlrpc:"reply_to_mode,omitempty"` + ResDomain *String `xmlrpc:"res_domain,omitempty"` + ResDomainUserId *Many2One `xmlrpc:"res_domain_user_id,omitempty"` + ResIds *String `xmlrpc:"res_ids,omitempty"` + ScheduledDate *String `xmlrpc:"scheduled_date,omitempty"` + Subject *String `xmlrpc:"subject,omitempty"` + SubtypeId *Many2One `xmlrpc:"subtype_id,omitempty"` + SubtypeIsLog *Bool `xmlrpc:"subtype_is_log,omitempty"` + TemplateId *Many2One `xmlrpc:"template_id,omitempty"` + TemplateName *String `xmlrpc:"template_name,omitempty"` + UseExclusionList *Bool `xmlrpc:"use_exclusion_list,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailComposeMessages represents array of mail.compose.message model. +type MailComposeMessages []MailComposeMessage + +// MailComposeMessageModel is the odoo model name. +const MailComposeMessageModel = "mail.compose.message" + +// Many2One convert MailComposeMessage to *Many2One. +func (mcm *MailComposeMessage) Many2One() *Many2One { + return NewMany2One(mcm.Id.Get(), "") +} + +// CreateMailComposeMessage creates a new mail.compose.message model and returns its id. +func (c *Client) CreateMailComposeMessage(mcm *MailComposeMessage) (int64, error) { + ids, err := c.CreateMailComposeMessages([]*MailComposeMessage{mcm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailComposeMessage creates a new mail.compose.message model and returns its id. +func (c *Client) CreateMailComposeMessages(mcms []*MailComposeMessage) ([]int64, error) { + var vv []interface{} + for _, v := range mcms { + vv = append(vv, v) + } + return c.Create(MailComposeMessageModel, vv, nil) +} + +// UpdateMailComposeMessage updates an existing mail.compose.message record. +func (c *Client) UpdateMailComposeMessage(mcm *MailComposeMessage) error { + return c.UpdateMailComposeMessages([]int64{mcm.Id.Get()}, mcm) +} + +// UpdateMailComposeMessages updates existing mail.compose.message records. +// All records (represented by ids) will be updated by mcm values. +func (c *Client) UpdateMailComposeMessages(ids []int64, mcm *MailComposeMessage) error { + return c.Update(MailComposeMessageModel, ids, mcm, nil) +} + +// DeleteMailComposeMessage deletes an existing mail.compose.message record. +func (c *Client) DeleteMailComposeMessage(id int64) error { + return c.DeleteMailComposeMessages([]int64{id}) +} + +// DeleteMailComposeMessages deletes existing mail.compose.message records. +func (c *Client) DeleteMailComposeMessages(ids []int64) error { + return c.Delete(MailComposeMessageModel, ids) +} + +// GetMailComposeMessage gets mail.compose.message existing record. +func (c *Client) GetMailComposeMessage(id int64) (*MailComposeMessage, error) { + mcms, err := c.GetMailComposeMessages([]int64{id}) + if err != nil { + return nil, err + } + return &((*mcms)[0]), nil +} + +// GetMailComposeMessages gets mail.compose.message existing records. +func (c *Client) GetMailComposeMessages(ids []int64) (*MailComposeMessages, error) { + mcms := &MailComposeMessages{} + if err := c.Read(MailComposeMessageModel, ids, nil, mcms); err != nil { + return nil, err + } + return mcms, nil +} + +// FindMailComposeMessage finds mail.compose.message record by querying it with criteria. +func (c *Client) FindMailComposeMessage(criteria *Criteria) (*MailComposeMessage, error) { + mcms := &MailComposeMessages{} + if err := c.SearchRead(MailComposeMessageModel, criteria, NewOptions().Limit(1), mcms); err != nil { + return nil, err + } + return &((*mcms)[0]), nil +} + +// FindMailComposeMessages finds mail.compose.message records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailComposeMessages(criteria *Criteria, options *Options) (*MailComposeMessages, error) { + mcms := &MailComposeMessages{} + if err := c.SearchRead(MailComposeMessageModel, criteria, options, mcms); err != nil { + return nil, err + } + return mcms, nil +} + +// FindMailComposeMessageIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailComposeMessageIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailComposeMessageModel, criteria, options) +} + +// FindMailComposeMessageId finds record id by querying it with criteria. +func (c *Client) FindMailComposeMessageId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailComposeMessageModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_followers.go b/mail_followers.go new file mode 100644 index 0000000..70146c5 --- /dev/null +++ b/mail_followers.go @@ -0,0 +1,119 @@ +package odoo + +// MailFollowers represents mail.followers model. +type MailFollowers struct { + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsActive *Bool `xmlrpc:"is_active,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + ResId *Many2One `xmlrpc:"res_id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + SubtypeIds *Relation `xmlrpc:"subtype_ids,omitempty"` +} + +// MailFollowerss represents array of mail.followers model. +type MailFollowerss []MailFollowers + +// MailFollowersModel is the odoo model name. +const MailFollowersModel = "mail.followers" + +// Many2One convert MailFollowers to *Many2One. +func (mf *MailFollowers) Many2One() *Many2One { + return NewMany2One(mf.Id.Get(), "") +} + +// CreateMailFollowers creates a new mail.followers model and returns its id. +func (c *Client) CreateMailFollowers(mf *MailFollowers) (int64, error) { + ids, err := c.CreateMailFollowerss([]*MailFollowers{mf}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailFollowers creates a new mail.followers model and returns its id. +func (c *Client) CreateMailFollowerss(mfs []*MailFollowers) ([]int64, error) { + var vv []interface{} + for _, v := range mfs { + vv = append(vv, v) + } + return c.Create(MailFollowersModel, vv, nil) +} + +// UpdateMailFollowers updates an existing mail.followers record. +func (c *Client) UpdateMailFollowers(mf *MailFollowers) error { + return c.UpdateMailFollowerss([]int64{mf.Id.Get()}, mf) +} + +// UpdateMailFollowerss updates existing mail.followers records. +// All records (represented by ids) will be updated by mf values. +func (c *Client) UpdateMailFollowerss(ids []int64, mf *MailFollowers) error { + return c.Update(MailFollowersModel, ids, mf, nil) +} + +// DeleteMailFollowers deletes an existing mail.followers record. +func (c *Client) DeleteMailFollowers(id int64) error { + return c.DeleteMailFollowerss([]int64{id}) +} + +// DeleteMailFollowerss deletes existing mail.followers records. +func (c *Client) DeleteMailFollowerss(ids []int64) error { + return c.Delete(MailFollowersModel, ids) +} + +// GetMailFollowers gets mail.followers existing record. +func (c *Client) GetMailFollowers(id int64) (*MailFollowers, error) { + mfs, err := c.GetMailFollowerss([]int64{id}) + if err != nil { + return nil, err + } + return &((*mfs)[0]), nil +} + +// GetMailFollowerss gets mail.followers existing records. +func (c *Client) GetMailFollowerss(ids []int64) (*MailFollowerss, error) { + mfs := &MailFollowerss{} + if err := c.Read(MailFollowersModel, ids, nil, mfs); err != nil { + return nil, err + } + return mfs, nil +} + +// FindMailFollowers finds mail.followers record by querying it with criteria. +func (c *Client) FindMailFollowers(criteria *Criteria) (*MailFollowers, error) { + mfs := &MailFollowerss{} + if err := c.SearchRead(MailFollowersModel, criteria, NewOptions().Limit(1), mfs); err != nil { + return nil, err + } + return &((*mfs)[0]), nil +} + +// FindMailFollowerss finds mail.followers records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailFollowerss(criteria *Criteria, options *Options) (*MailFollowerss, error) { + mfs := &MailFollowerss{} + if err := c.SearchRead(MailFollowersModel, criteria, options, mfs); err != nil { + return nil, err + } + return mfs, nil +} + +// FindMailFollowersIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailFollowersIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailFollowersModel, criteria, options) +} + +// FindMailFollowersId finds record id by querying it with criteria. +func (c *Client) FindMailFollowersId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailFollowersModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_gateway_allowed.go b/mail_gateway_allowed.go new file mode 100644 index 0000000..39adf7e --- /dev/null +++ b/mail_gateway_allowed.go @@ -0,0 +1,118 @@ +package odoo + +// MailGatewayAllowed represents mail.gateway.allowed model. +type MailGatewayAllowed struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + EmailNormalized *String `xmlrpc:"email_normalized,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailGatewayAlloweds represents array of mail.gateway.allowed model. +type MailGatewayAlloweds []MailGatewayAllowed + +// MailGatewayAllowedModel is the odoo model name. +const MailGatewayAllowedModel = "mail.gateway.allowed" + +// Many2One convert MailGatewayAllowed to *Many2One. +func (mga *MailGatewayAllowed) Many2One() *Many2One { + return NewMany2One(mga.Id.Get(), "") +} + +// CreateMailGatewayAllowed creates a new mail.gateway.allowed model and returns its id. +func (c *Client) CreateMailGatewayAllowed(mga *MailGatewayAllowed) (int64, error) { + ids, err := c.CreateMailGatewayAlloweds([]*MailGatewayAllowed{mga}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailGatewayAllowed creates a new mail.gateway.allowed model and returns its id. +func (c *Client) CreateMailGatewayAlloweds(mgas []*MailGatewayAllowed) ([]int64, error) { + var vv []interface{} + for _, v := range mgas { + vv = append(vv, v) + } + return c.Create(MailGatewayAllowedModel, vv, nil) +} + +// UpdateMailGatewayAllowed updates an existing mail.gateway.allowed record. +func (c *Client) UpdateMailGatewayAllowed(mga *MailGatewayAllowed) error { + return c.UpdateMailGatewayAlloweds([]int64{mga.Id.Get()}, mga) +} + +// UpdateMailGatewayAlloweds updates existing mail.gateway.allowed records. +// All records (represented by ids) will be updated by mga values. +func (c *Client) UpdateMailGatewayAlloweds(ids []int64, mga *MailGatewayAllowed) error { + return c.Update(MailGatewayAllowedModel, ids, mga, nil) +} + +// DeleteMailGatewayAllowed deletes an existing mail.gateway.allowed record. +func (c *Client) DeleteMailGatewayAllowed(id int64) error { + return c.DeleteMailGatewayAlloweds([]int64{id}) +} + +// DeleteMailGatewayAlloweds deletes existing mail.gateway.allowed records. +func (c *Client) DeleteMailGatewayAlloweds(ids []int64) error { + return c.Delete(MailGatewayAllowedModel, ids) +} + +// GetMailGatewayAllowed gets mail.gateway.allowed existing record. +func (c *Client) GetMailGatewayAllowed(id int64) (*MailGatewayAllowed, error) { + mgas, err := c.GetMailGatewayAlloweds([]int64{id}) + if err != nil { + return nil, err + } + return &((*mgas)[0]), nil +} + +// GetMailGatewayAlloweds gets mail.gateway.allowed existing records. +func (c *Client) GetMailGatewayAlloweds(ids []int64) (*MailGatewayAlloweds, error) { + mgas := &MailGatewayAlloweds{} + if err := c.Read(MailGatewayAllowedModel, ids, nil, mgas); err != nil { + return nil, err + } + return mgas, nil +} + +// FindMailGatewayAllowed finds mail.gateway.allowed record by querying it with criteria. +func (c *Client) FindMailGatewayAllowed(criteria *Criteria) (*MailGatewayAllowed, error) { + mgas := &MailGatewayAlloweds{} + if err := c.SearchRead(MailGatewayAllowedModel, criteria, NewOptions().Limit(1), mgas); err != nil { + return nil, err + } + return &((*mgas)[0]), nil +} + +// FindMailGatewayAlloweds finds mail.gateway.allowed records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailGatewayAlloweds(criteria *Criteria, options *Options) (*MailGatewayAlloweds, error) { + mgas := &MailGatewayAlloweds{} + if err := c.SearchRead(MailGatewayAllowedModel, criteria, options, mgas); err != nil { + return nil, err + } + return mgas, nil +} + +// FindMailGatewayAllowedIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailGatewayAllowedIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailGatewayAllowedModel, criteria, options) +} + +// FindMailGatewayAllowedId finds record id by querying it with criteria. +func (c *Client) FindMailGatewayAllowedId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailGatewayAllowedModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_guest.go b/mail_guest.go new file mode 100644 index 0000000..dd70f79 --- /dev/null +++ b/mail_guest.go @@ -0,0 +1,133 @@ +package odoo + +// MailGuest represents mail.guest model. +type MailGuest struct { + AccessToken *String `xmlrpc:"access_token,omitempty"` + Avatar1024 *String `xmlrpc:"avatar_1024,omitempty"` + Avatar128 *String `xmlrpc:"avatar_128,omitempty"` + Avatar1920 *String `xmlrpc:"avatar_1920,omitempty"` + Avatar256 *String `xmlrpc:"avatar_256,omitempty"` + Avatar512 *String `xmlrpc:"avatar_512,omitempty"` + ChannelIds *Relation `xmlrpc:"channel_ids,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ImStatus *String `xmlrpc:"im_status,omitempty"` + Image1024 *String `xmlrpc:"image_1024,omitempty"` + Image128 *String `xmlrpc:"image_128,omitempty"` + Image1920 *String `xmlrpc:"image_1920,omitempty"` + Image256 *String `xmlrpc:"image_256,omitempty"` + Image512 *String `xmlrpc:"image_512,omitempty"` + Lang *Selection `xmlrpc:"lang,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Timezone *Selection `xmlrpc:"timezone,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailGuests represents array of mail.guest model. +type MailGuests []MailGuest + +// MailGuestModel is the odoo model name. +const MailGuestModel = "mail.guest" + +// Many2One convert MailGuest to *Many2One. +func (mg *MailGuest) Many2One() *Many2One { + return NewMany2One(mg.Id.Get(), "") +} + +// CreateMailGuest creates a new mail.guest model and returns its id. +func (c *Client) CreateMailGuest(mg *MailGuest) (int64, error) { + ids, err := c.CreateMailGuests([]*MailGuest{mg}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailGuest creates a new mail.guest model and returns its id. +func (c *Client) CreateMailGuests(mgs []*MailGuest) ([]int64, error) { + var vv []interface{} + for _, v := range mgs { + vv = append(vv, v) + } + return c.Create(MailGuestModel, vv, nil) +} + +// UpdateMailGuest updates an existing mail.guest record. +func (c *Client) UpdateMailGuest(mg *MailGuest) error { + return c.UpdateMailGuests([]int64{mg.Id.Get()}, mg) +} + +// UpdateMailGuests updates existing mail.guest records. +// All records (represented by ids) will be updated by mg values. +func (c *Client) UpdateMailGuests(ids []int64, mg *MailGuest) error { + return c.Update(MailGuestModel, ids, mg, nil) +} + +// DeleteMailGuest deletes an existing mail.guest record. +func (c *Client) DeleteMailGuest(id int64) error { + return c.DeleteMailGuests([]int64{id}) +} + +// DeleteMailGuests deletes existing mail.guest records. +func (c *Client) DeleteMailGuests(ids []int64) error { + return c.Delete(MailGuestModel, ids) +} + +// GetMailGuest gets mail.guest existing record. +func (c *Client) GetMailGuest(id int64) (*MailGuest, error) { + mgs, err := c.GetMailGuests([]int64{id}) + if err != nil { + return nil, err + } + return &((*mgs)[0]), nil +} + +// GetMailGuests gets mail.guest existing records. +func (c *Client) GetMailGuests(ids []int64) (*MailGuests, error) { + mgs := &MailGuests{} + if err := c.Read(MailGuestModel, ids, nil, mgs); err != nil { + return nil, err + } + return mgs, nil +} + +// FindMailGuest finds mail.guest record by querying it with criteria. +func (c *Client) FindMailGuest(criteria *Criteria) (*MailGuest, error) { + mgs := &MailGuests{} + if err := c.SearchRead(MailGuestModel, criteria, NewOptions().Limit(1), mgs); err != nil { + return nil, err + } + return &((*mgs)[0]), nil +} + +// FindMailGuests finds mail.guest records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailGuests(criteria *Criteria, options *Options) (*MailGuests, error) { + mgs := &MailGuests{} + if err := c.SearchRead(MailGuestModel, criteria, options, mgs); err != nil { + return nil, err + } + return mgs, nil +} + +// FindMailGuestIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailGuestIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailGuestModel, criteria, options) +} + +// FindMailGuestId finds record id by querying it with criteria. +func (c *Client) FindMailGuestId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailGuestModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_ice_server.go b/mail_ice_server.go new file mode 100644 index 0000000..ade9091 --- /dev/null +++ b/mail_ice_server.go @@ -0,0 +1,120 @@ +package odoo + +// MailIceServer represents mail.ice.server model. +type MailIceServer struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Credential *String `xmlrpc:"credential,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ServerType *Selection `xmlrpc:"server_type,omitempty"` + Uri *String `xmlrpc:"uri,omitempty"` + Username *String `xmlrpc:"username,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailIceServers represents array of mail.ice.server model. +type MailIceServers []MailIceServer + +// MailIceServerModel is the odoo model name. +const MailIceServerModel = "mail.ice.server" + +// Many2One convert MailIceServer to *Many2One. +func (mis *MailIceServer) Many2One() *Many2One { + return NewMany2One(mis.Id.Get(), "") +} + +// CreateMailIceServer creates a new mail.ice.server model and returns its id. +func (c *Client) CreateMailIceServer(mis *MailIceServer) (int64, error) { + ids, err := c.CreateMailIceServers([]*MailIceServer{mis}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailIceServer creates a new mail.ice.server model and returns its id. +func (c *Client) CreateMailIceServers(miss []*MailIceServer) ([]int64, error) { + var vv []interface{} + for _, v := range miss { + vv = append(vv, v) + } + return c.Create(MailIceServerModel, vv, nil) +} + +// UpdateMailIceServer updates an existing mail.ice.server record. +func (c *Client) UpdateMailIceServer(mis *MailIceServer) error { + return c.UpdateMailIceServers([]int64{mis.Id.Get()}, mis) +} + +// UpdateMailIceServers updates existing mail.ice.server records. +// All records (represented by ids) will be updated by mis values. +func (c *Client) UpdateMailIceServers(ids []int64, mis *MailIceServer) error { + return c.Update(MailIceServerModel, ids, mis, nil) +} + +// DeleteMailIceServer deletes an existing mail.ice.server record. +func (c *Client) DeleteMailIceServer(id int64) error { + return c.DeleteMailIceServers([]int64{id}) +} + +// DeleteMailIceServers deletes existing mail.ice.server records. +func (c *Client) DeleteMailIceServers(ids []int64) error { + return c.Delete(MailIceServerModel, ids) +} + +// GetMailIceServer gets mail.ice.server existing record. +func (c *Client) GetMailIceServer(id int64) (*MailIceServer, error) { + miss, err := c.GetMailIceServers([]int64{id}) + if err != nil { + return nil, err + } + return &((*miss)[0]), nil +} + +// GetMailIceServers gets mail.ice.server existing records. +func (c *Client) GetMailIceServers(ids []int64) (*MailIceServers, error) { + miss := &MailIceServers{} + if err := c.Read(MailIceServerModel, ids, nil, miss); err != nil { + return nil, err + } + return miss, nil +} + +// FindMailIceServer finds mail.ice.server record by querying it with criteria. +func (c *Client) FindMailIceServer(criteria *Criteria) (*MailIceServer, error) { + miss := &MailIceServers{} + if err := c.SearchRead(MailIceServerModel, criteria, NewOptions().Limit(1), miss); err != nil { + return nil, err + } + return &((*miss)[0]), nil +} + +// FindMailIceServers finds mail.ice.server records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailIceServers(criteria *Criteria, options *Options) (*MailIceServers, error) { + miss := &MailIceServers{} + if err := c.SearchRead(MailIceServerModel, criteria, options, miss); err != nil { + return nil, err + } + return miss, nil +} + +// FindMailIceServerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailIceServerIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailIceServerModel, criteria, options) +} + +// FindMailIceServerId finds record id by querying it with criteria. +func (c *Client) FindMailIceServerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailIceServerModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_link_preview.go b/mail_link_preview.go new file mode 100644 index 0000000..7767d71 --- /dev/null +++ b/mail_link_preview.go @@ -0,0 +1,126 @@ +package odoo + +// MailLinkPreview represents mail.link.preview model. +type MailLinkPreview struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ImageMimetype *String `xmlrpc:"image_mimetype,omitempty"` + IsHidden *Bool `xmlrpc:"is_hidden,omitempty"` + MessageId *Many2One `xmlrpc:"message_id,omitempty"` + OgDescription *String `xmlrpc:"og_description,omitempty"` + OgImage *String `xmlrpc:"og_image,omitempty"` + OgMimetype *String `xmlrpc:"og_mimetype,omitempty"` + OgSiteName *String `xmlrpc:"og_site_name,omitempty"` + OgTitle *String `xmlrpc:"og_title,omitempty"` + OgType *String `xmlrpc:"og_type,omitempty"` + SourceUrl *String `xmlrpc:"source_url,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailLinkPreviews represents array of mail.link.preview model. +type MailLinkPreviews []MailLinkPreview + +// MailLinkPreviewModel is the odoo model name. +const MailLinkPreviewModel = "mail.link.preview" + +// Many2One convert MailLinkPreview to *Many2One. +func (mlp *MailLinkPreview) Many2One() *Many2One { + return NewMany2One(mlp.Id.Get(), "") +} + +// CreateMailLinkPreview creates a new mail.link.preview model and returns its id. +func (c *Client) CreateMailLinkPreview(mlp *MailLinkPreview) (int64, error) { + ids, err := c.CreateMailLinkPreviews([]*MailLinkPreview{mlp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailLinkPreview creates a new mail.link.preview model and returns its id. +func (c *Client) CreateMailLinkPreviews(mlps []*MailLinkPreview) ([]int64, error) { + var vv []interface{} + for _, v := range mlps { + vv = append(vv, v) + } + return c.Create(MailLinkPreviewModel, vv, nil) +} + +// UpdateMailLinkPreview updates an existing mail.link.preview record. +func (c *Client) UpdateMailLinkPreview(mlp *MailLinkPreview) error { + return c.UpdateMailLinkPreviews([]int64{mlp.Id.Get()}, mlp) +} + +// UpdateMailLinkPreviews updates existing mail.link.preview records. +// All records (represented by ids) will be updated by mlp values. +func (c *Client) UpdateMailLinkPreviews(ids []int64, mlp *MailLinkPreview) error { + return c.Update(MailLinkPreviewModel, ids, mlp, nil) +} + +// DeleteMailLinkPreview deletes an existing mail.link.preview record. +func (c *Client) DeleteMailLinkPreview(id int64) error { + return c.DeleteMailLinkPreviews([]int64{id}) +} + +// DeleteMailLinkPreviews deletes existing mail.link.preview records. +func (c *Client) DeleteMailLinkPreviews(ids []int64) error { + return c.Delete(MailLinkPreviewModel, ids) +} + +// GetMailLinkPreview gets mail.link.preview existing record. +func (c *Client) GetMailLinkPreview(id int64) (*MailLinkPreview, error) { + mlps, err := c.GetMailLinkPreviews([]int64{id}) + if err != nil { + return nil, err + } + return &((*mlps)[0]), nil +} + +// GetMailLinkPreviews gets mail.link.preview existing records. +func (c *Client) GetMailLinkPreviews(ids []int64) (*MailLinkPreviews, error) { + mlps := &MailLinkPreviews{} + if err := c.Read(MailLinkPreviewModel, ids, nil, mlps); err != nil { + return nil, err + } + return mlps, nil +} + +// FindMailLinkPreview finds mail.link.preview record by querying it with criteria. +func (c *Client) FindMailLinkPreview(criteria *Criteria) (*MailLinkPreview, error) { + mlps := &MailLinkPreviews{} + if err := c.SearchRead(MailLinkPreviewModel, criteria, NewOptions().Limit(1), mlps); err != nil { + return nil, err + } + return &((*mlps)[0]), nil +} + +// FindMailLinkPreviews finds mail.link.preview records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailLinkPreviews(criteria *Criteria, options *Options) (*MailLinkPreviews, error) { + mlps := &MailLinkPreviews{} + if err := c.SearchRead(MailLinkPreviewModel, criteria, options, mlps); err != nil { + return nil, err + } + return mlps, nil +} + +// FindMailLinkPreviewIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailLinkPreviewIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailLinkPreviewModel, criteria, options) +} + +// FindMailLinkPreviewId finds record id by querying it with criteria. +func (c *Client) FindMailLinkPreviewId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailLinkPreviewModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_mail.go b/mail_mail.go new file mode 100644 index 0000000..35ca84b --- /dev/null +++ b/mail_mail.go @@ -0,0 +1,186 @@ +package odoo + +// MailMail represents mail.mail model. +type MailMail struct { + AccountAuditLogAccountId *Many2One `xmlrpc:"account_audit_log_account_id,omitempty"` + AccountAuditLogActivated *Bool `xmlrpc:"account_audit_log_activated,omitempty"` + AccountAuditLogCompanyId *Many2One `xmlrpc:"account_audit_log_company_id,omitempty"` + AccountAuditLogMoveId *Many2One `xmlrpc:"account_audit_log_move_id,omitempty"` + AccountAuditLogPartnerId *Many2One `xmlrpc:"account_audit_log_partner_id,omitempty"` + AccountAuditLogPreview *String `xmlrpc:"account_audit_log_preview,omitempty"` + AccountAuditLogTaxId *Many2One `xmlrpc:"account_audit_log_tax_id,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + AuthorAvatar *String `xmlrpc:"author_avatar,omitempty"` + AuthorGuestId *Many2One `xmlrpc:"author_guest_id,omitempty"` + AuthorId *Many2One `xmlrpc:"author_id,omitempty"` + AutoDelete *Bool `xmlrpc:"auto_delete,omitempty"` + Body *String `xmlrpc:"body,omitempty"` + BodyContent *String `xmlrpc:"body_content,omitempty"` + BodyHtml *String `xmlrpc:"body_html,omitempty"` + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmailAddSignature *Bool `xmlrpc:"email_add_signature,omitempty"` + EmailCc *String `xmlrpc:"email_cc,omitempty"` + EmailFrom *String `xmlrpc:"email_from,omitempty"` + EmailLayoutXmlid *String `xmlrpc:"email_layout_xmlid,omitempty"` + EmailTo *String `xmlrpc:"email_to,omitempty"` + FailureReason *String `xmlrpc:"failure_reason,omitempty"` + FailureType *Selection `xmlrpc:"failure_type,omitempty"` + FetchmailServerId *Many2One `xmlrpc:"fetchmail_server_id,omitempty"` + HasError *Bool `xmlrpc:"has_error,omitempty"` + HasSmsError *Bool `xmlrpc:"has_sms_error,omitempty"` + Headers *String `xmlrpc:"headers,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsCurrentUserOrGuestAuthor *Bool `xmlrpc:"is_current_user_or_guest_author,omitempty"` + IsInternal *Bool `xmlrpc:"is_internal,omitempty"` + IsNotification *Bool `xmlrpc:"is_notification,omitempty"` + LetterIds *Relation `xmlrpc:"letter_ids,omitempty"` + LinkPreviewIds *Relation `xmlrpc:"link_preview_ids,omitempty"` + MailActivityTypeId *Many2One `xmlrpc:"mail_activity_type_id,omitempty"` + MailIds *Relation `xmlrpc:"mail_ids,omitempty"` + MailMessageId *Many2One `xmlrpc:"mail_message_id,omitempty"` + MailMessageIdInt *Int `xmlrpc:"mail_message_id_int,omitempty"` + MailServerId *Many2One `xmlrpc:"mail_server_id,omitempty"` + MessageId *String `xmlrpc:"message_id,omitempty"` + MessageType *Selection `xmlrpc:"message_type,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + Needaction *Bool `xmlrpc:"needaction,omitempty"` + NotificationIds *Relation `xmlrpc:"notification_ids,omitempty"` + NotifiedPartnerIds *Relation `xmlrpc:"notified_partner_ids,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + PinnedAt *Time `xmlrpc:"pinned_at,omitempty"` + Preview *String `xmlrpc:"preview,omitempty"` + RatingId *Many2One `xmlrpc:"rating_id,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RatingValue *Float `xmlrpc:"rating_value,omitempty"` + ReactionIds *Relation `xmlrpc:"reaction_ids,omitempty"` + RecipientIds *Relation `xmlrpc:"recipient_ids,omitempty"` + RecordAliasDomainId *Many2One `xmlrpc:"record_alias_domain_id,omitempty"` + RecordCompanyId *Many2One `xmlrpc:"record_company_id,omitempty"` + RecordName *String `xmlrpc:"record_name,omitempty"` + References *String `xmlrpc:"references,omitempty"` + ReplyTo *String `xmlrpc:"reply_to,omitempty"` + ReplyToForceNew *Bool `xmlrpc:"reply_to_force_new,omitempty"` + ResId *Many2One `xmlrpc:"res_id,omitempty"` + RestrictedAttachmentCount *Int `xmlrpc:"restricted_attachment_count,omitempty"` + ScheduledDate *Time `xmlrpc:"scheduled_date,omitempty"` + SnailmailError *Bool `xmlrpc:"snailmail_error,omitempty"` + Starred *Bool `xmlrpc:"starred,omitempty"` + StarredPartnerIds *Relation `xmlrpc:"starred_partner_ids,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + Subject *String `xmlrpc:"subject,omitempty"` + SubtypeId *Many2One `xmlrpc:"subtype_id,omitempty"` + TrackingValueIds *Relation `xmlrpc:"tracking_value_ids,omitempty"` + UnrestrictedAttachmentIds *Relation `xmlrpc:"unrestricted_attachment_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailMails represents array of mail.mail model. +type MailMails []MailMail + +// MailMailModel is the odoo model name. +const MailMailModel = "mail.mail" + +// Many2One convert MailMail to *Many2One. +func (mm *MailMail) Many2One() *Many2One { + return NewMany2One(mm.Id.Get(), "") +} + +// CreateMailMail creates a new mail.mail model and returns its id. +func (c *Client) CreateMailMail(mm *MailMail) (int64, error) { + ids, err := c.CreateMailMails([]*MailMail{mm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailMail creates a new mail.mail model and returns its id. +func (c *Client) CreateMailMails(mms []*MailMail) ([]int64, error) { + var vv []interface{} + for _, v := range mms { + vv = append(vv, v) + } + return c.Create(MailMailModel, vv, nil) +} + +// UpdateMailMail updates an existing mail.mail record. +func (c *Client) UpdateMailMail(mm *MailMail) error { + return c.UpdateMailMails([]int64{mm.Id.Get()}, mm) +} + +// UpdateMailMails updates existing mail.mail records. +// All records (represented by ids) will be updated by mm values. +func (c *Client) UpdateMailMails(ids []int64, mm *MailMail) error { + return c.Update(MailMailModel, ids, mm, nil) +} + +// DeleteMailMail deletes an existing mail.mail record. +func (c *Client) DeleteMailMail(id int64) error { + return c.DeleteMailMails([]int64{id}) +} + +// DeleteMailMails deletes existing mail.mail records. +func (c *Client) DeleteMailMails(ids []int64) error { + return c.Delete(MailMailModel, ids) +} + +// GetMailMail gets mail.mail existing record. +func (c *Client) GetMailMail(id int64) (*MailMail, error) { + mms, err := c.GetMailMails([]int64{id}) + if err != nil { + return nil, err + } + return &((*mms)[0]), nil +} + +// GetMailMails gets mail.mail existing records. +func (c *Client) GetMailMails(ids []int64) (*MailMails, error) { + mms := &MailMails{} + if err := c.Read(MailMailModel, ids, nil, mms); err != nil { + return nil, err + } + return mms, nil +} + +// FindMailMail finds mail.mail record by querying it with criteria. +func (c *Client) FindMailMail(criteria *Criteria) (*MailMail, error) { + mms := &MailMails{} + if err := c.SearchRead(MailMailModel, criteria, NewOptions().Limit(1), mms); err != nil { + return nil, err + } + return &((*mms)[0]), nil +} + +// FindMailMails finds mail.mail records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMails(criteria *Criteria, options *Options) (*MailMails, error) { + mms := &MailMails{} + if err := c.SearchRead(MailMailModel, criteria, options, mms); err != nil { + return nil, err + } + return mms, nil +} + +// FindMailMailIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMailIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailMailModel, criteria, options) +} + +// FindMailMailId finds record id by querying it with criteria. +func (c *Client) FindMailMailId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailMailModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_message.go b/mail_message.go new file mode 100644 index 0000000..2aaaed0 --- /dev/null +++ b/mail_message.go @@ -0,0 +1,168 @@ +package odoo + +// MailMessage represents mail.message model. +type MailMessage struct { + AccountAuditLogAccountId *Many2One `xmlrpc:"account_audit_log_account_id,omitempty"` + AccountAuditLogActivated *Bool `xmlrpc:"account_audit_log_activated,omitempty"` + AccountAuditLogCompanyId *Many2One `xmlrpc:"account_audit_log_company_id,omitempty"` + AccountAuditLogMoveId *Many2One `xmlrpc:"account_audit_log_move_id,omitempty"` + AccountAuditLogPartnerId *Many2One `xmlrpc:"account_audit_log_partner_id,omitempty"` + AccountAuditLogPreview *String `xmlrpc:"account_audit_log_preview,omitempty"` + AccountAuditLogTaxId *Many2One `xmlrpc:"account_audit_log_tax_id,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + AuthorAvatar *String `xmlrpc:"author_avatar,omitempty"` + AuthorGuestId *Many2One `xmlrpc:"author_guest_id,omitempty"` + AuthorId *Many2One `xmlrpc:"author_id,omitempty"` + Body *String `xmlrpc:"body,omitempty"` + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmailAddSignature *Bool `xmlrpc:"email_add_signature,omitempty"` + EmailFrom *String `xmlrpc:"email_from,omitempty"` + EmailLayoutXmlid *String `xmlrpc:"email_layout_xmlid,omitempty"` + HasError *Bool `xmlrpc:"has_error,omitempty"` + HasSmsError *Bool `xmlrpc:"has_sms_error,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsCurrentUserOrGuestAuthor *Bool `xmlrpc:"is_current_user_or_guest_author,omitempty"` + IsInternal *Bool `xmlrpc:"is_internal,omitempty"` + LetterIds *Relation `xmlrpc:"letter_ids,omitempty"` + LinkPreviewIds *Relation `xmlrpc:"link_preview_ids,omitempty"` + MailActivityTypeId *Many2One `xmlrpc:"mail_activity_type_id,omitempty"` + MailIds *Relation `xmlrpc:"mail_ids,omitempty"` + MailServerId *Many2One `xmlrpc:"mail_server_id,omitempty"` + MessageId *String `xmlrpc:"message_id,omitempty"` + MessageType *Selection `xmlrpc:"message_type,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + Needaction *Bool `xmlrpc:"needaction,omitempty"` + NotificationIds *Relation `xmlrpc:"notification_ids,omitempty"` + NotifiedPartnerIds *Relation `xmlrpc:"notified_partner_ids,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + PinnedAt *Time `xmlrpc:"pinned_at,omitempty"` + Preview *String `xmlrpc:"preview,omitempty"` + RatingId *Many2One `xmlrpc:"rating_id,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RatingValue *Float `xmlrpc:"rating_value,omitempty"` + ReactionIds *Relation `xmlrpc:"reaction_ids,omitempty"` + RecordAliasDomainId *Many2One `xmlrpc:"record_alias_domain_id,omitempty"` + RecordCompanyId *Many2One `xmlrpc:"record_company_id,omitempty"` + RecordName *String `xmlrpc:"record_name,omitempty"` + ReplyTo *String `xmlrpc:"reply_to,omitempty"` + ReplyToForceNew *Bool `xmlrpc:"reply_to_force_new,omitempty"` + ResId *Many2One `xmlrpc:"res_id,omitempty"` + SnailmailError *Bool `xmlrpc:"snailmail_error,omitempty"` + Starred *Bool `xmlrpc:"starred,omitempty"` + StarredPartnerIds *Relation `xmlrpc:"starred_partner_ids,omitempty"` + Subject *String `xmlrpc:"subject,omitempty"` + SubtypeId *Many2One `xmlrpc:"subtype_id,omitempty"` + TrackingValueIds *Relation `xmlrpc:"tracking_value_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailMessages represents array of mail.message model. +type MailMessages []MailMessage + +// MailMessageModel is the odoo model name. +const MailMessageModel = "mail.message" + +// Many2One convert MailMessage to *Many2One. +func (mm *MailMessage) Many2One() *Many2One { + return NewMany2One(mm.Id.Get(), "") +} + +// CreateMailMessage creates a new mail.message model and returns its id. +func (c *Client) CreateMailMessage(mm *MailMessage) (int64, error) { + ids, err := c.CreateMailMessages([]*MailMessage{mm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailMessage creates a new mail.message model and returns its id. +func (c *Client) CreateMailMessages(mms []*MailMessage) ([]int64, error) { + var vv []interface{} + for _, v := range mms { + vv = append(vv, v) + } + return c.Create(MailMessageModel, vv, nil) +} + +// UpdateMailMessage updates an existing mail.message record. +func (c *Client) UpdateMailMessage(mm *MailMessage) error { + return c.UpdateMailMessages([]int64{mm.Id.Get()}, mm) +} + +// UpdateMailMessages updates existing mail.message records. +// All records (represented by ids) will be updated by mm values. +func (c *Client) UpdateMailMessages(ids []int64, mm *MailMessage) error { + return c.Update(MailMessageModel, ids, mm, nil) +} + +// DeleteMailMessage deletes an existing mail.message record. +func (c *Client) DeleteMailMessage(id int64) error { + return c.DeleteMailMessages([]int64{id}) +} + +// DeleteMailMessages deletes existing mail.message records. +func (c *Client) DeleteMailMessages(ids []int64) error { + return c.Delete(MailMessageModel, ids) +} + +// GetMailMessage gets mail.message existing record. +func (c *Client) GetMailMessage(id int64) (*MailMessage, error) { + mms, err := c.GetMailMessages([]int64{id}) + if err != nil { + return nil, err + } + return &((*mms)[0]), nil +} + +// GetMailMessages gets mail.message existing records. +func (c *Client) GetMailMessages(ids []int64) (*MailMessages, error) { + mms := &MailMessages{} + if err := c.Read(MailMessageModel, ids, nil, mms); err != nil { + return nil, err + } + return mms, nil +} + +// FindMailMessage finds mail.message record by querying it with criteria. +func (c *Client) FindMailMessage(criteria *Criteria) (*MailMessage, error) { + mms := &MailMessages{} + if err := c.SearchRead(MailMessageModel, criteria, NewOptions().Limit(1), mms); err != nil { + return nil, err + } + return &((*mms)[0]), nil +} + +// FindMailMessages finds mail.message records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMessages(criteria *Criteria, options *Options) (*MailMessages, error) { + mms := &MailMessages{} + if err := c.SearchRead(MailMessageModel, criteria, options, mms); err != nil { + return nil, err + } + return mms, nil +} + +// FindMailMessageIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMessageIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailMessageModel, criteria, options) +} + +// FindMailMessageId finds record id by querying it with criteria. +func (c *Client) FindMailMessageId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailMessageModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_message_reaction.go b/mail_message_reaction.go new file mode 100644 index 0000000..a7afab5 --- /dev/null +++ b/mail_message_reaction.go @@ -0,0 +1,116 @@ +package odoo + +// MailMessageReaction represents mail.message.reaction model. +type MailMessageReaction struct { + Content *String `xmlrpc:"content,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + GuestId *Many2One `xmlrpc:"guest_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MessageId *Many2One `xmlrpc:"message_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` +} + +// MailMessageReactions represents array of mail.message.reaction model. +type MailMessageReactions []MailMessageReaction + +// MailMessageReactionModel is the odoo model name. +const MailMessageReactionModel = "mail.message.reaction" + +// Many2One convert MailMessageReaction to *Many2One. +func (mmr *MailMessageReaction) Many2One() *Many2One { + return NewMany2One(mmr.Id.Get(), "") +} + +// CreateMailMessageReaction creates a new mail.message.reaction model and returns its id. +func (c *Client) CreateMailMessageReaction(mmr *MailMessageReaction) (int64, error) { + ids, err := c.CreateMailMessageReactions([]*MailMessageReaction{mmr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailMessageReaction creates a new mail.message.reaction model and returns its id. +func (c *Client) CreateMailMessageReactions(mmrs []*MailMessageReaction) ([]int64, error) { + var vv []interface{} + for _, v := range mmrs { + vv = append(vv, v) + } + return c.Create(MailMessageReactionModel, vv, nil) +} + +// UpdateMailMessageReaction updates an existing mail.message.reaction record. +func (c *Client) UpdateMailMessageReaction(mmr *MailMessageReaction) error { + return c.UpdateMailMessageReactions([]int64{mmr.Id.Get()}, mmr) +} + +// UpdateMailMessageReactions updates existing mail.message.reaction records. +// All records (represented by ids) will be updated by mmr values. +func (c *Client) UpdateMailMessageReactions(ids []int64, mmr *MailMessageReaction) error { + return c.Update(MailMessageReactionModel, ids, mmr, nil) +} + +// DeleteMailMessageReaction deletes an existing mail.message.reaction record. +func (c *Client) DeleteMailMessageReaction(id int64) error { + return c.DeleteMailMessageReactions([]int64{id}) +} + +// DeleteMailMessageReactions deletes existing mail.message.reaction records. +func (c *Client) DeleteMailMessageReactions(ids []int64) error { + return c.Delete(MailMessageReactionModel, ids) +} + +// GetMailMessageReaction gets mail.message.reaction existing record. +func (c *Client) GetMailMessageReaction(id int64) (*MailMessageReaction, error) { + mmrs, err := c.GetMailMessageReactions([]int64{id}) + if err != nil { + return nil, err + } + return &((*mmrs)[0]), nil +} + +// GetMailMessageReactions gets mail.message.reaction existing records. +func (c *Client) GetMailMessageReactions(ids []int64) (*MailMessageReactions, error) { + mmrs := &MailMessageReactions{} + if err := c.Read(MailMessageReactionModel, ids, nil, mmrs); err != nil { + return nil, err + } + return mmrs, nil +} + +// FindMailMessageReaction finds mail.message.reaction record by querying it with criteria. +func (c *Client) FindMailMessageReaction(criteria *Criteria) (*MailMessageReaction, error) { + mmrs := &MailMessageReactions{} + if err := c.SearchRead(MailMessageReactionModel, criteria, NewOptions().Limit(1), mmrs); err != nil { + return nil, err + } + return &((*mmrs)[0]), nil +} + +// FindMailMessageReactions finds mail.message.reaction records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMessageReactions(criteria *Criteria, options *Options) (*MailMessageReactions, error) { + mmrs := &MailMessageReactions{} + if err := c.SearchRead(MailMessageReactionModel, criteria, options, mmrs); err != nil { + return nil, err + } + return mmrs, nil +} + +// FindMailMessageReactionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMessageReactionIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailMessageReactionModel, criteria, options) +} + +// FindMailMessageReactionId finds record id by querying it with criteria. +func (c *Client) FindMailMessageReactionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailMessageReactionModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_message_schedule.go b/mail_message_schedule.go new file mode 100644 index 0000000..11a593d --- /dev/null +++ b/mail_message_schedule.go @@ -0,0 +1,119 @@ +package odoo + +// MailMessageSchedule represents mail.message.schedule model. +type MailMessageSchedule struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MailMessageId *Many2One `xmlrpc:"mail_message_id,omitempty"` + NotificationParameters *String `xmlrpc:"notification_parameters,omitempty"` + ScheduledDatetime *Time `xmlrpc:"scheduled_datetime,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailMessageSchedules represents array of mail.message.schedule model. +type MailMessageSchedules []MailMessageSchedule + +// MailMessageScheduleModel is the odoo model name. +const MailMessageScheduleModel = "mail.message.schedule" + +// Many2One convert MailMessageSchedule to *Many2One. +func (mms *MailMessageSchedule) Many2One() *Many2One { + return NewMany2One(mms.Id.Get(), "") +} + +// CreateMailMessageSchedule creates a new mail.message.schedule model and returns its id. +func (c *Client) CreateMailMessageSchedule(mms *MailMessageSchedule) (int64, error) { + ids, err := c.CreateMailMessageSchedules([]*MailMessageSchedule{mms}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailMessageSchedule creates a new mail.message.schedule model and returns its id. +func (c *Client) CreateMailMessageSchedules(mmss []*MailMessageSchedule) ([]int64, error) { + var vv []interface{} + for _, v := range mmss { + vv = append(vv, v) + } + return c.Create(MailMessageScheduleModel, vv, nil) +} + +// UpdateMailMessageSchedule updates an existing mail.message.schedule record. +func (c *Client) UpdateMailMessageSchedule(mms *MailMessageSchedule) error { + return c.UpdateMailMessageSchedules([]int64{mms.Id.Get()}, mms) +} + +// UpdateMailMessageSchedules updates existing mail.message.schedule records. +// All records (represented by ids) will be updated by mms values. +func (c *Client) UpdateMailMessageSchedules(ids []int64, mms *MailMessageSchedule) error { + return c.Update(MailMessageScheduleModel, ids, mms, nil) +} + +// DeleteMailMessageSchedule deletes an existing mail.message.schedule record. +func (c *Client) DeleteMailMessageSchedule(id int64) error { + return c.DeleteMailMessageSchedules([]int64{id}) +} + +// DeleteMailMessageSchedules deletes existing mail.message.schedule records. +func (c *Client) DeleteMailMessageSchedules(ids []int64) error { + return c.Delete(MailMessageScheduleModel, ids) +} + +// GetMailMessageSchedule gets mail.message.schedule existing record. +func (c *Client) GetMailMessageSchedule(id int64) (*MailMessageSchedule, error) { + mmss, err := c.GetMailMessageSchedules([]int64{id}) + if err != nil { + return nil, err + } + return &((*mmss)[0]), nil +} + +// GetMailMessageSchedules gets mail.message.schedule existing records. +func (c *Client) GetMailMessageSchedules(ids []int64) (*MailMessageSchedules, error) { + mmss := &MailMessageSchedules{} + if err := c.Read(MailMessageScheduleModel, ids, nil, mmss); err != nil { + return nil, err + } + return mmss, nil +} + +// FindMailMessageSchedule finds mail.message.schedule record by querying it with criteria. +func (c *Client) FindMailMessageSchedule(criteria *Criteria) (*MailMessageSchedule, error) { + mmss := &MailMessageSchedules{} + if err := c.SearchRead(MailMessageScheduleModel, criteria, NewOptions().Limit(1), mmss); err != nil { + return nil, err + } + return &((*mmss)[0]), nil +} + +// FindMailMessageSchedules finds mail.message.schedule records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMessageSchedules(criteria *Criteria, options *Options) (*MailMessageSchedules, error) { + mmss := &MailMessageSchedules{} + if err := c.SearchRead(MailMessageScheduleModel, criteria, options, mmss); err != nil { + return nil, err + } + return mmss, nil +} + +// FindMailMessageScheduleIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMessageScheduleIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailMessageScheduleModel, criteria, options) +} + +// FindMailMessageScheduleId finds record id by querying it with criteria. +func (c *Client) FindMailMessageScheduleId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailMessageScheduleModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_message_subtype.go b/mail_message_subtype.go new file mode 100644 index 0000000..33495c8 --- /dev/null +++ b/mail_message_subtype.go @@ -0,0 +1,126 @@ +package odoo + +// MailMessageSubtype represents mail.message.subtype model. +type MailMessageSubtype struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Default *Bool `xmlrpc:"default,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Hidden *Bool `xmlrpc:"hidden,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Internal *Bool `xmlrpc:"internal,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + RelationField *String `xmlrpc:"relation_field,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TrackRecipients *Bool `xmlrpc:"track_recipients,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailMessageSubtypes represents array of mail.message.subtype model. +type MailMessageSubtypes []MailMessageSubtype + +// MailMessageSubtypeModel is the odoo model name. +const MailMessageSubtypeModel = "mail.message.subtype" + +// Many2One convert MailMessageSubtype to *Many2One. +func (mms *MailMessageSubtype) Many2One() *Many2One { + return NewMany2One(mms.Id.Get(), "") +} + +// CreateMailMessageSubtype creates a new mail.message.subtype model and returns its id. +func (c *Client) CreateMailMessageSubtype(mms *MailMessageSubtype) (int64, error) { + ids, err := c.CreateMailMessageSubtypes([]*MailMessageSubtype{mms}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailMessageSubtype creates a new mail.message.subtype model and returns its id. +func (c *Client) CreateMailMessageSubtypes(mmss []*MailMessageSubtype) ([]int64, error) { + var vv []interface{} + for _, v := range mmss { + vv = append(vv, v) + } + return c.Create(MailMessageSubtypeModel, vv, nil) +} + +// UpdateMailMessageSubtype updates an existing mail.message.subtype record. +func (c *Client) UpdateMailMessageSubtype(mms *MailMessageSubtype) error { + return c.UpdateMailMessageSubtypes([]int64{mms.Id.Get()}, mms) +} + +// UpdateMailMessageSubtypes updates existing mail.message.subtype records. +// All records (represented by ids) will be updated by mms values. +func (c *Client) UpdateMailMessageSubtypes(ids []int64, mms *MailMessageSubtype) error { + return c.Update(MailMessageSubtypeModel, ids, mms, nil) +} + +// DeleteMailMessageSubtype deletes an existing mail.message.subtype record. +func (c *Client) DeleteMailMessageSubtype(id int64) error { + return c.DeleteMailMessageSubtypes([]int64{id}) +} + +// DeleteMailMessageSubtypes deletes existing mail.message.subtype records. +func (c *Client) DeleteMailMessageSubtypes(ids []int64) error { + return c.Delete(MailMessageSubtypeModel, ids) +} + +// GetMailMessageSubtype gets mail.message.subtype existing record. +func (c *Client) GetMailMessageSubtype(id int64) (*MailMessageSubtype, error) { + mmss, err := c.GetMailMessageSubtypes([]int64{id}) + if err != nil { + return nil, err + } + return &((*mmss)[0]), nil +} + +// GetMailMessageSubtypes gets mail.message.subtype existing records. +func (c *Client) GetMailMessageSubtypes(ids []int64) (*MailMessageSubtypes, error) { + mmss := &MailMessageSubtypes{} + if err := c.Read(MailMessageSubtypeModel, ids, nil, mmss); err != nil { + return nil, err + } + return mmss, nil +} + +// FindMailMessageSubtype finds mail.message.subtype record by querying it with criteria. +func (c *Client) FindMailMessageSubtype(criteria *Criteria) (*MailMessageSubtype, error) { + mmss := &MailMessageSubtypes{} + if err := c.SearchRead(MailMessageSubtypeModel, criteria, NewOptions().Limit(1), mmss); err != nil { + return nil, err + } + return &((*mmss)[0]), nil +} + +// FindMailMessageSubtypes finds mail.message.subtype records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMessageSubtypes(criteria *Criteria, options *Options) (*MailMessageSubtypes, error) { + mmss := &MailMessageSubtypes{} + if err := c.SearchRead(MailMessageSubtypeModel, criteria, options, mmss); err != nil { + return nil, err + } + return mmss, nil +} + +// FindMailMessageSubtypeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMessageSubtypeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailMessageSubtypeModel, criteria, options) +} + +// FindMailMessageSubtypeId finds record id by querying it with criteria. +func (c *Client) FindMailMessageSubtypeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailMessageSubtypeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_message_translation.go b/mail_message_translation.go new file mode 100644 index 0000000..cbd8a61 --- /dev/null +++ b/mail_message_translation.go @@ -0,0 +1,120 @@ +package odoo + +// MailMessageTranslation represents mail.message.translation model. +type MailMessageTranslation struct { + Body *String `xmlrpc:"body,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MessageId *Many2One `xmlrpc:"message_id,omitempty"` + SourceLang *String `xmlrpc:"source_lang,omitempty"` + TargetLang *String `xmlrpc:"target_lang,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailMessageTranslations represents array of mail.message.translation model. +type MailMessageTranslations []MailMessageTranslation + +// MailMessageTranslationModel is the odoo model name. +const MailMessageTranslationModel = "mail.message.translation" + +// Many2One convert MailMessageTranslation to *Many2One. +func (mmt *MailMessageTranslation) Many2One() *Many2One { + return NewMany2One(mmt.Id.Get(), "") +} + +// CreateMailMessageTranslation creates a new mail.message.translation model and returns its id. +func (c *Client) CreateMailMessageTranslation(mmt *MailMessageTranslation) (int64, error) { + ids, err := c.CreateMailMessageTranslations([]*MailMessageTranslation{mmt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailMessageTranslation creates a new mail.message.translation model and returns its id. +func (c *Client) CreateMailMessageTranslations(mmts []*MailMessageTranslation) ([]int64, error) { + var vv []interface{} + for _, v := range mmts { + vv = append(vv, v) + } + return c.Create(MailMessageTranslationModel, vv, nil) +} + +// UpdateMailMessageTranslation updates an existing mail.message.translation record. +func (c *Client) UpdateMailMessageTranslation(mmt *MailMessageTranslation) error { + return c.UpdateMailMessageTranslations([]int64{mmt.Id.Get()}, mmt) +} + +// UpdateMailMessageTranslations updates existing mail.message.translation records. +// All records (represented by ids) will be updated by mmt values. +func (c *Client) UpdateMailMessageTranslations(ids []int64, mmt *MailMessageTranslation) error { + return c.Update(MailMessageTranslationModel, ids, mmt, nil) +} + +// DeleteMailMessageTranslation deletes an existing mail.message.translation record. +func (c *Client) DeleteMailMessageTranslation(id int64) error { + return c.DeleteMailMessageTranslations([]int64{id}) +} + +// DeleteMailMessageTranslations deletes existing mail.message.translation records. +func (c *Client) DeleteMailMessageTranslations(ids []int64) error { + return c.Delete(MailMessageTranslationModel, ids) +} + +// GetMailMessageTranslation gets mail.message.translation existing record. +func (c *Client) GetMailMessageTranslation(id int64) (*MailMessageTranslation, error) { + mmts, err := c.GetMailMessageTranslations([]int64{id}) + if err != nil { + return nil, err + } + return &((*mmts)[0]), nil +} + +// GetMailMessageTranslations gets mail.message.translation existing records. +func (c *Client) GetMailMessageTranslations(ids []int64) (*MailMessageTranslations, error) { + mmts := &MailMessageTranslations{} + if err := c.Read(MailMessageTranslationModel, ids, nil, mmts); err != nil { + return nil, err + } + return mmts, nil +} + +// FindMailMessageTranslation finds mail.message.translation record by querying it with criteria. +func (c *Client) FindMailMessageTranslation(criteria *Criteria) (*MailMessageTranslation, error) { + mmts := &MailMessageTranslations{} + if err := c.SearchRead(MailMessageTranslationModel, criteria, NewOptions().Limit(1), mmts); err != nil { + return nil, err + } + return &((*mmts)[0]), nil +} + +// FindMailMessageTranslations finds mail.message.translation records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMessageTranslations(criteria *Criteria, options *Options) (*MailMessageTranslations, error) { + mmts := &MailMessageTranslations{} + if err := c.SearchRead(MailMessageTranslationModel, criteria, options, mmts); err != nil { + return nil, err + } + return mmts, nil +} + +// FindMailMessageTranslationIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailMessageTranslationIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailMessageTranslationModel, criteria, options) +} + +// FindMailMessageTranslationId finds record id by querying it with criteria. +func (c *Client) FindMailMessageTranslationId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailMessageTranslationModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_notification.go b/mail_notification.go new file mode 100644 index 0000000..0cdbdb1 --- /dev/null +++ b/mail_notification.go @@ -0,0 +1,127 @@ +package odoo + +// MailNotification represents mail.notification model. +type MailNotification struct { + AuthorId *Many2One `xmlrpc:"author_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FailureReason *String `xmlrpc:"failure_reason,omitempty"` + FailureType *Selection `xmlrpc:"failure_type,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsRead *Bool `xmlrpc:"is_read,omitempty"` + LetterId *Many2One `xmlrpc:"letter_id,omitempty"` + MailMailId *Many2One `xmlrpc:"mail_mail_id,omitempty"` + MailMessageId *Many2One `xmlrpc:"mail_message_id,omitempty"` + NotificationStatus *Selection `xmlrpc:"notification_status,omitempty"` + NotificationType *Selection `xmlrpc:"notification_type,omitempty"` + ReadDate *Time `xmlrpc:"read_date,omitempty"` + ResPartnerId *Many2One `xmlrpc:"res_partner_id,omitempty"` + SmsId *Many2One `xmlrpc:"sms_id,omitempty"` + SmsIdInt *Int `xmlrpc:"sms_id_int,omitempty"` + SmsNumber *String `xmlrpc:"sms_number,omitempty"` + SmsTrackerIds *Relation `xmlrpc:"sms_tracker_ids,omitempty"` +} + +// MailNotifications represents array of mail.notification model. +type MailNotifications []MailNotification + +// MailNotificationModel is the odoo model name. +const MailNotificationModel = "mail.notification" + +// Many2One convert MailNotification to *Many2One. +func (mn *MailNotification) Many2One() *Many2One { + return NewMany2One(mn.Id.Get(), "") +} + +// CreateMailNotification creates a new mail.notification model and returns its id. +func (c *Client) CreateMailNotification(mn *MailNotification) (int64, error) { + ids, err := c.CreateMailNotifications([]*MailNotification{mn}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailNotification creates a new mail.notification model and returns its id. +func (c *Client) CreateMailNotifications(mns []*MailNotification) ([]int64, error) { + var vv []interface{} + for _, v := range mns { + vv = append(vv, v) + } + return c.Create(MailNotificationModel, vv, nil) +} + +// UpdateMailNotification updates an existing mail.notification record. +func (c *Client) UpdateMailNotification(mn *MailNotification) error { + return c.UpdateMailNotifications([]int64{mn.Id.Get()}, mn) +} + +// UpdateMailNotifications updates existing mail.notification records. +// All records (represented by ids) will be updated by mn values. +func (c *Client) UpdateMailNotifications(ids []int64, mn *MailNotification) error { + return c.Update(MailNotificationModel, ids, mn, nil) +} + +// DeleteMailNotification deletes an existing mail.notification record. +func (c *Client) DeleteMailNotification(id int64) error { + return c.DeleteMailNotifications([]int64{id}) +} + +// DeleteMailNotifications deletes existing mail.notification records. +func (c *Client) DeleteMailNotifications(ids []int64) error { + return c.Delete(MailNotificationModel, ids) +} + +// GetMailNotification gets mail.notification existing record. +func (c *Client) GetMailNotification(id int64) (*MailNotification, error) { + mns, err := c.GetMailNotifications([]int64{id}) + if err != nil { + return nil, err + } + return &((*mns)[0]), nil +} + +// GetMailNotifications gets mail.notification existing records. +func (c *Client) GetMailNotifications(ids []int64) (*MailNotifications, error) { + mns := &MailNotifications{} + if err := c.Read(MailNotificationModel, ids, nil, mns); err != nil { + return nil, err + } + return mns, nil +} + +// FindMailNotification finds mail.notification record by querying it with criteria. +func (c *Client) FindMailNotification(criteria *Criteria) (*MailNotification, error) { + mns := &MailNotifications{} + if err := c.SearchRead(MailNotificationModel, criteria, NewOptions().Limit(1), mns); err != nil { + return nil, err + } + return &((*mns)[0]), nil +} + +// FindMailNotifications finds mail.notification records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailNotifications(criteria *Criteria, options *Options) (*MailNotifications, error) { + mns := &MailNotifications{} + if err := c.SearchRead(MailNotificationModel, criteria, options, mns); err != nil { + return nil, err + } + return mns, nil +} + +// FindMailNotificationIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailNotificationIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailNotificationModel, criteria, options) +} + +// FindMailNotificationId finds record id by querying it with criteria. +func (c *Client) FindMailNotificationId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailNotificationModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_push.go b/mail_push.go new file mode 100644 index 0000000..80fd3f5 --- /dev/null +++ b/mail_push.go @@ -0,0 +1,118 @@ +package odoo + +// MailPush represents mail.push model. +type MailPush struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MailPushDeviceId *Many2One `xmlrpc:"mail_push_device_id,omitempty"` + Payload *String `xmlrpc:"payload,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailPushs represents array of mail.push model. +type MailPushs []MailPush + +// MailPushModel is the odoo model name. +const MailPushModel = "mail.push" + +// Many2One convert MailPush to *Many2One. +func (mp *MailPush) Many2One() *Many2One { + return NewMany2One(mp.Id.Get(), "") +} + +// CreateMailPush creates a new mail.push model and returns its id. +func (c *Client) CreateMailPush(mp *MailPush) (int64, error) { + ids, err := c.CreateMailPushs([]*MailPush{mp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailPush creates a new mail.push model and returns its id. +func (c *Client) CreateMailPushs(mps []*MailPush) ([]int64, error) { + var vv []interface{} + for _, v := range mps { + vv = append(vv, v) + } + return c.Create(MailPushModel, vv, nil) +} + +// UpdateMailPush updates an existing mail.push record. +func (c *Client) UpdateMailPush(mp *MailPush) error { + return c.UpdateMailPushs([]int64{mp.Id.Get()}, mp) +} + +// UpdateMailPushs updates existing mail.push records. +// All records (represented by ids) will be updated by mp values. +func (c *Client) UpdateMailPushs(ids []int64, mp *MailPush) error { + return c.Update(MailPushModel, ids, mp, nil) +} + +// DeleteMailPush deletes an existing mail.push record. +func (c *Client) DeleteMailPush(id int64) error { + return c.DeleteMailPushs([]int64{id}) +} + +// DeleteMailPushs deletes existing mail.push records. +func (c *Client) DeleteMailPushs(ids []int64) error { + return c.Delete(MailPushModel, ids) +} + +// GetMailPush gets mail.push existing record. +func (c *Client) GetMailPush(id int64) (*MailPush, error) { + mps, err := c.GetMailPushs([]int64{id}) + if err != nil { + return nil, err + } + return &((*mps)[0]), nil +} + +// GetMailPushs gets mail.push existing records. +func (c *Client) GetMailPushs(ids []int64) (*MailPushs, error) { + mps := &MailPushs{} + if err := c.Read(MailPushModel, ids, nil, mps); err != nil { + return nil, err + } + return mps, nil +} + +// FindMailPush finds mail.push record by querying it with criteria. +func (c *Client) FindMailPush(criteria *Criteria) (*MailPush, error) { + mps := &MailPushs{} + if err := c.SearchRead(MailPushModel, criteria, NewOptions().Limit(1), mps); err != nil { + return nil, err + } + return &((*mps)[0]), nil +} + +// FindMailPushs finds mail.push records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailPushs(criteria *Criteria, options *Options) (*MailPushs, error) { + mps := &MailPushs{} + if err := c.SearchRead(MailPushModel, criteria, options, mps); err != nil { + return nil, err + } + return mps, nil +} + +// FindMailPushIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailPushIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailPushModel, criteria, options) +} + +// FindMailPushId finds record id by querying it with criteria. +func (c *Client) FindMailPushId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailPushModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_push_device.go b/mail_push_device.go new file mode 100644 index 0000000..e3fd36a --- /dev/null +++ b/mail_push_device.go @@ -0,0 +1,120 @@ +package odoo + +// MailPushDevice represents mail.push.device model. +type MailPushDevice struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Endpoint *String `xmlrpc:"endpoint,omitempty"` + ExpirationTime *Time `xmlrpc:"expiration_time,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Keys *String `xmlrpc:"keys,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailPushDevices represents array of mail.push.device model. +type MailPushDevices []MailPushDevice + +// MailPushDeviceModel is the odoo model name. +const MailPushDeviceModel = "mail.push.device" + +// Many2One convert MailPushDevice to *Many2One. +func (mpd *MailPushDevice) Many2One() *Many2One { + return NewMany2One(mpd.Id.Get(), "") +} + +// CreateMailPushDevice creates a new mail.push.device model and returns its id. +func (c *Client) CreateMailPushDevice(mpd *MailPushDevice) (int64, error) { + ids, err := c.CreateMailPushDevices([]*MailPushDevice{mpd}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailPushDevice creates a new mail.push.device model and returns its id. +func (c *Client) CreateMailPushDevices(mpds []*MailPushDevice) ([]int64, error) { + var vv []interface{} + for _, v := range mpds { + vv = append(vv, v) + } + return c.Create(MailPushDeviceModel, vv, nil) +} + +// UpdateMailPushDevice updates an existing mail.push.device record. +func (c *Client) UpdateMailPushDevice(mpd *MailPushDevice) error { + return c.UpdateMailPushDevices([]int64{mpd.Id.Get()}, mpd) +} + +// UpdateMailPushDevices updates existing mail.push.device records. +// All records (represented by ids) will be updated by mpd values. +func (c *Client) UpdateMailPushDevices(ids []int64, mpd *MailPushDevice) error { + return c.Update(MailPushDeviceModel, ids, mpd, nil) +} + +// DeleteMailPushDevice deletes an existing mail.push.device record. +func (c *Client) DeleteMailPushDevice(id int64) error { + return c.DeleteMailPushDevices([]int64{id}) +} + +// DeleteMailPushDevices deletes existing mail.push.device records. +func (c *Client) DeleteMailPushDevices(ids []int64) error { + return c.Delete(MailPushDeviceModel, ids) +} + +// GetMailPushDevice gets mail.push.device existing record. +func (c *Client) GetMailPushDevice(id int64) (*MailPushDevice, error) { + mpds, err := c.GetMailPushDevices([]int64{id}) + if err != nil { + return nil, err + } + return &((*mpds)[0]), nil +} + +// GetMailPushDevices gets mail.push.device existing records. +func (c *Client) GetMailPushDevices(ids []int64) (*MailPushDevices, error) { + mpds := &MailPushDevices{} + if err := c.Read(MailPushDeviceModel, ids, nil, mpds); err != nil { + return nil, err + } + return mpds, nil +} + +// FindMailPushDevice finds mail.push.device record by querying it with criteria. +func (c *Client) FindMailPushDevice(criteria *Criteria) (*MailPushDevice, error) { + mpds := &MailPushDevices{} + if err := c.SearchRead(MailPushDeviceModel, criteria, NewOptions().Limit(1), mpds); err != nil { + return nil, err + } + return &((*mpds)[0]), nil +} + +// FindMailPushDevices finds mail.push.device records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailPushDevices(criteria *Criteria, options *Options) (*MailPushDevices, error) { + mpds := &MailPushDevices{} + if err := c.SearchRead(MailPushDeviceModel, criteria, options, mpds); err != nil { + return nil, err + } + return mpds, nil +} + +// FindMailPushDeviceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailPushDeviceIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailPushDeviceModel, criteria, options) +} + +// FindMailPushDeviceId finds record id by querying it with criteria. +func (c *Client) FindMailPushDeviceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailPushDeviceModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_resend_message.go b/mail_resend_message.go new file mode 100644 index 0000000..b302094 --- /dev/null +++ b/mail_resend_message.go @@ -0,0 +1,122 @@ +package odoo + +// MailResendMessage represents mail.resend.message model. +type MailResendMessage struct { + CanCancel *Bool `xmlrpc:"can_cancel,omitempty"` + CanResend *Bool `xmlrpc:"can_resend,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MailMessageId *Many2One `xmlrpc:"mail_message_id,omitempty"` + NotificationIds *Relation `xmlrpc:"notification_ids,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + PartnerReadonly *Bool `xmlrpc:"partner_readonly,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailResendMessages represents array of mail.resend.message model. +type MailResendMessages []MailResendMessage + +// MailResendMessageModel is the odoo model name. +const MailResendMessageModel = "mail.resend.message" + +// Many2One convert MailResendMessage to *Many2One. +func (mrm *MailResendMessage) Many2One() *Many2One { + return NewMany2One(mrm.Id.Get(), "") +} + +// CreateMailResendMessage creates a new mail.resend.message model and returns its id. +func (c *Client) CreateMailResendMessage(mrm *MailResendMessage) (int64, error) { + ids, err := c.CreateMailResendMessages([]*MailResendMessage{mrm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailResendMessage creates a new mail.resend.message model and returns its id. +func (c *Client) CreateMailResendMessages(mrms []*MailResendMessage) ([]int64, error) { + var vv []interface{} + for _, v := range mrms { + vv = append(vv, v) + } + return c.Create(MailResendMessageModel, vv, nil) +} + +// UpdateMailResendMessage updates an existing mail.resend.message record. +func (c *Client) UpdateMailResendMessage(mrm *MailResendMessage) error { + return c.UpdateMailResendMessages([]int64{mrm.Id.Get()}, mrm) +} + +// UpdateMailResendMessages updates existing mail.resend.message records. +// All records (represented by ids) will be updated by mrm values. +func (c *Client) UpdateMailResendMessages(ids []int64, mrm *MailResendMessage) error { + return c.Update(MailResendMessageModel, ids, mrm, nil) +} + +// DeleteMailResendMessage deletes an existing mail.resend.message record. +func (c *Client) DeleteMailResendMessage(id int64) error { + return c.DeleteMailResendMessages([]int64{id}) +} + +// DeleteMailResendMessages deletes existing mail.resend.message records. +func (c *Client) DeleteMailResendMessages(ids []int64) error { + return c.Delete(MailResendMessageModel, ids) +} + +// GetMailResendMessage gets mail.resend.message existing record. +func (c *Client) GetMailResendMessage(id int64) (*MailResendMessage, error) { + mrms, err := c.GetMailResendMessages([]int64{id}) + if err != nil { + return nil, err + } + return &((*mrms)[0]), nil +} + +// GetMailResendMessages gets mail.resend.message existing records. +func (c *Client) GetMailResendMessages(ids []int64) (*MailResendMessages, error) { + mrms := &MailResendMessages{} + if err := c.Read(MailResendMessageModel, ids, nil, mrms); err != nil { + return nil, err + } + return mrms, nil +} + +// FindMailResendMessage finds mail.resend.message record by querying it with criteria. +func (c *Client) FindMailResendMessage(criteria *Criteria) (*MailResendMessage, error) { + mrms := &MailResendMessages{} + if err := c.SearchRead(MailResendMessageModel, criteria, NewOptions().Limit(1), mrms); err != nil { + return nil, err + } + return &((*mrms)[0]), nil +} + +// FindMailResendMessages finds mail.resend.message records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailResendMessages(criteria *Criteria, options *Options) (*MailResendMessages, error) { + mrms := &MailResendMessages{} + if err := c.SearchRead(MailResendMessageModel, criteria, options, mrms); err != nil { + return nil, err + } + return mrms, nil +} + +// FindMailResendMessageIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailResendMessageIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailResendMessageModel, criteria, options) +} + +// FindMailResendMessageId finds record id by querying it with criteria. +func (c *Client) FindMailResendMessageId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailResendMessageModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_resend_partner.go b/mail_resend_partner.go new file mode 100644 index 0000000..558f020 --- /dev/null +++ b/mail_resend_partner.go @@ -0,0 +1,125 @@ +package odoo + +// MailResendPartner represents mail.resend.partner model. +type MailResendPartner struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + FailureReason *String `xmlrpc:"failure_reason,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Message *String `xmlrpc:"message,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NotificationId *Many2One `xmlrpc:"notification_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerReadonly *Bool `xmlrpc:"partner_readonly,omitempty"` + Resend *Bool `xmlrpc:"resend,omitempty"` + ResendWizardId *Many2One `xmlrpc:"resend_wizard_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailResendPartners represents array of mail.resend.partner model. +type MailResendPartners []MailResendPartner + +// MailResendPartnerModel is the odoo model name. +const MailResendPartnerModel = "mail.resend.partner" + +// Many2One convert MailResendPartner to *Many2One. +func (mrp *MailResendPartner) Many2One() *Many2One { + return NewMany2One(mrp.Id.Get(), "") +} + +// CreateMailResendPartner creates a new mail.resend.partner model and returns its id. +func (c *Client) CreateMailResendPartner(mrp *MailResendPartner) (int64, error) { + ids, err := c.CreateMailResendPartners([]*MailResendPartner{mrp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailResendPartner creates a new mail.resend.partner model and returns its id. +func (c *Client) CreateMailResendPartners(mrps []*MailResendPartner) ([]int64, error) { + var vv []interface{} + for _, v := range mrps { + vv = append(vv, v) + } + return c.Create(MailResendPartnerModel, vv, nil) +} + +// UpdateMailResendPartner updates an existing mail.resend.partner record. +func (c *Client) UpdateMailResendPartner(mrp *MailResendPartner) error { + return c.UpdateMailResendPartners([]int64{mrp.Id.Get()}, mrp) +} + +// UpdateMailResendPartners updates existing mail.resend.partner records. +// All records (represented by ids) will be updated by mrp values. +func (c *Client) UpdateMailResendPartners(ids []int64, mrp *MailResendPartner) error { + return c.Update(MailResendPartnerModel, ids, mrp, nil) +} + +// DeleteMailResendPartner deletes an existing mail.resend.partner record. +func (c *Client) DeleteMailResendPartner(id int64) error { + return c.DeleteMailResendPartners([]int64{id}) +} + +// DeleteMailResendPartners deletes existing mail.resend.partner records. +func (c *Client) DeleteMailResendPartners(ids []int64) error { + return c.Delete(MailResendPartnerModel, ids) +} + +// GetMailResendPartner gets mail.resend.partner existing record. +func (c *Client) GetMailResendPartner(id int64) (*MailResendPartner, error) { + mrps, err := c.GetMailResendPartners([]int64{id}) + if err != nil { + return nil, err + } + return &((*mrps)[0]), nil +} + +// GetMailResendPartners gets mail.resend.partner existing records. +func (c *Client) GetMailResendPartners(ids []int64) (*MailResendPartners, error) { + mrps := &MailResendPartners{} + if err := c.Read(MailResendPartnerModel, ids, nil, mrps); err != nil { + return nil, err + } + return mrps, nil +} + +// FindMailResendPartner finds mail.resend.partner record by querying it with criteria. +func (c *Client) FindMailResendPartner(criteria *Criteria) (*MailResendPartner, error) { + mrps := &MailResendPartners{} + if err := c.SearchRead(MailResendPartnerModel, criteria, NewOptions().Limit(1), mrps); err != nil { + return nil, err + } + return &((*mrps)[0]), nil +} + +// FindMailResendPartners finds mail.resend.partner records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailResendPartners(criteria *Criteria, options *Options) (*MailResendPartners, error) { + mrps := &MailResendPartners{} + if err := c.SearchRead(MailResendPartnerModel, criteria, options, mrps); err != nil { + return nil, err + } + return mrps, nil +} + +// FindMailResendPartnerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailResendPartnerIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailResendPartnerModel, criteria, options) +} + +// FindMailResendPartnerId finds record id by querying it with criteria. +func (c *Client) FindMailResendPartnerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailResendPartnerModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_scheduled_message.go b/mail_scheduled_message.go new file mode 100644 index 0000000..68e56de --- /dev/null +++ b/mail_scheduled_message.go @@ -0,0 +1,126 @@ +package odoo + +// MailScheduledMessage represents mail.scheduled.message model. +type MailScheduledMessage struct { + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + AuthorId *Many2One `xmlrpc:"author_id,omitempty"` + Body *String `xmlrpc:"body,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsNote *Bool `xmlrpc:"is_note,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + NotificationParameters *String `xmlrpc:"notification_parameters,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + ResId *Many2One `xmlrpc:"res_id,omitempty"` + ScheduledDate *Time `xmlrpc:"scheduled_date,omitempty"` + Subject *String `xmlrpc:"subject,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailScheduledMessages represents array of mail.scheduled.message model. +type MailScheduledMessages []MailScheduledMessage + +// MailScheduledMessageModel is the odoo model name. +const MailScheduledMessageModel = "mail.scheduled.message" + +// Many2One convert MailScheduledMessage to *Many2One. +func (msm *MailScheduledMessage) Many2One() *Many2One { + return NewMany2One(msm.Id.Get(), "") +} + +// CreateMailScheduledMessage creates a new mail.scheduled.message model and returns its id. +func (c *Client) CreateMailScheduledMessage(msm *MailScheduledMessage) (int64, error) { + ids, err := c.CreateMailScheduledMessages([]*MailScheduledMessage{msm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailScheduledMessage creates a new mail.scheduled.message model and returns its id. +func (c *Client) CreateMailScheduledMessages(msms []*MailScheduledMessage) ([]int64, error) { + var vv []interface{} + for _, v := range msms { + vv = append(vv, v) + } + return c.Create(MailScheduledMessageModel, vv, nil) +} + +// UpdateMailScheduledMessage updates an existing mail.scheduled.message record. +func (c *Client) UpdateMailScheduledMessage(msm *MailScheduledMessage) error { + return c.UpdateMailScheduledMessages([]int64{msm.Id.Get()}, msm) +} + +// UpdateMailScheduledMessages updates existing mail.scheduled.message records. +// All records (represented by ids) will be updated by msm values. +func (c *Client) UpdateMailScheduledMessages(ids []int64, msm *MailScheduledMessage) error { + return c.Update(MailScheduledMessageModel, ids, msm, nil) +} + +// DeleteMailScheduledMessage deletes an existing mail.scheduled.message record. +func (c *Client) DeleteMailScheduledMessage(id int64) error { + return c.DeleteMailScheduledMessages([]int64{id}) +} + +// DeleteMailScheduledMessages deletes existing mail.scheduled.message records. +func (c *Client) DeleteMailScheduledMessages(ids []int64) error { + return c.Delete(MailScheduledMessageModel, ids) +} + +// GetMailScheduledMessage gets mail.scheduled.message existing record. +func (c *Client) GetMailScheduledMessage(id int64) (*MailScheduledMessage, error) { + msms, err := c.GetMailScheduledMessages([]int64{id}) + if err != nil { + return nil, err + } + return &((*msms)[0]), nil +} + +// GetMailScheduledMessages gets mail.scheduled.message existing records. +func (c *Client) GetMailScheduledMessages(ids []int64) (*MailScheduledMessages, error) { + msms := &MailScheduledMessages{} + if err := c.Read(MailScheduledMessageModel, ids, nil, msms); err != nil { + return nil, err + } + return msms, nil +} + +// FindMailScheduledMessage finds mail.scheduled.message record by querying it with criteria. +func (c *Client) FindMailScheduledMessage(criteria *Criteria) (*MailScheduledMessage, error) { + msms := &MailScheduledMessages{} + if err := c.SearchRead(MailScheduledMessageModel, criteria, NewOptions().Limit(1), msms); err != nil { + return nil, err + } + return &((*msms)[0]), nil +} + +// FindMailScheduledMessages finds mail.scheduled.message records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailScheduledMessages(criteria *Criteria, options *Options) (*MailScheduledMessages, error) { + msms := &MailScheduledMessages{} + if err := c.SearchRead(MailScheduledMessageModel, criteria, options, msms); err != nil { + return nil, err + } + return msms, nil +} + +// FindMailScheduledMessageIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailScheduledMessageIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailScheduledMessageModel, criteria, options) +} + +// FindMailScheduledMessageId finds record id by querying it with criteria. +func (c *Client) FindMailScheduledMessageId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailScheduledMessageModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_template.go b/mail_template.go new file mode 100644 index 0000000..39385df --- /dev/null +++ b/mail_template.go @@ -0,0 +1,143 @@ +package odoo + +// MailTemplate represents mail.template model. +type MailTemplate struct { + Active *Bool `xmlrpc:"active,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + AutoDelete *Bool `xmlrpc:"auto_delete,omitempty"` + BodyHtml *String `xmlrpc:"body_html,omitempty"` + CanWrite *Bool `xmlrpc:"can_write,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmailCc *String `xmlrpc:"email_cc,omitempty"` + EmailFrom *String `xmlrpc:"email_from,omitempty"` + EmailLayoutXmlid *String `xmlrpc:"email_layout_xmlid,omitempty"` + EmailTo *String `xmlrpc:"email_to,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsTemplateEditor *Bool `xmlrpc:"is_template_editor,omitempty"` + Lang *String `xmlrpc:"lang,omitempty"` + MailServerId *Many2One `xmlrpc:"mail_server_id,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PartnerTo *String `xmlrpc:"partner_to,omitempty"` + RefIrActWindow *Many2One `xmlrpc:"ref_ir_act_window,omitempty"` + RenderModel *String `xmlrpc:"render_model,omitempty"` + ReplyTo *String `xmlrpc:"reply_to,omitempty"` + ReportTemplateIds *Relation `xmlrpc:"report_template_ids,omitempty"` + ScheduledDate *String `xmlrpc:"scheduled_date,omitempty"` + Subject *String `xmlrpc:"subject,omitempty"` + TemplateCategory *Selection `xmlrpc:"template_category,omitempty"` + TemplateFs *String `xmlrpc:"template_fs,omitempty"` + UseDefaultTo *Bool `xmlrpc:"use_default_to,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailTemplates represents array of mail.template model. +type MailTemplates []MailTemplate + +// MailTemplateModel is the odoo model name. +const MailTemplateModel = "mail.template" + +// Many2One convert MailTemplate to *Many2One. +func (mt *MailTemplate) Many2One() *Many2One { + return NewMany2One(mt.Id.Get(), "") +} + +// CreateMailTemplate creates a new mail.template model and returns its id. +func (c *Client) CreateMailTemplate(mt *MailTemplate) (int64, error) { + ids, err := c.CreateMailTemplates([]*MailTemplate{mt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailTemplate creates a new mail.template model and returns its id. +func (c *Client) CreateMailTemplates(mts []*MailTemplate) ([]int64, error) { + var vv []interface{} + for _, v := range mts { + vv = append(vv, v) + } + return c.Create(MailTemplateModel, vv, nil) +} + +// UpdateMailTemplate updates an existing mail.template record. +func (c *Client) UpdateMailTemplate(mt *MailTemplate) error { + return c.UpdateMailTemplates([]int64{mt.Id.Get()}, mt) +} + +// UpdateMailTemplates updates existing mail.template records. +// All records (represented by ids) will be updated by mt values. +func (c *Client) UpdateMailTemplates(ids []int64, mt *MailTemplate) error { + return c.Update(MailTemplateModel, ids, mt, nil) +} + +// DeleteMailTemplate deletes an existing mail.template record. +func (c *Client) DeleteMailTemplate(id int64) error { + return c.DeleteMailTemplates([]int64{id}) +} + +// DeleteMailTemplates deletes existing mail.template records. +func (c *Client) DeleteMailTemplates(ids []int64) error { + return c.Delete(MailTemplateModel, ids) +} + +// GetMailTemplate gets mail.template existing record. +func (c *Client) GetMailTemplate(id int64) (*MailTemplate, error) { + mts, err := c.GetMailTemplates([]int64{id}) + if err != nil { + return nil, err + } + return &((*mts)[0]), nil +} + +// GetMailTemplates gets mail.template existing records. +func (c *Client) GetMailTemplates(ids []int64) (*MailTemplates, error) { + mts := &MailTemplates{} + if err := c.Read(MailTemplateModel, ids, nil, mts); err != nil { + return nil, err + } + return mts, nil +} + +// FindMailTemplate finds mail.template record by querying it with criteria. +func (c *Client) FindMailTemplate(criteria *Criteria) (*MailTemplate, error) { + mts := &MailTemplates{} + if err := c.SearchRead(MailTemplateModel, criteria, NewOptions().Limit(1), mts); err != nil { + return nil, err + } + return &((*mts)[0]), nil +} + +// FindMailTemplates finds mail.template records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailTemplates(criteria *Criteria, options *Options) (*MailTemplates, error) { + mts := &MailTemplates{} + if err := c.SearchRead(MailTemplateModel, criteria, options, mts); err != nil { + return nil, err + } + return mts, nil +} + +// FindMailTemplateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailTemplateIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailTemplateModel, criteria, options) +} + +// FindMailTemplateId finds record id by querying it with criteria. +func (c *Client) FindMailTemplateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailTemplateModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_template_preview.go b/mail_template_preview.go new file mode 100644 index 0000000..a120b26 --- /dev/null +++ b/mail_template_preview.go @@ -0,0 +1,131 @@ +package odoo + +// MailTemplatePreview represents mail.template.preview model. +type MailTemplatePreview struct { + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + BodyHtml *String `xmlrpc:"body_html,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmailCc *String `xmlrpc:"email_cc,omitempty"` + EmailFrom *String `xmlrpc:"email_from,omitempty"` + EmailTo *String `xmlrpc:"email_to,omitempty"` + ErrorMsg *String `xmlrpc:"error_msg,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Lang *Selection `xmlrpc:"lang,omitempty"` + MailTemplateId *Many2One `xmlrpc:"mail_template_id,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + NoRecord *Bool `xmlrpc:"no_record,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + ReplyTo *String `xmlrpc:"reply_to,omitempty"` + ResourceRef *String `xmlrpc:"resource_ref,omitempty"` + ScheduledDate *String `xmlrpc:"scheduled_date,omitempty"` + Subject *String `xmlrpc:"subject,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailTemplatePreviews represents array of mail.template.preview model. +type MailTemplatePreviews []MailTemplatePreview + +// MailTemplatePreviewModel is the odoo model name. +const MailTemplatePreviewModel = "mail.template.preview" + +// Many2One convert MailTemplatePreview to *Many2One. +func (mtp *MailTemplatePreview) Many2One() *Many2One { + return NewMany2One(mtp.Id.Get(), "") +} + +// CreateMailTemplatePreview creates a new mail.template.preview model and returns its id. +func (c *Client) CreateMailTemplatePreview(mtp *MailTemplatePreview) (int64, error) { + ids, err := c.CreateMailTemplatePreviews([]*MailTemplatePreview{mtp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailTemplatePreview creates a new mail.template.preview model and returns its id. +func (c *Client) CreateMailTemplatePreviews(mtps []*MailTemplatePreview) ([]int64, error) { + var vv []interface{} + for _, v := range mtps { + vv = append(vv, v) + } + return c.Create(MailTemplatePreviewModel, vv, nil) +} + +// UpdateMailTemplatePreview updates an existing mail.template.preview record. +func (c *Client) UpdateMailTemplatePreview(mtp *MailTemplatePreview) error { + return c.UpdateMailTemplatePreviews([]int64{mtp.Id.Get()}, mtp) +} + +// UpdateMailTemplatePreviews updates existing mail.template.preview records. +// All records (represented by ids) will be updated by mtp values. +func (c *Client) UpdateMailTemplatePreviews(ids []int64, mtp *MailTemplatePreview) error { + return c.Update(MailTemplatePreviewModel, ids, mtp, nil) +} + +// DeleteMailTemplatePreview deletes an existing mail.template.preview record. +func (c *Client) DeleteMailTemplatePreview(id int64) error { + return c.DeleteMailTemplatePreviews([]int64{id}) +} + +// DeleteMailTemplatePreviews deletes existing mail.template.preview records. +func (c *Client) DeleteMailTemplatePreviews(ids []int64) error { + return c.Delete(MailTemplatePreviewModel, ids) +} + +// GetMailTemplatePreview gets mail.template.preview existing record. +func (c *Client) GetMailTemplatePreview(id int64) (*MailTemplatePreview, error) { + mtps, err := c.GetMailTemplatePreviews([]int64{id}) + if err != nil { + return nil, err + } + return &((*mtps)[0]), nil +} + +// GetMailTemplatePreviews gets mail.template.preview existing records. +func (c *Client) GetMailTemplatePreviews(ids []int64) (*MailTemplatePreviews, error) { + mtps := &MailTemplatePreviews{} + if err := c.Read(MailTemplatePreviewModel, ids, nil, mtps); err != nil { + return nil, err + } + return mtps, nil +} + +// FindMailTemplatePreview finds mail.template.preview record by querying it with criteria. +func (c *Client) FindMailTemplatePreview(criteria *Criteria) (*MailTemplatePreview, error) { + mtps := &MailTemplatePreviews{} + if err := c.SearchRead(MailTemplatePreviewModel, criteria, NewOptions().Limit(1), mtps); err != nil { + return nil, err + } + return &((*mtps)[0]), nil +} + +// FindMailTemplatePreviews finds mail.template.preview records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailTemplatePreviews(criteria *Criteria, options *Options) (*MailTemplatePreviews, error) { + mtps := &MailTemplatePreviews{} + if err := c.SearchRead(MailTemplatePreviewModel, criteria, options, mtps); err != nil { + return nil, err + } + return mtps, nil +} + +// FindMailTemplatePreviewIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailTemplatePreviewIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailTemplatePreviewModel, criteria, options) +} + +// FindMailTemplatePreviewId finds record id by querying it with criteria. +func (c *Client) FindMailTemplatePreviewId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailTemplatePreviewModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_template_reset.go b/mail_template_reset.go new file mode 100644 index 0000000..4caca23 --- /dev/null +++ b/mail_template_reset.go @@ -0,0 +1,117 @@ +package odoo + +// MailTemplateReset represents mail.template.reset model. +type MailTemplateReset struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + TemplateIds *Relation `xmlrpc:"template_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailTemplateResets represents array of mail.template.reset model. +type MailTemplateResets []MailTemplateReset + +// MailTemplateResetModel is the odoo model name. +const MailTemplateResetModel = "mail.template.reset" + +// Many2One convert MailTemplateReset to *Many2One. +func (mtr *MailTemplateReset) Many2One() *Many2One { + return NewMany2One(mtr.Id.Get(), "") +} + +// CreateMailTemplateReset creates a new mail.template.reset model and returns its id. +func (c *Client) CreateMailTemplateReset(mtr *MailTemplateReset) (int64, error) { + ids, err := c.CreateMailTemplateResets([]*MailTemplateReset{mtr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailTemplateReset creates a new mail.template.reset model and returns its id. +func (c *Client) CreateMailTemplateResets(mtrs []*MailTemplateReset) ([]int64, error) { + var vv []interface{} + for _, v := range mtrs { + vv = append(vv, v) + } + return c.Create(MailTemplateResetModel, vv, nil) +} + +// UpdateMailTemplateReset updates an existing mail.template.reset record. +func (c *Client) UpdateMailTemplateReset(mtr *MailTemplateReset) error { + return c.UpdateMailTemplateResets([]int64{mtr.Id.Get()}, mtr) +} + +// UpdateMailTemplateResets updates existing mail.template.reset records. +// All records (represented by ids) will be updated by mtr values. +func (c *Client) UpdateMailTemplateResets(ids []int64, mtr *MailTemplateReset) error { + return c.Update(MailTemplateResetModel, ids, mtr, nil) +} + +// DeleteMailTemplateReset deletes an existing mail.template.reset record. +func (c *Client) DeleteMailTemplateReset(id int64) error { + return c.DeleteMailTemplateResets([]int64{id}) +} + +// DeleteMailTemplateResets deletes existing mail.template.reset records. +func (c *Client) DeleteMailTemplateResets(ids []int64) error { + return c.Delete(MailTemplateResetModel, ids) +} + +// GetMailTemplateReset gets mail.template.reset existing record. +func (c *Client) GetMailTemplateReset(id int64) (*MailTemplateReset, error) { + mtrs, err := c.GetMailTemplateResets([]int64{id}) + if err != nil { + return nil, err + } + return &((*mtrs)[0]), nil +} + +// GetMailTemplateResets gets mail.template.reset existing records. +func (c *Client) GetMailTemplateResets(ids []int64) (*MailTemplateResets, error) { + mtrs := &MailTemplateResets{} + if err := c.Read(MailTemplateResetModel, ids, nil, mtrs); err != nil { + return nil, err + } + return mtrs, nil +} + +// FindMailTemplateReset finds mail.template.reset record by querying it with criteria. +func (c *Client) FindMailTemplateReset(criteria *Criteria) (*MailTemplateReset, error) { + mtrs := &MailTemplateResets{} + if err := c.SearchRead(MailTemplateResetModel, criteria, NewOptions().Limit(1), mtrs); err != nil { + return nil, err + } + return &((*mtrs)[0]), nil +} + +// FindMailTemplateResets finds mail.template.reset records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailTemplateResets(criteria *Criteria, options *Options) (*MailTemplateResets, error) { + mtrs := &MailTemplateResets{} + if err := c.SearchRead(MailTemplateResetModel, criteria, options, mtrs); err != nil { + return nil, err + } + return mtrs, nil +} + +// FindMailTemplateResetIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailTemplateResetIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailTemplateResetModel, criteria, options) +} + +// FindMailTemplateResetId finds record id by querying it with criteria. +func (c *Client) FindMailTemplateResetId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailTemplateResetModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_tracking_value.go b/mail_tracking_value.go new file mode 100644 index 0000000..28e4396 --- /dev/null +++ b/mail_tracking_value.go @@ -0,0 +1,130 @@ +package odoo + +// MailTrackingValue represents mail.tracking.value model. +type MailTrackingValue struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FieldId *Many2One `xmlrpc:"field_id,omitempty"` + FieldInfo *String `xmlrpc:"field_info,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MailMessageId *Many2One `xmlrpc:"mail_message_id,omitempty"` + NewValueChar *String `xmlrpc:"new_value_char,omitempty"` + NewValueDatetime *Time `xmlrpc:"new_value_datetime,omitempty"` + NewValueFloat *Float `xmlrpc:"new_value_float,omitempty"` + NewValueInteger *Int `xmlrpc:"new_value_integer,omitempty"` + NewValueText *String `xmlrpc:"new_value_text,omitempty"` + OldValueChar *String `xmlrpc:"old_value_char,omitempty"` + OldValueDatetime *Time `xmlrpc:"old_value_datetime,omitempty"` + OldValueFloat *Float `xmlrpc:"old_value_float,omitempty"` + OldValueInteger *Int `xmlrpc:"old_value_integer,omitempty"` + OldValueText *String `xmlrpc:"old_value_text,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailTrackingValues represents array of mail.tracking.value model. +type MailTrackingValues []MailTrackingValue + +// MailTrackingValueModel is the odoo model name. +const MailTrackingValueModel = "mail.tracking.value" + +// Many2One convert MailTrackingValue to *Many2One. +func (mtv *MailTrackingValue) Many2One() *Many2One { + return NewMany2One(mtv.Id.Get(), "") +} + +// CreateMailTrackingValue creates a new mail.tracking.value model and returns its id. +func (c *Client) CreateMailTrackingValue(mtv *MailTrackingValue) (int64, error) { + ids, err := c.CreateMailTrackingValues([]*MailTrackingValue{mtv}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailTrackingValue creates a new mail.tracking.value model and returns its id. +func (c *Client) CreateMailTrackingValues(mtvs []*MailTrackingValue) ([]int64, error) { + var vv []interface{} + for _, v := range mtvs { + vv = append(vv, v) + } + return c.Create(MailTrackingValueModel, vv, nil) +} + +// UpdateMailTrackingValue updates an existing mail.tracking.value record. +func (c *Client) UpdateMailTrackingValue(mtv *MailTrackingValue) error { + return c.UpdateMailTrackingValues([]int64{mtv.Id.Get()}, mtv) +} + +// UpdateMailTrackingValues updates existing mail.tracking.value records. +// All records (represented by ids) will be updated by mtv values. +func (c *Client) UpdateMailTrackingValues(ids []int64, mtv *MailTrackingValue) error { + return c.Update(MailTrackingValueModel, ids, mtv, nil) +} + +// DeleteMailTrackingValue deletes an existing mail.tracking.value record. +func (c *Client) DeleteMailTrackingValue(id int64) error { + return c.DeleteMailTrackingValues([]int64{id}) +} + +// DeleteMailTrackingValues deletes existing mail.tracking.value records. +func (c *Client) DeleteMailTrackingValues(ids []int64) error { + return c.Delete(MailTrackingValueModel, ids) +} + +// GetMailTrackingValue gets mail.tracking.value existing record. +func (c *Client) GetMailTrackingValue(id int64) (*MailTrackingValue, error) { + mtvs, err := c.GetMailTrackingValues([]int64{id}) + if err != nil { + return nil, err + } + return &((*mtvs)[0]), nil +} + +// GetMailTrackingValues gets mail.tracking.value existing records. +func (c *Client) GetMailTrackingValues(ids []int64) (*MailTrackingValues, error) { + mtvs := &MailTrackingValues{} + if err := c.Read(MailTrackingValueModel, ids, nil, mtvs); err != nil { + return nil, err + } + return mtvs, nil +} + +// FindMailTrackingValue finds mail.tracking.value record by querying it with criteria. +func (c *Client) FindMailTrackingValue(criteria *Criteria) (*MailTrackingValue, error) { + mtvs := &MailTrackingValues{} + if err := c.SearchRead(MailTrackingValueModel, criteria, NewOptions().Limit(1), mtvs); err != nil { + return nil, err + } + return &((*mtvs)[0]), nil +} + +// FindMailTrackingValues finds mail.tracking.value records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailTrackingValues(criteria *Criteria, options *Options) (*MailTrackingValues, error) { + mtvs := &MailTrackingValues{} + if err := c.SearchRead(MailTrackingValueModel, criteria, options, mtvs); err != nil { + return nil, err + } + return mtvs, nil +} + +// FindMailTrackingValueIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailTrackingValueIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailTrackingValueModel, criteria, options) +} + +// FindMailTrackingValueId finds record id by querying it with criteria. +func (c *Client) FindMailTrackingValueId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailTrackingValueModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/mail_wizard_invite.go b/mail_wizard_invite.go new file mode 100644 index 0000000..d20dabb --- /dev/null +++ b/mail_wizard_invite.go @@ -0,0 +1,121 @@ +package odoo + +// MailWizardInvite represents mail.wizard.invite model. +type MailWizardInvite struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Message *String `xmlrpc:"message,omitempty"` + Notify *Bool `xmlrpc:"notify,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + ResId *Int `xmlrpc:"res_id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// MailWizardInvites represents array of mail.wizard.invite model. +type MailWizardInvites []MailWizardInvite + +// MailWizardInviteModel is the odoo model name. +const MailWizardInviteModel = "mail.wizard.invite" + +// Many2One convert MailWizardInvite to *Many2One. +func (mwi *MailWizardInvite) Many2One() *Many2One { + return NewMany2One(mwi.Id.Get(), "") +} + +// CreateMailWizardInvite creates a new mail.wizard.invite model and returns its id. +func (c *Client) CreateMailWizardInvite(mwi *MailWizardInvite) (int64, error) { + ids, err := c.CreateMailWizardInvites([]*MailWizardInvite{mwi}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateMailWizardInvite creates a new mail.wizard.invite model and returns its id. +func (c *Client) CreateMailWizardInvites(mwis []*MailWizardInvite) ([]int64, error) { + var vv []interface{} + for _, v := range mwis { + vv = append(vv, v) + } + return c.Create(MailWizardInviteModel, vv, nil) +} + +// UpdateMailWizardInvite updates an existing mail.wizard.invite record. +func (c *Client) UpdateMailWizardInvite(mwi *MailWizardInvite) error { + return c.UpdateMailWizardInvites([]int64{mwi.Id.Get()}, mwi) +} + +// UpdateMailWizardInvites updates existing mail.wizard.invite records. +// All records (represented by ids) will be updated by mwi values. +func (c *Client) UpdateMailWizardInvites(ids []int64, mwi *MailWizardInvite) error { + return c.Update(MailWizardInviteModel, ids, mwi, nil) +} + +// DeleteMailWizardInvite deletes an existing mail.wizard.invite record. +func (c *Client) DeleteMailWizardInvite(id int64) error { + return c.DeleteMailWizardInvites([]int64{id}) +} + +// DeleteMailWizardInvites deletes existing mail.wizard.invite records. +func (c *Client) DeleteMailWizardInvites(ids []int64) error { + return c.Delete(MailWizardInviteModel, ids) +} + +// GetMailWizardInvite gets mail.wizard.invite existing record. +func (c *Client) GetMailWizardInvite(id int64) (*MailWizardInvite, error) { + mwis, err := c.GetMailWizardInvites([]int64{id}) + if err != nil { + return nil, err + } + return &((*mwis)[0]), nil +} + +// GetMailWizardInvites gets mail.wizard.invite existing records. +func (c *Client) GetMailWizardInvites(ids []int64) (*MailWizardInvites, error) { + mwis := &MailWizardInvites{} + if err := c.Read(MailWizardInviteModel, ids, nil, mwis); err != nil { + return nil, err + } + return mwis, nil +} + +// FindMailWizardInvite finds mail.wizard.invite record by querying it with criteria. +func (c *Client) FindMailWizardInvite(criteria *Criteria) (*MailWizardInvite, error) { + mwis := &MailWizardInvites{} + if err := c.SearchRead(MailWizardInviteModel, criteria, NewOptions().Limit(1), mwis); err != nil { + return nil, err + } + return &((*mwis)[0]), nil +} + +// FindMailWizardInvites finds mail.wizard.invite records by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailWizardInvites(criteria *Criteria, options *Options) (*MailWizardInvites, error) { + mwis := &MailWizardInvites{} + if err := c.SearchRead(MailWizardInviteModel, criteria, options, mwis); err != nil { + return nil, err + } + return mwis, nil +} + +// FindMailWizardInviteIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindMailWizardInviteIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(MailWizardInviteModel, criteria, options) +} + +// FindMailWizardInviteId finds record id by querying it with criteria. +func (c *Client) FindMailWizardInviteId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(MailWizardInviteModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/onboarding_onboarding.go b/onboarding_onboarding.go new file mode 100644 index 0000000..2699dc6 --- /dev/null +++ b/onboarding_onboarding.go @@ -0,0 +1,127 @@ +package odoo + +// OnboardingOnboarding represents onboarding.onboarding model. +type OnboardingOnboarding struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrentOnboardingState *Selection `xmlrpc:"current_onboarding_state,omitempty"` + CurrentProgressId *Many2One `xmlrpc:"current_progress_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsOnboardingClosed *Bool `xmlrpc:"is_onboarding_closed,omitempty"` + IsPerCompany *Bool `xmlrpc:"is_per_company,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PanelCloseActionName *String `xmlrpc:"panel_close_action_name,omitempty"` + ProgressIds *Relation `xmlrpc:"progress_ids,omitempty"` + RouteName *String `xmlrpc:"route_name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + StepIds *Relation `xmlrpc:"step_ids,omitempty"` + TextCompleted *String `xmlrpc:"text_completed,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// OnboardingOnboardings represents array of onboarding.onboarding model. +type OnboardingOnboardings []OnboardingOnboarding + +// OnboardingOnboardingModel is the odoo model name. +const OnboardingOnboardingModel = "onboarding.onboarding" + +// Many2One convert OnboardingOnboarding to *Many2One. +func (oo *OnboardingOnboarding) Many2One() *Many2One { + return NewMany2One(oo.Id.Get(), "") +} + +// CreateOnboardingOnboarding creates a new onboarding.onboarding model and returns its id. +func (c *Client) CreateOnboardingOnboarding(oo *OnboardingOnboarding) (int64, error) { + ids, err := c.CreateOnboardingOnboardings([]*OnboardingOnboarding{oo}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateOnboardingOnboarding creates a new onboarding.onboarding model and returns its id. +func (c *Client) CreateOnboardingOnboardings(oos []*OnboardingOnboarding) ([]int64, error) { + var vv []interface{} + for _, v := range oos { + vv = append(vv, v) + } + return c.Create(OnboardingOnboardingModel, vv, nil) +} + +// UpdateOnboardingOnboarding updates an existing onboarding.onboarding record. +func (c *Client) UpdateOnboardingOnboarding(oo *OnboardingOnboarding) error { + return c.UpdateOnboardingOnboardings([]int64{oo.Id.Get()}, oo) +} + +// UpdateOnboardingOnboardings updates existing onboarding.onboarding records. +// All records (represented by ids) will be updated by oo values. +func (c *Client) UpdateOnboardingOnboardings(ids []int64, oo *OnboardingOnboarding) error { + return c.Update(OnboardingOnboardingModel, ids, oo, nil) +} + +// DeleteOnboardingOnboarding deletes an existing onboarding.onboarding record. +func (c *Client) DeleteOnboardingOnboarding(id int64) error { + return c.DeleteOnboardingOnboardings([]int64{id}) +} + +// DeleteOnboardingOnboardings deletes existing onboarding.onboarding records. +func (c *Client) DeleteOnboardingOnboardings(ids []int64) error { + return c.Delete(OnboardingOnboardingModel, ids) +} + +// GetOnboardingOnboarding gets onboarding.onboarding existing record. +func (c *Client) GetOnboardingOnboarding(id int64) (*OnboardingOnboarding, error) { + oos, err := c.GetOnboardingOnboardings([]int64{id}) + if err != nil { + return nil, err + } + return &((*oos)[0]), nil +} + +// GetOnboardingOnboardings gets onboarding.onboarding existing records. +func (c *Client) GetOnboardingOnboardings(ids []int64) (*OnboardingOnboardings, error) { + oos := &OnboardingOnboardings{} + if err := c.Read(OnboardingOnboardingModel, ids, nil, oos); err != nil { + return nil, err + } + return oos, nil +} + +// FindOnboardingOnboarding finds onboarding.onboarding record by querying it with criteria. +func (c *Client) FindOnboardingOnboarding(criteria *Criteria) (*OnboardingOnboarding, error) { + oos := &OnboardingOnboardings{} + if err := c.SearchRead(OnboardingOnboardingModel, criteria, NewOptions().Limit(1), oos); err != nil { + return nil, err + } + return &((*oos)[0]), nil +} + +// FindOnboardingOnboardings finds onboarding.onboarding records by querying it +// and filtering it with criteria and options. +func (c *Client) FindOnboardingOnboardings(criteria *Criteria, options *Options) (*OnboardingOnboardings, error) { + oos := &OnboardingOnboardings{} + if err := c.SearchRead(OnboardingOnboardingModel, criteria, options, oos); err != nil { + return nil, err + } + return oos, nil +} + +// FindOnboardingOnboardingIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindOnboardingOnboardingIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(OnboardingOnboardingModel, criteria, options) +} + +// FindOnboardingOnboardingId finds record id by querying it with criteria. +func (c *Client) FindOnboardingOnboardingId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(OnboardingOnboardingModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/onboarding_onboarding_step.go b/onboarding_onboarding_step.go new file mode 100644 index 0000000..ca2077f --- /dev/null +++ b/onboarding_onboarding_step.go @@ -0,0 +1,131 @@ +package odoo + +// OnboardingOnboardingStep represents onboarding.onboarding.step model. +type OnboardingOnboardingStep struct { + ButtonText *String `xmlrpc:"button_text,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrentProgressStepId *Many2One `xmlrpc:"current_progress_step_id,omitempty"` + CurrentStepState *Selection `xmlrpc:"current_step_state,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DoneIcon *String `xmlrpc:"done_icon,omitempty"` + DoneText *String `xmlrpc:"done_text,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsPerCompany *Bool `xmlrpc:"is_per_company,omitempty"` + OnboardingIds *Relation `xmlrpc:"onboarding_ids,omitempty"` + PanelStepOpenActionName *String `xmlrpc:"panel_step_open_action_name,omitempty"` + ProgressIds *Relation `xmlrpc:"progress_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + StepImage *String `xmlrpc:"step_image,omitempty"` + StepImageAlt *String `xmlrpc:"step_image_alt,omitempty"` + StepImageFilename *String `xmlrpc:"step_image_filename,omitempty"` + Title *String `xmlrpc:"title,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// OnboardingOnboardingSteps represents array of onboarding.onboarding.step model. +type OnboardingOnboardingSteps []OnboardingOnboardingStep + +// OnboardingOnboardingStepModel is the odoo model name. +const OnboardingOnboardingStepModel = "onboarding.onboarding.step" + +// Many2One convert OnboardingOnboardingStep to *Many2One. +func (oos *OnboardingOnboardingStep) Many2One() *Many2One { + return NewMany2One(oos.Id.Get(), "") +} + +// CreateOnboardingOnboardingStep creates a new onboarding.onboarding.step model and returns its id. +func (c *Client) CreateOnboardingOnboardingStep(oos *OnboardingOnboardingStep) (int64, error) { + ids, err := c.CreateOnboardingOnboardingSteps([]*OnboardingOnboardingStep{oos}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateOnboardingOnboardingStep creates a new onboarding.onboarding.step model and returns its id. +func (c *Client) CreateOnboardingOnboardingSteps(ooss []*OnboardingOnboardingStep) ([]int64, error) { + var vv []interface{} + for _, v := range ooss { + vv = append(vv, v) + } + return c.Create(OnboardingOnboardingStepModel, vv, nil) +} + +// UpdateOnboardingOnboardingStep updates an existing onboarding.onboarding.step record. +func (c *Client) UpdateOnboardingOnboardingStep(oos *OnboardingOnboardingStep) error { + return c.UpdateOnboardingOnboardingSteps([]int64{oos.Id.Get()}, oos) +} + +// UpdateOnboardingOnboardingSteps updates existing onboarding.onboarding.step records. +// All records (represented by ids) will be updated by oos values. +func (c *Client) UpdateOnboardingOnboardingSteps(ids []int64, oos *OnboardingOnboardingStep) error { + return c.Update(OnboardingOnboardingStepModel, ids, oos, nil) +} + +// DeleteOnboardingOnboardingStep deletes an existing onboarding.onboarding.step record. +func (c *Client) DeleteOnboardingOnboardingStep(id int64) error { + return c.DeleteOnboardingOnboardingSteps([]int64{id}) +} + +// DeleteOnboardingOnboardingSteps deletes existing onboarding.onboarding.step records. +func (c *Client) DeleteOnboardingOnboardingSteps(ids []int64) error { + return c.Delete(OnboardingOnboardingStepModel, ids) +} + +// GetOnboardingOnboardingStep gets onboarding.onboarding.step existing record. +func (c *Client) GetOnboardingOnboardingStep(id int64) (*OnboardingOnboardingStep, error) { + ooss, err := c.GetOnboardingOnboardingSteps([]int64{id}) + if err != nil { + return nil, err + } + return &((*ooss)[0]), nil +} + +// GetOnboardingOnboardingSteps gets onboarding.onboarding.step existing records. +func (c *Client) GetOnboardingOnboardingSteps(ids []int64) (*OnboardingOnboardingSteps, error) { + ooss := &OnboardingOnboardingSteps{} + if err := c.Read(OnboardingOnboardingStepModel, ids, nil, ooss); err != nil { + return nil, err + } + return ooss, nil +} + +// FindOnboardingOnboardingStep finds onboarding.onboarding.step record by querying it with criteria. +func (c *Client) FindOnboardingOnboardingStep(criteria *Criteria) (*OnboardingOnboardingStep, error) { + ooss := &OnboardingOnboardingSteps{} + if err := c.SearchRead(OnboardingOnboardingStepModel, criteria, NewOptions().Limit(1), ooss); err != nil { + return nil, err + } + return &((*ooss)[0]), nil +} + +// FindOnboardingOnboardingSteps finds onboarding.onboarding.step records by querying it +// and filtering it with criteria and options. +func (c *Client) FindOnboardingOnboardingSteps(criteria *Criteria, options *Options) (*OnboardingOnboardingSteps, error) { + ooss := &OnboardingOnboardingSteps{} + if err := c.SearchRead(OnboardingOnboardingStepModel, criteria, options, ooss); err != nil { + return nil, err + } + return ooss, nil +} + +// FindOnboardingOnboardingStepIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindOnboardingOnboardingStepIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(OnboardingOnboardingStepModel, criteria, options) +} + +// FindOnboardingOnboardingStepId finds record id by querying it with criteria. +func (c *Client) FindOnboardingOnboardingStepId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(OnboardingOnboardingStepModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/onboarding_progress.go b/onboarding_progress.go new file mode 100644 index 0000000..cddf67f --- /dev/null +++ b/onboarding_progress.go @@ -0,0 +1,121 @@ +package odoo + +// OnboardingProgress represents onboarding.progress model. +type OnboardingProgress struct { + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsOnboardingClosed *Bool `xmlrpc:"is_onboarding_closed,omitempty"` + OnboardingId *Many2One `xmlrpc:"onboarding_id,omitempty"` + OnboardingState *Selection `xmlrpc:"onboarding_state,omitempty"` + ProgressStepIds *Relation `xmlrpc:"progress_step_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// OnboardingProgresss represents array of onboarding.progress model. +type OnboardingProgresss []OnboardingProgress + +// OnboardingProgressModel is the odoo model name. +const OnboardingProgressModel = "onboarding.progress" + +// Many2One convert OnboardingProgress to *Many2One. +func (op *OnboardingProgress) Many2One() *Many2One { + return NewMany2One(op.Id.Get(), "") +} + +// CreateOnboardingProgress creates a new onboarding.progress model and returns its id. +func (c *Client) CreateOnboardingProgress(op *OnboardingProgress) (int64, error) { + ids, err := c.CreateOnboardingProgresss([]*OnboardingProgress{op}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateOnboardingProgress creates a new onboarding.progress model and returns its id. +func (c *Client) CreateOnboardingProgresss(ops []*OnboardingProgress) ([]int64, error) { + var vv []interface{} + for _, v := range ops { + vv = append(vv, v) + } + return c.Create(OnboardingProgressModel, vv, nil) +} + +// UpdateOnboardingProgress updates an existing onboarding.progress record. +func (c *Client) UpdateOnboardingProgress(op *OnboardingProgress) error { + return c.UpdateOnboardingProgresss([]int64{op.Id.Get()}, op) +} + +// UpdateOnboardingProgresss updates existing onboarding.progress records. +// All records (represented by ids) will be updated by op values. +func (c *Client) UpdateOnboardingProgresss(ids []int64, op *OnboardingProgress) error { + return c.Update(OnboardingProgressModel, ids, op, nil) +} + +// DeleteOnboardingProgress deletes an existing onboarding.progress record. +func (c *Client) DeleteOnboardingProgress(id int64) error { + return c.DeleteOnboardingProgresss([]int64{id}) +} + +// DeleteOnboardingProgresss deletes existing onboarding.progress records. +func (c *Client) DeleteOnboardingProgresss(ids []int64) error { + return c.Delete(OnboardingProgressModel, ids) +} + +// GetOnboardingProgress gets onboarding.progress existing record. +func (c *Client) GetOnboardingProgress(id int64) (*OnboardingProgress, error) { + ops, err := c.GetOnboardingProgresss([]int64{id}) + if err != nil { + return nil, err + } + return &((*ops)[0]), nil +} + +// GetOnboardingProgresss gets onboarding.progress existing records. +func (c *Client) GetOnboardingProgresss(ids []int64) (*OnboardingProgresss, error) { + ops := &OnboardingProgresss{} + if err := c.Read(OnboardingProgressModel, ids, nil, ops); err != nil { + return nil, err + } + return ops, nil +} + +// FindOnboardingProgress finds onboarding.progress record by querying it with criteria. +func (c *Client) FindOnboardingProgress(criteria *Criteria) (*OnboardingProgress, error) { + ops := &OnboardingProgresss{} + if err := c.SearchRead(OnboardingProgressModel, criteria, NewOptions().Limit(1), ops); err != nil { + return nil, err + } + return &((*ops)[0]), nil +} + +// FindOnboardingProgresss finds onboarding.progress records by querying it +// and filtering it with criteria and options. +func (c *Client) FindOnboardingProgresss(criteria *Criteria, options *Options) (*OnboardingProgresss, error) { + ops := &OnboardingProgresss{} + if err := c.SearchRead(OnboardingProgressModel, criteria, options, ops); err != nil { + return nil, err + } + return ops, nil +} + +// FindOnboardingProgressIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindOnboardingProgressIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(OnboardingProgressModel, criteria, options) +} + +// FindOnboardingProgressId finds record id by querying it with criteria. +func (c *Client) FindOnboardingProgressId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(OnboardingProgressModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/onboarding_progress_step.go b/onboarding_progress_step.go new file mode 100644 index 0000000..41bede9 --- /dev/null +++ b/onboarding_progress_step.go @@ -0,0 +1,120 @@ +package odoo + +// OnboardingProgressStep represents onboarding.progress.step model. +type OnboardingProgressStep struct { + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ProgressIds *Relation `xmlrpc:"progress_ids,omitempty"` + StepId *Many2One `xmlrpc:"step_id,omitempty"` + StepState *Selection `xmlrpc:"step_state,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// OnboardingProgressSteps represents array of onboarding.progress.step model. +type OnboardingProgressSteps []OnboardingProgressStep + +// OnboardingProgressStepModel is the odoo model name. +const OnboardingProgressStepModel = "onboarding.progress.step" + +// Many2One convert OnboardingProgressStep to *Many2One. +func (ops *OnboardingProgressStep) Many2One() *Many2One { + return NewMany2One(ops.Id.Get(), "") +} + +// CreateOnboardingProgressStep creates a new onboarding.progress.step model and returns its id. +func (c *Client) CreateOnboardingProgressStep(ops *OnboardingProgressStep) (int64, error) { + ids, err := c.CreateOnboardingProgressSteps([]*OnboardingProgressStep{ops}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateOnboardingProgressStep creates a new onboarding.progress.step model and returns its id. +func (c *Client) CreateOnboardingProgressSteps(opss []*OnboardingProgressStep) ([]int64, error) { + var vv []interface{} + for _, v := range opss { + vv = append(vv, v) + } + return c.Create(OnboardingProgressStepModel, vv, nil) +} + +// UpdateOnboardingProgressStep updates an existing onboarding.progress.step record. +func (c *Client) UpdateOnboardingProgressStep(ops *OnboardingProgressStep) error { + return c.UpdateOnboardingProgressSteps([]int64{ops.Id.Get()}, ops) +} + +// UpdateOnboardingProgressSteps updates existing onboarding.progress.step records. +// All records (represented by ids) will be updated by ops values. +func (c *Client) UpdateOnboardingProgressSteps(ids []int64, ops *OnboardingProgressStep) error { + return c.Update(OnboardingProgressStepModel, ids, ops, nil) +} + +// DeleteOnboardingProgressStep deletes an existing onboarding.progress.step record. +func (c *Client) DeleteOnboardingProgressStep(id int64) error { + return c.DeleteOnboardingProgressSteps([]int64{id}) +} + +// DeleteOnboardingProgressSteps deletes existing onboarding.progress.step records. +func (c *Client) DeleteOnboardingProgressSteps(ids []int64) error { + return c.Delete(OnboardingProgressStepModel, ids) +} + +// GetOnboardingProgressStep gets onboarding.progress.step existing record. +func (c *Client) GetOnboardingProgressStep(id int64) (*OnboardingProgressStep, error) { + opss, err := c.GetOnboardingProgressSteps([]int64{id}) + if err != nil { + return nil, err + } + return &((*opss)[0]), nil +} + +// GetOnboardingProgressSteps gets onboarding.progress.step existing records. +func (c *Client) GetOnboardingProgressSteps(ids []int64) (*OnboardingProgressSteps, error) { + opss := &OnboardingProgressSteps{} + if err := c.Read(OnboardingProgressStepModel, ids, nil, opss); err != nil { + return nil, err + } + return opss, nil +} + +// FindOnboardingProgressStep finds onboarding.progress.step record by querying it with criteria. +func (c *Client) FindOnboardingProgressStep(criteria *Criteria) (*OnboardingProgressStep, error) { + opss := &OnboardingProgressSteps{} + if err := c.SearchRead(OnboardingProgressStepModel, criteria, NewOptions().Limit(1), opss); err != nil { + return nil, err + } + return &((*opss)[0]), nil +} + +// FindOnboardingProgressSteps finds onboarding.progress.step records by querying it +// and filtering it with criteria and options. +func (c *Client) FindOnboardingProgressSteps(criteria *Criteria, options *Options) (*OnboardingProgressSteps, error) { + opss := &OnboardingProgressSteps{} + if err := c.SearchRead(OnboardingProgressStepModel, criteria, options, opss); err != nil { + return nil, err + } + return opss, nil +} + +// FindOnboardingProgressStepIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindOnboardingProgressStepIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(OnboardingProgressStepModel, criteria, options) +} + +// FindOnboardingProgressStepId finds record id by querying it with criteria. +func (c *Client) FindOnboardingProgressStepId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(OnboardingProgressStepModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/payment_capture_wizard.go b/payment_capture_wizard.go new file mode 100644 index 0000000..edb9842 --- /dev/null +++ b/payment_capture_wizard.go @@ -0,0 +1,128 @@ +package odoo + +// PaymentCaptureWizard represents payment.capture.wizard model. +type PaymentCaptureWizard struct { + AmountToCapture *Float `xmlrpc:"amount_to_capture,omitempty"` + AuthorizedAmount *Float `xmlrpc:"authorized_amount,omitempty"` + AvailableAmount *Float `xmlrpc:"available_amount,omitempty"` + CapturedAmount *Float `xmlrpc:"captured_amount,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasDraftChildren *Bool `xmlrpc:"has_draft_children,omitempty"` + HasRemainingAmount *Bool `xmlrpc:"has_remaining_amount,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsAmountToCaptureValid *Bool `xmlrpc:"is_amount_to_capture_valid,omitempty"` + SupportPartialCapture *Bool `xmlrpc:"support_partial_capture,omitempty"` + TransactionIds *Relation `xmlrpc:"transaction_ids,omitempty"` + VoidRemainingAmount *Bool `xmlrpc:"void_remaining_amount,omitempty"` + VoidedAmount *Float `xmlrpc:"voided_amount,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PaymentCaptureWizards represents array of payment.capture.wizard model. +type PaymentCaptureWizards []PaymentCaptureWizard + +// PaymentCaptureWizardModel is the odoo model name. +const PaymentCaptureWizardModel = "payment.capture.wizard" + +// Many2One convert PaymentCaptureWizard to *Many2One. +func (pcw *PaymentCaptureWizard) Many2One() *Many2One { + return NewMany2One(pcw.Id.Get(), "") +} + +// CreatePaymentCaptureWizard creates a new payment.capture.wizard model and returns its id. +func (c *Client) CreatePaymentCaptureWizard(pcw *PaymentCaptureWizard) (int64, error) { + ids, err := c.CreatePaymentCaptureWizards([]*PaymentCaptureWizard{pcw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePaymentCaptureWizard creates a new payment.capture.wizard model and returns its id. +func (c *Client) CreatePaymentCaptureWizards(pcws []*PaymentCaptureWizard) ([]int64, error) { + var vv []interface{} + for _, v := range pcws { + vv = append(vv, v) + } + return c.Create(PaymentCaptureWizardModel, vv, nil) +} + +// UpdatePaymentCaptureWizard updates an existing payment.capture.wizard record. +func (c *Client) UpdatePaymentCaptureWizard(pcw *PaymentCaptureWizard) error { + return c.UpdatePaymentCaptureWizards([]int64{pcw.Id.Get()}, pcw) +} + +// UpdatePaymentCaptureWizards updates existing payment.capture.wizard records. +// All records (represented by ids) will be updated by pcw values. +func (c *Client) UpdatePaymentCaptureWizards(ids []int64, pcw *PaymentCaptureWizard) error { + return c.Update(PaymentCaptureWizardModel, ids, pcw, nil) +} + +// DeletePaymentCaptureWizard deletes an existing payment.capture.wizard record. +func (c *Client) DeletePaymentCaptureWizard(id int64) error { + return c.DeletePaymentCaptureWizards([]int64{id}) +} + +// DeletePaymentCaptureWizards deletes existing payment.capture.wizard records. +func (c *Client) DeletePaymentCaptureWizards(ids []int64) error { + return c.Delete(PaymentCaptureWizardModel, ids) +} + +// GetPaymentCaptureWizard gets payment.capture.wizard existing record. +func (c *Client) GetPaymentCaptureWizard(id int64) (*PaymentCaptureWizard, error) { + pcws, err := c.GetPaymentCaptureWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*pcws)[0]), nil +} + +// GetPaymentCaptureWizards gets payment.capture.wizard existing records. +func (c *Client) GetPaymentCaptureWizards(ids []int64) (*PaymentCaptureWizards, error) { + pcws := &PaymentCaptureWizards{} + if err := c.Read(PaymentCaptureWizardModel, ids, nil, pcws); err != nil { + return nil, err + } + return pcws, nil +} + +// FindPaymentCaptureWizard finds payment.capture.wizard record by querying it with criteria. +func (c *Client) FindPaymentCaptureWizard(criteria *Criteria) (*PaymentCaptureWizard, error) { + pcws := &PaymentCaptureWizards{} + if err := c.SearchRead(PaymentCaptureWizardModel, criteria, NewOptions().Limit(1), pcws); err != nil { + return nil, err + } + return &((*pcws)[0]), nil +} + +// FindPaymentCaptureWizards finds payment.capture.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentCaptureWizards(criteria *Criteria, options *Options) (*PaymentCaptureWizards, error) { + pcws := &PaymentCaptureWizards{} + if err := c.SearchRead(PaymentCaptureWizardModel, criteria, options, pcws); err != nil { + return nil, err + } + return pcws, nil +} + +// FindPaymentCaptureWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentCaptureWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PaymentCaptureWizardModel, criteria, options) +} + +// FindPaymentCaptureWizardId finds record id by querying it with criteria. +func (c *Client) FindPaymentCaptureWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PaymentCaptureWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/payment_link_wizard.go b/payment_link_wizard.go new file mode 100644 index 0000000..0fcce15 --- /dev/null +++ b/payment_link_wizard.go @@ -0,0 +1,135 @@ +package odoo + +// PaymentLinkWizard represents payment.link.wizard model. +type PaymentLinkWizard struct { + Amount *Float `xmlrpc:"amount,omitempty"` + AmountMax *Float `xmlrpc:"amount_max,omitempty"` + AmountPaid *Float `xmlrpc:"amount_paid,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + ConfirmationMessage *String `xmlrpc:"confirmation_message,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DiscountDate *Time `xmlrpc:"discount_date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayOpenInstallments *Bool `xmlrpc:"display_open_installments,omitempty"` + EpdInfo *String `xmlrpc:"epd_info,omitempty"` + HasEligibleEpd *Bool `xmlrpc:"has_eligible_epd,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceAmountDue *Float `xmlrpc:"invoice_amount_due,omitempty"` + Link *String `xmlrpc:"link,omitempty"` + OpenInstallments *String `xmlrpc:"open_installments,omitempty"` + OpenInstallmentsPreview *String `xmlrpc:"open_installments_preview,omitempty"` + PartnerEmail *String `xmlrpc:"partner_email,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + ResId *Int `xmlrpc:"res_id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + WarningMessage *String `xmlrpc:"warning_message,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PaymentLinkWizards represents array of payment.link.wizard model. +type PaymentLinkWizards []PaymentLinkWizard + +// PaymentLinkWizardModel is the odoo model name. +const PaymentLinkWizardModel = "payment.link.wizard" + +// Many2One convert PaymentLinkWizard to *Many2One. +func (plw *PaymentLinkWizard) Many2One() *Many2One { + return NewMany2One(plw.Id.Get(), "") +} + +// CreatePaymentLinkWizard creates a new payment.link.wizard model and returns its id. +func (c *Client) CreatePaymentLinkWizard(plw *PaymentLinkWizard) (int64, error) { + ids, err := c.CreatePaymentLinkWizards([]*PaymentLinkWizard{plw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePaymentLinkWizard creates a new payment.link.wizard model and returns its id. +func (c *Client) CreatePaymentLinkWizards(plws []*PaymentLinkWizard) ([]int64, error) { + var vv []interface{} + for _, v := range plws { + vv = append(vv, v) + } + return c.Create(PaymentLinkWizardModel, vv, nil) +} + +// UpdatePaymentLinkWizard updates an existing payment.link.wizard record. +func (c *Client) UpdatePaymentLinkWizard(plw *PaymentLinkWizard) error { + return c.UpdatePaymentLinkWizards([]int64{plw.Id.Get()}, plw) +} + +// UpdatePaymentLinkWizards updates existing payment.link.wizard records. +// All records (represented by ids) will be updated by plw values. +func (c *Client) UpdatePaymentLinkWizards(ids []int64, plw *PaymentLinkWizard) error { + return c.Update(PaymentLinkWizardModel, ids, plw, nil) +} + +// DeletePaymentLinkWizard deletes an existing payment.link.wizard record. +func (c *Client) DeletePaymentLinkWizard(id int64) error { + return c.DeletePaymentLinkWizards([]int64{id}) +} + +// DeletePaymentLinkWizards deletes existing payment.link.wizard records. +func (c *Client) DeletePaymentLinkWizards(ids []int64) error { + return c.Delete(PaymentLinkWizardModel, ids) +} + +// GetPaymentLinkWizard gets payment.link.wizard existing record. +func (c *Client) GetPaymentLinkWizard(id int64) (*PaymentLinkWizard, error) { + plws, err := c.GetPaymentLinkWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*plws)[0]), nil +} + +// GetPaymentLinkWizards gets payment.link.wizard existing records. +func (c *Client) GetPaymentLinkWizards(ids []int64) (*PaymentLinkWizards, error) { + plws := &PaymentLinkWizards{} + if err := c.Read(PaymentLinkWizardModel, ids, nil, plws); err != nil { + return nil, err + } + return plws, nil +} + +// FindPaymentLinkWizard finds payment.link.wizard record by querying it with criteria. +func (c *Client) FindPaymentLinkWizard(criteria *Criteria) (*PaymentLinkWizard, error) { + plws := &PaymentLinkWizards{} + if err := c.SearchRead(PaymentLinkWizardModel, criteria, NewOptions().Limit(1), plws); err != nil { + return nil, err + } + return &((*plws)[0]), nil +} + +// FindPaymentLinkWizards finds payment.link.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentLinkWizards(criteria *Criteria, options *Options) (*PaymentLinkWizards, error) { + plws := &PaymentLinkWizards{} + if err := c.SearchRead(PaymentLinkWizardModel, criteria, options, plws); err != nil { + return nil, err + } + return plws, nil +} + +// FindPaymentLinkWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentLinkWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PaymentLinkWizardModel, criteria, options) +} + +// FindPaymentLinkWizardId finds record id by querying it with criteria. +func (c *Client) FindPaymentLinkWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PaymentLinkWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/payment_method.go b/payment_method.go new file mode 100644 index 0000000..d81429f --- /dev/null +++ b/payment_method.go @@ -0,0 +1,131 @@ +package odoo + +// PaymentMethod represents payment.method model. +type PaymentMethod struct { + Active *Bool `xmlrpc:"active,omitempty"` + BrandIds *Relation `xmlrpc:"brand_ids,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Image *String `xmlrpc:"image,omitempty"` + ImagePaymentForm *String `xmlrpc:"image_payment_form,omitempty"` + IsPrimary *Bool `xmlrpc:"is_primary,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PrimaryPaymentMethodId *Many2One `xmlrpc:"primary_payment_method_id,omitempty"` + ProviderIds *Relation `xmlrpc:"provider_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SupportExpressCheckout *Bool `xmlrpc:"support_express_checkout,omitempty"` + SupportRefund *Selection `xmlrpc:"support_refund,omitempty"` + SupportTokenization *Bool `xmlrpc:"support_tokenization,omitempty"` + SupportedCountryIds *Relation `xmlrpc:"supported_country_ids,omitempty"` + SupportedCurrencyIds *Relation `xmlrpc:"supported_currency_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PaymentMethods represents array of payment.method model. +type PaymentMethods []PaymentMethod + +// PaymentMethodModel is the odoo model name. +const PaymentMethodModel = "payment.method" + +// Many2One convert PaymentMethod to *Many2One. +func (pm *PaymentMethod) Many2One() *Many2One { + return NewMany2One(pm.Id.Get(), "") +} + +// CreatePaymentMethod creates a new payment.method model and returns its id. +func (c *Client) CreatePaymentMethod(pm *PaymentMethod) (int64, error) { + ids, err := c.CreatePaymentMethods([]*PaymentMethod{pm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePaymentMethod creates a new payment.method model and returns its id. +func (c *Client) CreatePaymentMethods(pms []*PaymentMethod) ([]int64, error) { + var vv []interface{} + for _, v := range pms { + vv = append(vv, v) + } + return c.Create(PaymentMethodModel, vv, nil) +} + +// UpdatePaymentMethod updates an existing payment.method record. +func (c *Client) UpdatePaymentMethod(pm *PaymentMethod) error { + return c.UpdatePaymentMethods([]int64{pm.Id.Get()}, pm) +} + +// UpdatePaymentMethods updates existing payment.method records. +// All records (represented by ids) will be updated by pm values. +func (c *Client) UpdatePaymentMethods(ids []int64, pm *PaymentMethod) error { + return c.Update(PaymentMethodModel, ids, pm, nil) +} + +// DeletePaymentMethod deletes an existing payment.method record. +func (c *Client) DeletePaymentMethod(id int64) error { + return c.DeletePaymentMethods([]int64{id}) +} + +// DeletePaymentMethods deletes existing payment.method records. +func (c *Client) DeletePaymentMethods(ids []int64) error { + return c.Delete(PaymentMethodModel, ids) +} + +// GetPaymentMethod gets payment.method existing record. +func (c *Client) GetPaymentMethod(id int64) (*PaymentMethod, error) { + pms, err := c.GetPaymentMethods([]int64{id}) + if err != nil { + return nil, err + } + return &((*pms)[0]), nil +} + +// GetPaymentMethods gets payment.method existing records. +func (c *Client) GetPaymentMethods(ids []int64) (*PaymentMethods, error) { + pms := &PaymentMethods{} + if err := c.Read(PaymentMethodModel, ids, nil, pms); err != nil { + return nil, err + } + return pms, nil +} + +// FindPaymentMethod finds payment.method record by querying it with criteria. +func (c *Client) FindPaymentMethod(criteria *Criteria) (*PaymentMethod, error) { + pms := &PaymentMethods{} + if err := c.SearchRead(PaymentMethodModel, criteria, NewOptions().Limit(1), pms); err != nil { + return nil, err + } + return &((*pms)[0]), nil +} + +// FindPaymentMethods finds payment.method records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentMethods(criteria *Criteria, options *Options) (*PaymentMethods, error) { + pms := &PaymentMethods{} + if err := c.SearchRead(PaymentMethodModel, criteria, options, pms); err != nil { + return nil, err + } + return pms, nil +} + +// FindPaymentMethodIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentMethodIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PaymentMethodModel, criteria, options) +} + +// FindPaymentMethodId finds record id by querying it with criteria. +func (c *Client) FindPaymentMethodId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PaymentMethodModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/payment_provider.go b/payment_provider.go new file mode 100644 index 0000000..d37e400 --- /dev/null +++ b/payment_provider.go @@ -0,0 +1,152 @@ +package odoo + +// PaymentProvider represents payment.provider model. +type PaymentProvider struct { + AllowExpressCheckout *Bool `xmlrpc:"allow_express_checkout,omitempty"` + AllowTokenization *Bool `xmlrpc:"allow_tokenization,omitempty"` + AuthMsg *String `xmlrpc:"auth_msg,omitempty"` + AvailableCountryIds *Relation `xmlrpc:"available_country_ids,omitempty"` + AvailableCurrencyIds *Relation `xmlrpc:"available_currency_ids,omitempty"` + CancelMsg *String `xmlrpc:"cancel_msg,omitempty"` + CaptureManually *Bool `xmlrpc:"capture_manually,omitempty"` + Code *Selection `xmlrpc:"code,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CustomMode *Selection `xmlrpc:"custom_mode,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DoneMsg *String `xmlrpc:"done_msg,omitempty"` + ExpressCheckoutFormViewId *Many2One `xmlrpc:"express_checkout_form_view_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Image128 *String `xmlrpc:"image_128,omitempty"` + InlineFormViewId *Many2One `xmlrpc:"inline_form_view_id,omitempty"` + IsPublished *Bool `xmlrpc:"is_published,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + MainCurrencyId *Many2One `xmlrpc:"main_currency_id,omitempty"` + MaximumAmount *Float `xmlrpc:"maximum_amount,omitempty"` + ModuleId *Many2One `xmlrpc:"module_id,omitempty"` + ModuleState *Selection `xmlrpc:"module_state,omitempty"` + ModuleToBuy *Bool `xmlrpc:"module_to_buy,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PaymentMethodIds *Relation `xmlrpc:"payment_method_ids,omitempty"` + PendingMsg *String `xmlrpc:"pending_msg,omitempty"` + PreMsg *String `xmlrpc:"pre_msg,omitempty"` + QrCode *Bool `xmlrpc:"qr_code,omitempty"` + RedirectFormViewId *Many2One `xmlrpc:"redirect_form_view_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SoReferenceType *Selection `xmlrpc:"so_reference_type,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + SupportExpressCheckout *Bool `xmlrpc:"support_express_checkout,omitempty"` + SupportManualCapture *Selection `xmlrpc:"support_manual_capture,omitempty"` + SupportRefund *Selection `xmlrpc:"support_refund,omitempty"` + SupportTokenization *Bool `xmlrpc:"support_tokenization,omitempty"` + TokenInlineFormViewId *Many2One `xmlrpc:"token_inline_form_view_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PaymentProviders represents array of payment.provider model. +type PaymentProviders []PaymentProvider + +// PaymentProviderModel is the odoo model name. +const PaymentProviderModel = "payment.provider" + +// Many2One convert PaymentProvider to *Many2One. +func (pp *PaymentProvider) Many2One() *Many2One { + return NewMany2One(pp.Id.Get(), "") +} + +// CreatePaymentProvider creates a new payment.provider model and returns its id. +func (c *Client) CreatePaymentProvider(pp *PaymentProvider) (int64, error) { + ids, err := c.CreatePaymentProviders([]*PaymentProvider{pp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePaymentProvider creates a new payment.provider model and returns its id. +func (c *Client) CreatePaymentProviders(pps []*PaymentProvider) ([]int64, error) { + var vv []interface{} + for _, v := range pps { + vv = append(vv, v) + } + return c.Create(PaymentProviderModel, vv, nil) +} + +// UpdatePaymentProvider updates an existing payment.provider record. +func (c *Client) UpdatePaymentProvider(pp *PaymentProvider) error { + return c.UpdatePaymentProviders([]int64{pp.Id.Get()}, pp) +} + +// UpdatePaymentProviders updates existing payment.provider records. +// All records (represented by ids) will be updated by pp values. +func (c *Client) UpdatePaymentProviders(ids []int64, pp *PaymentProvider) error { + return c.Update(PaymentProviderModel, ids, pp, nil) +} + +// DeletePaymentProvider deletes an existing payment.provider record. +func (c *Client) DeletePaymentProvider(id int64) error { + return c.DeletePaymentProviders([]int64{id}) +} + +// DeletePaymentProviders deletes existing payment.provider records. +func (c *Client) DeletePaymentProviders(ids []int64) error { + return c.Delete(PaymentProviderModel, ids) +} + +// GetPaymentProvider gets payment.provider existing record. +func (c *Client) GetPaymentProvider(id int64) (*PaymentProvider, error) { + pps, err := c.GetPaymentProviders([]int64{id}) + if err != nil { + return nil, err + } + return &((*pps)[0]), nil +} + +// GetPaymentProviders gets payment.provider existing records. +func (c *Client) GetPaymentProviders(ids []int64) (*PaymentProviders, error) { + pps := &PaymentProviders{} + if err := c.Read(PaymentProviderModel, ids, nil, pps); err != nil { + return nil, err + } + return pps, nil +} + +// FindPaymentProvider finds payment.provider record by querying it with criteria. +func (c *Client) FindPaymentProvider(criteria *Criteria) (*PaymentProvider, error) { + pps := &PaymentProviders{} + if err := c.SearchRead(PaymentProviderModel, criteria, NewOptions().Limit(1), pps); err != nil { + return nil, err + } + return &((*pps)[0]), nil +} + +// FindPaymentProviders finds payment.provider records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentProviders(criteria *Criteria, options *Options) (*PaymentProviders, error) { + pps := &PaymentProviders{} + if err := c.SearchRead(PaymentProviderModel, criteria, options, pps); err != nil { + return nil, err + } + return pps, nil +} + +// FindPaymentProviderIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentProviderIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PaymentProviderModel, criteria, options) +} + +// FindPaymentProviderId finds record id by querying it with criteria. +func (c *Client) FindPaymentProviderId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PaymentProviderModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/payment_provider_onboarding_wizard.go b/payment_provider_onboarding_wizard.go new file mode 100644 index 0000000..dc51f7c --- /dev/null +++ b/payment_provider_onboarding_wizard.go @@ -0,0 +1,123 @@ +package odoo + +// PaymentProviderOnboardingWizard represents payment.provider.onboarding.wizard model. +type PaymentProviderOnboardingWizard struct { + DataFetched *Bool `xmlrpc:"_data_fetched,omitempty"` + AccNumber *String `xmlrpc:"acc_number,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalName *String `xmlrpc:"journal_name,omitempty"` + ManualName *String `xmlrpc:"manual_name,omitempty"` + ManualPostMsg *String `xmlrpc:"manual_post_msg,omitempty"` + PaymentMethod *Selection `xmlrpc:"payment_method,omitempty"` + PaypalEmailAccount *String `xmlrpc:"paypal_email_account,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PaymentProviderOnboardingWizards represents array of payment.provider.onboarding.wizard model. +type PaymentProviderOnboardingWizards []PaymentProviderOnboardingWizard + +// PaymentProviderOnboardingWizardModel is the odoo model name. +const PaymentProviderOnboardingWizardModel = "payment.provider.onboarding.wizard" + +// Many2One convert PaymentProviderOnboardingWizard to *Many2One. +func (ppow *PaymentProviderOnboardingWizard) Many2One() *Many2One { + return NewMany2One(ppow.Id.Get(), "") +} + +// CreatePaymentProviderOnboardingWizard creates a new payment.provider.onboarding.wizard model and returns its id. +func (c *Client) CreatePaymentProviderOnboardingWizard(ppow *PaymentProviderOnboardingWizard) (int64, error) { + ids, err := c.CreatePaymentProviderOnboardingWizards([]*PaymentProviderOnboardingWizard{ppow}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePaymentProviderOnboardingWizard creates a new payment.provider.onboarding.wizard model and returns its id. +func (c *Client) CreatePaymentProviderOnboardingWizards(ppows []*PaymentProviderOnboardingWizard) ([]int64, error) { + var vv []interface{} + for _, v := range ppows { + vv = append(vv, v) + } + return c.Create(PaymentProviderOnboardingWizardModel, vv, nil) +} + +// UpdatePaymentProviderOnboardingWizard updates an existing payment.provider.onboarding.wizard record. +func (c *Client) UpdatePaymentProviderOnboardingWizard(ppow *PaymentProviderOnboardingWizard) error { + return c.UpdatePaymentProviderOnboardingWizards([]int64{ppow.Id.Get()}, ppow) +} + +// UpdatePaymentProviderOnboardingWizards updates existing payment.provider.onboarding.wizard records. +// All records (represented by ids) will be updated by ppow values. +func (c *Client) UpdatePaymentProviderOnboardingWizards(ids []int64, ppow *PaymentProviderOnboardingWizard) error { + return c.Update(PaymentProviderOnboardingWizardModel, ids, ppow, nil) +} + +// DeletePaymentProviderOnboardingWizard deletes an existing payment.provider.onboarding.wizard record. +func (c *Client) DeletePaymentProviderOnboardingWizard(id int64) error { + return c.DeletePaymentProviderOnboardingWizards([]int64{id}) +} + +// DeletePaymentProviderOnboardingWizards deletes existing payment.provider.onboarding.wizard records. +func (c *Client) DeletePaymentProviderOnboardingWizards(ids []int64) error { + return c.Delete(PaymentProviderOnboardingWizardModel, ids) +} + +// GetPaymentProviderOnboardingWizard gets payment.provider.onboarding.wizard existing record. +func (c *Client) GetPaymentProviderOnboardingWizard(id int64) (*PaymentProviderOnboardingWizard, error) { + ppows, err := c.GetPaymentProviderOnboardingWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*ppows)[0]), nil +} + +// GetPaymentProviderOnboardingWizards gets payment.provider.onboarding.wizard existing records. +func (c *Client) GetPaymentProviderOnboardingWizards(ids []int64) (*PaymentProviderOnboardingWizards, error) { + ppows := &PaymentProviderOnboardingWizards{} + if err := c.Read(PaymentProviderOnboardingWizardModel, ids, nil, ppows); err != nil { + return nil, err + } + return ppows, nil +} + +// FindPaymentProviderOnboardingWizard finds payment.provider.onboarding.wizard record by querying it with criteria. +func (c *Client) FindPaymentProviderOnboardingWizard(criteria *Criteria) (*PaymentProviderOnboardingWizard, error) { + ppows := &PaymentProviderOnboardingWizards{} + if err := c.SearchRead(PaymentProviderOnboardingWizardModel, criteria, NewOptions().Limit(1), ppows); err != nil { + return nil, err + } + return &((*ppows)[0]), nil +} + +// FindPaymentProviderOnboardingWizards finds payment.provider.onboarding.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentProviderOnboardingWizards(criteria *Criteria, options *Options) (*PaymentProviderOnboardingWizards, error) { + ppows := &PaymentProviderOnboardingWizards{} + if err := c.SearchRead(PaymentProviderOnboardingWizardModel, criteria, options, ppows); err != nil { + return nil, err + } + return ppows, nil +} + +// FindPaymentProviderOnboardingWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentProviderOnboardingWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PaymentProviderOnboardingWizardModel, criteria, options) +} + +// FindPaymentProviderOnboardingWizardId finds record id by querying it with criteria. +func (c *Client) FindPaymentProviderOnboardingWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PaymentProviderOnboardingWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/payment_refund_wizard.go b/payment_refund_wizard.go new file mode 100644 index 0000000..19d108b --- /dev/null +++ b/payment_refund_wizard.go @@ -0,0 +1,125 @@ +package odoo + +// PaymentRefundWizard represents payment.refund.wizard model. +type PaymentRefundWizard struct { + AmountAvailableForRefund *Float `xmlrpc:"amount_available_for_refund,omitempty"` + AmountToRefund *Float `xmlrpc:"amount_to_refund,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasPendingRefund *Bool `xmlrpc:"has_pending_refund,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PaymentAmount *Float `xmlrpc:"payment_amount,omitempty"` + PaymentId *Many2One `xmlrpc:"payment_id,omitempty"` + RefundedAmount *Float `xmlrpc:"refunded_amount,omitempty"` + SupportRefund *Selection `xmlrpc:"support_refund,omitempty"` + TransactionId *Many2One `xmlrpc:"transaction_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PaymentRefundWizards represents array of payment.refund.wizard model. +type PaymentRefundWizards []PaymentRefundWizard + +// PaymentRefundWizardModel is the odoo model name. +const PaymentRefundWizardModel = "payment.refund.wizard" + +// Many2One convert PaymentRefundWizard to *Many2One. +func (prw *PaymentRefundWizard) Many2One() *Many2One { + return NewMany2One(prw.Id.Get(), "") +} + +// CreatePaymentRefundWizard creates a new payment.refund.wizard model and returns its id. +func (c *Client) CreatePaymentRefundWizard(prw *PaymentRefundWizard) (int64, error) { + ids, err := c.CreatePaymentRefundWizards([]*PaymentRefundWizard{prw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePaymentRefundWizard creates a new payment.refund.wizard model and returns its id. +func (c *Client) CreatePaymentRefundWizards(prws []*PaymentRefundWizard) ([]int64, error) { + var vv []interface{} + for _, v := range prws { + vv = append(vv, v) + } + return c.Create(PaymentRefundWizardModel, vv, nil) +} + +// UpdatePaymentRefundWizard updates an existing payment.refund.wizard record. +func (c *Client) UpdatePaymentRefundWizard(prw *PaymentRefundWizard) error { + return c.UpdatePaymentRefundWizards([]int64{prw.Id.Get()}, prw) +} + +// UpdatePaymentRefundWizards updates existing payment.refund.wizard records. +// All records (represented by ids) will be updated by prw values. +func (c *Client) UpdatePaymentRefundWizards(ids []int64, prw *PaymentRefundWizard) error { + return c.Update(PaymentRefundWizardModel, ids, prw, nil) +} + +// DeletePaymentRefundWizard deletes an existing payment.refund.wizard record. +func (c *Client) DeletePaymentRefundWizard(id int64) error { + return c.DeletePaymentRefundWizards([]int64{id}) +} + +// DeletePaymentRefundWizards deletes existing payment.refund.wizard records. +func (c *Client) DeletePaymentRefundWizards(ids []int64) error { + return c.Delete(PaymentRefundWizardModel, ids) +} + +// GetPaymentRefundWizard gets payment.refund.wizard existing record. +func (c *Client) GetPaymentRefundWizard(id int64) (*PaymentRefundWizard, error) { + prws, err := c.GetPaymentRefundWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*prws)[0]), nil +} + +// GetPaymentRefundWizards gets payment.refund.wizard existing records. +func (c *Client) GetPaymentRefundWizards(ids []int64) (*PaymentRefundWizards, error) { + prws := &PaymentRefundWizards{} + if err := c.Read(PaymentRefundWizardModel, ids, nil, prws); err != nil { + return nil, err + } + return prws, nil +} + +// FindPaymentRefundWizard finds payment.refund.wizard record by querying it with criteria. +func (c *Client) FindPaymentRefundWizard(criteria *Criteria) (*PaymentRefundWizard, error) { + prws := &PaymentRefundWizards{} + if err := c.SearchRead(PaymentRefundWizardModel, criteria, NewOptions().Limit(1), prws); err != nil { + return nil, err + } + return &((*prws)[0]), nil +} + +// FindPaymentRefundWizards finds payment.refund.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentRefundWizards(criteria *Criteria, options *Options) (*PaymentRefundWizards, error) { + prws := &PaymentRefundWizards{} + if err := c.SearchRead(PaymentRefundWizardModel, criteria, options, prws); err != nil { + return nil, err + } + return prws, nil +} + +// FindPaymentRefundWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentRefundWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PaymentRefundWizardModel, criteria, options) +} + +// FindPaymentRefundWizardId finds record id by querying it with criteria. +func (c *Client) FindPaymentRefundWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PaymentRefundWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/payment_token.go b/payment_token.go new file mode 100644 index 0000000..74fa6de --- /dev/null +++ b/payment_token.go @@ -0,0 +1,126 @@ +package odoo + +// PaymentToken represents payment.token model. +type PaymentToken struct { + Active *Bool `xmlrpc:"active,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PaymentDetails *String `xmlrpc:"payment_details,omitempty"` + PaymentMethodCode *String `xmlrpc:"payment_method_code,omitempty"` + PaymentMethodId *Many2One `xmlrpc:"payment_method_id,omitempty"` + ProviderCode *Selection `xmlrpc:"provider_code,omitempty"` + ProviderId *Many2One `xmlrpc:"provider_id,omitempty"` + ProviderRef *String `xmlrpc:"provider_ref,omitempty"` + TransactionIds *Relation `xmlrpc:"transaction_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PaymentTokens represents array of payment.token model. +type PaymentTokens []PaymentToken + +// PaymentTokenModel is the odoo model name. +const PaymentTokenModel = "payment.token" + +// Many2One convert PaymentToken to *Many2One. +func (pt *PaymentToken) Many2One() *Many2One { + return NewMany2One(pt.Id.Get(), "") +} + +// CreatePaymentToken creates a new payment.token model and returns its id. +func (c *Client) CreatePaymentToken(pt *PaymentToken) (int64, error) { + ids, err := c.CreatePaymentTokens([]*PaymentToken{pt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePaymentToken creates a new payment.token model and returns its id. +func (c *Client) CreatePaymentTokens(pts []*PaymentToken) ([]int64, error) { + var vv []interface{} + for _, v := range pts { + vv = append(vv, v) + } + return c.Create(PaymentTokenModel, vv, nil) +} + +// UpdatePaymentToken updates an existing payment.token record. +func (c *Client) UpdatePaymentToken(pt *PaymentToken) error { + return c.UpdatePaymentTokens([]int64{pt.Id.Get()}, pt) +} + +// UpdatePaymentTokens updates existing payment.token records. +// All records (represented by ids) will be updated by pt values. +func (c *Client) UpdatePaymentTokens(ids []int64, pt *PaymentToken) error { + return c.Update(PaymentTokenModel, ids, pt, nil) +} + +// DeletePaymentToken deletes an existing payment.token record. +func (c *Client) DeletePaymentToken(id int64) error { + return c.DeletePaymentTokens([]int64{id}) +} + +// DeletePaymentTokens deletes existing payment.token records. +func (c *Client) DeletePaymentTokens(ids []int64) error { + return c.Delete(PaymentTokenModel, ids) +} + +// GetPaymentToken gets payment.token existing record. +func (c *Client) GetPaymentToken(id int64) (*PaymentToken, error) { + pts, err := c.GetPaymentTokens([]int64{id}) + if err != nil { + return nil, err + } + return &((*pts)[0]), nil +} + +// GetPaymentTokens gets payment.token existing records. +func (c *Client) GetPaymentTokens(ids []int64) (*PaymentTokens, error) { + pts := &PaymentTokens{} + if err := c.Read(PaymentTokenModel, ids, nil, pts); err != nil { + return nil, err + } + return pts, nil +} + +// FindPaymentToken finds payment.token record by querying it with criteria. +func (c *Client) FindPaymentToken(criteria *Criteria) (*PaymentToken, error) { + pts := &PaymentTokens{} + if err := c.SearchRead(PaymentTokenModel, criteria, NewOptions().Limit(1), pts); err != nil { + return nil, err + } + return &((*pts)[0]), nil +} + +// FindPaymentTokens finds payment.token records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentTokens(criteria *Criteria, options *Options) (*PaymentTokens, error) { + pts := &PaymentTokens{} + if err := c.SearchRead(PaymentTokenModel, criteria, options, pts); err != nil { + return nil, err + } + return pts, nil +} + +// FindPaymentTokenIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentTokenIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PaymentTokenModel, criteria, options) +} + +// FindPaymentTokenId finds record id by querying it with criteria. +func (c *Client) FindPaymentTokenId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PaymentTokenModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/payment_transaction.go b/payment_transaction.go new file mode 100644 index 0000000..60910b6 --- /dev/null +++ b/payment_transaction.go @@ -0,0 +1,151 @@ +package odoo + +// PaymentTransaction represents payment.transaction model. +type PaymentTransaction struct { + Amount *Float `xmlrpc:"amount,omitempty"` + ChildTransactionIds *Relation `xmlrpc:"child_transaction_ids,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceIds *Relation `xmlrpc:"invoice_ids,omitempty"` + InvoicesCount *Int `xmlrpc:"invoices_count,omitempty"` + IsPostProcessed *Bool `xmlrpc:"is_post_processed,omitempty"` + LandingRoute *String `xmlrpc:"landing_route,omitempty"` + LastStateChange *Time `xmlrpc:"last_state_change,omitempty"` + Operation *Selection `xmlrpc:"operation,omitempty"` + PartnerAddress *String `xmlrpc:"partner_address,omitempty"` + PartnerCity *String `xmlrpc:"partner_city,omitempty"` + PartnerCountryId *Many2One `xmlrpc:"partner_country_id,omitempty"` + PartnerEmail *String `xmlrpc:"partner_email,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerLang *Selection `xmlrpc:"partner_lang,omitempty"` + PartnerName *String `xmlrpc:"partner_name,omitempty"` + PartnerPhone *String `xmlrpc:"partner_phone,omitempty"` + PartnerStateId *Many2One `xmlrpc:"partner_state_id,omitempty"` + PartnerZip *String `xmlrpc:"partner_zip,omitempty"` + PaymentId *Many2One `xmlrpc:"payment_id,omitempty"` + PaymentMethodCode *String `xmlrpc:"payment_method_code,omitempty"` + PaymentMethodId *Many2One `xmlrpc:"payment_method_id,omitempty"` + ProviderCode *Selection `xmlrpc:"provider_code,omitempty"` + ProviderId *Many2One `xmlrpc:"provider_id,omitempty"` + ProviderReference *String `xmlrpc:"provider_reference,omitempty"` + Reference *String `xmlrpc:"reference,omitempty"` + RefundsCount *Int `xmlrpc:"refunds_count,omitempty"` + SaleOrderIds *Relation `xmlrpc:"sale_order_ids,omitempty"` + SaleOrderIdsNbr *Int `xmlrpc:"sale_order_ids_nbr,omitempty"` + SourceTransactionId *Many2One `xmlrpc:"source_transaction_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StateMessage *String `xmlrpc:"state_message,omitempty"` + TokenId *Many2One `xmlrpc:"token_id,omitempty"` + Tokenize *Bool `xmlrpc:"tokenize,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PaymentTransactions represents array of payment.transaction model. +type PaymentTransactions []PaymentTransaction + +// PaymentTransactionModel is the odoo model name. +const PaymentTransactionModel = "payment.transaction" + +// Many2One convert PaymentTransaction to *Many2One. +func (pt *PaymentTransaction) Many2One() *Many2One { + return NewMany2One(pt.Id.Get(), "") +} + +// CreatePaymentTransaction creates a new payment.transaction model and returns its id. +func (c *Client) CreatePaymentTransaction(pt *PaymentTransaction) (int64, error) { + ids, err := c.CreatePaymentTransactions([]*PaymentTransaction{pt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePaymentTransaction creates a new payment.transaction model and returns its id. +func (c *Client) CreatePaymentTransactions(pts []*PaymentTransaction) ([]int64, error) { + var vv []interface{} + for _, v := range pts { + vv = append(vv, v) + } + return c.Create(PaymentTransactionModel, vv, nil) +} + +// UpdatePaymentTransaction updates an existing payment.transaction record. +func (c *Client) UpdatePaymentTransaction(pt *PaymentTransaction) error { + return c.UpdatePaymentTransactions([]int64{pt.Id.Get()}, pt) +} + +// UpdatePaymentTransactions updates existing payment.transaction records. +// All records (represented by ids) will be updated by pt values. +func (c *Client) UpdatePaymentTransactions(ids []int64, pt *PaymentTransaction) error { + return c.Update(PaymentTransactionModel, ids, pt, nil) +} + +// DeletePaymentTransaction deletes an existing payment.transaction record. +func (c *Client) DeletePaymentTransaction(id int64) error { + return c.DeletePaymentTransactions([]int64{id}) +} + +// DeletePaymentTransactions deletes existing payment.transaction records. +func (c *Client) DeletePaymentTransactions(ids []int64) error { + return c.Delete(PaymentTransactionModel, ids) +} + +// GetPaymentTransaction gets payment.transaction existing record. +func (c *Client) GetPaymentTransaction(id int64) (*PaymentTransaction, error) { + pts, err := c.GetPaymentTransactions([]int64{id}) + if err != nil { + return nil, err + } + return &((*pts)[0]), nil +} + +// GetPaymentTransactions gets payment.transaction existing records. +func (c *Client) GetPaymentTransactions(ids []int64) (*PaymentTransactions, error) { + pts := &PaymentTransactions{} + if err := c.Read(PaymentTransactionModel, ids, nil, pts); err != nil { + return nil, err + } + return pts, nil +} + +// FindPaymentTransaction finds payment.transaction record by querying it with criteria. +func (c *Client) FindPaymentTransaction(criteria *Criteria) (*PaymentTransaction, error) { + pts := &PaymentTransactions{} + if err := c.SearchRead(PaymentTransactionModel, criteria, NewOptions().Limit(1), pts); err != nil { + return nil, err + } + return &((*pts)[0]), nil +} + +// FindPaymentTransactions finds payment.transaction records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentTransactions(criteria *Criteria, options *Options) (*PaymentTransactions, error) { + pts := &PaymentTransactions{} + if err := c.SearchRead(PaymentTransactionModel, criteria, options, pts); err != nil { + return nil, err + } + return pts, nil +} + +// FindPaymentTransactionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPaymentTransactionIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PaymentTransactionModel, criteria, options) +} + +// FindPaymentTransactionId finds record id by querying it with criteria. +func (c *Client) FindPaymentTransactionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PaymentTransactionModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/phone_blacklist.go b/phone_blacklist.go new file mode 100644 index 0000000..4b422e9 --- /dev/null +++ b/phone_blacklist.go @@ -0,0 +1,131 @@ +package odoo + +// PhoneBlacklist represents phone.blacklist model. +type PhoneBlacklist struct { + Active *Bool `xmlrpc:"active,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Number *String `xmlrpc:"number,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PhoneBlacklists represents array of phone.blacklist model. +type PhoneBlacklists []PhoneBlacklist + +// PhoneBlacklistModel is the odoo model name. +const PhoneBlacklistModel = "phone.blacklist" + +// Many2One convert PhoneBlacklist to *Many2One. +func (pb *PhoneBlacklist) Many2One() *Many2One { + return NewMany2One(pb.Id.Get(), "") +} + +// CreatePhoneBlacklist creates a new phone.blacklist model and returns its id. +func (c *Client) CreatePhoneBlacklist(pb *PhoneBlacklist) (int64, error) { + ids, err := c.CreatePhoneBlacklists([]*PhoneBlacklist{pb}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePhoneBlacklist creates a new phone.blacklist model and returns its id. +func (c *Client) CreatePhoneBlacklists(pbs []*PhoneBlacklist) ([]int64, error) { + var vv []interface{} + for _, v := range pbs { + vv = append(vv, v) + } + return c.Create(PhoneBlacklistModel, vv, nil) +} + +// UpdatePhoneBlacklist updates an existing phone.blacklist record. +func (c *Client) UpdatePhoneBlacklist(pb *PhoneBlacklist) error { + return c.UpdatePhoneBlacklists([]int64{pb.Id.Get()}, pb) +} + +// UpdatePhoneBlacklists updates existing phone.blacklist records. +// All records (represented by ids) will be updated by pb values. +func (c *Client) UpdatePhoneBlacklists(ids []int64, pb *PhoneBlacklist) error { + return c.Update(PhoneBlacklistModel, ids, pb, nil) +} + +// DeletePhoneBlacklist deletes an existing phone.blacklist record. +func (c *Client) DeletePhoneBlacklist(id int64) error { + return c.DeletePhoneBlacklists([]int64{id}) +} + +// DeletePhoneBlacklists deletes existing phone.blacklist records. +func (c *Client) DeletePhoneBlacklists(ids []int64) error { + return c.Delete(PhoneBlacklistModel, ids) +} + +// GetPhoneBlacklist gets phone.blacklist existing record. +func (c *Client) GetPhoneBlacklist(id int64) (*PhoneBlacklist, error) { + pbs, err := c.GetPhoneBlacklists([]int64{id}) + if err != nil { + return nil, err + } + return &((*pbs)[0]), nil +} + +// GetPhoneBlacklists gets phone.blacklist existing records. +func (c *Client) GetPhoneBlacklists(ids []int64) (*PhoneBlacklists, error) { + pbs := &PhoneBlacklists{} + if err := c.Read(PhoneBlacklistModel, ids, nil, pbs); err != nil { + return nil, err + } + return pbs, nil +} + +// FindPhoneBlacklist finds phone.blacklist record by querying it with criteria. +func (c *Client) FindPhoneBlacklist(criteria *Criteria) (*PhoneBlacklist, error) { + pbs := &PhoneBlacklists{} + if err := c.SearchRead(PhoneBlacklistModel, criteria, NewOptions().Limit(1), pbs); err != nil { + return nil, err + } + return &((*pbs)[0]), nil +} + +// FindPhoneBlacklists finds phone.blacklist records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPhoneBlacklists(criteria *Criteria, options *Options) (*PhoneBlacklists, error) { + pbs := &PhoneBlacklists{} + if err := c.SearchRead(PhoneBlacklistModel, criteria, options, pbs); err != nil { + return nil, err + } + return pbs, nil +} + +// FindPhoneBlacklistIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPhoneBlacklistIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PhoneBlacklistModel, criteria, options) +} + +// FindPhoneBlacklistId finds record id by querying it with criteria. +func (c *Client) FindPhoneBlacklistId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PhoneBlacklistModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/phone_blacklist_remove.go b/phone_blacklist_remove.go new file mode 100644 index 0000000..fc7f083 --- /dev/null +++ b/phone_blacklist_remove.go @@ -0,0 +1,118 @@ +package odoo + +// PhoneBlacklistRemove represents phone.blacklist.remove model. +type PhoneBlacklistRemove struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Phone *String `xmlrpc:"phone,omitempty"` + Reason *String `xmlrpc:"reason,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PhoneBlacklistRemoves represents array of phone.blacklist.remove model. +type PhoneBlacklistRemoves []PhoneBlacklistRemove + +// PhoneBlacklistRemoveModel is the odoo model name. +const PhoneBlacklistRemoveModel = "phone.blacklist.remove" + +// Many2One convert PhoneBlacklistRemove to *Many2One. +func (pbr *PhoneBlacklistRemove) Many2One() *Many2One { + return NewMany2One(pbr.Id.Get(), "") +} + +// CreatePhoneBlacklistRemove creates a new phone.blacklist.remove model and returns its id. +func (c *Client) CreatePhoneBlacklistRemove(pbr *PhoneBlacklistRemove) (int64, error) { + ids, err := c.CreatePhoneBlacklistRemoves([]*PhoneBlacklistRemove{pbr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePhoneBlacklistRemove creates a new phone.blacklist.remove model and returns its id. +func (c *Client) CreatePhoneBlacklistRemoves(pbrs []*PhoneBlacklistRemove) ([]int64, error) { + var vv []interface{} + for _, v := range pbrs { + vv = append(vv, v) + } + return c.Create(PhoneBlacklistRemoveModel, vv, nil) +} + +// UpdatePhoneBlacklistRemove updates an existing phone.blacklist.remove record. +func (c *Client) UpdatePhoneBlacklistRemove(pbr *PhoneBlacklistRemove) error { + return c.UpdatePhoneBlacklistRemoves([]int64{pbr.Id.Get()}, pbr) +} + +// UpdatePhoneBlacklistRemoves updates existing phone.blacklist.remove records. +// All records (represented by ids) will be updated by pbr values. +func (c *Client) UpdatePhoneBlacklistRemoves(ids []int64, pbr *PhoneBlacklistRemove) error { + return c.Update(PhoneBlacklistRemoveModel, ids, pbr, nil) +} + +// DeletePhoneBlacklistRemove deletes an existing phone.blacklist.remove record. +func (c *Client) DeletePhoneBlacklistRemove(id int64) error { + return c.DeletePhoneBlacklistRemoves([]int64{id}) +} + +// DeletePhoneBlacklistRemoves deletes existing phone.blacklist.remove records. +func (c *Client) DeletePhoneBlacklistRemoves(ids []int64) error { + return c.Delete(PhoneBlacklistRemoveModel, ids) +} + +// GetPhoneBlacklistRemove gets phone.blacklist.remove existing record. +func (c *Client) GetPhoneBlacklistRemove(id int64) (*PhoneBlacklistRemove, error) { + pbrs, err := c.GetPhoneBlacklistRemoves([]int64{id}) + if err != nil { + return nil, err + } + return &((*pbrs)[0]), nil +} + +// GetPhoneBlacklistRemoves gets phone.blacklist.remove existing records. +func (c *Client) GetPhoneBlacklistRemoves(ids []int64) (*PhoneBlacklistRemoves, error) { + pbrs := &PhoneBlacklistRemoves{} + if err := c.Read(PhoneBlacklistRemoveModel, ids, nil, pbrs); err != nil { + return nil, err + } + return pbrs, nil +} + +// FindPhoneBlacklistRemove finds phone.blacklist.remove record by querying it with criteria. +func (c *Client) FindPhoneBlacklistRemove(criteria *Criteria) (*PhoneBlacklistRemove, error) { + pbrs := &PhoneBlacklistRemoves{} + if err := c.SearchRead(PhoneBlacklistRemoveModel, criteria, NewOptions().Limit(1), pbrs); err != nil { + return nil, err + } + return &((*pbrs)[0]), nil +} + +// FindPhoneBlacklistRemoves finds phone.blacklist.remove records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPhoneBlacklistRemoves(criteria *Criteria, options *Options) (*PhoneBlacklistRemoves, error) { + pbrs := &PhoneBlacklistRemoves{} + if err := c.SearchRead(PhoneBlacklistRemoveModel, criteria, options, pbrs); err != nil { + return nil, err + } + return pbrs, nil +} + +// FindPhoneBlacklistRemoveIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPhoneBlacklistRemoveIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PhoneBlacklistRemoveModel, criteria, options) +} + +// FindPhoneBlacklistRemoveId finds record id by querying it with criteria. +func (c *Client) FindPhoneBlacklistRemoveId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PhoneBlacklistRemoveModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/portal_share.go b/portal_share.go new file mode 100644 index 0000000..5a2d11c --- /dev/null +++ b/portal_share.go @@ -0,0 +1,123 @@ +package odoo + +// PortalShare represents portal.share model. +type PortalShare struct { + AccessWarning *String `xmlrpc:"access_warning,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + ResId *Int `xmlrpc:"res_id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + ResourceRef *String `xmlrpc:"resource_ref,omitempty"` + ShareLink *String `xmlrpc:"share_link,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PortalShares represents array of portal.share model. +type PortalShares []PortalShare + +// PortalShareModel is the odoo model name. +const PortalShareModel = "portal.share" + +// Many2One convert PortalShare to *Many2One. +func (ps *PortalShare) Many2One() *Many2One { + return NewMany2One(ps.Id.Get(), "") +} + +// CreatePortalShare creates a new portal.share model and returns its id. +func (c *Client) CreatePortalShare(ps *PortalShare) (int64, error) { + ids, err := c.CreatePortalShares([]*PortalShare{ps}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePortalShare creates a new portal.share model and returns its id. +func (c *Client) CreatePortalShares(pss []*PortalShare) ([]int64, error) { + var vv []interface{} + for _, v := range pss { + vv = append(vv, v) + } + return c.Create(PortalShareModel, vv, nil) +} + +// UpdatePortalShare updates an existing portal.share record. +func (c *Client) UpdatePortalShare(ps *PortalShare) error { + return c.UpdatePortalShares([]int64{ps.Id.Get()}, ps) +} + +// UpdatePortalShares updates existing portal.share records. +// All records (represented by ids) will be updated by ps values. +func (c *Client) UpdatePortalShares(ids []int64, ps *PortalShare) error { + return c.Update(PortalShareModel, ids, ps, nil) +} + +// DeletePortalShare deletes an existing portal.share record. +func (c *Client) DeletePortalShare(id int64) error { + return c.DeletePortalShares([]int64{id}) +} + +// DeletePortalShares deletes existing portal.share records. +func (c *Client) DeletePortalShares(ids []int64) error { + return c.Delete(PortalShareModel, ids) +} + +// GetPortalShare gets portal.share existing record. +func (c *Client) GetPortalShare(id int64) (*PortalShare, error) { + pss, err := c.GetPortalShares([]int64{id}) + if err != nil { + return nil, err + } + return &((*pss)[0]), nil +} + +// GetPortalShares gets portal.share existing records. +func (c *Client) GetPortalShares(ids []int64) (*PortalShares, error) { + pss := &PortalShares{} + if err := c.Read(PortalShareModel, ids, nil, pss); err != nil { + return nil, err + } + return pss, nil +} + +// FindPortalShare finds portal.share record by querying it with criteria. +func (c *Client) FindPortalShare(criteria *Criteria) (*PortalShare, error) { + pss := &PortalShares{} + if err := c.SearchRead(PortalShareModel, criteria, NewOptions().Limit(1), pss); err != nil { + return nil, err + } + return &((*pss)[0]), nil +} + +// FindPortalShares finds portal.share records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPortalShares(criteria *Criteria, options *Options) (*PortalShares, error) { + pss := &PortalShares{} + if err := c.SearchRead(PortalShareModel, criteria, options, pss); err != nil { + return nil, err + } + return pss, nil +} + +// FindPortalShareIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPortalShareIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PortalShareModel, criteria, options) +} + +// FindPortalShareId finds record id by querying it with criteria. +func (c *Client) FindPortalShareId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PortalShareModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/portal_wizard.go b/portal_wizard.go new file mode 100644 index 0000000..9607be7 --- /dev/null +++ b/portal_wizard.go @@ -0,0 +1,119 @@ +package odoo + +// PortalWizard represents portal.wizard model. +type PortalWizard struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + UserIds *Relation `xmlrpc:"user_ids,omitempty"` + WelcomeMessage *String `xmlrpc:"welcome_message,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PortalWizards represents array of portal.wizard model. +type PortalWizards []PortalWizard + +// PortalWizardModel is the odoo model name. +const PortalWizardModel = "portal.wizard" + +// Many2One convert PortalWizard to *Many2One. +func (pw *PortalWizard) Many2One() *Many2One { + return NewMany2One(pw.Id.Get(), "") +} + +// CreatePortalWizard creates a new portal.wizard model and returns its id. +func (c *Client) CreatePortalWizard(pw *PortalWizard) (int64, error) { + ids, err := c.CreatePortalWizards([]*PortalWizard{pw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePortalWizard creates a new portal.wizard model and returns its id. +func (c *Client) CreatePortalWizards(pws []*PortalWizard) ([]int64, error) { + var vv []interface{} + for _, v := range pws { + vv = append(vv, v) + } + return c.Create(PortalWizardModel, vv, nil) +} + +// UpdatePortalWizard updates an existing portal.wizard record. +func (c *Client) UpdatePortalWizard(pw *PortalWizard) error { + return c.UpdatePortalWizards([]int64{pw.Id.Get()}, pw) +} + +// UpdatePortalWizards updates existing portal.wizard records. +// All records (represented by ids) will be updated by pw values. +func (c *Client) UpdatePortalWizards(ids []int64, pw *PortalWizard) error { + return c.Update(PortalWizardModel, ids, pw, nil) +} + +// DeletePortalWizard deletes an existing portal.wizard record. +func (c *Client) DeletePortalWizard(id int64) error { + return c.DeletePortalWizards([]int64{id}) +} + +// DeletePortalWizards deletes existing portal.wizard records. +func (c *Client) DeletePortalWizards(ids []int64) error { + return c.Delete(PortalWizardModel, ids) +} + +// GetPortalWizard gets portal.wizard existing record. +func (c *Client) GetPortalWizard(id int64) (*PortalWizard, error) { + pws, err := c.GetPortalWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*pws)[0]), nil +} + +// GetPortalWizards gets portal.wizard existing records. +func (c *Client) GetPortalWizards(ids []int64) (*PortalWizards, error) { + pws := &PortalWizards{} + if err := c.Read(PortalWizardModel, ids, nil, pws); err != nil { + return nil, err + } + return pws, nil +} + +// FindPortalWizard finds portal.wizard record by querying it with criteria. +func (c *Client) FindPortalWizard(criteria *Criteria) (*PortalWizard, error) { + pws := &PortalWizards{} + if err := c.SearchRead(PortalWizardModel, criteria, NewOptions().Limit(1), pws); err != nil { + return nil, err + } + return &((*pws)[0]), nil +} + +// FindPortalWizards finds portal.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPortalWizards(criteria *Criteria, options *Options) (*PortalWizards, error) { + pws := &PortalWizards{} + if err := c.SearchRead(PortalWizardModel, criteria, options, pws); err != nil { + return nil, err + } + return pws, nil +} + +// FindPortalWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPortalWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PortalWizardModel, criteria, options) +} + +// FindPortalWizardId finds record id by querying it with criteria. +func (c *Client) FindPortalWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PortalWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/portal_wizard_user.go b/portal_wizard_user.go new file mode 100644 index 0000000..b6eb9f9 --- /dev/null +++ b/portal_wizard_user.go @@ -0,0 +1,124 @@ +package odoo + +// PortalWizardUser represents portal.wizard.user model. +type PortalWizardUser struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + EmailState *Selection `xmlrpc:"email_state,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsInternal *Bool `xmlrpc:"is_internal,omitempty"` + IsPortal *Bool `xmlrpc:"is_portal,omitempty"` + LoginDate *Time `xmlrpc:"login_date,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WizardId *Many2One `xmlrpc:"wizard_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PortalWizardUsers represents array of portal.wizard.user model. +type PortalWizardUsers []PortalWizardUser + +// PortalWizardUserModel is the odoo model name. +const PortalWizardUserModel = "portal.wizard.user" + +// Many2One convert PortalWizardUser to *Many2One. +func (pwu *PortalWizardUser) Many2One() *Many2One { + return NewMany2One(pwu.Id.Get(), "") +} + +// CreatePortalWizardUser creates a new portal.wizard.user model and returns its id. +func (c *Client) CreatePortalWizardUser(pwu *PortalWizardUser) (int64, error) { + ids, err := c.CreatePortalWizardUsers([]*PortalWizardUser{pwu}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePortalWizardUser creates a new portal.wizard.user model and returns its id. +func (c *Client) CreatePortalWizardUsers(pwus []*PortalWizardUser) ([]int64, error) { + var vv []interface{} + for _, v := range pwus { + vv = append(vv, v) + } + return c.Create(PortalWizardUserModel, vv, nil) +} + +// UpdatePortalWizardUser updates an existing portal.wizard.user record. +func (c *Client) UpdatePortalWizardUser(pwu *PortalWizardUser) error { + return c.UpdatePortalWizardUsers([]int64{pwu.Id.Get()}, pwu) +} + +// UpdatePortalWizardUsers updates existing portal.wizard.user records. +// All records (represented by ids) will be updated by pwu values. +func (c *Client) UpdatePortalWizardUsers(ids []int64, pwu *PortalWizardUser) error { + return c.Update(PortalWizardUserModel, ids, pwu, nil) +} + +// DeletePortalWizardUser deletes an existing portal.wizard.user record. +func (c *Client) DeletePortalWizardUser(id int64) error { + return c.DeletePortalWizardUsers([]int64{id}) +} + +// DeletePortalWizardUsers deletes existing portal.wizard.user records. +func (c *Client) DeletePortalWizardUsers(ids []int64) error { + return c.Delete(PortalWizardUserModel, ids) +} + +// GetPortalWizardUser gets portal.wizard.user existing record. +func (c *Client) GetPortalWizardUser(id int64) (*PortalWizardUser, error) { + pwus, err := c.GetPortalWizardUsers([]int64{id}) + if err != nil { + return nil, err + } + return &((*pwus)[0]), nil +} + +// GetPortalWizardUsers gets portal.wizard.user existing records. +func (c *Client) GetPortalWizardUsers(ids []int64) (*PortalWizardUsers, error) { + pwus := &PortalWizardUsers{} + if err := c.Read(PortalWizardUserModel, ids, nil, pwus); err != nil { + return nil, err + } + return pwus, nil +} + +// FindPortalWizardUser finds portal.wizard.user record by querying it with criteria. +func (c *Client) FindPortalWizardUser(criteria *Criteria) (*PortalWizardUser, error) { + pwus := &PortalWizardUsers{} + if err := c.SearchRead(PortalWizardUserModel, criteria, NewOptions().Limit(1), pwus); err != nil { + return nil, err + } + return &((*pwus)[0]), nil +} + +// FindPortalWizardUsers finds portal.wizard.user records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPortalWizardUsers(criteria *Criteria, options *Options) (*PortalWizardUsers, error) { + pwus := &PortalWizardUsers{} + if err := c.SearchRead(PortalWizardUserModel, criteria, options, pwus); err != nil { + return nil, err + } + return pwus, nil +} + +// FindPortalWizardUserIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPortalWizardUserIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PortalWizardUserModel, criteria, options) +} + +// FindPortalWizardUserId finds record id by querying it with criteria. +func (c *Client) FindPortalWizardUserId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PortalWizardUserModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/privacy_log.go b/privacy_log.go new file mode 100644 index 0000000..863b0a0 --- /dev/null +++ b/privacy_log.go @@ -0,0 +1,123 @@ +package odoo + +// PrivacyLog represents privacy.log model. +type PrivacyLog struct { + AdditionalNote *String `xmlrpc:"additional_note,omitempty"` + AnonymizedEmail *String `xmlrpc:"anonymized_email,omitempty"` + AnonymizedName *String `xmlrpc:"anonymized_name,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExecutionDetails *String `xmlrpc:"execution_details,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + RecordsDescription *String `xmlrpc:"records_description,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PrivacyLogs represents array of privacy.log model. +type PrivacyLogs []PrivacyLog + +// PrivacyLogModel is the odoo model name. +const PrivacyLogModel = "privacy.log" + +// Many2One convert PrivacyLog to *Many2One. +func (pl *PrivacyLog) Many2One() *Many2One { + return NewMany2One(pl.Id.Get(), "") +} + +// CreatePrivacyLog creates a new privacy.log model and returns its id. +func (c *Client) CreatePrivacyLog(pl *PrivacyLog) (int64, error) { + ids, err := c.CreatePrivacyLogs([]*PrivacyLog{pl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePrivacyLog creates a new privacy.log model and returns its id. +func (c *Client) CreatePrivacyLogs(pls []*PrivacyLog) ([]int64, error) { + var vv []interface{} + for _, v := range pls { + vv = append(vv, v) + } + return c.Create(PrivacyLogModel, vv, nil) +} + +// UpdatePrivacyLog updates an existing privacy.log record. +func (c *Client) UpdatePrivacyLog(pl *PrivacyLog) error { + return c.UpdatePrivacyLogs([]int64{pl.Id.Get()}, pl) +} + +// UpdatePrivacyLogs updates existing privacy.log records. +// All records (represented by ids) will be updated by pl values. +func (c *Client) UpdatePrivacyLogs(ids []int64, pl *PrivacyLog) error { + return c.Update(PrivacyLogModel, ids, pl, nil) +} + +// DeletePrivacyLog deletes an existing privacy.log record. +func (c *Client) DeletePrivacyLog(id int64) error { + return c.DeletePrivacyLogs([]int64{id}) +} + +// DeletePrivacyLogs deletes existing privacy.log records. +func (c *Client) DeletePrivacyLogs(ids []int64) error { + return c.Delete(PrivacyLogModel, ids) +} + +// GetPrivacyLog gets privacy.log existing record. +func (c *Client) GetPrivacyLog(id int64) (*PrivacyLog, error) { + pls, err := c.GetPrivacyLogs([]int64{id}) + if err != nil { + return nil, err + } + return &((*pls)[0]), nil +} + +// GetPrivacyLogs gets privacy.log existing records. +func (c *Client) GetPrivacyLogs(ids []int64) (*PrivacyLogs, error) { + pls := &PrivacyLogs{} + if err := c.Read(PrivacyLogModel, ids, nil, pls); err != nil { + return nil, err + } + return pls, nil +} + +// FindPrivacyLog finds privacy.log record by querying it with criteria. +func (c *Client) FindPrivacyLog(criteria *Criteria) (*PrivacyLog, error) { + pls := &PrivacyLogs{} + if err := c.SearchRead(PrivacyLogModel, criteria, NewOptions().Limit(1), pls); err != nil { + return nil, err + } + return &((*pls)[0]), nil +} + +// FindPrivacyLogs finds privacy.log records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPrivacyLogs(criteria *Criteria, options *Options) (*PrivacyLogs, error) { + pls := &PrivacyLogs{} + if err := c.SearchRead(PrivacyLogModel, criteria, options, pls); err != nil { + return nil, err + } + return pls, nil +} + +// FindPrivacyLogIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPrivacyLogIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PrivacyLogModel, criteria, options) +} + +// FindPrivacyLogId finds record id by querying it with criteria. +func (c *Client) FindPrivacyLogId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PrivacyLogModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/privacy_lookup_wizard.go b/privacy_lookup_wizard.go new file mode 100644 index 0000000..e022d7a --- /dev/null +++ b/privacy_lookup_wizard.go @@ -0,0 +1,123 @@ +package odoo + +// PrivacyLookupWizard represents privacy.lookup.wizard model. +type PrivacyLookupWizard struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + ExecutionDetails *String `xmlrpc:"execution_details,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LineCount *Int `xmlrpc:"line_count,omitempty"` + LineIds *Relation `xmlrpc:"line_ids,omitempty"` + LogId *Many2One `xmlrpc:"log_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + RecordsDescription *String `xmlrpc:"records_description,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PrivacyLookupWizards represents array of privacy.lookup.wizard model. +type PrivacyLookupWizards []PrivacyLookupWizard + +// PrivacyLookupWizardModel is the odoo model name. +const PrivacyLookupWizardModel = "privacy.lookup.wizard" + +// Many2One convert PrivacyLookupWizard to *Many2One. +func (plw *PrivacyLookupWizard) Many2One() *Many2One { + return NewMany2One(plw.Id.Get(), "") +} + +// CreatePrivacyLookupWizard creates a new privacy.lookup.wizard model and returns its id. +func (c *Client) CreatePrivacyLookupWizard(plw *PrivacyLookupWizard) (int64, error) { + ids, err := c.CreatePrivacyLookupWizards([]*PrivacyLookupWizard{plw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePrivacyLookupWizard creates a new privacy.lookup.wizard model and returns its id. +func (c *Client) CreatePrivacyLookupWizards(plws []*PrivacyLookupWizard) ([]int64, error) { + var vv []interface{} + for _, v := range plws { + vv = append(vv, v) + } + return c.Create(PrivacyLookupWizardModel, vv, nil) +} + +// UpdatePrivacyLookupWizard updates an existing privacy.lookup.wizard record. +func (c *Client) UpdatePrivacyLookupWizard(plw *PrivacyLookupWizard) error { + return c.UpdatePrivacyLookupWizards([]int64{plw.Id.Get()}, plw) +} + +// UpdatePrivacyLookupWizards updates existing privacy.lookup.wizard records. +// All records (represented by ids) will be updated by plw values. +func (c *Client) UpdatePrivacyLookupWizards(ids []int64, plw *PrivacyLookupWizard) error { + return c.Update(PrivacyLookupWizardModel, ids, plw, nil) +} + +// DeletePrivacyLookupWizard deletes an existing privacy.lookup.wizard record. +func (c *Client) DeletePrivacyLookupWizard(id int64) error { + return c.DeletePrivacyLookupWizards([]int64{id}) +} + +// DeletePrivacyLookupWizards deletes existing privacy.lookup.wizard records. +func (c *Client) DeletePrivacyLookupWizards(ids []int64) error { + return c.Delete(PrivacyLookupWizardModel, ids) +} + +// GetPrivacyLookupWizard gets privacy.lookup.wizard existing record. +func (c *Client) GetPrivacyLookupWizard(id int64) (*PrivacyLookupWizard, error) { + plws, err := c.GetPrivacyLookupWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*plws)[0]), nil +} + +// GetPrivacyLookupWizards gets privacy.lookup.wizard existing records. +func (c *Client) GetPrivacyLookupWizards(ids []int64) (*PrivacyLookupWizards, error) { + plws := &PrivacyLookupWizards{} + if err := c.Read(PrivacyLookupWizardModel, ids, nil, plws); err != nil { + return nil, err + } + return plws, nil +} + +// FindPrivacyLookupWizard finds privacy.lookup.wizard record by querying it with criteria. +func (c *Client) FindPrivacyLookupWizard(criteria *Criteria) (*PrivacyLookupWizard, error) { + plws := &PrivacyLookupWizards{} + if err := c.SearchRead(PrivacyLookupWizardModel, criteria, NewOptions().Limit(1), plws); err != nil { + return nil, err + } + return &((*plws)[0]), nil +} + +// FindPrivacyLookupWizards finds privacy.lookup.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPrivacyLookupWizards(criteria *Criteria, options *Options) (*PrivacyLookupWizards, error) { + plws := &PrivacyLookupWizards{} + if err := c.SearchRead(PrivacyLookupWizardModel, criteria, options, plws); err != nil { + return nil, err + } + return plws, nil +} + +// FindPrivacyLookupWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPrivacyLookupWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PrivacyLookupWizardModel, criteria, options) +} + +// FindPrivacyLookupWizardId finds record id by querying it with criteria. +func (c *Client) FindPrivacyLookupWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PrivacyLookupWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/privacy_lookup_wizard_line.go b/privacy_lookup_wizard_line.go new file mode 100644 index 0000000..d9efe38 --- /dev/null +++ b/privacy_lookup_wizard_line.go @@ -0,0 +1,126 @@ +package odoo + +// PrivacyLookupWizardLine represents privacy.lookup.wizard.line model. +type PrivacyLookupWizardLine struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExecutionDetails *String `xmlrpc:"execution_details,omitempty"` + HasActive *Bool `xmlrpc:"has_active,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsActive *Bool `xmlrpc:"is_active,omitempty"` + IsUnlinked *Bool `xmlrpc:"is_unlinked,omitempty"` + ResId *Int `xmlrpc:"res_id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + ResModelId *Many2One `xmlrpc:"res_model_id,omitempty"` + ResName *String `xmlrpc:"res_name,omitempty"` + ResourceRef *String `xmlrpc:"resource_ref,omitempty"` + WizardId *Many2One `xmlrpc:"wizard_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PrivacyLookupWizardLines represents array of privacy.lookup.wizard.line model. +type PrivacyLookupWizardLines []PrivacyLookupWizardLine + +// PrivacyLookupWizardLineModel is the odoo model name. +const PrivacyLookupWizardLineModel = "privacy.lookup.wizard.line" + +// Many2One convert PrivacyLookupWizardLine to *Many2One. +func (plwl *PrivacyLookupWizardLine) Many2One() *Many2One { + return NewMany2One(plwl.Id.Get(), "") +} + +// CreatePrivacyLookupWizardLine creates a new privacy.lookup.wizard.line model and returns its id. +func (c *Client) CreatePrivacyLookupWizardLine(plwl *PrivacyLookupWizardLine) (int64, error) { + ids, err := c.CreatePrivacyLookupWizardLines([]*PrivacyLookupWizardLine{plwl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePrivacyLookupWizardLine creates a new privacy.lookup.wizard.line model and returns its id. +func (c *Client) CreatePrivacyLookupWizardLines(plwls []*PrivacyLookupWizardLine) ([]int64, error) { + var vv []interface{} + for _, v := range plwls { + vv = append(vv, v) + } + return c.Create(PrivacyLookupWizardLineModel, vv, nil) +} + +// UpdatePrivacyLookupWizardLine updates an existing privacy.lookup.wizard.line record. +func (c *Client) UpdatePrivacyLookupWizardLine(plwl *PrivacyLookupWizardLine) error { + return c.UpdatePrivacyLookupWizardLines([]int64{plwl.Id.Get()}, plwl) +} + +// UpdatePrivacyLookupWizardLines updates existing privacy.lookup.wizard.line records. +// All records (represented by ids) will be updated by plwl values. +func (c *Client) UpdatePrivacyLookupWizardLines(ids []int64, plwl *PrivacyLookupWizardLine) error { + return c.Update(PrivacyLookupWizardLineModel, ids, plwl, nil) +} + +// DeletePrivacyLookupWizardLine deletes an existing privacy.lookup.wizard.line record. +func (c *Client) DeletePrivacyLookupWizardLine(id int64) error { + return c.DeletePrivacyLookupWizardLines([]int64{id}) +} + +// DeletePrivacyLookupWizardLines deletes existing privacy.lookup.wizard.line records. +func (c *Client) DeletePrivacyLookupWizardLines(ids []int64) error { + return c.Delete(PrivacyLookupWizardLineModel, ids) +} + +// GetPrivacyLookupWizardLine gets privacy.lookup.wizard.line existing record. +func (c *Client) GetPrivacyLookupWizardLine(id int64) (*PrivacyLookupWizardLine, error) { + plwls, err := c.GetPrivacyLookupWizardLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*plwls)[0]), nil +} + +// GetPrivacyLookupWizardLines gets privacy.lookup.wizard.line existing records. +func (c *Client) GetPrivacyLookupWizardLines(ids []int64) (*PrivacyLookupWizardLines, error) { + plwls := &PrivacyLookupWizardLines{} + if err := c.Read(PrivacyLookupWizardLineModel, ids, nil, plwls); err != nil { + return nil, err + } + return plwls, nil +} + +// FindPrivacyLookupWizardLine finds privacy.lookup.wizard.line record by querying it with criteria. +func (c *Client) FindPrivacyLookupWizardLine(criteria *Criteria) (*PrivacyLookupWizardLine, error) { + plwls := &PrivacyLookupWizardLines{} + if err := c.SearchRead(PrivacyLookupWizardLineModel, criteria, NewOptions().Limit(1), plwls); err != nil { + return nil, err + } + return &((*plwls)[0]), nil +} + +// FindPrivacyLookupWizardLines finds privacy.lookup.wizard.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPrivacyLookupWizardLines(criteria *Criteria, options *Options) (*PrivacyLookupWizardLines, error) { + plwls := &PrivacyLookupWizardLines{} + if err := c.SearchRead(PrivacyLookupWizardLineModel, criteria, options, plwls); err != nil { + return nil, err + } + return plwls, nil +} + +// FindPrivacyLookupWizardLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPrivacyLookupWizardLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PrivacyLookupWizardLineModel, criteria, options) +} + +// FindPrivacyLookupWizardLineId finds record id by querying it with criteria. +func (c *Client) FindPrivacyLookupWizardLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PrivacyLookupWizardLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_attribute.go b/product_attribute.go new file mode 100644 index 0000000..d288ba8 --- /dev/null +++ b/product_attribute.go @@ -0,0 +1,126 @@ +package odoo + +// ProductAttribute represents product.attribute model. +type ProductAttribute struct { + Active *Bool `xmlrpc:"active,omitempty"` + AttributeLineIds *Relation `xmlrpc:"attribute_line_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CreateVariant *Selection `xmlrpc:"create_variant,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayType *Selection `xmlrpc:"display_type,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NumberRelatedProducts *Int `xmlrpc:"number_related_products,omitempty"` + ProductTmplIds *Relation `xmlrpc:"product_tmpl_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TemplateValueIds *Relation `xmlrpc:"template_value_ids,omitempty"` + ValueIds *Relation `xmlrpc:"value_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductAttributes represents array of product.attribute model. +type ProductAttributes []ProductAttribute + +// ProductAttributeModel is the odoo model name. +const ProductAttributeModel = "product.attribute" + +// Many2One convert ProductAttribute to *Many2One. +func (pa *ProductAttribute) Many2One() *Many2One { + return NewMany2One(pa.Id.Get(), "") +} + +// CreateProductAttribute creates a new product.attribute model and returns its id. +func (c *Client) CreateProductAttribute(pa *ProductAttribute) (int64, error) { + ids, err := c.CreateProductAttributes([]*ProductAttribute{pa}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductAttribute creates a new product.attribute model and returns its id. +func (c *Client) CreateProductAttributes(pas []*ProductAttribute) ([]int64, error) { + var vv []interface{} + for _, v := range pas { + vv = append(vv, v) + } + return c.Create(ProductAttributeModel, vv, nil) +} + +// UpdateProductAttribute updates an existing product.attribute record. +func (c *Client) UpdateProductAttribute(pa *ProductAttribute) error { + return c.UpdateProductAttributes([]int64{pa.Id.Get()}, pa) +} + +// UpdateProductAttributes updates existing product.attribute records. +// All records (represented by ids) will be updated by pa values. +func (c *Client) UpdateProductAttributes(ids []int64, pa *ProductAttribute) error { + return c.Update(ProductAttributeModel, ids, pa, nil) +} + +// DeleteProductAttribute deletes an existing product.attribute record. +func (c *Client) DeleteProductAttribute(id int64) error { + return c.DeleteProductAttributes([]int64{id}) +} + +// DeleteProductAttributes deletes existing product.attribute records. +func (c *Client) DeleteProductAttributes(ids []int64) error { + return c.Delete(ProductAttributeModel, ids) +} + +// GetProductAttribute gets product.attribute existing record. +func (c *Client) GetProductAttribute(id int64) (*ProductAttribute, error) { + pas, err := c.GetProductAttributes([]int64{id}) + if err != nil { + return nil, err + } + return &((*pas)[0]), nil +} + +// GetProductAttributes gets product.attribute existing records. +func (c *Client) GetProductAttributes(ids []int64) (*ProductAttributes, error) { + pas := &ProductAttributes{} + if err := c.Read(ProductAttributeModel, ids, nil, pas); err != nil { + return nil, err + } + return pas, nil +} + +// FindProductAttribute finds product.attribute record by querying it with criteria. +func (c *Client) FindProductAttribute(criteria *Criteria) (*ProductAttribute, error) { + pas := &ProductAttributes{} + if err := c.SearchRead(ProductAttributeModel, criteria, NewOptions().Limit(1), pas); err != nil { + return nil, err + } + return &((*pas)[0]), nil +} + +// FindProductAttributes finds product.attribute records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductAttributes(criteria *Criteria, options *Options) (*ProductAttributes, error) { + pas := &ProductAttributes{} + if err := c.SearchRead(ProductAttributeModel, criteria, options, pas); err != nil { + return nil, err + } + return pas, nil +} + +// FindProductAttributeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductAttributeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductAttributeModel, criteria, options) +} + +// FindProductAttributeId finds record id by querying it with criteria. +func (c *Client) FindProductAttributeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductAttributeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_attribute_custom_value.go b/product_attribute_custom_value.go new file mode 100644 index 0000000..ec29a3b --- /dev/null +++ b/product_attribute_custom_value.go @@ -0,0 +1,120 @@ +package odoo + +// ProductAttributeCustomValue represents product.attribute.custom.value model. +type ProductAttributeCustomValue struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CustomProductTemplateAttributeValueId *Many2One `xmlrpc:"custom_product_template_attribute_value_id,omitempty"` + CustomValue *String `xmlrpc:"custom_value,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + SaleOrderLineId *Many2One `xmlrpc:"sale_order_line_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductAttributeCustomValues represents array of product.attribute.custom.value model. +type ProductAttributeCustomValues []ProductAttributeCustomValue + +// ProductAttributeCustomValueModel is the odoo model name. +const ProductAttributeCustomValueModel = "product.attribute.custom.value" + +// Many2One convert ProductAttributeCustomValue to *Many2One. +func (pacv *ProductAttributeCustomValue) Many2One() *Many2One { + return NewMany2One(pacv.Id.Get(), "") +} + +// CreateProductAttributeCustomValue creates a new product.attribute.custom.value model and returns its id. +func (c *Client) CreateProductAttributeCustomValue(pacv *ProductAttributeCustomValue) (int64, error) { + ids, err := c.CreateProductAttributeCustomValues([]*ProductAttributeCustomValue{pacv}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductAttributeCustomValue creates a new product.attribute.custom.value model and returns its id. +func (c *Client) CreateProductAttributeCustomValues(pacvs []*ProductAttributeCustomValue) ([]int64, error) { + var vv []interface{} + for _, v := range pacvs { + vv = append(vv, v) + } + return c.Create(ProductAttributeCustomValueModel, vv, nil) +} + +// UpdateProductAttributeCustomValue updates an existing product.attribute.custom.value record. +func (c *Client) UpdateProductAttributeCustomValue(pacv *ProductAttributeCustomValue) error { + return c.UpdateProductAttributeCustomValues([]int64{pacv.Id.Get()}, pacv) +} + +// UpdateProductAttributeCustomValues updates existing product.attribute.custom.value records. +// All records (represented by ids) will be updated by pacv values. +func (c *Client) UpdateProductAttributeCustomValues(ids []int64, pacv *ProductAttributeCustomValue) error { + return c.Update(ProductAttributeCustomValueModel, ids, pacv, nil) +} + +// DeleteProductAttributeCustomValue deletes an existing product.attribute.custom.value record. +func (c *Client) DeleteProductAttributeCustomValue(id int64) error { + return c.DeleteProductAttributeCustomValues([]int64{id}) +} + +// DeleteProductAttributeCustomValues deletes existing product.attribute.custom.value records. +func (c *Client) DeleteProductAttributeCustomValues(ids []int64) error { + return c.Delete(ProductAttributeCustomValueModel, ids) +} + +// GetProductAttributeCustomValue gets product.attribute.custom.value existing record. +func (c *Client) GetProductAttributeCustomValue(id int64) (*ProductAttributeCustomValue, error) { + pacvs, err := c.GetProductAttributeCustomValues([]int64{id}) + if err != nil { + return nil, err + } + return &((*pacvs)[0]), nil +} + +// GetProductAttributeCustomValues gets product.attribute.custom.value existing records. +func (c *Client) GetProductAttributeCustomValues(ids []int64) (*ProductAttributeCustomValues, error) { + pacvs := &ProductAttributeCustomValues{} + if err := c.Read(ProductAttributeCustomValueModel, ids, nil, pacvs); err != nil { + return nil, err + } + return pacvs, nil +} + +// FindProductAttributeCustomValue finds product.attribute.custom.value record by querying it with criteria. +func (c *Client) FindProductAttributeCustomValue(criteria *Criteria) (*ProductAttributeCustomValue, error) { + pacvs := &ProductAttributeCustomValues{} + if err := c.SearchRead(ProductAttributeCustomValueModel, criteria, NewOptions().Limit(1), pacvs); err != nil { + return nil, err + } + return &((*pacvs)[0]), nil +} + +// FindProductAttributeCustomValues finds product.attribute.custom.value records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductAttributeCustomValues(criteria *Criteria, options *Options) (*ProductAttributeCustomValues, error) { + pacvs := &ProductAttributeCustomValues{} + if err := c.SearchRead(ProductAttributeCustomValueModel, criteria, options, pacvs); err != nil { + return nil, err + } + return pacvs, nil +} + +// FindProductAttributeCustomValueIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductAttributeCustomValueIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductAttributeCustomValueModel, criteria, options) +} + +// FindProductAttributeCustomValueId finds record id by querying it with criteria. +func (c *Client) FindProductAttributeCustomValueId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductAttributeCustomValueModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_attribute_value.go b/product_attribute_value.go new file mode 100644 index 0000000..064c3e6 --- /dev/null +++ b/product_attribute_value.go @@ -0,0 +1,129 @@ +package odoo + +// ProductAttributeValue represents product.attribute.value model. +type ProductAttributeValue struct { + Active *Bool `xmlrpc:"active,omitempty"` + AttributeId *Many2One `xmlrpc:"attribute_id,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DefaultExtraPrice *Float `xmlrpc:"default_extra_price,omitempty"` + DefaultExtraPriceChanged *Bool `xmlrpc:"default_extra_price_changed,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayType *Selection `xmlrpc:"display_type,omitempty"` + HtmlColor *String `xmlrpc:"html_color,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Image *String `xmlrpc:"image,omitempty"` + IsCustom *Bool `xmlrpc:"is_custom,omitempty"` + IsUsedOnProducts *Bool `xmlrpc:"is_used_on_products,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PavAttributeLineIds *Relation `xmlrpc:"pav_attribute_line_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductAttributeValues represents array of product.attribute.value model. +type ProductAttributeValues []ProductAttributeValue + +// ProductAttributeValueModel is the odoo model name. +const ProductAttributeValueModel = "product.attribute.value" + +// Many2One convert ProductAttributeValue to *Many2One. +func (pav *ProductAttributeValue) Many2One() *Many2One { + return NewMany2One(pav.Id.Get(), "") +} + +// CreateProductAttributeValue creates a new product.attribute.value model and returns its id. +func (c *Client) CreateProductAttributeValue(pav *ProductAttributeValue) (int64, error) { + ids, err := c.CreateProductAttributeValues([]*ProductAttributeValue{pav}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductAttributeValue creates a new product.attribute.value model and returns its id. +func (c *Client) CreateProductAttributeValues(pavs []*ProductAttributeValue) ([]int64, error) { + var vv []interface{} + for _, v := range pavs { + vv = append(vv, v) + } + return c.Create(ProductAttributeValueModel, vv, nil) +} + +// UpdateProductAttributeValue updates an existing product.attribute.value record. +func (c *Client) UpdateProductAttributeValue(pav *ProductAttributeValue) error { + return c.UpdateProductAttributeValues([]int64{pav.Id.Get()}, pav) +} + +// UpdateProductAttributeValues updates existing product.attribute.value records. +// All records (represented by ids) will be updated by pav values. +func (c *Client) UpdateProductAttributeValues(ids []int64, pav *ProductAttributeValue) error { + return c.Update(ProductAttributeValueModel, ids, pav, nil) +} + +// DeleteProductAttributeValue deletes an existing product.attribute.value record. +func (c *Client) DeleteProductAttributeValue(id int64) error { + return c.DeleteProductAttributeValues([]int64{id}) +} + +// DeleteProductAttributeValues deletes existing product.attribute.value records. +func (c *Client) DeleteProductAttributeValues(ids []int64) error { + return c.Delete(ProductAttributeValueModel, ids) +} + +// GetProductAttributeValue gets product.attribute.value existing record. +func (c *Client) GetProductAttributeValue(id int64) (*ProductAttributeValue, error) { + pavs, err := c.GetProductAttributeValues([]int64{id}) + if err != nil { + return nil, err + } + return &((*pavs)[0]), nil +} + +// GetProductAttributeValues gets product.attribute.value existing records. +func (c *Client) GetProductAttributeValues(ids []int64) (*ProductAttributeValues, error) { + pavs := &ProductAttributeValues{} + if err := c.Read(ProductAttributeValueModel, ids, nil, pavs); err != nil { + return nil, err + } + return pavs, nil +} + +// FindProductAttributeValue finds product.attribute.value record by querying it with criteria. +func (c *Client) FindProductAttributeValue(criteria *Criteria) (*ProductAttributeValue, error) { + pavs := &ProductAttributeValues{} + if err := c.SearchRead(ProductAttributeValueModel, criteria, NewOptions().Limit(1), pavs); err != nil { + return nil, err + } + return &((*pavs)[0]), nil +} + +// FindProductAttributeValues finds product.attribute.value records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductAttributeValues(criteria *Criteria, options *Options) (*ProductAttributeValues, error) { + pavs := &ProductAttributeValues{} + if err := c.SearchRead(ProductAttributeValueModel, criteria, options, pavs); err != nil { + return nil, err + } + return pavs, nil +} + +// FindProductAttributeValueIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductAttributeValueIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductAttributeValueModel, criteria, options) +} + +// FindProductAttributeValueId finds record id by querying it with criteria. +func (c *Client) FindProductAttributeValueId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductAttributeValueModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_category.go b/product_category.go new file mode 100644 index 0000000..2c41e34 --- /dev/null +++ b/product_category.go @@ -0,0 +1,139 @@ +package odoo + +// ProductCategory represents product.category model. +type ProductCategory struct { + ChildId *Relation `xmlrpc:"child_id,omitempty"` + CompleteName *String `xmlrpc:"complete_name,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + ParentPath *String `xmlrpc:"parent_path,omitempty"` + ProductCount *Int `xmlrpc:"product_count,omitempty"` + ProductPropertiesDefinition interface{} `xmlrpc:"product_properties_definition,omitempty"` + PropertyAccountDownpaymentCategId *Many2One `xmlrpc:"property_account_downpayment_categ_id,omitempty"` + PropertyAccountExpenseCategId *Many2One `xmlrpc:"property_account_expense_categ_id,omitempty"` + PropertyAccountIncomeCategId *Many2One `xmlrpc:"property_account_income_categ_id,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductCategorys represents array of product.category model. +type ProductCategorys []ProductCategory + +// ProductCategoryModel is the odoo model name. +const ProductCategoryModel = "product.category" + +// Many2One convert ProductCategory to *Many2One. +func (pc *ProductCategory) Many2One() *Many2One { + return NewMany2One(pc.Id.Get(), "") +} + +// CreateProductCategory creates a new product.category model and returns its id. +func (c *Client) CreateProductCategory(pc *ProductCategory) (int64, error) { + ids, err := c.CreateProductCategorys([]*ProductCategory{pc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductCategory creates a new product.category model and returns its id. +func (c *Client) CreateProductCategorys(pcs []*ProductCategory) ([]int64, error) { + var vv []interface{} + for _, v := range pcs { + vv = append(vv, v) + } + return c.Create(ProductCategoryModel, vv, nil) +} + +// UpdateProductCategory updates an existing product.category record. +func (c *Client) UpdateProductCategory(pc *ProductCategory) error { + return c.UpdateProductCategorys([]int64{pc.Id.Get()}, pc) +} + +// UpdateProductCategorys updates existing product.category records. +// All records (represented by ids) will be updated by pc values. +func (c *Client) UpdateProductCategorys(ids []int64, pc *ProductCategory) error { + return c.Update(ProductCategoryModel, ids, pc, nil) +} + +// DeleteProductCategory deletes an existing product.category record. +func (c *Client) DeleteProductCategory(id int64) error { + return c.DeleteProductCategorys([]int64{id}) +} + +// DeleteProductCategorys deletes existing product.category records. +func (c *Client) DeleteProductCategorys(ids []int64) error { + return c.Delete(ProductCategoryModel, ids) +} + +// GetProductCategory gets product.category existing record. +func (c *Client) GetProductCategory(id int64) (*ProductCategory, error) { + pcs, err := c.GetProductCategorys([]int64{id}) + if err != nil { + return nil, err + } + return &((*pcs)[0]), nil +} + +// GetProductCategorys gets product.category existing records. +func (c *Client) GetProductCategorys(ids []int64) (*ProductCategorys, error) { + pcs := &ProductCategorys{} + if err := c.Read(ProductCategoryModel, ids, nil, pcs); err != nil { + return nil, err + } + return pcs, nil +} + +// FindProductCategory finds product.category record by querying it with criteria. +func (c *Client) FindProductCategory(criteria *Criteria) (*ProductCategory, error) { + pcs := &ProductCategorys{} + if err := c.SearchRead(ProductCategoryModel, criteria, NewOptions().Limit(1), pcs); err != nil { + return nil, err + } + return &((*pcs)[0]), nil +} + +// FindProductCategorys finds product.category records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductCategorys(criteria *Criteria, options *Options) (*ProductCategorys, error) { + pcs := &ProductCategorys{} + if err := c.SearchRead(ProductCategoryModel, criteria, options, pcs); err != nil { + return nil, err + } + return pcs, nil +} + +// FindProductCategoryIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductCategoryIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductCategoryModel, criteria, options) +} + +// FindProductCategoryId finds record id by querying it with criteria. +func (c *Client) FindProductCategoryId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductCategoryModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_combo.go b/product_combo.go new file mode 100644 index 0000000..7e594c3 --- /dev/null +++ b/product_combo.go @@ -0,0 +1,123 @@ +package odoo + +// ProductCombo represents product.combo model. +type ProductCombo struct { + BasePrice *Float `xmlrpc:"base_price,omitempty"` + ComboItemCount *Int `xmlrpc:"combo_item_count,omitempty"` + ComboItemIds *Relation `xmlrpc:"combo_item_ids,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductCombos represents array of product.combo model. +type ProductCombos []ProductCombo + +// ProductComboModel is the odoo model name. +const ProductComboModel = "product.combo" + +// Many2One convert ProductCombo to *Many2One. +func (pc *ProductCombo) Many2One() *Many2One { + return NewMany2One(pc.Id.Get(), "") +} + +// CreateProductCombo creates a new product.combo model and returns its id. +func (c *Client) CreateProductCombo(pc *ProductCombo) (int64, error) { + ids, err := c.CreateProductCombos([]*ProductCombo{pc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductCombo creates a new product.combo model and returns its id. +func (c *Client) CreateProductCombos(pcs []*ProductCombo) ([]int64, error) { + var vv []interface{} + for _, v := range pcs { + vv = append(vv, v) + } + return c.Create(ProductComboModel, vv, nil) +} + +// UpdateProductCombo updates an existing product.combo record. +func (c *Client) UpdateProductCombo(pc *ProductCombo) error { + return c.UpdateProductCombos([]int64{pc.Id.Get()}, pc) +} + +// UpdateProductCombos updates existing product.combo records. +// All records (represented by ids) will be updated by pc values. +func (c *Client) UpdateProductCombos(ids []int64, pc *ProductCombo) error { + return c.Update(ProductComboModel, ids, pc, nil) +} + +// DeleteProductCombo deletes an existing product.combo record. +func (c *Client) DeleteProductCombo(id int64) error { + return c.DeleteProductCombos([]int64{id}) +} + +// DeleteProductCombos deletes existing product.combo records. +func (c *Client) DeleteProductCombos(ids []int64) error { + return c.Delete(ProductComboModel, ids) +} + +// GetProductCombo gets product.combo existing record. +func (c *Client) GetProductCombo(id int64) (*ProductCombo, error) { + pcs, err := c.GetProductCombos([]int64{id}) + if err != nil { + return nil, err + } + return &((*pcs)[0]), nil +} + +// GetProductCombos gets product.combo existing records. +func (c *Client) GetProductCombos(ids []int64) (*ProductCombos, error) { + pcs := &ProductCombos{} + if err := c.Read(ProductComboModel, ids, nil, pcs); err != nil { + return nil, err + } + return pcs, nil +} + +// FindProductCombo finds product.combo record by querying it with criteria. +func (c *Client) FindProductCombo(criteria *Criteria) (*ProductCombo, error) { + pcs := &ProductCombos{} + if err := c.SearchRead(ProductComboModel, criteria, NewOptions().Limit(1), pcs); err != nil { + return nil, err + } + return &((*pcs)[0]), nil +} + +// FindProductCombos finds product.combo records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductCombos(criteria *Criteria, options *Options) (*ProductCombos, error) { + pcs := &ProductCombos{} + if err := c.SearchRead(ProductComboModel, criteria, options, pcs); err != nil { + return nil, err + } + return pcs, nil +} + +// FindProductComboIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductComboIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductComboModel, criteria, options) +} + +// FindProductComboId finds record id by querying it with criteria. +func (c *Client) FindProductComboId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductComboModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_combo_item.go b/product_combo_item.go new file mode 100644 index 0000000..c311c9d --- /dev/null +++ b/product_combo_item.go @@ -0,0 +1,122 @@ +package odoo + +// ProductComboItem represents product.combo.item model. +type ProductComboItem struct { + ComboId *Many2One `xmlrpc:"combo_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExtraPrice *Float `xmlrpc:"extra_price,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LstPrice *Float `xmlrpc:"lst_price,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductComboItems represents array of product.combo.item model. +type ProductComboItems []ProductComboItem + +// ProductComboItemModel is the odoo model name. +const ProductComboItemModel = "product.combo.item" + +// Many2One convert ProductComboItem to *Many2One. +func (pci *ProductComboItem) Many2One() *Many2One { + return NewMany2One(pci.Id.Get(), "") +} + +// CreateProductComboItem creates a new product.combo.item model and returns its id. +func (c *Client) CreateProductComboItem(pci *ProductComboItem) (int64, error) { + ids, err := c.CreateProductComboItems([]*ProductComboItem{pci}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductComboItem creates a new product.combo.item model and returns its id. +func (c *Client) CreateProductComboItems(pcis []*ProductComboItem) ([]int64, error) { + var vv []interface{} + for _, v := range pcis { + vv = append(vv, v) + } + return c.Create(ProductComboItemModel, vv, nil) +} + +// UpdateProductComboItem updates an existing product.combo.item record. +func (c *Client) UpdateProductComboItem(pci *ProductComboItem) error { + return c.UpdateProductComboItems([]int64{pci.Id.Get()}, pci) +} + +// UpdateProductComboItems updates existing product.combo.item records. +// All records (represented by ids) will be updated by pci values. +func (c *Client) UpdateProductComboItems(ids []int64, pci *ProductComboItem) error { + return c.Update(ProductComboItemModel, ids, pci, nil) +} + +// DeleteProductComboItem deletes an existing product.combo.item record. +func (c *Client) DeleteProductComboItem(id int64) error { + return c.DeleteProductComboItems([]int64{id}) +} + +// DeleteProductComboItems deletes existing product.combo.item records. +func (c *Client) DeleteProductComboItems(ids []int64) error { + return c.Delete(ProductComboItemModel, ids) +} + +// GetProductComboItem gets product.combo.item existing record. +func (c *Client) GetProductComboItem(id int64) (*ProductComboItem, error) { + pcis, err := c.GetProductComboItems([]int64{id}) + if err != nil { + return nil, err + } + return &((*pcis)[0]), nil +} + +// GetProductComboItems gets product.combo.item existing records. +func (c *Client) GetProductComboItems(ids []int64) (*ProductComboItems, error) { + pcis := &ProductComboItems{} + if err := c.Read(ProductComboItemModel, ids, nil, pcis); err != nil { + return nil, err + } + return pcis, nil +} + +// FindProductComboItem finds product.combo.item record by querying it with criteria. +func (c *Client) FindProductComboItem(criteria *Criteria) (*ProductComboItem, error) { + pcis := &ProductComboItems{} + if err := c.SearchRead(ProductComboItemModel, criteria, NewOptions().Limit(1), pcis); err != nil { + return nil, err + } + return &((*pcis)[0]), nil +} + +// FindProductComboItems finds product.combo.item records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductComboItems(criteria *Criteria, options *Options) (*ProductComboItems, error) { + pcis := &ProductComboItems{} + if err := c.SearchRead(ProductComboItemModel, criteria, options, pcis); err != nil { + return nil, err + } + return pcis, nil +} + +// FindProductComboItemIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductComboItemIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductComboItemModel, criteria, options) +} + +// FindProductComboItemId finds record id by querying it with criteria. +func (c *Client) FindProductComboItemId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductComboItemModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_document.go b/product_document.go new file mode 100644 index 0000000..d0ea19d --- /dev/null +++ b/product_document.go @@ -0,0 +1,146 @@ +package odoo + +// ProductDocument represents product.document model. +type ProductDocument struct { + AccessToken *String `xmlrpc:"access_token,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + AttachedOnSale *Selection `xmlrpc:"attached_on_sale,omitempty"` + Checksum *String `xmlrpc:"checksum,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Datas *String `xmlrpc:"datas,omitempty"` + DbDatas *String `xmlrpc:"db_datas,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FileSize *Int `xmlrpc:"file_size,omitempty"` + FormFieldIds *Relation `xmlrpc:"form_field_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ImageHeight *Int `xmlrpc:"image_height,omitempty"` + ImageSrc *String `xmlrpc:"image_src,omitempty"` + ImageWidth *Int `xmlrpc:"image_width,omitempty"` + IndexContent *String `xmlrpc:"index_content,omitempty"` + IrAttachmentId *Many2One `xmlrpc:"ir_attachment_id,omitempty"` + LocalUrl *String `xmlrpc:"local_url,omitempty"` + Mimetype *String `xmlrpc:"mimetype,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OriginalId *Many2One `xmlrpc:"original_id,omitempty"` + Public *Bool `xmlrpc:"public,omitempty"` + Raw *String `xmlrpc:"raw,omitempty"` + ResField *String `xmlrpc:"res_field,omitempty"` + ResId *Many2One `xmlrpc:"res_id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + ResName *String `xmlrpc:"res_name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + StoreFname *String `xmlrpc:"store_fname,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + Url *String `xmlrpc:"url,omitempty"` + VoiceIds *Relation `xmlrpc:"voice_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductDocuments represents array of product.document model. +type ProductDocuments []ProductDocument + +// ProductDocumentModel is the odoo model name. +const ProductDocumentModel = "product.document" + +// Many2One convert ProductDocument to *Many2One. +func (pd *ProductDocument) Many2One() *Many2One { + return NewMany2One(pd.Id.Get(), "") +} + +// CreateProductDocument creates a new product.document model and returns its id. +func (c *Client) CreateProductDocument(pd *ProductDocument) (int64, error) { + ids, err := c.CreateProductDocuments([]*ProductDocument{pd}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductDocument creates a new product.document model and returns its id. +func (c *Client) CreateProductDocuments(pds []*ProductDocument) ([]int64, error) { + var vv []interface{} + for _, v := range pds { + vv = append(vv, v) + } + return c.Create(ProductDocumentModel, vv, nil) +} + +// UpdateProductDocument updates an existing product.document record. +func (c *Client) UpdateProductDocument(pd *ProductDocument) error { + return c.UpdateProductDocuments([]int64{pd.Id.Get()}, pd) +} + +// UpdateProductDocuments updates existing product.document records. +// All records (represented by ids) will be updated by pd values. +func (c *Client) UpdateProductDocuments(ids []int64, pd *ProductDocument) error { + return c.Update(ProductDocumentModel, ids, pd, nil) +} + +// DeleteProductDocument deletes an existing product.document record. +func (c *Client) DeleteProductDocument(id int64) error { + return c.DeleteProductDocuments([]int64{id}) +} + +// DeleteProductDocuments deletes existing product.document records. +func (c *Client) DeleteProductDocuments(ids []int64) error { + return c.Delete(ProductDocumentModel, ids) +} + +// GetProductDocument gets product.document existing record. +func (c *Client) GetProductDocument(id int64) (*ProductDocument, error) { + pds, err := c.GetProductDocuments([]int64{id}) + if err != nil { + return nil, err + } + return &((*pds)[0]), nil +} + +// GetProductDocuments gets product.document existing records. +func (c *Client) GetProductDocuments(ids []int64) (*ProductDocuments, error) { + pds := &ProductDocuments{} + if err := c.Read(ProductDocumentModel, ids, nil, pds); err != nil { + return nil, err + } + return pds, nil +} + +// FindProductDocument finds product.document record by querying it with criteria. +func (c *Client) FindProductDocument(criteria *Criteria) (*ProductDocument, error) { + pds := &ProductDocuments{} + if err := c.SearchRead(ProductDocumentModel, criteria, NewOptions().Limit(1), pds); err != nil { + return nil, err + } + return &((*pds)[0]), nil +} + +// FindProductDocuments finds product.document records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductDocuments(criteria *Criteria, options *Options) (*ProductDocuments, error) { + pds := &ProductDocuments{} + if err := c.SearchRead(ProductDocumentModel, criteria, options, pds); err != nil { + return nil, err + } + return pds, nil +} + +// FindProductDocumentIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductDocumentIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductDocumentModel, criteria, options) +} + +// FindProductDocumentId finds record id by querying it with criteria. +func (c *Client) FindProductDocumentId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductDocumentModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_label_layout.go b/product_label_layout.go new file mode 100644 index 0000000..8a66165 --- /dev/null +++ b/product_label_layout.go @@ -0,0 +1,124 @@ +package odoo + +// ProductLabelLayout represents product.label.layout model. +type ProductLabelLayout struct { + Columns *Int `xmlrpc:"columns,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CustomQuantity *Int `xmlrpc:"custom_quantity,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExtraHtml *String `xmlrpc:"extra_html,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PricelistId *Many2One `xmlrpc:"pricelist_id,omitempty"` + PrintFormat *Selection `xmlrpc:"print_format,omitempty"` + ProductIds *Relation `xmlrpc:"product_ids,omitempty"` + ProductTmplIds *Relation `xmlrpc:"product_tmpl_ids,omitempty"` + Rows *Int `xmlrpc:"rows,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductLabelLayouts represents array of product.label.layout model. +type ProductLabelLayouts []ProductLabelLayout + +// ProductLabelLayoutModel is the odoo model name. +const ProductLabelLayoutModel = "product.label.layout" + +// Many2One convert ProductLabelLayout to *Many2One. +func (pll *ProductLabelLayout) Many2One() *Many2One { + return NewMany2One(pll.Id.Get(), "") +} + +// CreateProductLabelLayout creates a new product.label.layout model and returns its id. +func (c *Client) CreateProductLabelLayout(pll *ProductLabelLayout) (int64, error) { + ids, err := c.CreateProductLabelLayouts([]*ProductLabelLayout{pll}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductLabelLayout creates a new product.label.layout model and returns its id. +func (c *Client) CreateProductLabelLayouts(plls []*ProductLabelLayout) ([]int64, error) { + var vv []interface{} + for _, v := range plls { + vv = append(vv, v) + } + return c.Create(ProductLabelLayoutModel, vv, nil) +} + +// UpdateProductLabelLayout updates an existing product.label.layout record. +func (c *Client) UpdateProductLabelLayout(pll *ProductLabelLayout) error { + return c.UpdateProductLabelLayouts([]int64{pll.Id.Get()}, pll) +} + +// UpdateProductLabelLayouts updates existing product.label.layout records. +// All records (represented by ids) will be updated by pll values. +func (c *Client) UpdateProductLabelLayouts(ids []int64, pll *ProductLabelLayout) error { + return c.Update(ProductLabelLayoutModel, ids, pll, nil) +} + +// DeleteProductLabelLayout deletes an existing product.label.layout record. +func (c *Client) DeleteProductLabelLayout(id int64) error { + return c.DeleteProductLabelLayouts([]int64{id}) +} + +// DeleteProductLabelLayouts deletes existing product.label.layout records. +func (c *Client) DeleteProductLabelLayouts(ids []int64) error { + return c.Delete(ProductLabelLayoutModel, ids) +} + +// GetProductLabelLayout gets product.label.layout existing record. +func (c *Client) GetProductLabelLayout(id int64) (*ProductLabelLayout, error) { + plls, err := c.GetProductLabelLayouts([]int64{id}) + if err != nil { + return nil, err + } + return &((*plls)[0]), nil +} + +// GetProductLabelLayouts gets product.label.layout existing records. +func (c *Client) GetProductLabelLayouts(ids []int64) (*ProductLabelLayouts, error) { + plls := &ProductLabelLayouts{} + if err := c.Read(ProductLabelLayoutModel, ids, nil, plls); err != nil { + return nil, err + } + return plls, nil +} + +// FindProductLabelLayout finds product.label.layout record by querying it with criteria. +func (c *Client) FindProductLabelLayout(criteria *Criteria) (*ProductLabelLayout, error) { + plls := &ProductLabelLayouts{} + if err := c.SearchRead(ProductLabelLayoutModel, criteria, NewOptions().Limit(1), plls); err != nil { + return nil, err + } + return &((*plls)[0]), nil +} + +// FindProductLabelLayouts finds product.label.layout records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductLabelLayouts(criteria *Criteria, options *Options) (*ProductLabelLayouts, error) { + plls := &ProductLabelLayouts{} + if err := c.SearchRead(ProductLabelLayoutModel, criteria, options, plls); err != nil { + return nil, err + } + return plls, nil +} + +// FindProductLabelLayoutIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductLabelLayoutIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductLabelLayoutModel, criteria, options) +} + +// FindProductLabelLayoutId finds record id by querying it with criteria. +func (c *Client) FindProductLabelLayoutId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductLabelLayoutModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_packaging.go b/product_packaging.go new file mode 100644 index 0000000..c1fbdec --- /dev/null +++ b/product_packaging.go @@ -0,0 +1,125 @@ +package odoo + +// ProductPackaging represents product.packaging model. +type ProductPackaging struct { + Barcode *String `xmlrpc:"barcode,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductUomId *Many2One `xmlrpc:"product_uom_id,omitempty"` + Purchase *Bool `xmlrpc:"purchase,omitempty"` + Qty *Float `xmlrpc:"qty,omitempty"` + Sales *Bool `xmlrpc:"sales,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductPackagings represents array of product.packaging model. +type ProductPackagings []ProductPackaging + +// ProductPackagingModel is the odoo model name. +const ProductPackagingModel = "product.packaging" + +// Many2One convert ProductPackaging to *Many2One. +func (pp *ProductPackaging) Many2One() *Many2One { + return NewMany2One(pp.Id.Get(), "") +} + +// CreateProductPackaging creates a new product.packaging model and returns its id. +func (c *Client) CreateProductPackaging(pp *ProductPackaging) (int64, error) { + ids, err := c.CreateProductPackagings([]*ProductPackaging{pp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductPackaging creates a new product.packaging model and returns its id. +func (c *Client) CreateProductPackagings(pps []*ProductPackaging) ([]int64, error) { + var vv []interface{} + for _, v := range pps { + vv = append(vv, v) + } + return c.Create(ProductPackagingModel, vv, nil) +} + +// UpdateProductPackaging updates an existing product.packaging record. +func (c *Client) UpdateProductPackaging(pp *ProductPackaging) error { + return c.UpdateProductPackagings([]int64{pp.Id.Get()}, pp) +} + +// UpdateProductPackagings updates existing product.packaging records. +// All records (represented by ids) will be updated by pp values. +func (c *Client) UpdateProductPackagings(ids []int64, pp *ProductPackaging) error { + return c.Update(ProductPackagingModel, ids, pp, nil) +} + +// DeleteProductPackaging deletes an existing product.packaging record. +func (c *Client) DeleteProductPackaging(id int64) error { + return c.DeleteProductPackagings([]int64{id}) +} + +// DeleteProductPackagings deletes existing product.packaging records. +func (c *Client) DeleteProductPackagings(ids []int64) error { + return c.Delete(ProductPackagingModel, ids) +} + +// GetProductPackaging gets product.packaging existing record. +func (c *Client) GetProductPackaging(id int64) (*ProductPackaging, error) { + pps, err := c.GetProductPackagings([]int64{id}) + if err != nil { + return nil, err + } + return &((*pps)[0]), nil +} + +// GetProductPackagings gets product.packaging existing records. +func (c *Client) GetProductPackagings(ids []int64) (*ProductPackagings, error) { + pps := &ProductPackagings{} + if err := c.Read(ProductPackagingModel, ids, nil, pps); err != nil { + return nil, err + } + return pps, nil +} + +// FindProductPackaging finds product.packaging record by querying it with criteria. +func (c *Client) FindProductPackaging(criteria *Criteria) (*ProductPackaging, error) { + pps := &ProductPackagings{} + if err := c.SearchRead(ProductPackagingModel, criteria, NewOptions().Limit(1), pps); err != nil { + return nil, err + } + return &((*pps)[0]), nil +} + +// FindProductPackagings finds product.packaging records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductPackagings(criteria *Criteria, options *Options) (*ProductPackagings, error) { + pps := &ProductPackagings{} + if err := c.SearchRead(ProductPackagingModel, criteria, options, pps); err != nil { + return nil, err + } + return pps, nil +} + +// FindProductPackagingIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductPackagingIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductPackagingModel, criteria, options) +} + +// FindProductPackagingId finds record id by querying it with criteria. +func (c *Client) FindProductPackagingId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductPackagingModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_pricelist.go b/product_pricelist.go new file mode 100644 index 0000000..081eb7c --- /dev/null +++ b/product_pricelist.go @@ -0,0 +1,147 @@ +package odoo + +// ProductPricelist represents product.pricelist model. +type ProductPricelist struct { + Active *Bool `xmlrpc:"active,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryGroupIds *Relation `xmlrpc:"country_group_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ItemIds *Relation `xmlrpc:"item_ids,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductPricelists represents array of product.pricelist model. +type ProductPricelists []ProductPricelist + +// ProductPricelistModel is the odoo model name. +const ProductPricelistModel = "product.pricelist" + +// Many2One convert ProductPricelist to *Many2One. +func (pp *ProductPricelist) Many2One() *Many2One { + return NewMany2One(pp.Id.Get(), "") +} + +// CreateProductPricelist creates a new product.pricelist model and returns its id. +func (c *Client) CreateProductPricelist(pp *ProductPricelist) (int64, error) { + ids, err := c.CreateProductPricelists([]*ProductPricelist{pp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductPricelist creates a new product.pricelist model and returns its id. +func (c *Client) CreateProductPricelists(pps []*ProductPricelist) ([]int64, error) { + var vv []interface{} + for _, v := range pps { + vv = append(vv, v) + } + return c.Create(ProductPricelistModel, vv, nil) +} + +// UpdateProductPricelist updates an existing product.pricelist record. +func (c *Client) UpdateProductPricelist(pp *ProductPricelist) error { + return c.UpdateProductPricelists([]int64{pp.Id.Get()}, pp) +} + +// UpdateProductPricelists updates existing product.pricelist records. +// All records (represented by ids) will be updated by pp values. +func (c *Client) UpdateProductPricelists(ids []int64, pp *ProductPricelist) error { + return c.Update(ProductPricelistModel, ids, pp, nil) +} + +// DeleteProductPricelist deletes an existing product.pricelist record. +func (c *Client) DeleteProductPricelist(id int64) error { + return c.DeleteProductPricelists([]int64{id}) +} + +// DeleteProductPricelists deletes existing product.pricelist records. +func (c *Client) DeleteProductPricelists(ids []int64) error { + return c.Delete(ProductPricelistModel, ids) +} + +// GetProductPricelist gets product.pricelist existing record. +func (c *Client) GetProductPricelist(id int64) (*ProductPricelist, error) { + pps, err := c.GetProductPricelists([]int64{id}) + if err != nil { + return nil, err + } + return &((*pps)[0]), nil +} + +// GetProductPricelists gets product.pricelist existing records. +func (c *Client) GetProductPricelists(ids []int64) (*ProductPricelists, error) { + pps := &ProductPricelists{} + if err := c.Read(ProductPricelistModel, ids, nil, pps); err != nil { + return nil, err + } + return pps, nil +} + +// FindProductPricelist finds product.pricelist record by querying it with criteria. +func (c *Client) FindProductPricelist(criteria *Criteria) (*ProductPricelist, error) { + pps := &ProductPricelists{} + if err := c.SearchRead(ProductPricelistModel, criteria, NewOptions().Limit(1), pps); err != nil { + return nil, err + } + return &((*pps)[0]), nil +} + +// FindProductPricelists finds product.pricelist records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductPricelists(criteria *Criteria, options *Options) (*ProductPricelists, error) { + pps := &ProductPricelists{} + if err := c.SearchRead(ProductPricelistModel, criteria, options, pps); err != nil { + return nil, err + } + return pps, nil +} + +// FindProductPricelistIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductPricelistIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductPricelistModel, criteria, options) +} + +// FindProductPricelistId finds record id by querying it with criteria. +func (c *Client) FindProductPricelistId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductPricelistModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_pricelist_item.go b/product_pricelist_item.go new file mode 100644 index 0000000..1969d09 --- /dev/null +++ b/product_pricelist_item.go @@ -0,0 +1,143 @@ +package odoo + +// ProductPricelistItem represents product.pricelist.item model. +type ProductPricelistItem struct { + AppliedOn *Selection `xmlrpc:"applied_on,omitempty"` + Base *Selection `xmlrpc:"base,omitempty"` + BasePricelistId *Many2One `xmlrpc:"base_pricelist_id,omitempty"` + CategId *Many2One `xmlrpc:"categ_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + ComputePrice *Selection `xmlrpc:"compute_price,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DateEnd *Time `xmlrpc:"date_end,omitempty"` + DateStart *Time `xmlrpc:"date_start,omitempty"` + DisplayAppliedOn *Selection `xmlrpc:"display_applied_on,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FixedPrice *Float `xmlrpc:"fixed_price,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MinQuantity *Float `xmlrpc:"min_quantity,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PercentPrice *Float `xmlrpc:"percent_price,omitempty"` + Price *String `xmlrpc:"price,omitempty"` + PriceDiscount *Float `xmlrpc:"price_discount,omitempty"` + PriceMarkup *Float `xmlrpc:"price_markup,omitempty"` + PriceMaxMargin *Float `xmlrpc:"price_max_margin,omitempty"` + PriceMinMargin *Float `xmlrpc:"price_min_margin,omitempty"` + PriceRound *Float `xmlrpc:"price_round,omitempty"` + PriceSurcharge *Float `xmlrpc:"price_surcharge,omitempty"` + PricelistId *Many2One `xmlrpc:"pricelist_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,omitempty"` + ProductUom *String `xmlrpc:"product_uom,omitempty"` + ProductVariantCount *Int `xmlrpc:"product_variant_count,omitempty"` + RuleTip *String `xmlrpc:"rule_tip,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductPricelistItems represents array of product.pricelist.item model. +type ProductPricelistItems []ProductPricelistItem + +// ProductPricelistItemModel is the odoo model name. +const ProductPricelistItemModel = "product.pricelist.item" + +// Many2One convert ProductPricelistItem to *Many2One. +func (ppi *ProductPricelistItem) Many2One() *Many2One { + return NewMany2One(ppi.Id.Get(), "") +} + +// CreateProductPricelistItem creates a new product.pricelist.item model and returns its id. +func (c *Client) CreateProductPricelistItem(ppi *ProductPricelistItem) (int64, error) { + ids, err := c.CreateProductPricelistItems([]*ProductPricelistItem{ppi}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductPricelistItem creates a new product.pricelist.item model and returns its id. +func (c *Client) CreateProductPricelistItems(ppis []*ProductPricelistItem) ([]int64, error) { + var vv []interface{} + for _, v := range ppis { + vv = append(vv, v) + } + return c.Create(ProductPricelistItemModel, vv, nil) +} + +// UpdateProductPricelistItem updates an existing product.pricelist.item record. +func (c *Client) UpdateProductPricelistItem(ppi *ProductPricelistItem) error { + return c.UpdateProductPricelistItems([]int64{ppi.Id.Get()}, ppi) +} + +// UpdateProductPricelistItems updates existing product.pricelist.item records. +// All records (represented by ids) will be updated by ppi values. +func (c *Client) UpdateProductPricelistItems(ids []int64, ppi *ProductPricelistItem) error { + return c.Update(ProductPricelistItemModel, ids, ppi, nil) +} + +// DeleteProductPricelistItem deletes an existing product.pricelist.item record. +func (c *Client) DeleteProductPricelistItem(id int64) error { + return c.DeleteProductPricelistItems([]int64{id}) +} + +// DeleteProductPricelistItems deletes existing product.pricelist.item records. +func (c *Client) DeleteProductPricelistItems(ids []int64) error { + return c.Delete(ProductPricelistItemModel, ids) +} + +// GetProductPricelistItem gets product.pricelist.item existing record. +func (c *Client) GetProductPricelistItem(id int64) (*ProductPricelistItem, error) { + ppis, err := c.GetProductPricelistItems([]int64{id}) + if err != nil { + return nil, err + } + return &((*ppis)[0]), nil +} + +// GetProductPricelistItems gets product.pricelist.item existing records. +func (c *Client) GetProductPricelistItems(ids []int64) (*ProductPricelistItems, error) { + ppis := &ProductPricelistItems{} + if err := c.Read(ProductPricelistItemModel, ids, nil, ppis); err != nil { + return nil, err + } + return ppis, nil +} + +// FindProductPricelistItem finds product.pricelist.item record by querying it with criteria. +func (c *Client) FindProductPricelistItem(criteria *Criteria) (*ProductPricelistItem, error) { + ppis := &ProductPricelistItems{} + if err := c.SearchRead(ProductPricelistItemModel, criteria, NewOptions().Limit(1), ppis); err != nil { + return nil, err + } + return &((*ppis)[0]), nil +} + +// FindProductPricelistItems finds product.pricelist.item records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductPricelistItems(criteria *Criteria, options *Options) (*ProductPricelistItems, error) { + ppis := &ProductPricelistItems{} + if err := c.SearchRead(ProductPricelistItemModel, criteria, options, ppis); err != nil { + return nil, err + } + return ppis, nil +} + +// FindProductPricelistItemIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductPricelistItemIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductPricelistItemModel, criteria, options) +} + +// FindProductPricelistItemId finds record id by querying it with criteria. +func (c *Client) FindProductPricelistItemId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductPricelistItemModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_product.go b/product_product.go new file mode 100644 index 0000000..e6478f4 --- /dev/null +++ b/product_product.go @@ -0,0 +1,236 @@ +package odoo + +// ProductProduct represents product.product model. +type ProductProduct struct { + AccountTagIds *Relation `xmlrpc:"account_tag_ids,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AdditionalProductTagIds *Relation `xmlrpc:"additional_product_tag_ids,omitempty"` + AllProductTagIds *Relation `xmlrpc:"all_product_tag_ids,omitempty"` + AttributeLineIds *Relation `xmlrpc:"attribute_line_ids,omitempty"` + Barcode *String `xmlrpc:"barcode,omitempty"` + CanBeExpensed *Bool `xmlrpc:"can_be_expensed,omitempty"` + CanImage1024BeZoomed *Bool `xmlrpc:"can_image_1024_be_zoomed,omitempty"` + CanImageVariant1024BeZoomed *Bool `xmlrpc:"can_image_variant_1024_be_zoomed,omitempty"` + CategId *Many2One `xmlrpc:"categ_id,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CombinationIndices *String `xmlrpc:"combination_indices,omitempty"` + ComboIds *Relation `xmlrpc:"combo_ids,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CostCurrencyId *Many2One `xmlrpc:"cost_currency_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DefaultCode *String `xmlrpc:"default_code,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DescriptionPurchase *String `xmlrpc:"description_purchase,omitempty"` + DescriptionSale *String `xmlrpc:"description_sale,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExpensePolicy *Selection `xmlrpc:"expense_policy,omitempty"` + ExpensePolicyTooltip *String `xmlrpc:"expense_policy_tooltip,omitempty"` + FiscalCountryCodes *String `xmlrpc:"fiscal_country_codes,omitempty"` + HasConfigurableAttributes *Bool `xmlrpc:"has_configurable_attributes,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Image1024 *String `xmlrpc:"image_1024,omitempty"` + Image128 *String `xmlrpc:"image_128,omitempty"` + Image1920 *String `xmlrpc:"image_1920,omitempty"` + Image256 *String `xmlrpc:"image_256,omitempty"` + Image512 *String `xmlrpc:"image_512,omitempty"` + ImageVariant1024 *String `xmlrpc:"image_variant_1024,omitempty"` + ImageVariant128 *String `xmlrpc:"image_variant_128,omitempty"` + ImageVariant1920 *String `xmlrpc:"image_variant_1920,omitempty"` + ImageVariant256 *String `xmlrpc:"image_variant_256,omitempty"` + ImageVariant512 *String `xmlrpc:"image_variant_512,omitempty"` + InvoicePolicy *Selection `xmlrpc:"invoice_policy,omitempty"` + IsFavorite *Bool `xmlrpc:"is_favorite,omitempty"` + IsInPurchaseOrder *Bool `xmlrpc:"is_in_purchase_order,omitempty"` + IsProductVariant *Bool `xmlrpc:"is_product_variant,omitempty"` + ListPrice *Float `xmlrpc:"list_price,omitempty"` + LstPrice *Float `xmlrpc:"lst_price,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OptionalProductIds *Relation `xmlrpc:"optional_product_ids,omitempty"` + PackagingIds *Relation `xmlrpc:"packaging_ids,omitempty"` + PartnerRef *String `xmlrpc:"partner_ref,omitempty"` + PriceExtra *Float `xmlrpc:"price_extra,omitempty"` + PricelistItemCount *Int `xmlrpc:"pricelist_item_count,omitempty"` + ProductCatalogProductIsInSaleOrder *Bool `xmlrpc:"product_catalog_product_is_in_sale_order,omitempty"` + ProductDocumentCount *Int `xmlrpc:"product_document_count,omitempty"` + ProductDocumentIds *Relation `xmlrpc:"product_document_ids,omitempty"` + ProductProperties interface{} `xmlrpc:"product_properties,omitempty"` + ProductTagIds *Relation `xmlrpc:"product_tag_ids,omitempty"` + ProductTemplateAttributeValueIds *Relation `xmlrpc:"product_template_attribute_value_ids,omitempty"` + ProductTemplateVariantValueIds *Relation `xmlrpc:"product_template_variant_value_ids,omitempty"` + ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,omitempty"` + ProductTooltip *String `xmlrpc:"product_tooltip,omitempty"` + ProductVariantCount *Int `xmlrpc:"product_variant_count,omitempty"` + ProductVariantId *Many2One `xmlrpc:"product_variant_id,omitempty"` + ProductVariantIds *Relation `xmlrpc:"product_variant_ids,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + ProjectTemplateId *Many2One `xmlrpc:"project_template_id,omitempty"` + PropertyAccountExpenseId *Many2One `xmlrpc:"property_account_expense_id,omitempty"` + PropertyAccountIncomeId *Many2One `xmlrpc:"property_account_income_id,omitempty"` + PurchaseLineWarn *Selection `xmlrpc:"purchase_line_warn,omitempty"` + PurchaseLineWarnMsg *String `xmlrpc:"purchase_line_warn_msg,omitempty"` + PurchaseMethod *Selection `xmlrpc:"purchase_method,omitempty"` + PurchaseOk *Bool `xmlrpc:"purchase_ok,omitempty"` + PurchasedProductQty *Float `xmlrpc:"purchased_product_qty,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + SaleLineWarn *Selection `xmlrpc:"sale_line_warn,omitempty"` + SaleLineWarnMsg *String `xmlrpc:"sale_line_warn_msg,omitempty"` + SaleOk *Bool `xmlrpc:"sale_ok,omitempty"` + SalesCount *Float `xmlrpc:"sales_count,omitempty"` + SellerIds *Relation `xmlrpc:"seller_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + ServicePolicy *Selection `xmlrpc:"service_policy,omitempty"` + ServiceToPurchase *Bool `xmlrpc:"service_to_purchase,omitempty"` + ServiceTracking *Selection `xmlrpc:"service_tracking,omitempty"` + ServiceType *Selection `xmlrpc:"service_type,omitempty"` + ServiceUpsellThreshold *Float `xmlrpc:"service_upsell_threshold,omitempty"` + ServiceUpsellThresholdRatio *String `xmlrpc:"service_upsell_threshold_ratio,omitempty"` + StandardPrice *Float `xmlrpc:"standard_price,omitempty"` + StandardPriceUpdateWarning *String `xmlrpc:"standard_price_update_warning,omitempty"` + SupplierTaxesId *Relation `xmlrpc:"supplier_taxes_id,omitempty"` + TaxString *String `xmlrpc:"tax_string,omitempty"` + TaxesId *Relation `xmlrpc:"taxes_id,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + UomId *Many2One `xmlrpc:"uom_id,omitempty"` + UomName *String `xmlrpc:"uom_name,omitempty"` + UomPoId *Many2One `xmlrpc:"uom_po_id,omitempty"` + ValidProductTemplateAttributeLineIds *Relation `xmlrpc:"valid_product_template_attribute_line_ids,omitempty"` + VariantSellerIds *Relation `xmlrpc:"variant_seller_ids,omitempty"` + VisibleExpensePolicy *Bool `xmlrpc:"visible_expense_policy,omitempty"` + Volume *Float `xmlrpc:"volume,omitempty"` + VolumeUomName *String `xmlrpc:"volume_uom_name,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + Weight *Float `xmlrpc:"weight,omitempty"` + WeightUomName *String `xmlrpc:"weight_uom_name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductProducts represents array of product.product model. +type ProductProducts []ProductProduct + +// ProductProductModel is the odoo model name. +const ProductProductModel = "product.product" + +// Many2One convert ProductProduct to *Many2One. +func (pp *ProductProduct) Many2One() *Many2One { + return NewMany2One(pp.Id.Get(), "") +} + +// CreateProductProduct creates a new product.product model and returns its id. +func (c *Client) CreateProductProduct(pp *ProductProduct) (int64, error) { + ids, err := c.CreateProductProducts([]*ProductProduct{pp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductProduct creates a new product.product model and returns its id. +func (c *Client) CreateProductProducts(pps []*ProductProduct) ([]int64, error) { + var vv []interface{} + for _, v := range pps { + vv = append(vv, v) + } + return c.Create(ProductProductModel, vv, nil) +} + +// UpdateProductProduct updates an existing product.product record. +func (c *Client) UpdateProductProduct(pp *ProductProduct) error { + return c.UpdateProductProducts([]int64{pp.Id.Get()}, pp) +} + +// UpdateProductProducts updates existing product.product records. +// All records (represented by ids) will be updated by pp values. +func (c *Client) UpdateProductProducts(ids []int64, pp *ProductProduct) error { + return c.Update(ProductProductModel, ids, pp, nil) +} + +// DeleteProductProduct deletes an existing product.product record. +func (c *Client) DeleteProductProduct(id int64) error { + return c.DeleteProductProducts([]int64{id}) +} + +// DeleteProductProducts deletes existing product.product records. +func (c *Client) DeleteProductProducts(ids []int64) error { + return c.Delete(ProductProductModel, ids) +} + +// GetProductProduct gets product.product existing record. +func (c *Client) GetProductProduct(id int64) (*ProductProduct, error) { + pps, err := c.GetProductProducts([]int64{id}) + if err != nil { + return nil, err + } + return &((*pps)[0]), nil +} + +// GetProductProducts gets product.product existing records. +func (c *Client) GetProductProducts(ids []int64) (*ProductProducts, error) { + pps := &ProductProducts{} + if err := c.Read(ProductProductModel, ids, nil, pps); err != nil { + return nil, err + } + return pps, nil +} + +// FindProductProduct finds product.product record by querying it with criteria. +func (c *Client) FindProductProduct(criteria *Criteria) (*ProductProduct, error) { + pps := &ProductProducts{} + if err := c.SearchRead(ProductProductModel, criteria, NewOptions().Limit(1), pps); err != nil { + return nil, err + } + return &((*pps)[0]), nil +} + +// FindProductProducts finds product.product records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductProducts(criteria *Criteria, options *Options) (*ProductProducts, error) { + pps := &ProductProducts{} + if err := c.SearchRead(ProductProductModel, criteria, options, pps); err != nil { + return nil, err + } + return pps, nil +} + +// FindProductProductIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductProductIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductProductModel, criteria, options) +} + +// FindProductProductId finds record id by querying it with criteria. +func (c *Client) FindProductProductId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductProductModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_supplierinfo.go b/product_supplierinfo.go new file mode 100644 index 0000000..89679ac --- /dev/null +++ b/product_supplierinfo.go @@ -0,0 +1,133 @@ +package odoo + +// ProductSupplierinfo represents product.supplierinfo model. +type ProductSupplierinfo struct { + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DateEnd *Time `xmlrpc:"date_end,omitempty"` + DateStart *Time `xmlrpc:"date_start,omitempty"` + Delay *Int `xmlrpc:"delay,omitempty"` + Discount *Float `xmlrpc:"discount,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MinQty *Float `xmlrpc:"min_qty,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + Price *Float `xmlrpc:"price,omitempty"` + PriceDiscounted *Float `xmlrpc:"price_discounted,omitempty"` + ProductCode *String `xmlrpc:"product_code,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductName *String `xmlrpc:"product_name,omitempty"` + ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,omitempty"` + ProductUom *Many2One `xmlrpc:"product_uom,omitempty"` + ProductVariantCount *Int `xmlrpc:"product_variant_count,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductSupplierinfos represents array of product.supplierinfo model. +type ProductSupplierinfos []ProductSupplierinfo + +// ProductSupplierinfoModel is the odoo model name. +const ProductSupplierinfoModel = "product.supplierinfo" + +// Many2One convert ProductSupplierinfo to *Many2One. +func (ps *ProductSupplierinfo) Many2One() *Many2One { + return NewMany2One(ps.Id.Get(), "") +} + +// CreateProductSupplierinfo creates a new product.supplierinfo model and returns its id. +func (c *Client) CreateProductSupplierinfo(ps *ProductSupplierinfo) (int64, error) { + ids, err := c.CreateProductSupplierinfos([]*ProductSupplierinfo{ps}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductSupplierinfo creates a new product.supplierinfo model and returns its id. +func (c *Client) CreateProductSupplierinfos(pss []*ProductSupplierinfo) ([]int64, error) { + var vv []interface{} + for _, v := range pss { + vv = append(vv, v) + } + return c.Create(ProductSupplierinfoModel, vv, nil) +} + +// UpdateProductSupplierinfo updates an existing product.supplierinfo record. +func (c *Client) UpdateProductSupplierinfo(ps *ProductSupplierinfo) error { + return c.UpdateProductSupplierinfos([]int64{ps.Id.Get()}, ps) +} + +// UpdateProductSupplierinfos updates existing product.supplierinfo records. +// All records (represented by ids) will be updated by ps values. +func (c *Client) UpdateProductSupplierinfos(ids []int64, ps *ProductSupplierinfo) error { + return c.Update(ProductSupplierinfoModel, ids, ps, nil) +} + +// DeleteProductSupplierinfo deletes an existing product.supplierinfo record. +func (c *Client) DeleteProductSupplierinfo(id int64) error { + return c.DeleteProductSupplierinfos([]int64{id}) +} + +// DeleteProductSupplierinfos deletes existing product.supplierinfo records. +func (c *Client) DeleteProductSupplierinfos(ids []int64) error { + return c.Delete(ProductSupplierinfoModel, ids) +} + +// GetProductSupplierinfo gets product.supplierinfo existing record. +func (c *Client) GetProductSupplierinfo(id int64) (*ProductSupplierinfo, error) { + pss, err := c.GetProductSupplierinfos([]int64{id}) + if err != nil { + return nil, err + } + return &((*pss)[0]), nil +} + +// GetProductSupplierinfos gets product.supplierinfo existing records. +func (c *Client) GetProductSupplierinfos(ids []int64) (*ProductSupplierinfos, error) { + pss := &ProductSupplierinfos{} + if err := c.Read(ProductSupplierinfoModel, ids, nil, pss); err != nil { + return nil, err + } + return pss, nil +} + +// FindProductSupplierinfo finds product.supplierinfo record by querying it with criteria. +func (c *Client) FindProductSupplierinfo(criteria *Criteria) (*ProductSupplierinfo, error) { + pss := &ProductSupplierinfos{} + if err := c.SearchRead(ProductSupplierinfoModel, criteria, NewOptions().Limit(1), pss); err != nil { + return nil, err + } + return &((*pss)[0]), nil +} + +// FindProductSupplierinfos finds product.supplierinfo records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductSupplierinfos(criteria *Criteria, options *Options) (*ProductSupplierinfos, error) { + pss := &ProductSupplierinfos{} + if err := c.SearchRead(ProductSupplierinfoModel, criteria, options, pss); err != nil { + return nil, err + } + return pss, nil +} + +// FindProductSupplierinfoIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductSupplierinfoIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductSupplierinfoModel, criteria, options) +} + +// FindProductSupplierinfoId finds record id by querying it with criteria. +func (c *Client) FindProductSupplierinfoId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductSupplierinfoModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_tag.go b/product_tag.go new file mode 100644 index 0000000..32d059c --- /dev/null +++ b/product_tag.go @@ -0,0 +1,122 @@ +package odoo + +// ProductTag represents product.tag model. +type ProductTag struct { + Color *String `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ProductIds *Relation `xmlrpc:"product_ids,omitempty"` + ProductProductIds *Relation `xmlrpc:"product_product_ids,omitempty"` + ProductTemplateIds *Relation `xmlrpc:"product_template_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductTags represents array of product.tag model. +type ProductTags []ProductTag + +// ProductTagModel is the odoo model name. +const ProductTagModel = "product.tag" + +// Many2One convert ProductTag to *Many2One. +func (pt *ProductTag) Many2One() *Many2One { + return NewMany2One(pt.Id.Get(), "") +} + +// CreateProductTag creates a new product.tag model and returns its id. +func (c *Client) CreateProductTag(pt *ProductTag) (int64, error) { + ids, err := c.CreateProductTags([]*ProductTag{pt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductTag creates a new product.tag model and returns its id. +func (c *Client) CreateProductTags(pts []*ProductTag) ([]int64, error) { + var vv []interface{} + for _, v := range pts { + vv = append(vv, v) + } + return c.Create(ProductTagModel, vv, nil) +} + +// UpdateProductTag updates an existing product.tag record. +func (c *Client) UpdateProductTag(pt *ProductTag) error { + return c.UpdateProductTags([]int64{pt.Id.Get()}, pt) +} + +// UpdateProductTags updates existing product.tag records. +// All records (represented by ids) will be updated by pt values. +func (c *Client) UpdateProductTags(ids []int64, pt *ProductTag) error { + return c.Update(ProductTagModel, ids, pt, nil) +} + +// DeleteProductTag deletes an existing product.tag record. +func (c *Client) DeleteProductTag(id int64) error { + return c.DeleteProductTags([]int64{id}) +} + +// DeleteProductTags deletes existing product.tag records. +func (c *Client) DeleteProductTags(ids []int64) error { + return c.Delete(ProductTagModel, ids) +} + +// GetProductTag gets product.tag existing record. +func (c *Client) GetProductTag(id int64) (*ProductTag, error) { + pts, err := c.GetProductTags([]int64{id}) + if err != nil { + return nil, err + } + return &((*pts)[0]), nil +} + +// GetProductTags gets product.tag existing records. +func (c *Client) GetProductTags(ids []int64) (*ProductTags, error) { + pts := &ProductTags{} + if err := c.Read(ProductTagModel, ids, nil, pts); err != nil { + return nil, err + } + return pts, nil +} + +// FindProductTag finds product.tag record by querying it with criteria. +func (c *Client) FindProductTag(criteria *Criteria) (*ProductTag, error) { + pts := &ProductTags{} + if err := c.SearchRead(ProductTagModel, criteria, NewOptions().Limit(1), pts); err != nil { + return nil, err + } + return &((*pts)[0]), nil +} + +// FindProductTags finds product.tag records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductTags(criteria *Criteria, options *Options) (*ProductTags, error) { + pts := &ProductTags{} + if err := c.SearchRead(ProductTagModel, criteria, options, pts); err != nil { + return nil, err + } + return pts, nil +} + +// FindProductTagIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductTagIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductTagModel, criteria, options) +} + +// FindProductTagId finds record id by querying it with criteria. +func (c *Client) FindProductTagId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductTagModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_template.go b/product_template.go new file mode 100644 index 0000000..6aaace9 --- /dev/null +++ b/product_template.go @@ -0,0 +1,217 @@ +package odoo + +// ProductTemplate represents product.template model. +type ProductTemplate struct { + AccountTagIds *Relation `xmlrpc:"account_tag_ids,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AttributeLineIds *Relation `xmlrpc:"attribute_line_ids,omitempty"` + Barcode *String `xmlrpc:"barcode,omitempty"` + CanBeExpensed *Bool `xmlrpc:"can_be_expensed,omitempty"` + CanImage1024BeZoomed *Bool `xmlrpc:"can_image_1024_be_zoomed,omitempty"` + CategId *Many2One `xmlrpc:"categ_id,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + ComboIds *Relation `xmlrpc:"combo_ids,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CostCurrencyId *Many2One `xmlrpc:"cost_currency_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DefaultCode *String `xmlrpc:"default_code,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DescriptionPurchase *String `xmlrpc:"description_purchase,omitempty"` + DescriptionSale *String `xmlrpc:"description_sale,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExpensePolicy *Selection `xmlrpc:"expense_policy,omitempty"` + ExpensePolicyTooltip *String `xmlrpc:"expense_policy_tooltip,omitempty"` + FiscalCountryCodes *String `xmlrpc:"fiscal_country_codes,omitempty"` + HasConfigurableAttributes *Bool `xmlrpc:"has_configurable_attributes,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Image1024 *String `xmlrpc:"image_1024,omitempty"` + Image128 *String `xmlrpc:"image_128,omitempty"` + Image1920 *String `xmlrpc:"image_1920,omitempty"` + Image256 *String `xmlrpc:"image_256,omitempty"` + Image512 *String `xmlrpc:"image_512,omitempty"` + InvoicePolicy *Selection `xmlrpc:"invoice_policy,omitempty"` + IsFavorite *Bool `xmlrpc:"is_favorite,omitempty"` + IsProductVariant *Bool `xmlrpc:"is_product_variant,omitempty"` + ListPrice *Float `xmlrpc:"list_price,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OptionalProductIds *Relation `xmlrpc:"optional_product_ids,omitempty"` + PackagingIds *Relation `xmlrpc:"packaging_ids,omitempty"` + PricelistItemCount *Int `xmlrpc:"pricelist_item_count,omitempty"` + ProductDocumentCount *Int `xmlrpc:"product_document_count,omitempty"` + ProductDocumentIds *Relation `xmlrpc:"product_document_ids,omitempty"` + ProductProperties interface{} `xmlrpc:"product_properties,omitempty"` + ProductTagIds *Relation `xmlrpc:"product_tag_ids,omitempty"` + ProductTooltip *String `xmlrpc:"product_tooltip,omitempty"` + ProductVariantCount *Int `xmlrpc:"product_variant_count,omitempty"` + ProductVariantId *Many2One `xmlrpc:"product_variant_id,omitempty"` + ProductVariantIds *Relation `xmlrpc:"product_variant_ids,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + ProjectTemplateId *Many2One `xmlrpc:"project_template_id,omitempty"` + PropertyAccountExpenseId *Many2One `xmlrpc:"property_account_expense_id,omitempty"` + PropertyAccountIncomeId *Many2One `xmlrpc:"property_account_income_id,omitempty"` + PurchaseLineWarn *Selection `xmlrpc:"purchase_line_warn,omitempty"` + PurchaseLineWarnMsg *String `xmlrpc:"purchase_line_warn_msg,omitempty"` + PurchaseMethod *Selection `xmlrpc:"purchase_method,omitempty"` + PurchaseOk *Bool `xmlrpc:"purchase_ok,omitempty"` + PurchasedProductQty *Float `xmlrpc:"purchased_product_qty,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + SaleLineWarn *Selection `xmlrpc:"sale_line_warn,omitempty"` + SaleLineWarnMsg *String `xmlrpc:"sale_line_warn_msg,omitempty"` + SaleOk *Bool `xmlrpc:"sale_ok,omitempty"` + SalesCount *Float `xmlrpc:"sales_count,omitempty"` + SellerIds *Relation `xmlrpc:"seller_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + ServicePolicy *Selection `xmlrpc:"service_policy,omitempty"` + ServiceToPurchase *Bool `xmlrpc:"service_to_purchase,omitempty"` + ServiceTracking *Selection `xmlrpc:"service_tracking,omitempty"` + ServiceType *Selection `xmlrpc:"service_type,omitempty"` + ServiceUpsellThreshold *Float `xmlrpc:"service_upsell_threshold,omitempty"` + ServiceUpsellThresholdRatio *String `xmlrpc:"service_upsell_threshold_ratio,omitempty"` + StandardPrice *Float `xmlrpc:"standard_price,omitempty"` + SupplierTaxesId *Relation `xmlrpc:"supplier_taxes_id,omitempty"` + TaxString *String `xmlrpc:"tax_string,omitempty"` + TaxesId *Relation `xmlrpc:"taxes_id,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + UomId *Many2One `xmlrpc:"uom_id,omitempty"` + UomName *String `xmlrpc:"uom_name,omitempty"` + UomPoId *Many2One `xmlrpc:"uom_po_id,omitempty"` + ValidProductTemplateAttributeLineIds *Relation `xmlrpc:"valid_product_template_attribute_line_ids,omitempty"` + VariantSellerIds *Relation `xmlrpc:"variant_seller_ids,omitempty"` + VisibleExpensePolicy *Bool `xmlrpc:"visible_expense_policy,omitempty"` + Volume *Float `xmlrpc:"volume,omitempty"` + VolumeUomName *String `xmlrpc:"volume_uom_name,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + Weight *Float `xmlrpc:"weight,omitempty"` + WeightUomName *String `xmlrpc:"weight_uom_name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductTemplates represents array of product.template model. +type ProductTemplates []ProductTemplate + +// ProductTemplateModel is the odoo model name. +const ProductTemplateModel = "product.template" + +// Many2One convert ProductTemplate to *Many2One. +func (pt *ProductTemplate) Many2One() *Many2One { + return NewMany2One(pt.Id.Get(), "") +} + +// CreateProductTemplate creates a new product.template model and returns its id. +func (c *Client) CreateProductTemplate(pt *ProductTemplate) (int64, error) { + ids, err := c.CreateProductTemplates([]*ProductTemplate{pt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductTemplate creates a new product.template model and returns its id. +func (c *Client) CreateProductTemplates(pts []*ProductTemplate) ([]int64, error) { + var vv []interface{} + for _, v := range pts { + vv = append(vv, v) + } + return c.Create(ProductTemplateModel, vv, nil) +} + +// UpdateProductTemplate updates an existing product.template record. +func (c *Client) UpdateProductTemplate(pt *ProductTemplate) error { + return c.UpdateProductTemplates([]int64{pt.Id.Get()}, pt) +} + +// UpdateProductTemplates updates existing product.template records. +// All records (represented by ids) will be updated by pt values. +func (c *Client) UpdateProductTemplates(ids []int64, pt *ProductTemplate) error { + return c.Update(ProductTemplateModel, ids, pt, nil) +} + +// DeleteProductTemplate deletes an existing product.template record. +func (c *Client) DeleteProductTemplate(id int64) error { + return c.DeleteProductTemplates([]int64{id}) +} + +// DeleteProductTemplates deletes existing product.template records. +func (c *Client) DeleteProductTemplates(ids []int64) error { + return c.Delete(ProductTemplateModel, ids) +} + +// GetProductTemplate gets product.template existing record. +func (c *Client) GetProductTemplate(id int64) (*ProductTemplate, error) { + pts, err := c.GetProductTemplates([]int64{id}) + if err != nil { + return nil, err + } + return &((*pts)[0]), nil +} + +// GetProductTemplates gets product.template existing records. +func (c *Client) GetProductTemplates(ids []int64) (*ProductTemplates, error) { + pts := &ProductTemplates{} + if err := c.Read(ProductTemplateModel, ids, nil, pts); err != nil { + return nil, err + } + return pts, nil +} + +// FindProductTemplate finds product.template record by querying it with criteria. +func (c *Client) FindProductTemplate(criteria *Criteria) (*ProductTemplate, error) { + pts := &ProductTemplates{} + if err := c.SearchRead(ProductTemplateModel, criteria, NewOptions().Limit(1), pts); err != nil { + return nil, err + } + return &((*pts)[0]), nil +} + +// FindProductTemplates finds product.template records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductTemplates(criteria *Criteria, options *Options) (*ProductTemplates, error) { + pts := &ProductTemplates{} + if err := c.SearchRead(ProductTemplateModel, criteria, options, pts); err != nil { + return nil, err + } + return pts, nil +} + +// FindProductTemplateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductTemplateIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductTemplateModel, criteria, options) +} + +// FindProductTemplateId finds record id by querying it with criteria. +func (c *Client) FindProductTemplateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductTemplateModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_template_attribute_exclusion.go b/product_template_attribute_exclusion.go new file mode 100644 index 0000000..30e0a60 --- /dev/null +++ b/product_template_attribute_exclusion.go @@ -0,0 +1,119 @@ +package odoo + +// ProductTemplateAttributeExclusion represents product.template.attribute.exclusion model. +type ProductTemplateAttributeExclusion struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ProductTemplateAttributeValueId *Many2One `xmlrpc:"product_template_attribute_value_id,omitempty"` + ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,omitempty"` + ValueIds *Relation `xmlrpc:"value_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductTemplateAttributeExclusions represents array of product.template.attribute.exclusion model. +type ProductTemplateAttributeExclusions []ProductTemplateAttributeExclusion + +// ProductTemplateAttributeExclusionModel is the odoo model name. +const ProductTemplateAttributeExclusionModel = "product.template.attribute.exclusion" + +// Many2One convert ProductTemplateAttributeExclusion to *Many2One. +func (ptae *ProductTemplateAttributeExclusion) Many2One() *Many2One { + return NewMany2One(ptae.Id.Get(), "") +} + +// CreateProductTemplateAttributeExclusion creates a new product.template.attribute.exclusion model and returns its id. +func (c *Client) CreateProductTemplateAttributeExclusion(ptae *ProductTemplateAttributeExclusion) (int64, error) { + ids, err := c.CreateProductTemplateAttributeExclusions([]*ProductTemplateAttributeExclusion{ptae}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductTemplateAttributeExclusion creates a new product.template.attribute.exclusion model and returns its id. +func (c *Client) CreateProductTemplateAttributeExclusions(ptaes []*ProductTemplateAttributeExclusion) ([]int64, error) { + var vv []interface{} + for _, v := range ptaes { + vv = append(vv, v) + } + return c.Create(ProductTemplateAttributeExclusionModel, vv, nil) +} + +// UpdateProductTemplateAttributeExclusion updates an existing product.template.attribute.exclusion record. +func (c *Client) UpdateProductTemplateAttributeExclusion(ptae *ProductTemplateAttributeExclusion) error { + return c.UpdateProductTemplateAttributeExclusions([]int64{ptae.Id.Get()}, ptae) +} + +// UpdateProductTemplateAttributeExclusions updates existing product.template.attribute.exclusion records. +// All records (represented by ids) will be updated by ptae values. +func (c *Client) UpdateProductTemplateAttributeExclusions(ids []int64, ptae *ProductTemplateAttributeExclusion) error { + return c.Update(ProductTemplateAttributeExclusionModel, ids, ptae, nil) +} + +// DeleteProductTemplateAttributeExclusion deletes an existing product.template.attribute.exclusion record. +func (c *Client) DeleteProductTemplateAttributeExclusion(id int64) error { + return c.DeleteProductTemplateAttributeExclusions([]int64{id}) +} + +// DeleteProductTemplateAttributeExclusions deletes existing product.template.attribute.exclusion records. +func (c *Client) DeleteProductTemplateAttributeExclusions(ids []int64) error { + return c.Delete(ProductTemplateAttributeExclusionModel, ids) +} + +// GetProductTemplateAttributeExclusion gets product.template.attribute.exclusion existing record. +func (c *Client) GetProductTemplateAttributeExclusion(id int64) (*ProductTemplateAttributeExclusion, error) { + ptaes, err := c.GetProductTemplateAttributeExclusions([]int64{id}) + if err != nil { + return nil, err + } + return &((*ptaes)[0]), nil +} + +// GetProductTemplateAttributeExclusions gets product.template.attribute.exclusion existing records. +func (c *Client) GetProductTemplateAttributeExclusions(ids []int64) (*ProductTemplateAttributeExclusions, error) { + ptaes := &ProductTemplateAttributeExclusions{} + if err := c.Read(ProductTemplateAttributeExclusionModel, ids, nil, ptaes); err != nil { + return nil, err + } + return ptaes, nil +} + +// FindProductTemplateAttributeExclusion finds product.template.attribute.exclusion record by querying it with criteria. +func (c *Client) FindProductTemplateAttributeExclusion(criteria *Criteria) (*ProductTemplateAttributeExclusion, error) { + ptaes := &ProductTemplateAttributeExclusions{} + if err := c.SearchRead(ProductTemplateAttributeExclusionModel, criteria, NewOptions().Limit(1), ptaes); err != nil { + return nil, err + } + return &((*ptaes)[0]), nil +} + +// FindProductTemplateAttributeExclusions finds product.template.attribute.exclusion records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductTemplateAttributeExclusions(criteria *Criteria, options *Options) (*ProductTemplateAttributeExclusions, error) { + ptaes := &ProductTemplateAttributeExclusions{} + if err := c.SearchRead(ProductTemplateAttributeExclusionModel, criteria, options, ptaes); err != nil { + return nil, err + } + return ptaes, nil +} + +// FindProductTemplateAttributeExclusionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductTemplateAttributeExclusionIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductTemplateAttributeExclusionModel, criteria, options) +} + +// FindProductTemplateAttributeExclusionId finds record id by querying it with criteria. +func (c *Client) FindProductTemplateAttributeExclusionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductTemplateAttributeExclusionModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_template_attribute_line.go b/product_template_attribute_line.go new file mode 100644 index 0000000..483d9e4 --- /dev/null +++ b/product_template_attribute_line.go @@ -0,0 +1,123 @@ +package odoo + +// ProductTemplateAttributeLine represents product.template.attribute.line model. +type ProductTemplateAttributeLine struct { + Active *Bool `xmlrpc:"active,omitempty"` + AttributeId *Many2One `xmlrpc:"attribute_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ProductTemplateValueIds *Relation `xmlrpc:"product_template_value_ids,omitempty"` + ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + ValueCount *Int `xmlrpc:"value_count,omitempty"` + ValueIds *Relation `xmlrpc:"value_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductTemplateAttributeLines represents array of product.template.attribute.line model. +type ProductTemplateAttributeLines []ProductTemplateAttributeLine + +// ProductTemplateAttributeLineModel is the odoo model name. +const ProductTemplateAttributeLineModel = "product.template.attribute.line" + +// Many2One convert ProductTemplateAttributeLine to *Many2One. +func (ptal *ProductTemplateAttributeLine) Many2One() *Many2One { + return NewMany2One(ptal.Id.Get(), "") +} + +// CreateProductTemplateAttributeLine creates a new product.template.attribute.line model and returns its id. +func (c *Client) CreateProductTemplateAttributeLine(ptal *ProductTemplateAttributeLine) (int64, error) { + ids, err := c.CreateProductTemplateAttributeLines([]*ProductTemplateAttributeLine{ptal}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductTemplateAttributeLine creates a new product.template.attribute.line model and returns its id. +func (c *Client) CreateProductTemplateAttributeLines(ptals []*ProductTemplateAttributeLine) ([]int64, error) { + var vv []interface{} + for _, v := range ptals { + vv = append(vv, v) + } + return c.Create(ProductTemplateAttributeLineModel, vv, nil) +} + +// UpdateProductTemplateAttributeLine updates an existing product.template.attribute.line record. +func (c *Client) UpdateProductTemplateAttributeLine(ptal *ProductTemplateAttributeLine) error { + return c.UpdateProductTemplateAttributeLines([]int64{ptal.Id.Get()}, ptal) +} + +// UpdateProductTemplateAttributeLines updates existing product.template.attribute.line records. +// All records (represented by ids) will be updated by ptal values. +func (c *Client) UpdateProductTemplateAttributeLines(ids []int64, ptal *ProductTemplateAttributeLine) error { + return c.Update(ProductTemplateAttributeLineModel, ids, ptal, nil) +} + +// DeleteProductTemplateAttributeLine deletes an existing product.template.attribute.line record. +func (c *Client) DeleteProductTemplateAttributeLine(id int64) error { + return c.DeleteProductTemplateAttributeLines([]int64{id}) +} + +// DeleteProductTemplateAttributeLines deletes existing product.template.attribute.line records. +func (c *Client) DeleteProductTemplateAttributeLines(ids []int64) error { + return c.Delete(ProductTemplateAttributeLineModel, ids) +} + +// GetProductTemplateAttributeLine gets product.template.attribute.line existing record. +func (c *Client) GetProductTemplateAttributeLine(id int64) (*ProductTemplateAttributeLine, error) { + ptals, err := c.GetProductTemplateAttributeLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*ptals)[0]), nil +} + +// GetProductTemplateAttributeLines gets product.template.attribute.line existing records. +func (c *Client) GetProductTemplateAttributeLines(ids []int64) (*ProductTemplateAttributeLines, error) { + ptals := &ProductTemplateAttributeLines{} + if err := c.Read(ProductTemplateAttributeLineModel, ids, nil, ptals); err != nil { + return nil, err + } + return ptals, nil +} + +// FindProductTemplateAttributeLine finds product.template.attribute.line record by querying it with criteria. +func (c *Client) FindProductTemplateAttributeLine(criteria *Criteria) (*ProductTemplateAttributeLine, error) { + ptals := &ProductTemplateAttributeLines{} + if err := c.SearchRead(ProductTemplateAttributeLineModel, criteria, NewOptions().Limit(1), ptals); err != nil { + return nil, err + } + return &((*ptals)[0]), nil +} + +// FindProductTemplateAttributeLines finds product.template.attribute.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductTemplateAttributeLines(criteria *Criteria, options *Options) (*ProductTemplateAttributeLines, error) { + ptals := &ProductTemplateAttributeLines{} + if err := c.SearchRead(ProductTemplateAttributeLineModel, criteria, options, ptals); err != nil { + return nil, err + } + return ptals, nil +} + +// FindProductTemplateAttributeLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductTemplateAttributeLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductTemplateAttributeLineModel, criteria, options) +} + +// FindProductTemplateAttributeLineId finds record id by querying it with criteria. +func (c *Client) FindProductTemplateAttributeLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductTemplateAttributeLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/product_template_attribute_value.go b/product_template_attribute_value.go new file mode 100644 index 0000000..fbe4a20 --- /dev/null +++ b/product_template_attribute_value.go @@ -0,0 +1,131 @@ +package odoo + +// ProductTemplateAttributeValue represents product.template.attribute.value model. +type ProductTemplateAttributeValue struct { + AttributeId *Many2One `xmlrpc:"attribute_id,omitempty"` + AttributeLineId *Many2One `xmlrpc:"attribute_line_id,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayType *Selection `xmlrpc:"display_type,omitempty"` + ExcludeFor *Relation `xmlrpc:"exclude_for,omitempty"` + HtmlColor *String `xmlrpc:"html_color,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Image *String `xmlrpc:"image,omitempty"` + IsCustom *Bool `xmlrpc:"is_custom,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PriceExtra *Float `xmlrpc:"price_extra,omitempty"` + ProductAttributeValueId *Many2One `xmlrpc:"product_attribute_value_id,omitempty"` + ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,omitempty"` + PtavActive *Bool `xmlrpc:"ptav_active,omitempty"` + PtavProductVariantIds *Relation `xmlrpc:"ptav_product_variant_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProductTemplateAttributeValues represents array of product.template.attribute.value model. +type ProductTemplateAttributeValues []ProductTemplateAttributeValue + +// ProductTemplateAttributeValueModel is the odoo model name. +const ProductTemplateAttributeValueModel = "product.template.attribute.value" + +// Many2One convert ProductTemplateAttributeValue to *Many2One. +func (ptav *ProductTemplateAttributeValue) Many2One() *Many2One { + return NewMany2One(ptav.Id.Get(), "") +} + +// CreateProductTemplateAttributeValue creates a new product.template.attribute.value model and returns its id. +func (c *Client) CreateProductTemplateAttributeValue(ptav *ProductTemplateAttributeValue) (int64, error) { + ids, err := c.CreateProductTemplateAttributeValues([]*ProductTemplateAttributeValue{ptav}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProductTemplateAttributeValue creates a new product.template.attribute.value model and returns its id. +func (c *Client) CreateProductTemplateAttributeValues(ptavs []*ProductTemplateAttributeValue) ([]int64, error) { + var vv []interface{} + for _, v := range ptavs { + vv = append(vv, v) + } + return c.Create(ProductTemplateAttributeValueModel, vv, nil) +} + +// UpdateProductTemplateAttributeValue updates an existing product.template.attribute.value record. +func (c *Client) UpdateProductTemplateAttributeValue(ptav *ProductTemplateAttributeValue) error { + return c.UpdateProductTemplateAttributeValues([]int64{ptav.Id.Get()}, ptav) +} + +// UpdateProductTemplateAttributeValues updates existing product.template.attribute.value records. +// All records (represented by ids) will be updated by ptav values. +func (c *Client) UpdateProductTemplateAttributeValues(ids []int64, ptav *ProductTemplateAttributeValue) error { + return c.Update(ProductTemplateAttributeValueModel, ids, ptav, nil) +} + +// DeleteProductTemplateAttributeValue deletes an existing product.template.attribute.value record. +func (c *Client) DeleteProductTemplateAttributeValue(id int64) error { + return c.DeleteProductTemplateAttributeValues([]int64{id}) +} + +// DeleteProductTemplateAttributeValues deletes existing product.template.attribute.value records. +func (c *Client) DeleteProductTemplateAttributeValues(ids []int64) error { + return c.Delete(ProductTemplateAttributeValueModel, ids) +} + +// GetProductTemplateAttributeValue gets product.template.attribute.value existing record. +func (c *Client) GetProductTemplateAttributeValue(id int64) (*ProductTemplateAttributeValue, error) { + ptavs, err := c.GetProductTemplateAttributeValues([]int64{id}) + if err != nil { + return nil, err + } + return &((*ptavs)[0]), nil +} + +// GetProductTemplateAttributeValues gets product.template.attribute.value existing records. +func (c *Client) GetProductTemplateAttributeValues(ids []int64) (*ProductTemplateAttributeValues, error) { + ptavs := &ProductTemplateAttributeValues{} + if err := c.Read(ProductTemplateAttributeValueModel, ids, nil, ptavs); err != nil { + return nil, err + } + return ptavs, nil +} + +// FindProductTemplateAttributeValue finds product.template.attribute.value record by querying it with criteria. +func (c *Client) FindProductTemplateAttributeValue(criteria *Criteria) (*ProductTemplateAttributeValue, error) { + ptavs := &ProductTemplateAttributeValues{} + if err := c.SearchRead(ProductTemplateAttributeValueModel, criteria, NewOptions().Limit(1), ptavs); err != nil { + return nil, err + } + return &((*ptavs)[0]), nil +} + +// FindProductTemplateAttributeValues finds product.template.attribute.value records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductTemplateAttributeValues(criteria *Criteria, options *Options) (*ProductTemplateAttributeValues, error) { + ptavs := &ProductTemplateAttributeValues{} + if err := c.SearchRead(ProductTemplateAttributeValueModel, criteria, options, ptavs); err != nil { + return nil, err + } + return ptavs, nil +} + +// FindProductTemplateAttributeValueIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProductTemplateAttributeValueIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProductTemplateAttributeValueModel, criteria, options) +} + +// FindProductTemplateAttributeValueId finds record id by querying it with criteria. +func (c *Client) FindProductTemplateAttributeValueId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProductTemplateAttributeValueModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/project_collaborator.go b/project_collaborator.go new file mode 100644 index 0000000..ce58cc4 --- /dev/null +++ b/project_collaborator.go @@ -0,0 +1,120 @@ +package odoo + +// ProjectCollaborator represents project.collaborator model. +type ProjectCollaborator struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LimitedAccess *Bool `xmlrpc:"limited_access,omitempty"` + PartnerEmail *String `xmlrpc:"partner_email,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectCollaborators represents array of project.collaborator model. +type ProjectCollaborators []ProjectCollaborator + +// ProjectCollaboratorModel is the odoo model name. +const ProjectCollaboratorModel = "project.collaborator" + +// Many2One convert ProjectCollaborator to *Many2One. +func (pc *ProjectCollaborator) Many2One() *Many2One { + return NewMany2One(pc.Id.Get(), "") +} + +// CreateProjectCollaborator creates a new project.collaborator model and returns its id. +func (c *Client) CreateProjectCollaborator(pc *ProjectCollaborator) (int64, error) { + ids, err := c.CreateProjectCollaborators([]*ProjectCollaborator{pc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProjectCollaborator creates a new project.collaborator model and returns its id. +func (c *Client) CreateProjectCollaborators(pcs []*ProjectCollaborator) ([]int64, error) { + var vv []interface{} + for _, v := range pcs { + vv = append(vv, v) + } + return c.Create(ProjectCollaboratorModel, vv, nil) +} + +// UpdateProjectCollaborator updates an existing project.collaborator record. +func (c *Client) UpdateProjectCollaborator(pc *ProjectCollaborator) error { + return c.UpdateProjectCollaborators([]int64{pc.Id.Get()}, pc) +} + +// UpdateProjectCollaborators updates existing project.collaborator records. +// All records (represented by ids) will be updated by pc values. +func (c *Client) UpdateProjectCollaborators(ids []int64, pc *ProjectCollaborator) error { + return c.Update(ProjectCollaboratorModel, ids, pc, nil) +} + +// DeleteProjectCollaborator deletes an existing project.collaborator record. +func (c *Client) DeleteProjectCollaborator(id int64) error { + return c.DeleteProjectCollaborators([]int64{id}) +} + +// DeleteProjectCollaborators deletes existing project.collaborator records. +func (c *Client) DeleteProjectCollaborators(ids []int64) error { + return c.Delete(ProjectCollaboratorModel, ids) +} + +// GetProjectCollaborator gets project.collaborator existing record. +func (c *Client) GetProjectCollaborator(id int64) (*ProjectCollaborator, error) { + pcs, err := c.GetProjectCollaborators([]int64{id}) + if err != nil { + return nil, err + } + return &((*pcs)[0]), nil +} + +// GetProjectCollaborators gets project.collaborator existing records. +func (c *Client) GetProjectCollaborators(ids []int64) (*ProjectCollaborators, error) { + pcs := &ProjectCollaborators{} + if err := c.Read(ProjectCollaboratorModel, ids, nil, pcs); err != nil { + return nil, err + } + return pcs, nil +} + +// FindProjectCollaborator finds project.collaborator record by querying it with criteria. +func (c *Client) FindProjectCollaborator(criteria *Criteria) (*ProjectCollaborator, error) { + pcs := &ProjectCollaborators{} + if err := c.SearchRead(ProjectCollaboratorModel, criteria, NewOptions().Limit(1), pcs); err != nil { + return nil, err + } + return &((*pcs)[0]), nil +} + +// FindProjectCollaborators finds project.collaborator records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectCollaborators(criteria *Criteria, options *Options) (*ProjectCollaborators, error) { + pcs := &ProjectCollaborators{} + if err := c.SearchRead(ProjectCollaboratorModel, criteria, options, pcs); err != nil { + return nil, err + } + return pcs, nil +} + +// FindProjectCollaboratorIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectCollaboratorIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProjectCollaboratorModel, criteria, options) +} + +// FindProjectCollaboratorId finds record id by querying it with criteria. +func (c *Client) FindProjectCollaboratorId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectCollaboratorModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/project_create_invoice.go b/project_create_invoice.go new file mode 100644 index 0000000..866598b --- /dev/null +++ b/project_create_invoice.go @@ -0,0 +1,121 @@ +package odoo + +// ProjectCreateInvoice represents project.create.invoice model. +type ProjectCreateInvoice struct { + CandidateOrders *Relation `xmlrpc:"_candidate_orders,omitempty"` + AmountToInvoice *Float `xmlrpc:"amount_to_invoice,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + SaleOrderId *Many2One `xmlrpc:"sale_order_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectCreateInvoices represents array of project.create.invoice model. +type ProjectCreateInvoices []ProjectCreateInvoice + +// ProjectCreateInvoiceModel is the odoo model name. +const ProjectCreateInvoiceModel = "project.create.invoice" + +// Many2One convert ProjectCreateInvoice to *Many2One. +func (pci *ProjectCreateInvoice) Many2One() *Many2One { + return NewMany2One(pci.Id.Get(), "") +} + +// CreateProjectCreateInvoice creates a new project.create.invoice model and returns its id. +func (c *Client) CreateProjectCreateInvoice(pci *ProjectCreateInvoice) (int64, error) { + ids, err := c.CreateProjectCreateInvoices([]*ProjectCreateInvoice{pci}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProjectCreateInvoice creates a new project.create.invoice model and returns its id. +func (c *Client) CreateProjectCreateInvoices(pcis []*ProjectCreateInvoice) ([]int64, error) { + var vv []interface{} + for _, v := range pcis { + vv = append(vv, v) + } + return c.Create(ProjectCreateInvoiceModel, vv, nil) +} + +// UpdateProjectCreateInvoice updates an existing project.create.invoice record. +func (c *Client) UpdateProjectCreateInvoice(pci *ProjectCreateInvoice) error { + return c.UpdateProjectCreateInvoices([]int64{pci.Id.Get()}, pci) +} + +// UpdateProjectCreateInvoices updates existing project.create.invoice records. +// All records (represented by ids) will be updated by pci values. +func (c *Client) UpdateProjectCreateInvoices(ids []int64, pci *ProjectCreateInvoice) error { + return c.Update(ProjectCreateInvoiceModel, ids, pci, nil) +} + +// DeleteProjectCreateInvoice deletes an existing project.create.invoice record. +func (c *Client) DeleteProjectCreateInvoice(id int64) error { + return c.DeleteProjectCreateInvoices([]int64{id}) +} + +// DeleteProjectCreateInvoices deletes existing project.create.invoice records. +func (c *Client) DeleteProjectCreateInvoices(ids []int64) error { + return c.Delete(ProjectCreateInvoiceModel, ids) +} + +// GetProjectCreateInvoice gets project.create.invoice existing record. +func (c *Client) GetProjectCreateInvoice(id int64) (*ProjectCreateInvoice, error) { + pcis, err := c.GetProjectCreateInvoices([]int64{id}) + if err != nil { + return nil, err + } + return &((*pcis)[0]), nil +} + +// GetProjectCreateInvoices gets project.create.invoice existing records. +func (c *Client) GetProjectCreateInvoices(ids []int64) (*ProjectCreateInvoices, error) { + pcis := &ProjectCreateInvoices{} + if err := c.Read(ProjectCreateInvoiceModel, ids, nil, pcis); err != nil { + return nil, err + } + return pcis, nil +} + +// FindProjectCreateInvoice finds project.create.invoice record by querying it with criteria. +func (c *Client) FindProjectCreateInvoice(criteria *Criteria) (*ProjectCreateInvoice, error) { + pcis := &ProjectCreateInvoices{} + if err := c.SearchRead(ProjectCreateInvoiceModel, criteria, NewOptions().Limit(1), pcis); err != nil { + return nil, err + } + return &((*pcis)[0]), nil +} + +// FindProjectCreateInvoices finds project.create.invoice records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectCreateInvoices(criteria *Criteria, options *Options) (*ProjectCreateInvoices, error) { + pcis := &ProjectCreateInvoices{} + if err := c.SearchRead(ProjectCreateInvoiceModel, criteria, options, pcis); err != nil { + return nil, err + } + return pcis, nil +} + +// FindProjectCreateInvoiceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectCreateInvoiceIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProjectCreateInvoiceModel, criteria, options) +} + +// FindProjectCreateInvoiceId finds record id by querying it with criteria. +func (c *Client) FindProjectCreateInvoiceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectCreateInvoiceModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/project_milestone.go b/project_milestone.go new file mode 100644 index 0000000..3011e0a --- /dev/null +++ b/project_milestone.go @@ -0,0 +1,147 @@ +package odoo + +// ProjectMilestone represents project.milestone model. +type ProjectMilestone struct { + AllowBillable *Bool `xmlrpc:"allow_billable,omitempty"` + CanBeMarkedAsDone *Bool `xmlrpc:"can_be_marked_as_done,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Deadline *Time `xmlrpc:"deadline,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DoneTaskCount *Int `xmlrpc:"done_task_count,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsDeadlineExceeded *Bool `xmlrpc:"is_deadline_exceeded,omitempty"` + IsDeadlineFuture *Bool `xmlrpc:"is_deadline_future,omitempty"` + IsReached *Bool `xmlrpc:"is_reached,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ProductUom *Many2One `xmlrpc:"product_uom,omitempty"` + ProductUomQty *Float `xmlrpc:"product_uom_qty,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + ProjectPartnerId *Many2One `xmlrpc:"project_partner_id,omitempty"` + QuantityPercentage *Float `xmlrpc:"quantity_percentage,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + ReachedDate *Time `xmlrpc:"reached_date,omitempty"` + SaleLineDisplayName *String `xmlrpc:"sale_line_display_name,omitempty"` + SaleLineId *Many2One `xmlrpc:"sale_line_id,omitempty"` + TaskCount *Int `xmlrpc:"task_count,omitempty"` + TaskIds *Relation `xmlrpc:"task_ids,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectMilestones represents array of project.milestone model. +type ProjectMilestones []ProjectMilestone + +// ProjectMilestoneModel is the odoo model name. +const ProjectMilestoneModel = "project.milestone" + +// Many2One convert ProjectMilestone to *Many2One. +func (pm *ProjectMilestone) Many2One() *Many2One { + return NewMany2One(pm.Id.Get(), "") +} + +// CreateProjectMilestone creates a new project.milestone model and returns its id. +func (c *Client) CreateProjectMilestone(pm *ProjectMilestone) (int64, error) { + ids, err := c.CreateProjectMilestones([]*ProjectMilestone{pm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProjectMilestone creates a new project.milestone model and returns its id. +func (c *Client) CreateProjectMilestones(pms []*ProjectMilestone) ([]int64, error) { + var vv []interface{} + for _, v := range pms { + vv = append(vv, v) + } + return c.Create(ProjectMilestoneModel, vv, nil) +} + +// UpdateProjectMilestone updates an existing project.milestone record. +func (c *Client) UpdateProjectMilestone(pm *ProjectMilestone) error { + return c.UpdateProjectMilestones([]int64{pm.Id.Get()}, pm) +} + +// UpdateProjectMilestones updates existing project.milestone records. +// All records (represented by ids) will be updated by pm values. +func (c *Client) UpdateProjectMilestones(ids []int64, pm *ProjectMilestone) error { + return c.Update(ProjectMilestoneModel, ids, pm, nil) +} + +// DeleteProjectMilestone deletes an existing project.milestone record. +func (c *Client) DeleteProjectMilestone(id int64) error { + return c.DeleteProjectMilestones([]int64{id}) +} + +// DeleteProjectMilestones deletes existing project.milestone records. +func (c *Client) DeleteProjectMilestones(ids []int64) error { + return c.Delete(ProjectMilestoneModel, ids) +} + +// GetProjectMilestone gets project.milestone existing record. +func (c *Client) GetProjectMilestone(id int64) (*ProjectMilestone, error) { + pms, err := c.GetProjectMilestones([]int64{id}) + if err != nil { + return nil, err + } + return &((*pms)[0]), nil +} + +// GetProjectMilestones gets project.milestone existing records. +func (c *Client) GetProjectMilestones(ids []int64) (*ProjectMilestones, error) { + pms := &ProjectMilestones{} + if err := c.Read(ProjectMilestoneModel, ids, nil, pms); err != nil { + return nil, err + } + return pms, nil +} + +// FindProjectMilestone finds project.milestone record by querying it with criteria. +func (c *Client) FindProjectMilestone(criteria *Criteria) (*ProjectMilestone, error) { + pms := &ProjectMilestones{} + if err := c.SearchRead(ProjectMilestoneModel, criteria, NewOptions().Limit(1), pms); err != nil { + return nil, err + } + return &((*pms)[0]), nil +} + +// FindProjectMilestones finds project.milestone records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectMilestones(criteria *Criteria, options *Options) (*ProjectMilestones, error) { + pms := &ProjectMilestones{} + if err := c.SearchRead(ProjectMilestoneModel, criteria, options, pms); err != nil { + return nil, err + } + return pms, nil +} + +// FindProjectMilestoneIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectMilestoneIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProjectMilestoneModel, criteria, options) +} + +// FindProjectMilestoneId finds record id by querying it with criteria. +func (c *Client) FindProjectMilestoneId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectMilestoneModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/project_project.go b/project_project.go new file mode 100644 index 0000000..df3eb20 --- /dev/null +++ b/project_project.go @@ -0,0 +1,244 @@ +package odoo + +// ProjectProject represents project.project model. +type ProjectProject struct { + AccessInstructionMessage *String `xmlrpc:"access_instruction_message,omitempty"` + AccessToken *String `xmlrpc:"access_token,omitempty"` + AccessUrl *String `xmlrpc:"access_url,omitempty"` + AccessWarning *String `xmlrpc:"access_warning,omitempty"` + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AliasBouncedContent *String `xmlrpc:"alias_bounced_content,omitempty"` + AliasContact *Selection `xmlrpc:"alias_contact,omitempty"` + AliasDefaults *String `xmlrpc:"alias_defaults,omitempty"` + AliasDomain *String `xmlrpc:"alias_domain,omitempty"` + AliasDomainId *Many2One `xmlrpc:"alias_domain_id,omitempty"` + AliasEmail *String `xmlrpc:"alias_email,omitempty"` + AliasForceThreadId *Int `xmlrpc:"alias_force_thread_id,omitempty"` + AliasFullName *String `xmlrpc:"alias_full_name,omitempty"` + AliasId *Many2One `xmlrpc:"alias_id,omitempty"` + AliasIncomingLocal *Bool `xmlrpc:"alias_incoming_local,omitempty"` + AliasModelId *Many2One `xmlrpc:"alias_model_id,omitempty"` + AliasName *String `xmlrpc:"alias_name,omitempty"` + AliasParentModelId *Many2One `xmlrpc:"alias_parent_model_id,omitempty"` + AliasParentThreadId *Int `xmlrpc:"alias_parent_thread_id,omitempty"` + AliasStatus *Selection `xmlrpc:"alias_status,omitempty"` + AllocatedHours *Float `xmlrpc:"allocated_hours,omitempty"` + AllowBillable *Bool `xmlrpc:"allow_billable,omitempty"` + AllowMilestones *Bool `xmlrpc:"allow_milestones,omitempty"` + AllowTaskDependencies *Bool `xmlrpc:"allow_task_dependencies,omitempty"` + AllowTimesheets *Bool `xmlrpc:"allow_timesheets,omitempty"` + AnalyticAccountActive *Bool `xmlrpc:"analytic_account_active,omitempty"` + AnalyticAccountBalance *Float `xmlrpc:"analytic_account_balance,omitempty"` + AutoAccountId *Many2One `xmlrpc:"auto_account_id,omitempty"` + BillingType *Selection `xmlrpc:"billing_type,omitempty"` + CanMarkMilestoneAsDone *Bool `xmlrpc:"can_mark_milestone_as_done,omitempty"` + ClosedTaskCount *Int `xmlrpc:"closed_task_count,omitempty"` + CollaboratorCount *Int `xmlrpc:"collaborator_count,omitempty"` + CollaboratorIds *Relation `xmlrpc:"collaborator_ids,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DateStart *Time `xmlrpc:"date_start,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplaySalesStatButtons *Bool `xmlrpc:"display_sales_stat_buttons,omitempty"` + DurationTracking *String `xmlrpc:"duration_tracking,omitempty"` + EffectiveHours *Float `xmlrpc:"effective_hours,omitempty"` + EncodeUomInDays *Bool `xmlrpc:"encode_uom_in_days,omitempty"` + FavoriteUserIds *Relation `xmlrpc:"favorite_user_ids,omitempty"` + HasAnySoToInvoice *Bool `xmlrpc:"has_any_so_to_invoice,omitempty"` + HasAnySoWithNothingToInvoice *Bool `xmlrpc:"has_any_so_with_nothing_to_invoice,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceCount *Int `xmlrpc:"invoice_count,omitempty"` + IsFavorite *Bool `xmlrpc:"is_favorite,omitempty"` + IsInternalProject *Bool `xmlrpc:"is_internal_project,omitempty"` + IsMilestoneDeadlineExceeded *Bool `xmlrpc:"is_milestone_deadline_exceeded,omitempty"` + IsMilestoneExceeded *Bool `xmlrpc:"is_milestone_exceeded,omitempty"` + IsProjectOvertime *Bool `xmlrpc:"is_project_overtime,omitempty"` + LabelTasks *String `xmlrpc:"label_tasks,omitempty"` + LastUpdateColor *Int `xmlrpc:"last_update_color,omitempty"` + LastUpdateId *Many2One `xmlrpc:"last_update_id,omitempty"` + LastUpdateStatus *Selection `xmlrpc:"last_update_status,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MilestoneCount *Int `xmlrpc:"milestone_count,omitempty"` + MilestoneCountReached *Int `xmlrpc:"milestone_count_reached,omitempty"` + MilestoneIds *Relation `xmlrpc:"milestone_ids,omitempty"` + MilestoneProgress *Int `xmlrpc:"milestone_progress,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NextMilestoneId *Many2One `xmlrpc:"next_milestone_id,omitempty"` + OpenTaskCount *Int `xmlrpc:"open_task_count,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PricingType *Selection `xmlrpc:"pricing_type,omitempty"` + PrivacyVisibility *Selection `xmlrpc:"privacy_visibility,omitempty"` + PrivacyVisibilityWarning *String `xmlrpc:"privacy_visibility_warning,omitempty"` + PurchaseOrdersCount *Int `xmlrpc:"purchase_orders_count,omitempty"` + RatingActive *Bool `xmlrpc:"rating_active,omitempty"` + RatingAvg *Float `xmlrpc:"rating_avg,omitempty"` + RatingAvgPercentage *Float `xmlrpc:"rating_avg_percentage,omitempty"` + RatingCount *Int `xmlrpc:"rating_count,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RatingPercentageSatisfaction *Int `xmlrpc:"rating_percentage_satisfaction,omitempty"` + RatingRequestDeadline *Time `xmlrpc:"rating_request_deadline,omitempty"` + RatingStatus *Selection `xmlrpc:"rating_status,omitempty"` + RatingStatusPeriod *Selection `xmlrpc:"rating_status_period,omitempty"` + ReinvoicedSaleOrderId *Many2One `xmlrpc:"reinvoiced_sale_order_id,omitempty"` + RemainingHours *Float `xmlrpc:"remaining_hours,omitempty"` + ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omitempty"` + SaleLineEmployeeIds *Relation `xmlrpc:"sale_line_employee_ids,omitempty"` + SaleLineId *Many2One `xmlrpc:"sale_line_id,omitempty"` + SaleOrderCount *Int `xmlrpc:"sale_order_count,omitempty"` + SaleOrderId *Many2One `xmlrpc:"sale_order_id,omitempty"` + SaleOrderLineCount *Int `xmlrpc:"sale_order_line_count,omitempty"` + SaleOrderState *Selection `xmlrpc:"sale_order_state,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + StageId *Many2One `xmlrpc:"stage_id,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TaskCompletionPercentage *Float `xmlrpc:"task_completion_percentage,omitempty"` + TaskCount *Int `xmlrpc:"task_count,omitempty"` + TaskIds *Relation `xmlrpc:"task_ids,omitempty"` + TaskPropertiesDefinition interface{} `xmlrpc:"task_properties_definition,omitempty"` + Tasks *Relation `xmlrpc:"tasks,omitempty"` + TimesheetEncodeUomId *Many2One `xmlrpc:"timesheet_encode_uom_id,omitempty"` + TimesheetIds *Relation `xmlrpc:"timesheet_ids,omitempty"` + TimesheetProductId *Many2One `xmlrpc:"timesheet_product_id,omitempty"` + TotalTimesheetTime *Int `xmlrpc:"total_timesheet_time,omitempty"` + TypeIds *Relation `xmlrpc:"type_ids,omitempty"` + UpdateCount *Int `xmlrpc:"update_count,omitempty"` + UpdateIds *Relation `xmlrpc:"update_ids,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + VendorBillCount *Int `xmlrpc:"vendor_bill_count,omitempty"` + WarningEmployeeRate *Bool `xmlrpc:"warning_employee_rate,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectProjects represents array of project.project model. +type ProjectProjects []ProjectProject + +// ProjectProjectModel is the odoo model name. +const ProjectProjectModel = "project.project" + +// Many2One convert ProjectProject to *Many2One. +func (pp *ProjectProject) Many2One() *Many2One { + return NewMany2One(pp.Id.Get(), "") +} + +// CreateProjectProject creates a new project.project model and returns its id. +func (c *Client) CreateProjectProject(pp *ProjectProject) (int64, error) { + ids, err := c.CreateProjectProjects([]*ProjectProject{pp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProjectProject creates a new project.project model and returns its id. +func (c *Client) CreateProjectProjects(pps []*ProjectProject) ([]int64, error) { + var vv []interface{} + for _, v := range pps { + vv = append(vv, v) + } + return c.Create(ProjectProjectModel, vv, nil) +} + +// UpdateProjectProject updates an existing project.project record. +func (c *Client) UpdateProjectProject(pp *ProjectProject) error { + return c.UpdateProjectProjects([]int64{pp.Id.Get()}, pp) +} + +// UpdateProjectProjects updates existing project.project records. +// All records (represented by ids) will be updated by pp values. +func (c *Client) UpdateProjectProjects(ids []int64, pp *ProjectProject) error { + return c.Update(ProjectProjectModel, ids, pp, nil) +} + +// DeleteProjectProject deletes an existing project.project record. +func (c *Client) DeleteProjectProject(id int64) error { + return c.DeleteProjectProjects([]int64{id}) +} + +// DeleteProjectProjects deletes existing project.project records. +func (c *Client) DeleteProjectProjects(ids []int64) error { + return c.Delete(ProjectProjectModel, ids) +} + +// GetProjectProject gets project.project existing record. +func (c *Client) GetProjectProject(id int64) (*ProjectProject, error) { + pps, err := c.GetProjectProjects([]int64{id}) + if err != nil { + return nil, err + } + return &((*pps)[0]), nil +} + +// GetProjectProjects gets project.project existing records. +func (c *Client) GetProjectProjects(ids []int64) (*ProjectProjects, error) { + pps := &ProjectProjects{} + if err := c.Read(ProjectProjectModel, ids, nil, pps); err != nil { + return nil, err + } + return pps, nil +} + +// FindProjectProject finds project.project record by querying it with criteria. +func (c *Client) FindProjectProject(criteria *Criteria) (*ProjectProject, error) { + pps := &ProjectProjects{} + if err := c.SearchRead(ProjectProjectModel, criteria, NewOptions().Limit(1), pps); err != nil { + return nil, err + } + return &((*pps)[0]), nil +} + +// FindProjectProjects finds project.project records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectProjects(criteria *Criteria, options *Options) (*ProjectProjects, error) { + pps := &ProjectProjects{} + if err := c.SearchRead(ProjectProjectModel, criteria, options, pps); err != nil { + return nil, err + } + return pps, nil +} + +// FindProjectProjectIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectProjectIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProjectProjectModel, criteria, options) +} + +// FindProjectProjectId finds record id by querying it with criteria. +func (c *Client) FindProjectProjectId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectProjectModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/project_project_stage.go b/project_project_stage.go new file mode 100644 index 0000000..d9fb262 --- /dev/null +++ b/project_project_stage.go @@ -0,0 +1,123 @@ +package odoo + +// ProjectProjectStage represents project.project.stage model. +type ProjectProjectStage struct { + Active *Bool `xmlrpc:"active,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Fold *Bool `xmlrpc:"fold,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MailTemplateId *Many2One `xmlrpc:"mail_template_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SmsTemplateId *Many2One `xmlrpc:"sms_template_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectProjectStages represents array of project.project.stage model. +type ProjectProjectStages []ProjectProjectStage + +// ProjectProjectStageModel is the odoo model name. +const ProjectProjectStageModel = "project.project.stage" + +// Many2One convert ProjectProjectStage to *Many2One. +func (pps *ProjectProjectStage) Many2One() *Many2One { + return NewMany2One(pps.Id.Get(), "") +} + +// CreateProjectProjectStage creates a new project.project.stage model and returns its id. +func (c *Client) CreateProjectProjectStage(pps *ProjectProjectStage) (int64, error) { + ids, err := c.CreateProjectProjectStages([]*ProjectProjectStage{pps}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProjectProjectStage creates a new project.project.stage model and returns its id. +func (c *Client) CreateProjectProjectStages(ppss []*ProjectProjectStage) ([]int64, error) { + var vv []interface{} + for _, v := range ppss { + vv = append(vv, v) + } + return c.Create(ProjectProjectStageModel, vv, nil) +} + +// UpdateProjectProjectStage updates an existing project.project.stage record. +func (c *Client) UpdateProjectProjectStage(pps *ProjectProjectStage) error { + return c.UpdateProjectProjectStages([]int64{pps.Id.Get()}, pps) +} + +// UpdateProjectProjectStages updates existing project.project.stage records. +// All records (represented by ids) will be updated by pps values. +func (c *Client) UpdateProjectProjectStages(ids []int64, pps *ProjectProjectStage) error { + return c.Update(ProjectProjectStageModel, ids, pps, nil) +} + +// DeleteProjectProjectStage deletes an existing project.project.stage record. +func (c *Client) DeleteProjectProjectStage(id int64) error { + return c.DeleteProjectProjectStages([]int64{id}) +} + +// DeleteProjectProjectStages deletes existing project.project.stage records. +func (c *Client) DeleteProjectProjectStages(ids []int64) error { + return c.Delete(ProjectProjectStageModel, ids) +} + +// GetProjectProjectStage gets project.project.stage existing record. +func (c *Client) GetProjectProjectStage(id int64) (*ProjectProjectStage, error) { + ppss, err := c.GetProjectProjectStages([]int64{id}) + if err != nil { + return nil, err + } + return &((*ppss)[0]), nil +} + +// GetProjectProjectStages gets project.project.stage existing records. +func (c *Client) GetProjectProjectStages(ids []int64) (*ProjectProjectStages, error) { + ppss := &ProjectProjectStages{} + if err := c.Read(ProjectProjectStageModel, ids, nil, ppss); err != nil { + return nil, err + } + return ppss, nil +} + +// FindProjectProjectStage finds project.project.stage record by querying it with criteria. +func (c *Client) FindProjectProjectStage(criteria *Criteria) (*ProjectProjectStage, error) { + ppss := &ProjectProjectStages{} + if err := c.SearchRead(ProjectProjectStageModel, criteria, NewOptions().Limit(1), ppss); err != nil { + return nil, err + } + return &((*ppss)[0]), nil +} + +// FindProjectProjectStages finds project.project.stage records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectProjectStages(criteria *Criteria, options *Options) (*ProjectProjectStages, error) { + ppss := &ProjectProjectStages{} + if err := c.SearchRead(ProjectProjectStageModel, criteria, options, ppss); err != nil { + return nil, err + } + return ppss, nil +} + +// FindProjectProjectStageIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectProjectStageIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProjectProjectStageModel, criteria, options) +} + +// FindProjectProjectStageId finds record id by querying it with criteria. +func (c *Client) FindProjectProjectStageId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectProjectStageModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/project_project_stage_delete_wizard.go b/project_project_stage_delete_wizard.go new file mode 100644 index 0000000..be5d0d3 --- /dev/null +++ b/project_project_stage_delete_wizard.go @@ -0,0 +1,119 @@ +package odoo + +// ProjectProjectStageDeleteWizard represents project.project.stage.delete.wizard model. +type ProjectProjectStageDeleteWizard struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ProjectsCount *Int `xmlrpc:"projects_count,omitempty"` + StageIds *Relation `xmlrpc:"stage_ids,omitempty"` + StagesActive *Bool `xmlrpc:"stages_active,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectProjectStageDeleteWizards represents array of project.project.stage.delete.wizard model. +type ProjectProjectStageDeleteWizards []ProjectProjectStageDeleteWizard + +// ProjectProjectStageDeleteWizardModel is the odoo model name. +const ProjectProjectStageDeleteWizardModel = "project.project.stage.delete.wizard" + +// Many2One convert ProjectProjectStageDeleteWizard to *Many2One. +func (ppsdw *ProjectProjectStageDeleteWizard) Many2One() *Many2One { + return NewMany2One(ppsdw.Id.Get(), "") +} + +// CreateProjectProjectStageDeleteWizard creates a new project.project.stage.delete.wizard model and returns its id. +func (c *Client) CreateProjectProjectStageDeleteWizard(ppsdw *ProjectProjectStageDeleteWizard) (int64, error) { + ids, err := c.CreateProjectProjectStageDeleteWizards([]*ProjectProjectStageDeleteWizard{ppsdw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProjectProjectStageDeleteWizard creates a new project.project.stage.delete.wizard model and returns its id. +func (c *Client) CreateProjectProjectStageDeleteWizards(ppsdws []*ProjectProjectStageDeleteWizard) ([]int64, error) { + var vv []interface{} + for _, v := range ppsdws { + vv = append(vv, v) + } + return c.Create(ProjectProjectStageDeleteWizardModel, vv, nil) +} + +// UpdateProjectProjectStageDeleteWizard updates an existing project.project.stage.delete.wizard record. +func (c *Client) UpdateProjectProjectStageDeleteWizard(ppsdw *ProjectProjectStageDeleteWizard) error { + return c.UpdateProjectProjectStageDeleteWizards([]int64{ppsdw.Id.Get()}, ppsdw) +} + +// UpdateProjectProjectStageDeleteWizards updates existing project.project.stage.delete.wizard records. +// All records (represented by ids) will be updated by ppsdw values. +func (c *Client) UpdateProjectProjectStageDeleteWizards(ids []int64, ppsdw *ProjectProjectStageDeleteWizard) error { + return c.Update(ProjectProjectStageDeleteWizardModel, ids, ppsdw, nil) +} + +// DeleteProjectProjectStageDeleteWizard deletes an existing project.project.stage.delete.wizard record. +func (c *Client) DeleteProjectProjectStageDeleteWizard(id int64) error { + return c.DeleteProjectProjectStageDeleteWizards([]int64{id}) +} + +// DeleteProjectProjectStageDeleteWizards deletes existing project.project.stage.delete.wizard records. +func (c *Client) DeleteProjectProjectStageDeleteWizards(ids []int64) error { + return c.Delete(ProjectProjectStageDeleteWizardModel, ids) +} + +// GetProjectProjectStageDeleteWizard gets project.project.stage.delete.wizard existing record. +func (c *Client) GetProjectProjectStageDeleteWizard(id int64) (*ProjectProjectStageDeleteWizard, error) { + ppsdws, err := c.GetProjectProjectStageDeleteWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*ppsdws)[0]), nil +} + +// GetProjectProjectStageDeleteWizards gets project.project.stage.delete.wizard existing records. +func (c *Client) GetProjectProjectStageDeleteWizards(ids []int64) (*ProjectProjectStageDeleteWizards, error) { + ppsdws := &ProjectProjectStageDeleteWizards{} + if err := c.Read(ProjectProjectStageDeleteWizardModel, ids, nil, ppsdws); err != nil { + return nil, err + } + return ppsdws, nil +} + +// FindProjectProjectStageDeleteWizard finds project.project.stage.delete.wizard record by querying it with criteria. +func (c *Client) FindProjectProjectStageDeleteWizard(criteria *Criteria) (*ProjectProjectStageDeleteWizard, error) { + ppsdws := &ProjectProjectStageDeleteWizards{} + if err := c.SearchRead(ProjectProjectStageDeleteWizardModel, criteria, NewOptions().Limit(1), ppsdws); err != nil { + return nil, err + } + return &((*ppsdws)[0]), nil +} + +// FindProjectProjectStageDeleteWizards finds project.project.stage.delete.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectProjectStageDeleteWizards(criteria *Criteria, options *Options) (*ProjectProjectStageDeleteWizards, error) { + ppsdws := &ProjectProjectStageDeleteWizards{} + if err := c.SearchRead(ProjectProjectStageDeleteWizardModel, criteria, options, ppsdws); err != nil { + return nil, err + } + return ppsdws, nil +} + +// FindProjectProjectStageDeleteWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectProjectStageDeleteWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProjectProjectStageDeleteWizardModel, criteria, options) +} + +// FindProjectProjectStageDeleteWizardId finds record id by querying it with criteria. +func (c *Client) FindProjectProjectStageDeleteWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectProjectStageDeleteWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/project_sale_line_employee_map.go b/project_sale_line_employee_map.go new file mode 100644 index 0000000..69862a5 --- /dev/null +++ b/project_sale_line_employee_map.go @@ -0,0 +1,129 @@ +package odoo + +// ProjectSaleLineEmployeeMap represents project.sale.line.employee.map model. +type ProjectSaleLineEmployeeMap struct { + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + Cost *Float `xmlrpc:"cost,omitempty"` + CostCurrencyId *Many2One `xmlrpc:"cost_currency_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayCost *Float `xmlrpc:"display_cost,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + ExistingEmployeeIds *Relation `xmlrpc:"existing_employee_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsCostChanged *Bool `xmlrpc:"is_cost_changed,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PriceUnit *Float `xmlrpc:"price_unit,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + SaleLineId *Many2One `xmlrpc:"sale_line_id,omitempty"` + SaleOrderId *Many2One `xmlrpc:"sale_order_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectSaleLineEmployeeMaps represents array of project.sale.line.employee.map model. +type ProjectSaleLineEmployeeMaps []ProjectSaleLineEmployeeMap + +// ProjectSaleLineEmployeeMapModel is the odoo model name. +const ProjectSaleLineEmployeeMapModel = "project.sale.line.employee.map" + +// Many2One convert ProjectSaleLineEmployeeMap to *Many2One. +func (pslem *ProjectSaleLineEmployeeMap) Many2One() *Many2One { + return NewMany2One(pslem.Id.Get(), "") +} + +// CreateProjectSaleLineEmployeeMap creates a new project.sale.line.employee.map model and returns its id. +func (c *Client) CreateProjectSaleLineEmployeeMap(pslem *ProjectSaleLineEmployeeMap) (int64, error) { + ids, err := c.CreateProjectSaleLineEmployeeMaps([]*ProjectSaleLineEmployeeMap{pslem}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProjectSaleLineEmployeeMap creates a new project.sale.line.employee.map model and returns its id. +func (c *Client) CreateProjectSaleLineEmployeeMaps(pslems []*ProjectSaleLineEmployeeMap) ([]int64, error) { + var vv []interface{} + for _, v := range pslems { + vv = append(vv, v) + } + return c.Create(ProjectSaleLineEmployeeMapModel, vv, nil) +} + +// UpdateProjectSaleLineEmployeeMap updates an existing project.sale.line.employee.map record. +func (c *Client) UpdateProjectSaleLineEmployeeMap(pslem *ProjectSaleLineEmployeeMap) error { + return c.UpdateProjectSaleLineEmployeeMaps([]int64{pslem.Id.Get()}, pslem) +} + +// UpdateProjectSaleLineEmployeeMaps updates existing project.sale.line.employee.map records. +// All records (represented by ids) will be updated by pslem values. +func (c *Client) UpdateProjectSaleLineEmployeeMaps(ids []int64, pslem *ProjectSaleLineEmployeeMap) error { + return c.Update(ProjectSaleLineEmployeeMapModel, ids, pslem, nil) +} + +// DeleteProjectSaleLineEmployeeMap deletes an existing project.sale.line.employee.map record. +func (c *Client) DeleteProjectSaleLineEmployeeMap(id int64) error { + return c.DeleteProjectSaleLineEmployeeMaps([]int64{id}) +} + +// DeleteProjectSaleLineEmployeeMaps deletes existing project.sale.line.employee.map records. +func (c *Client) DeleteProjectSaleLineEmployeeMaps(ids []int64) error { + return c.Delete(ProjectSaleLineEmployeeMapModel, ids) +} + +// GetProjectSaleLineEmployeeMap gets project.sale.line.employee.map existing record. +func (c *Client) GetProjectSaleLineEmployeeMap(id int64) (*ProjectSaleLineEmployeeMap, error) { + pslems, err := c.GetProjectSaleLineEmployeeMaps([]int64{id}) + if err != nil { + return nil, err + } + return &((*pslems)[0]), nil +} + +// GetProjectSaleLineEmployeeMaps gets project.sale.line.employee.map existing records. +func (c *Client) GetProjectSaleLineEmployeeMaps(ids []int64) (*ProjectSaleLineEmployeeMaps, error) { + pslems := &ProjectSaleLineEmployeeMaps{} + if err := c.Read(ProjectSaleLineEmployeeMapModel, ids, nil, pslems); err != nil { + return nil, err + } + return pslems, nil +} + +// FindProjectSaleLineEmployeeMap finds project.sale.line.employee.map record by querying it with criteria. +func (c *Client) FindProjectSaleLineEmployeeMap(criteria *Criteria) (*ProjectSaleLineEmployeeMap, error) { + pslems := &ProjectSaleLineEmployeeMaps{} + if err := c.SearchRead(ProjectSaleLineEmployeeMapModel, criteria, NewOptions().Limit(1), pslems); err != nil { + return nil, err + } + return &((*pslems)[0]), nil +} + +// FindProjectSaleLineEmployeeMaps finds project.sale.line.employee.map records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectSaleLineEmployeeMaps(criteria *Criteria, options *Options) (*ProjectSaleLineEmployeeMaps, error) { + pslems := &ProjectSaleLineEmployeeMaps{} + if err := c.SearchRead(ProjectSaleLineEmployeeMapModel, criteria, options, pslems); err != nil { + return nil, err + } + return pslems, nil +} + +// FindProjectSaleLineEmployeeMapIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectSaleLineEmployeeMapIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProjectSaleLineEmployeeMapModel, criteria, options) +} + +// FindProjectSaleLineEmployeeMapId finds record id by querying it with criteria. +func (c *Client) FindProjectSaleLineEmployeeMapId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectSaleLineEmployeeMapModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/project_share_collaborator_wizard.go b/project_share_collaborator_wizard.go new file mode 100644 index 0000000..7bf7a63 --- /dev/null +++ b/project_share_collaborator_wizard.go @@ -0,0 +1,120 @@ +package odoo + +// ProjectShareCollaboratorWizard represents project.share.collaborator.wizard model. +type ProjectShareCollaboratorWizard struct { + AccessMode *Selection `xmlrpc:"access_mode,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ParentWizardId *Many2One `xmlrpc:"parent_wizard_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + SendInvitation *Bool `xmlrpc:"send_invitation,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectShareCollaboratorWizards represents array of project.share.collaborator.wizard model. +type ProjectShareCollaboratorWizards []ProjectShareCollaboratorWizard + +// ProjectShareCollaboratorWizardModel is the odoo model name. +const ProjectShareCollaboratorWizardModel = "project.share.collaborator.wizard" + +// Many2One convert ProjectShareCollaboratorWizard to *Many2One. +func (pscw *ProjectShareCollaboratorWizard) Many2One() *Many2One { + return NewMany2One(pscw.Id.Get(), "") +} + +// CreateProjectShareCollaboratorWizard creates a new project.share.collaborator.wizard model and returns its id. +func (c *Client) CreateProjectShareCollaboratorWizard(pscw *ProjectShareCollaboratorWizard) (int64, error) { + ids, err := c.CreateProjectShareCollaboratorWizards([]*ProjectShareCollaboratorWizard{pscw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProjectShareCollaboratorWizard creates a new project.share.collaborator.wizard model and returns its id. +func (c *Client) CreateProjectShareCollaboratorWizards(pscws []*ProjectShareCollaboratorWizard) ([]int64, error) { + var vv []interface{} + for _, v := range pscws { + vv = append(vv, v) + } + return c.Create(ProjectShareCollaboratorWizardModel, vv, nil) +} + +// UpdateProjectShareCollaboratorWizard updates an existing project.share.collaborator.wizard record. +func (c *Client) UpdateProjectShareCollaboratorWizard(pscw *ProjectShareCollaboratorWizard) error { + return c.UpdateProjectShareCollaboratorWizards([]int64{pscw.Id.Get()}, pscw) +} + +// UpdateProjectShareCollaboratorWizards updates existing project.share.collaborator.wizard records. +// All records (represented by ids) will be updated by pscw values. +func (c *Client) UpdateProjectShareCollaboratorWizards(ids []int64, pscw *ProjectShareCollaboratorWizard) error { + return c.Update(ProjectShareCollaboratorWizardModel, ids, pscw, nil) +} + +// DeleteProjectShareCollaboratorWizard deletes an existing project.share.collaborator.wizard record. +func (c *Client) DeleteProjectShareCollaboratorWizard(id int64) error { + return c.DeleteProjectShareCollaboratorWizards([]int64{id}) +} + +// DeleteProjectShareCollaboratorWizards deletes existing project.share.collaborator.wizard records. +func (c *Client) DeleteProjectShareCollaboratorWizards(ids []int64) error { + return c.Delete(ProjectShareCollaboratorWizardModel, ids) +} + +// GetProjectShareCollaboratorWizard gets project.share.collaborator.wizard existing record. +func (c *Client) GetProjectShareCollaboratorWizard(id int64) (*ProjectShareCollaboratorWizard, error) { + pscws, err := c.GetProjectShareCollaboratorWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*pscws)[0]), nil +} + +// GetProjectShareCollaboratorWizards gets project.share.collaborator.wizard existing records. +func (c *Client) GetProjectShareCollaboratorWizards(ids []int64) (*ProjectShareCollaboratorWizards, error) { + pscws := &ProjectShareCollaboratorWizards{} + if err := c.Read(ProjectShareCollaboratorWizardModel, ids, nil, pscws); err != nil { + return nil, err + } + return pscws, nil +} + +// FindProjectShareCollaboratorWizard finds project.share.collaborator.wizard record by querying it with criteria. +func (c *Client) FindProjectShareCollaboratorWizard(criteria *Criteria) (*ProjectShareCollaboratorWizard, error) { + pscws := &ProjectShareCollaboratorWizards{} + if err := c.SearchRead(ProjectShareCollaboratorWizardModel, criteria, NewOptions().Limit(1), pscws); err != nil { + return nil, err + } + return &((*pscws)[0]), nil +} + +// FindProjectShareCollaboratorWizards finds project.share.collaborator.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectShareCollaboratorWizards(criteria *Criteria, options *Options) (*ProjectShareCollaboratorWizards, error) { + pscws := &ProjectShareCollaboratorWizards{} + if err := c.SearchRead(ProjectShareCollaboratorWizardModel, criteria, options, pscws); err != nil { + return nil, err + } + return pscws, nil +} + +// FindProjectShareCollaboratorWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectShareCollaboratorWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProjectShareCollaboratorWizardModel, criteria, options) +} + +// FindProjectShareCollaboratorWizardId finds record id by querying it with criteria. +func (c *Client) FindProjectShareCollaboratorWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectShareCollaboratorWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/project_share_wizard.go b/project_share_wizard.go new file mode 100644 index 0000000..7529ac0 --- /dev/null +++ b/project_share_wizard.go @@ -0,0 +1,125 @@ +package odoo + +// ProjectShareWizard represents project.share.wizard model. +type ProjectShareWizard struct { + AccessWarning *String `xmlrpc:"access_warning,omitempty"` + CollaboratorIds *Relation `xmlrpc:"collaborator_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExistingPartnerIds *Relation `xmlrpc:"existing_partner_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + ResId *Int `xmlrpc:"res_id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + ResourceRef *String `xmlrpc:"resource_ref,omitempty"` + ShareLink *String `xmlrpc:"share_link,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectShareWizards represents array of project.share.wizard model. +type ProjectShareWizards []ProjectShareWizard + +// ProjectShareWizardModel is the odoo model name. +const ProjectShareWizardModel = "project.share.wizard" + +// Many2One convert ProjectShareWizard to *Many2One. +func (psw *ProjectShareWizard) Many2One() *Many2One { + return NewMany2One(psw.Id.Get(), "") +} + +// CreateProjectShareWizard creates a new project.share.wizard model and returns its id. +func (c *Client) CreateProjectShareWizard(psw *ProjectShareWizard) (int64, error) { + ids, err := c.CreateProjectShareWizards([]*ProjectShareWizard{psw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProjectShareWizard creates a new project.share.wizard model and returns its id. +func (c *Client) CreateProjectShareWizards(psws []*ProjectShareWizard) ([]int64, error) { + var vv []interface{} + for _, v := range psws { + vv = append(vv, v) + } + return c.Create(ProjectShareWizardModel, vv, nil) +} + +// UpdateProjectShareWizard updates an existing project.share.wizard record. +func (c *Client) UpdateProjectShareWizard(psw *ProjectShareWizard) error { + return c.UpdateProjectShareWizards([]int64{psw.Id.Get()}, psw) +} + +// UpdateProjectShareWizards updates existing project.share.wizard records. +// All records (represented by ids) will be updated by psw values. +func (c *Client) UpdateProjectShareWizards(ids []int64, psw *ProjectShareWizard) error { + return c.Update(ProjectShareWizardModel, ids, psw, nil) +} + +// DeleteProjectShareWizard deletes an existing project.share.wizard record. +func (c *Client) DeleteProjectShareWizard(id int64) error { + return c.DeleteProjectShareWizards([]int64{id}) +} + +// DeleteProjectShareWizards deletes existing project.share.wizard records. +func (c *Client) DeleteProjectShareWizards(ids []int64) error { + return c.Delete(ProjectShareWizardModel, ids) +} + +// GetProjectShareWizard gets project.share.wizard existing record. +func (c *Client) GetProjectShareWizard(id int64) (*ProjectShareWizard, error) { + psws, err := c.GetProjectShareWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*psws)[0]), nil +} + +// GetProjectShareWizards gets project.share.wizard existing records. +func (c *Client) GetProjectShareWizards(ids []int64) (*ProjectShareWizards, error) { + psws := &ProjectShareWizards{} + if err := c.Read(ProjectShareWizardModel, ids, nil, psws); err != nil { + return nil, err + } + return psws, nil +} + +// FindProjectShareWizard finds project.share.wizard record by querying it with criteria. +func (c *Client) FindProjectShareWizard(criteria *Criteria) (*ProjectShareWizard, error) { + psws := &ProjectShareWizards{} + if err := c.SearchRead(ProjectShareWizardModel, criteria, NewOptions().Limit(1), psws); err != nil { + return nil, err + } + return &((*psws)[0]), nil +} + +// FindProjectShareWizards finds project.share.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectShareWizards(criteria *Criteria, options *Options) (*ProjectShareWizards, error) { + psws := &ProjectShareWizards{} + if err := c.SearchRead(ProjectShareWizardModel, criteria, options, psws); err != nil { + return nil, err + } + return psws, nil +} + +// FindProjectShareWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectShareWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProjectShareWizardModel, criteria, options) +} + +// FindProjectShareWizardId finds record id by querying it with criteria. +func (c *Client) FindProjectShareWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectShareWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/project_tags.go b/project_tags.go new file mode 100644 index 0000000..fa5a50c --- /dev/null +++ b/project_tags.go @@ -0,0 +1,120 @@ +package odoo + +// ProjectTags represents project.tags model. +type ProjectTags struct { + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ProjectIds *Relation `xmlrpc:"project_ids,omitempty"` + TaskIds *Relation `xmlrpc:"task_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectTagss represents array of project.tags model. +type ProjectTagss []ProjectTags + +// ProjectTagsModel is the odoo model name. +const ProjectTagsModel = "project.tags" + +// Many2One convert ProjectTags to *Many2One. +func (pt *ProjectTags) Many2One() *Many2One { + return NewMany2One(pt.Id.Get(), "") +} + +// CreateProjectTags creates a new project.tags model and returns its id. +func (c *Client) CreateProjectTags(pt *ProjectTags) (int64, error) { + ids, err := c.CreateProjectTagss([]*ProjectTags{pt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProjectTags creates a new project.tags model and returns its id. +func (c *Client) CreateProjectTagss(pts []*ProjectTags) ([]int64, error) { + var vv []interface{} + for _, v := range pts { + vv = append(vv, v) + } + return c.Create(ProjectTagsModel, vv, nil) +} + +// UpdateProjectTags updates an existing project.tags record. +func (c *Client) UpdateProjectTags(pt *ProjectTags) error { + return c.UpdateProjectTagss([]int64{pt.Id.Get()}, pt) +} + +// UpdateProjectTagss updates existing project.tags records. +// All records (represented by ids) will be updated by pt values. +func (c *Client) UpdateProjectTagss(ids []int64, pt *ProjectTags) error { + return c.Update(ProjectTagsModel, ids, pt, nil) +} + +// DeleteProjectTags deletes an existing project.tags record. +func (c *Client) DeleteProjectTags(id int64) error { + return c.DeleteProjectTagss([]int64{id}) +} + +// DeleteProjectTagss deletes existing project.tags records. +func (c *Client) DeleteProjectTagss(ids []int64) error { + return c.Delete(ProjectTagsModel, ids) +} + +// GetProjectTags gets project.tags existing record. +func (c *Client) GetProjectTags(id int64) (*ProjectTags, error) { + pts, err := c.GetProjectTagss([]int64{id}) + if err != nil { + return nil, err + } + return &((*pts)[0]), nil +} + +// GetProjectTagss gets project.tags existing records. +func (c *Client) GetProjectTagss(ids []int64) (*ProjectTagss, error) { + pts := &ProjectTagss{} + if err := c.Read(ProjectTagsModel, ids, nil, pts); err != nil { + return nil, err + } + return pts, nil +} + +// FindProjectTags finds project.tags record by querying it with criteria. +func (c *Client) FindProjectTags(criteria *Criteria) (*ProjectTags, error) { + pts := &ProjectTagss{} + if err := c.SearchRead(ProjectTagsModel, criteria, NewOptions().Limit(1), pts); err != nil { + return nil, err + } + return &((*pts)[0]), nil +} + +// FindProjectTagss finds project.tags records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectTagss(criteria *Criteria, options *Options) (*ProjectTagss, error) { + pts := &ProjectTagss{} + if err := c.SearchRead(ProjectTagsModel, criteria, options, pts); err != nil { + return nil, err + } + return pts, nil +} + +// FindProjectTagsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectTagsIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProjectTagsModel, criteria, options) +} + +// FindProjectTagsId finds record id by querying it with criteria. +func (c *Client) FindProjectTagsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectTagsModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/project_task.go b/project_task.go new file mode 100644 index 0000000..171459b --- /dev/null +++ b/project_task.go @@ -0,0 +1,242 @@ +package odoo + +// ProjectTask represents project.task model. +type ProjectTask struct { + AccessToken *String `xmlrpc:"access_token,omitempty"` + AccessUrl *String `xmlrpc:"access_url,omitempty"` + AccessWarning *String `xmlrpc:"access_warning,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AllocatedHours *Float `xmlrpc:"allocated_hours,omitempty"` + AllowBillable *Bool `xmlrpc:"allow_billable,omitempty"` + AllowMilestones *Bool `xmlrpc:"allow_milestones,omitempty"` + AllowTaskDependencies *Bool `xmlrpc:"allow_task_dependencies,omitempty"` + AllowTimesheets *Bool `xmlrpc:"allow_timesheets,omitempty"` + AnalyticAccountActive *Bool `xmlrpc:"analytic_account_active,omitempty"` + AttachmentIds *Relation `xmlrpc:"attachment_ids,omitempty"` + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + ClosedDependOnCount *Int `xmlrpc:"closed_depend_on_count,omitempty"` + ClosedSubtaskCount *Int `xmlrpc:"closed_subtask_count,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrentUserSameCompanyPartner *Bool `xmlrpc:"current_user_same_company_partner,omitempty"` + DateAssign *Time `xmlrpc:"date_assign,omitempty"` + DateDeadline *Time `xmlrpc:"date_deadline,omitempty"` + DateEnd *Time `xmlrpc:"date_end,omitempty"` + DateLastStageUpdate *Time `xmlrpc:"date_last_stage_update,omitempty"` + DependOnCount *Int `xmlrpc:"depend_on_count,omitempty"` + DependOnIds *Relation `xmlrpc:"depend_on_ids,omitempty"` + DependentIds *Relation `xmlrpc:"dependent_ids,omitempty"` + DependentTasksCount *Int `xmlrpc:"dependent_tasks_count,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayFollowButton *Bool `xmlrpc:"display_follow_button,omitempty"` + DisplayInProject *Bool `xmlrpc:"display_in_project,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayParentTaskButton *Bool `xmlrpc:"display_parent_task_button,omitempty"` + DisplaySaleOrderButton *Bool `xmlrpc:"display_sale_order_button,omitempty"` + DisplayedImageId *Many2One `xmlrpc:"displayed_image_id,omitempty"` + DurationTracking *String `xmlrpc:"duration_tracking,omitempty"` + EffectiveHours *Float `xmlrpc:"effective_hours,omitempty"` + EmailCc *String `xmlrpc:"email_cc,omitempty"` + EncodeUomInDays *Bool `xmlrpc:"encode_uom_in_days,omitempty"` + HasLateAndUnreachedMilestone *Bool `xmlrpc:"has_late_and_unreached_milestone,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + HasMultiSol *Bool `xmlrpc:"has_multi_sol,omitempty"` + HtmlFieldHistory *String `xmlrpc:"html_field_history,omitempty"` + HtmlFieldHistoryMetadata *String `xmlrpc:"html_field_history_metadata,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsClosed *Bool `xmlrpc:"is_closed,omitempty"` + IsProjectMapEmpty *Bool `xmlrpc:"is_project_map_empty,omitempty"` + IsTimeoffTask *Bool `xmlrpc:"is_timeoff_task,omitempty"` + LeaveTypesCount *Int `xmlrpc:"leave_types_count,omitempty"` + LinkPreviewName *String `xmlrpc:"link_preview_name,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MilestoneId *Many2One `xmlrpc:"milestone_id,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Overtime *Float `xmlrpc:"overtime,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PersonalStageId *Many2One `xmlrpc:"personal_stage_id,omitempty"` + PersonalStageTypeId *Many2One `xmlrpc:"personal_stage_type_id,omitempty"` + PersonalStageTypeIds *Relation `xmlrpc:"personal_stage_type_ids,omitempty"` + PortalUserNames *String `xmlrpc:"portal_user_names,omitempty"` + PricingType *Selection `xmlrpc:"pricing_type,omitempty"` + Priority *Selection `xmlrpc:"priority,omitempty"` + Progress *Float `xmlrpc:"progress,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + ProjectPrivacyVisibility *Selection `xmlrpc:"project_privacy_visibility,omitempty"` + ProjectSaleOrderId *Many2One `xmlrpc:"project_sale_order_id,omitempty"` + RatingActive *Bool `xmlrpc:"rating_active,omitempty"` + RatingAvg *Float `xmlrpc:"rating_avg,omitempty"` + RatingAvgText *Selection `xmlrpc:"rating_avg_text,omitempty"` + RatingCount *Int `xmlrpc:"rating_count,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RatingLastFeedback *String `xmlrpc:"rating_last_feedback,omitempty"` + RatingLastImage *String `xmlrpc:"rating_last_image,omitempty"` + RatingLastText *Selection `xmlrpc:"rating_last_text,omitempty"` + RatingLastValue *Float `xmlrpc:"rating_last_value,omitempty"` + RatingPercentageSatisfaction *Float `xmlrpc:"rating_percentage_satisfaction,omitempty"` + RecurrenceId *Many2One `xmlrpc:"recurrence_id,omitempty"` + RecurringCount *Int `xmlrpc:"recurring_count,omitempty"` + RecurringTask *Bool `xmlrpc:"recurring_task,omitempty"` + RemainingHours *Float `xmlrpc:"remaining_hours,omitempty"` + RemainingHoursAvailable *Bool `xmlrpc:"remaining_hours_available,omitempty"` + RemainingHoursPercentage *Float `xmlrpc:"remaining_hours_percentage,omitempty"` + RemainingHoursSo *Float `xmlrpc:"remaining_hours_so,omitempty"` + RepeatInterval *Int `xmlrpc:"repeat_interval,omitempty"` + RepeatType *Selection `xmlrpc:"repeat_type,omitempty"` + RepeatUnit *Selection `xmlrpc:"repeat_unit,omitempty"` + RepeatUntil *Time `xmlrpc:"repeat_until,omitempty"` + SaleLineId *Many2One `xmlrpc:"sale_line_id,omitempty"` + SaleOrderId *Many2One `xmlrpc:"sale_order_id,omitempty"` + SaleOrderState *Selection `xmlrpc:"sale_order_state,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + ShowDisplayInProject *Bool `xmlrpc:"show_display_in_project,omitempty"` + StageId *Many2One `xmlrpc:"stage_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + SubtaskAllocatedHours *Float `xmlrpc:"subtask_allocated_hours,omitempty"` + SubtaskCompletionPercentage *Float `xmlrpc:"subtask_completion_percentage,omitempty"` + SubtaskCount *Int `xmlrpc:"subtask_count,omitempty"` + SubtaskEffectiveHours *Float `xmlrpc:"subtask_effective_hours,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TaskProperties interface{} `xmlrpc:"task_properties,omitempty"` + TaskToInvoice *Bool `xmlrpc:"task_to_invoice,omitempty"` + TimesheetIds *Relation `xmlrpc:"timesheet_ids,omitempty"` + TimesheetProductId *Many2One `xmlrpc:"timesheet_product_id,omitempty"` + TotalHoursSpent *Float `xmlrpc:"total_hours_spent,omitempty"` + UserIds *Relation `xmlrpc:"user_ids,omitempty"` + UserSkillIds *Relation `xmlrpc:"user_skill_ids,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WorkingDaysClose *Float `xmlrpc:"working_days_close,omitempty"` + WorkingDaysOpen *Float `xmlrpc:"working_days_open,omitempty"` + WorkingHoursClose *Float `xmlrpc:"working_hours_close,omitempty"` + WorkingHoursOpen *Float `xmlrpc:"working_hours_open,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectTasks represents array of project.task model. +type ProjectTasks []ProjectTask + +// ProjectTaskModel is the odoo model name. +const ProjectTaskModel = "project.task" + +// Many2One convert ProjectTask to *Many2One. +func (pt *ProjectTask) Many2One() *Many2One { + return NewMany2One(pt.Id.Get(), "") +} + +// CreateProjectTask creates a new project.task model and returns its id. +func (c *Client) CreateProjectTask(pt *ProjectTask) (int64, error) { + ids, err := c.CreateProjectTasks([]*ProjectTask{pt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProjectTask creates a new project.task model and returns its id. +func (c *Client) CreateProjectTasks(pts []*ProjectTask) ([]int64, error) { + var vv []interface{} + for _, v := range pts { + vv = append(vv, v) + } + return c.Create(ProjectTaskModel, vv, nil) +} + +// UpdateProjectTask updates an existing project.task record. +func (c *Client) UpdateProjectTask(pt *ProjectTask) error { + return c.UpdateProjectTasks([]int64{pt.Id.Get()}, pt) +} + +// UpdateProjectTasks updates existing project.task records. +// All records (represented by ids) will be updated by pt values. +func (c *Client) UpdateProjectTasks(ids []int64, pt *ProjectTask) error { + return c.Update(ProjectTaskModel, ids, pt, nil) +} + +// DeleteProjectTask deletes an existing project.task record. +func (c *Client) DeleteProjectTask(id int64) error { + return c.DeleteProjectTasks([]int64{id}) +} + +// DeleteProjectTasks deletes existing project.task records. +func (c *Client) DeleteProjectTasks(ids []int64) error { + return c.Delete(ProjectTaskModel, ids) +} + +// GetProjectTask gets project.task existing record. +func (c *Client) GetProjectTask(id int64) (*ProjectTask, error) { + pts, err := c.GetProjectTasks([]int64{id}) + if err != nil { + return nil, err + } + return &((*pts)[0]), nil +} + +// GetProjectTasks gets project.task existing records. +func (c *Client) GetProjectTasks(ids []int64) (*ProjectTasks, error) { + pts := &ProjectTasks{} + if err := c.Read(ProjectTaskModel, ids, nil, pts); err != nil { + return nil, err + } + return pts, nil +} + +// FindProjectTask finds project.task record by querying it with criteria. +func (c *Client) FindProjectTask(criteria *Criteria) (*ProjectTask, error) { + pts := &ProjectTasks{} + if err := c.SearchRead(ProjectTaskModel, criteria, NewOptions().Limit(1), pts); err != nil { + return nil, err + } + return &((*pts)[0]), nil +} + +// FindProjectTasks finds project.task records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectTasks(criteria *Criteria, options *Options) (*ProjectTasks, error) { + pts := &ProjectTasks{} + if err := c.SearchRead(ProjectTaskModel, criteria, options, pts); err != nil { + return nil, err + } + return pts, nil +} + +// FindProjectTaskIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectTaskIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProjectTaskModel, criteria, options) +} + +// FindProjectTaskId finds record id by querying it with criteria. +func (c *Client) FindProjectTaskId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectTaskModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/project_task_recurrence.go b/project_task_recurrence.go new file mode 100644 index 0000000..8f2ae13 --- /dev/null +++ b/project_task_recurrence.go @@ -0,0 +1,121 @@ +package odoo + +// ProjectTaskRecurrence represents project.task.recurrence model. +type ProjectTaskRecurrence struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + RepeatInterval *Int `xmlrpc:"repeat_interval,omitempty"` + RepeatType *Selection `xmlrpc:"repeat_type,omitempty"` + RepeatUnit *Selection `xmlrpc:"repeat_unit,omitempty"` + RepeatUntil *Time `xmlrpc:"repeat_until,omitempty"` + TaskIds *Relation `xmlrpc:"task_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectTaskRecurrences represents array of project.task.recurrence model. +type ProjectTaskRecurrences []ProjectTaskRecurrence + +// ProjectTaskRecurrenceModel is the odoo model name. +const ProjectTaskRecurrenceModel = "project.task.recurrence" + +// Many2One convert ProjectTaskRecurrence to *Many2One. +func (ptr *ProjectTaskRecurrence) Many2One() *Many2One { + return NewMany2One(ptr.Id.Get(), "") +} + +// CreateProjectTaskRecurrence creates a new project.task.recurrence model and returns its id. +func (c *Client) CreateProjectTaskRecurrence(ptr *ProjectTaskRecurrence) (int64, error) { + ids, err := c.CreateProjectTaskRecurrences([]*ProjectTaskRecurrence{ptr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProjectTaskRecurrence creates a new project.task.recurrence model and returns its id. +func (c *Client) CreateProjectTaskRecurrences(ptrs []*ProjectTaskRecurrence) ([]int64, error) { + var vv []interface{} + for _, v := range ptrs { + vv = append(vv, v) + } + return c.Create(ProjectTaskRecurrenceModel, vv, nil) +} + +// UpdateProjectTaskRecurrence updates an existing project.task.recurrence record. +func (c *Client) UpdateProjectTaskRecurrence(ptr *ProjectTaskRecurrence) error { + return c.UpdateProjectTaskRecurrences([]int64{ptr.Id.Get()}, ptr) +} + +// UpdateProjectTaskRecurrences updates existing project.task.recurrence records. +// All records (represented by ids) will be updated by ptr values. +func (c *Client) UpdateProjectTaskRecurrences(ids []int64, ptr *ProjectTaskRecurrence) error { + return c.Update(ProjectTaskRecurrenceModel, ids, ptr, nil) +} + +// DeleteProjectTaskRecurrence deletes an existing project.task.recurrence record. +func (c *Client) DeleteProjectTaskRecurrence(id int64) error { + return c.DeleteProjectTaskRecurrences([]int64{id}) +} + +// DeleteProjectTaskRecurrences deletes existing project.task.recurrence records. +func (c *Client) DeleteProjectTaskRecurrences(ids []int64) error { + return c.Delete(ProjectTaskRecurrenceModel, ids) +} + +// GetProjectTaskRecurrence gets project.task.recurrence existing record. +func (c *Client) GetProjectTaskRecurrence(id int64) (*ProjectTaskRecurrence, error) { + ptrs, err := c.GetProjectTaskRecurrences([]int64{id}) + if err != nil { + return nil, err + } + return &((*ptrs)[0]), nil +} + +// GetProjectTaskRecurrences gets project.task.recurrence existing records. +func (c *Client) GetProjectTaskRecurrences(ids []int64) (*ProjectTaskRecurrences, error) { + ptrs := &ProjectTaskRecurrences{} + if err := c.Read(ProjectTaskRecurrenceModel, ids, nil, ptrs); err != nil { + return nil, err + } + return ptrs, nil +} + +// FindProjectTaskRecurrence finds project.task.recurrence record by querying it with criteria. +func (c *Client) FindProjectTaskRecurrence(criteria *Criteria) (*ProjectTaskRecurrence, error) { + ptrs := &ProjectTaskRecurrences{} + if err := c.SearchRead(ProjectTaskRecurrenceModel, criteria, NewOptions().Limit(1), ptrs); err != nil { + return nil, err + } + return &((*ptrs)[0]), nil +} + +// FindProjectTaskRecurrences finds project.task.recurrence records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectTaskRecurrences(criteria *Criteria, options *Options) (*ProjectTaskRecurrences, error) { + ptrs := &ProjectTaskRecurrences{} + if err := c.SearchRead(ProjectTaskRecurrenceModel, criteria, options, ptrs); err != nil { + return nil, err + } + return ptrs, nil +} + +// FindProjectTaskRecurrenceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectTaskRecurrenceIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProjectTaskRecurrenceModel, criteria, options) +} + +// FindProjectTaskRecurrenceId finds record id by querying it with criteria. +func (c *Client) FindProjectTaskRecurrenceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectTaskRecurrenceModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/project_task_stage_personal.go b/project_task_stage_personal.go new file mode 100644 index 0000000..481cb77 --- /dev/null +++ b/project_task_stage_personal.go @@ -0,0 +1,119 @@ +package odoo + +// ProjectTaskStagePersonal represents project.task.stage.personal model. +type ProjectTaskStagePersonal struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + StageId *Many2One `xmlrpc:"stage_id,omitempty"` + TaskId *Many2One `xmlrpc:"task_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectTaskStagePersonals represents array of project.task.stage.personal model. +type ProjectTaskStagePersonals []ProjectTaskStagePersonal + +// ProjectTaskStagePersonalModel is the odoo model name. +const ProjectTaskStagePersonalModel = "project.task.stage.personal" + +// Many2One convert ProjectTaskStagePersonal to *Many2One. +func (ptsp *ProjectTaskStagePersonal) Many2One() *Many2One { + return NewMany2One(ptsp.Id.Get(), "") +} + +// CreateProjectTaskStagePersonal creates a new project.task.stage.personal model and returns its id. +func (c *Client) CreateProjectTaskStagePersonal(ptsp *ProjectTaskStagePersonal) (int64, error) { + ids, err := c.CreateProjectTaskStagePersonals([]*ProjectTaskStagePersonal{ptsp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProjectTaskStagePersonal creates a new project.task.stage.personal model and returns its id. +func (c *Client) CreateProjectTaskStagePersonals(ptsps []*ProjectTaskStagePersonal) ([]int64, error) { + var vv []interface{} + for _, v := range ptsps { + vv = append(vv, v) + } + return c.Create(ProjectTaskStagePersonalModel, vv, nil) +} + +// UpdateProjectTaskStagePersonal updates an existing project.task.stage.personal record. +func (c *Client) UpdateProjectTaskStagePersonal(ptsp *ProjectTaskStagePersonal) error { + return c.UpdateProjectTaskStagePersonals([]int64{ptsp.Id.Get()}, ptsp) +} + +// UpdateProjectTaskStagePersonals updates existing project.task.stage.personal records. +// All records (represented by ids) will be updated by ptsp values. +func (c *Client) UpdateProjectTaskStagePersonals(ids []int64, ptsp *ProjectTaskStagePersonal) error { + return c.Update(ProjectTaskStagePersonalModel, ids, ptsp, nil) +} + +// DeleteProjectTaskStagePersonal deletes an existing project.task.stage.personal record. +func (c *Client) DeleteProjectTaskStagePersonal(id int64) error { + return c.DeleteProjectTaskStagePersonals([]int64{id}) +} + +// DeleteProjectTaskStagePersonals deletes existing project.task.stage.personal records. +func (c *Client) DeleteProjectTaskStagePersonals(ids []int64) error { + return c.Delete(ProjectTaskStagePersonalModel, ids) +} + +// GetProjectTaskStagePersonal gets project.task.stage.personal existing record. +func (c *Client) GetProjectTaskStagePersonal(id int64) (*ProjectTaskStagePersonal, error) { + ptsps, err := c.GetProjectTaskStagePersonals([]int64{id}) + if err != nil { + return nil, err + } + return &((*ptsps)[0]), nil +} + +// GetProjectTaskStagePersonals gets project.task.stage.personal existing records. +func (c *Client) GetProjectTaskStagePersonals(ids []int64) (*ProjectTaskStagePersonals, error) { + ptsps := &ProjectTaskStagePersonals{} + if err := c.Read(ProjectTaskStagePersonalModel, ids, nil, ptsps); err != nil { + return nil, err + } + return ptsps, nil +} + +// FindProjectTaskStagePersonal finds project.task.stage.personal record by querying it with criteria. +func (c *Client) FindProjectTaskStagePersonal(criteria *Criteria) (*ProjectTaskStagePersonal, error) { + ptsps := &ProjectTaskStagePersonals{} + if err := c.SearchRead(ProjectTaskStagePersonalModel, criteria, NewOptions().Limit(1), ptsps); err != nil { + return nil, err + } + return &((*ptsps)[0]), nil +} + +// FindProjectTaskStagePersonals finds project.task.stage.personal records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectTaskStagePersonals(criteria *Criteria, options *Options) (*ProjectTaskStagePersonals, error) { + ptsps := &ProjectTaskStagePersonals{} + if err := c.SearchRead(ProjectTaskStagePersonalModel, criteria, options, ptsps); err != nil { + return nil, err + } + return ptsps, nil +} + +// FindProjectTaskStagePersonalIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectTaskStagePersonalIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProjectTaskStagePersonalModel, criteria, options) +} + +// FindProjectTaskStagePersonalId finds record id by querying it with criteria. +func (c *Client) FindProjectTaskStagePersonalId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectTaskStagePersonalModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/project_task_type.go b/project_task_type.go new file mode 100644 index 0000000..1ae0650 --- /dev/null +++ b/project_task_type.go @@ -0,0 +1,127 @@ +package odoo + +// ProjectTaskType represents project.task.type model. +type ProjectTaskType struct { + Active *Bool `xmlrpc:"active,omitempty"` + AutoValidationState *Bool `xmlrpc:"auto_validation_state,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisabledRatingWarning *String `xmlrpc:"disabled_rating_warning,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Fold *Bool `xmlrpc:"fold,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MailTemplateId *Many2One `xmlrpc:"mail_template_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ProjectIds *Relation `xmlrpc:"project_ids,omitempty"` + RatingTemplateId *Many2One `xmlrpc:"rating_template_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SmsTemplateId *Many2One `xmlrpc:"sms_template_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectTaskTypes represents array of project.task.type model. +type ProjectTaskTypes []ProjectTaskType + +// ProjectTaskTypeModel is the odoo model name. +const ProjectTaskTypeModel = "project.task.type" + +// Many2One convert ProjectTaskType to *Many2One. +func (ptt *ProjectTaskType) Many2One() *Many2One { + return NewMany2One(ptt.Id.Get(), "") +} + +// CreateProjectTaskType creates a new project.task.type model and returns its id. +func (c *Client) CreateProjectTaskType(ptt *ProjectTaskType) (int64, error) { + ids, err := c.CreateProjectTaskTypes([]*ProjectTaskType{ptt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProjectTaskType creates a new project.task.type model and returns its id. +func (c *Client) CreateProjectTaskTypes(ptts []*ProjectTaskType) ([]int64, error) { + var vv []interface{} + for _, v := range ptts { + vv = append(vv, v) + } + return c.Create(ProjectTaskTypeModel, vv, nil) +} + +// UpdateProjectTaskType updates an existing project.task.type record. +func (c *Client) UpdateProjectTaskType(ptt *ProjectTaskType) error { + return c.UpdateProjectTaskTypes([]int64{ptt.Id.Get()}, ptt) +} + +// UpdateProjectTaskTypes updates existing project.task.type records. +// All records (represented by ids) will be updated by ptt values. +func (c *Client) UpdateProjectTaskTypes(ids []int64, ptt *ProjectTaskType) error { + return c.Update(ProjectTaskTypeModel, ids, ptt, nil) +} + +// DeleteProjectTaskType deletes an existing project.task.type record. +func (c *Client) DeleteProjectTaskType(id int64) error { + return c.DeleteProjectTaskTypes([]int64{id}) +} + +// DeleteProjectTaskTypes deletes existing project.task.type records. +func (c *Client) DeleteProjectTaskTypes(ids []int64) error { + return c.Delete(ProjectTaskTypeModel, ids) +} + +// GetProjectTaskType gets project.task.type existing record. +func (c *Client) GetProjectTaskType(id int64) (*ProjectTaskType, error) { + ptts, err := c.GetProjectTaskTypes([]int64{id}) + if err != nil { + return nil, err + } + return &((*ptts)[0]), nil +} + +// GetProjectTaskTypes gets project.task.type existing records. +func (c *Client) GetProjectTaskTypes(ids []int64) (*ProjectTaskTypes, error) { + ptts := &ProjectTaskTypes{} + if err := c.Read(ProjectTaskTypeModel, ids, nil, ptts); err != nil { + return nil, err + } + return ptts, nil +} + +// FindProjectTaskType finds project.task.type record by querying it with criteria. +func (c *Client) FindProjectTaskType(criteria *Criteria) (*ProjectTaskType, error) { + ptts := &ProjectTaskTypes{} + if err := c.SearchRead(ProjectTaskTypeModel, criteria, NewOptions().Limit(1), ptts); err != nil { + return nil, err + } + return &((*ptts)[0]), nil +} + +// FindProjectTaskTypes finds project.task.type records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectTaskTypes(criteria *Criteria, options *Options) (*ProjectTaskTypes, error) { + ptts := &ProjectTaskTypes{} + if err := c.SearchRead(ProjectTaskTypeModel, criteria, options, ptts); err != nil { + return nil, err + } + return ptts, nil +} + +// FindProjectTaskTypeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectTaskTypeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProjectTaskTypeModel, criteria, options) +} + +// FindProjectTaskTypeId finds record id by querying it with criteria. +func (c *Client) FindProjectTaskTypeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectTaskTypeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/project_task_type_delete_wizard.go b/project_task_type_delete_wizard.go new file mode 100644 index 0000000..e321715 --- /dev/null +++ b/project_task_type_delete_wizard.go @@ -0,0 +1,120 @@ +package odoo + +// ProjectTaskTypeDeleteWizard represents project.task.type.delete.wizard model. +type ProjectTaskTypeDeleteWizard struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ProjectIds *Relation `xmlrpc:"project_ids,omitempty"` + StageIds *Relation `xmlrpc:"stage_ids,omitempty"` + StagesActive *Bool `xmlrpc:"stages_active,omitempty"` + TasksCount *Int `xmlrpc:"tasks_count,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectTaskTypeDeleteWizards represents array of project.task.type.delete.wizard model. +type ProjectTaskTypeDeleteWizards []ProjectTaskTypeDeleteWizard + +// ProjectTaskTypeDeleteWizardModel is the odoo model name. +const ProjectTaskTypeDeleteWizardModel = "project.task.type.delete.wizard" + +// Many2One convert ProjectTaskTypeDeleteWizard to *Many2One. +func (pttdw *ProjectTaskTypeDeleteWizard) Many2One() *Many2One { + return NewMany2One(pttdw.Id.Get(), "") +} + +// CreateProjectTaskTypeDeleteWizard creates a new project.task.type.delete.wizard model and returns its id. +func (c *Client) CreateProjectTaskTypeDeleteWizard(pttdw *ProjectTaskTypeDeleteWizard) (int64, error) { + ids, err := c.CreateProjectTaskTypeDeleteWizards([]*ProjectTaskTypeDeleteWizard{pttdw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProjectTaskTypeDeleteWizard creates a new project.task.type.delete.wizard model and returns its id. +func (c *Client) CreateProjectTaskTypeDeleteWizards(pttdws []*ProjectTaskTypeDeleteWizard) ([]int64, error) { + var vv []interface{} + for _, v := range pttdws { + vv = append(vv, v) + } + return c.Create(ProjectTaskTypeDeleteWizardModel, vv, nil) +} + +// UpdateProjectTaskTypeDeleteWizard updates an existing project.task.type.delete.wizard record. +func (c *Client) UpdateProjectTaskTypeDeleteWizard(pttdw *ProjectTaskTypeDeleteWizard) error { + return c.UpdateProjectTaskTypeDeleteWizards([]int64{pttdw.Id.Get()}, pttdw) +} + +// UpdateProjectTaskTypeDeleteWizards updates existing project.task.type.delete.wizard records. +// All records (represented by ids) will be updated by pttdw values. +func (c *Client) UpdateProjectTaskTypeDeleteWizards(ids []int64, pttdw *ProjectTaskTypeDeleteWizard) error { + return c.Update(ProjectTaskTypeDeleteWizardModel, ids, pttdw, nil) +} + +// DeleteProjectTaskTypeDeleteWizard deletes an existing project.task.type.delete.wizard record. +func (c *Client) DeleteProjectTaskTypeDeleteWizard(id int64) error { + return c.DeleteProjectTaskTypeDeleteWizards([]int64{id}) +} + +// DeleteProjectTaskTypeDeleteWizards deletes existing project.task.type.delete.wizard records. +func (c *Client) DeleteProjectTaskTypeDeleteWizards(ids []int64) error { + return c.Delete(ProjectTaskTypeDeleteWizardModel, ids) +} + +// GetProjectTaskTypeDeleteWizard gets project.task.type.delete.wizard existing record. +func (c *Client) GetProjectTaskTypeDeleteWizard(id int64) (*ProjectTaskTypeDeleteWizard, error) { + pttdws, err := c.GetProjectTaskTypeDeleteWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*pttdws)[0]), nil +} + +// GetProjectTaskTypeDeleteWizards gets project.task.type.delete.wizard existing records. +func (c *Client) GetProjectTaskTypeDeleteWizards(ids []int64) (*ProjectTaskTypeDeleteWizards, error) { + pttdws := &ProjectTaskTypeDeleteWizards{} + if err := c.Read(ProjectTaskTypeDeleteWizardModel, ids, nil, pttdws); err != nil { + return nil, err + } + return pttdws, nil +} + +// FindProjectTaskTypeDeleteWizard finds project.task.type.delete.wizard record by querying it with criteria. +func (c *Client) FindProjectTaskTypeDeleteWizard(criteria *Criteria) (*ProjectTaskTypeDeleteWizard, error) { + pttdws := &ProjectTaskTypeDeleteWizards{} + if err := c.SearchRead(ProjectTaskTypeDeleteWizardModel, criteria, NewOptions().Limit(1), pttdws); err != nil { + return nil, err + } + return &((*pttdws)[0]), nil +} + +// FindProjectTaskTypeDeleteWizards finds project.task.type.delete.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectTaskTypeDeleteWizards(criteria *Criteria, options *Options) (*ProjectTaskTypeDeleteWizards, error) { + pttdws := &ProjectTaskTypeDeleteWizards{} + if err := c.SearchRead(ProjectTaskTypeDeleteWizardModel, criteria, options, pttdws); err != nil { + return nil, err + } + return pttdws, nil +} + +// FindProjectTaskTypeDeleteWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectTaskTypeDeleteWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProjectTaskTypeDeleteWizardModel, criteria, options) +} + +// FindProjectTaskTypeDeleteWizardId finds record id by querying it with criteria. +func (c *Client) FindProjectTaskTypeDeleteWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectTaskTypeDeleteWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/project_update.go b/project_update.go new file mode 100644 index 0000000..a9b38db --- /dev/null +++ b/project_update.go @@ -0,0 +1,159 @@ +package odoo + +// ProjectUpdate represents project.update model. +type ProjectUpdate struct { + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AllocatedTime *Int `xmlrpc:"allocated_time,omitempty"` + ClosedTaskCount *Int `xmlrpc:"closed_task_count,omitempty"` + ClosedTaskPercentage *Int `xmlrpc:"closed_task_percentage,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayTimesheetStats *Bool `xmlrpc:"display_timesheet_stats,omitempty"` + EmailCc *String `xmlrpc:"email_cc,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NameCropped *String `xmlrpc:"name_cropped,omitempty"` + Progress *Int `xmlrpc:"progress,omitempty"` + ProgressPercentage *Float `xmlrpc:"progress_percentage,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + Status *Selection `xmlrpc:"status,omitempty"` + TaskCount *Int `xmlrpc:"task_count,omitempty"` + TimesheetPercentage *Int `xmlrpc:"timesheet_percentage,omitempty"` + TimesheetTime *Int `xmlrpc:"timesheet_time,omitempty"` + UomId *Many2One `xmlrpc:"uom_id,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ProjectUpdates represents array of project.update model. +type ProjectUpdates []ProjectUpdate + +// ProjectUpdateModel is the odoo model name. +const ProjectUpdateModel = "project.update" + +// Many2One convert ProjectUpdate to *Many2One. +func (pu *ProjectUpdate) Many2One() *Many2One { + return NewMany2One(pu.Id.Get(), "") +} + +// CreateProjectUpdate creates a new project.update model and returns its id. +func (c *Client) CreateProjectUpdate(pu *ProjectUpdate) (int64, error) { + ids, err := c.CreateProjectUpdates([]*ProjectUpdate{pu}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateProjectUpdate creates a new project.update model and returns its id. +func (c *Client) CreateProjectUpdates(pus []*ProjectUpdate) ([]int64, error) { + var vv []interface{} + for _, v := range pus { + vv = append(vv, v) + } + return c.Create(ProjectUpdateModel, vv, nil) +} + +// UpdateProjectUpdate updates an existing project.update record. +func (c *Client) UpdateProjectUpdate(pu *ProjectUpdate) error { + return c.UpdateProjectUpdates([]int64{pu.Id.Get()}, pu) +} + +// UpdateProjectUpdates updates existing project.update records. +// All records (represented by ids) will be updated by pu values. +func (c *Client) UpdateProjectUpdates(ids []int64, pu *ProjectUpdate) error { + return c.Update(ProjectUpdateModel, ids, pu, nil) +} + +// DeleteProjectUpdate deletes an existing project.update record. +func (c *Client) DeleteProjectUpdate(id int64) error { + return c.DeleteProjectUpdates([]int64{id}) +} + +// DeleteProjectUpdates deletes existing project.update records. +func (c *Client) DeleteProjectUpdates(ids []int64) error { + return c.Delete(ProjectUpdateModel, ids) +} + +// GetProjectUpdate gets project.update existing record. +func (c *Client) GetProjectUpdate(id int64) (*ProjectUpdate, error) { + pus, err := c.GetProjectUpdates([]int64{id}) + if err != nil { + return nil, err + } + return &((*pus)[0]), nil +} + +// GetProjectUpdates gets project.update existing records. +func (c *Client) GetProjectUpdates(ids []int64) (*ProjectUpdates, error) { + pus := &ProjectUpdates{} + if err := c.Read(ProjectUpdateModel, ids, nil, pus); err != nil { + return nil, err + } + return pus, nil +} + +// FindProjectUpdate finds project.update record by querying it with criteria. +func (c *Client) FindProjectUpdate(criteria *Criteria) (*ProjectUpdate, error) { + pus := &ProjectUpdates{} + if err := c.SearchRead(ProjectUpdateModel, criteria, NewOptions().Limit(1), pus); err != nil { + return nil, err + } + return &((*pus)[0]), nil +} + +// FindProjectUpdates finds project.update records by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectUpdates(criteria *Criteria, options *Options) (*ProjectUpdates, error) { + pus := &ProjectUpdates{} + if err := c.SearchRead(ProjectUpdateModel, criteria, options, pus); err != nil { + return nil, err + } + return pus, nil +} + +// FindProjectUpdateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindProjectUpdateIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ProjectUpdateModel, criteria, options) +} + +// FindProjectUpdateId finds record id by querying it with criteria. +func (c *Client) FindProjectUpdateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ProjectUpdateModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/purchase_bill_line_match.go b/purchase_bill_line_match.go new file mode 100644 index 0000000..9df5a5a --- /dev/null +++ b/purchase_bill_line_match.go @@ -0,0 +1,131 @@ +package odoo + +// PurchaseBillLineMatch represents purchase.bill.line.match model. +type PurchaseBillLineMatch struct { + AccountMoveId *Many2One `xmlrpc:"account_move_id,omitempty"` + AmlId *Many2One `xmlrpc:"aml_id,omitempty"` + BilledAmountUntaxed *Float `xmlrpc:"billed_amount_untaxed,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LineAmountUntaxed *Float `xmlrpc:"line_amount_untaxed,omitempty"` + LineQty *Float `xmlrpc:"line_qty,omitempty"` + LineUomId *Many2One `xmlrpc:"line_uom_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PolId *Many2One `xmlrpc:"pol_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductUomId *Many2One `xmlrpc:"product_uom_id,omitempty"` + ProductUomPrice *Float `xmlrpc:"product_uom_price,omitempty"` + ProductUomQty *Float `xmlrpc:"product_uom_qty,omitempty"` + PurchaseAmountUntaxed *Float `xmlrpc:"purchase_amount_untaxed,omitempty"` + PurchaseOrderId *Many2One `xmlrpc:"purchase_order_id,omitempty"` + QtyInvoiced *Float `xmlrpc:"qty_invoiced,omitempty"` + Reference *String `xmlrpc:"reference,omitempty"` + State *String `xmlrpc:"state,omitempty"` +} + +// PurchaseBillLineMatchs represents array of purchase.bill.line.match model. +type PurchaseBillLineMatchs []PurchaseBillLineMatch + +// PurchaseBillLineMatchModel is the odoo model name. +const PurchaseBillLineMatchModel = "purchase.bill.line.match" + +// Many2One convert PurchaseBillLineMatch to *Many2One. +func (pblm *PurchaseBillLineMatch) Many2One() *Many2One { + return NewMany2One(pblm.Id.Get(), "") +} + +// CreatePurchaseBillLineMatch creates a new purchase.bill.line.match model and returns its id. +func (c *Client) CreatePurchaseBillLineMatch(pblm *PurchaseBillLineMatch) (int64, error) { + ids, err := c.CreatePurchaseBillLineMatchs([]*PurchaseBillLineMatch{pblm}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePurchaseBillLineMatch creates a new purchase.bill.line.match model and returns its id. +func (c *Client) CreatePurchaseBillLineMatchs(pblms []*PurchaseBillLineMatch) ([]int64, error) { + var vv []interface{} + for _, v := range pblms { + vv = append(vv, v) + } + return c.Create(PurchaseBillLineMatchModel, vv, nil) +} + +// UpdatePurchaseBillLineMatch updates an existing purchase.bill.line.match record. +func (c *Client) UpdatePurchaseBillLineMatch(pblm *PurchaseBillLineMatch) error { + return c.UpdatePurchaseBillLineMatchs([]int64{pblm.Id.Get()}, pblm) +} + +// UpdatePurchaseBillLineMatchs updates existing purchase.bill.line.match records. +// All records (represented by ids) will be updated by pblm values. +func (c *Client) UpdatePurchaseBillLineMatchs(ids []int64, pblm *PurchaseBillLineMatch) error { + return c.Update(PurchaseBillLineMatchModel, ids, pblm, nil) +} + +// DeletePurchaseBillLineMatch deletes an existing purchase.bill.line.match record. +func (c *Client) DeletePurchaseBillLineMatch(id int64) error { + return c.DeletePurchaseBillLineMatchs([]int64{id}) +} + +// DeletePurchaseBillLineMatchs deletes existing purchase.bill.line.match records. +func (c *Client) DeletePurchaseBillLineMatchs(ids []int64) error { + return c.Delete(PurchaseBillLineMatchModel, ids) +} + +// GetPurchaseBillLineMatch gets purchase.bill.line.match existing record. +func (c *Client) GetPurchaseBillLineMatch(id int64) (*PurchaseBillLineMatch, error) { + pblms, err := c.GetPurchaseBillLineMatchs([]int64{id}) + if err != nil { + return nil, err + } + return &((*pblms)[0]), nil +} + +// GetPurchaseBillLineMatchs gets purchase.bill.line.match existing records. +func (c *Client) GetPurchaseBillLineMatchs(ids []int64) (*PurchaseBillLineMatchs, error) { + pblms := &PurchaseBillLineMatchs{} + if err := c.Read(PurchaseBillLineMatchModel, ids, nil, pblms); err != nil { + return nil, err + } + return pblms, nil +} + +// FindPurchaseBillLineMatch finds purchase.bill.line.match record by querying it with criteria. +func (c *Client) FindPurchaseBillLineMatch(criteria *Criteria) (*PurchaseBillLineMatch, error) { + pblms := &PurchaseBillLineMatchs{} + if err := c.SearchRead(PurchaseBillLineMatchModel, criteria, NewOptions().Limit(1), pblms); err != nil { + return nil, err + } + return &((*pblms)[0]), nil +} + +// FindPurchaseBillLineMatchs finds purchase.bill.line.match records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPurchaseBillLineMatchs(criteria *Criteria, options *Options) (*PurchaseBillLineMatchs, error) { + pblms := &PurchaseBillLineMatchs{} + if err := c.SearchRead(PurchaseBillLineMatchModel, criteria, options, pblms); err != nil { + return nil, err + } + return pblms, nil +} + +// FindPurchaseBillLineMatchIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPurchaseBillLineMatchIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PurchaseBillLineMatchModel, criteria, options) +} + +// FindPurchaseBillLineMatchId finds record id by querying it with criteria. +func (c *Client) FindPurchaseBillLineMatchId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PurchaseBillLineMatchModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/purchase_bill_union.go b/purchase_bill_union.go new file mode 100644 index 0000000..9b5ea34 --- /dev/null +++ b/purchase_bill_union.go @@ -0,0 +1,121 @@ +package odoo + +// PurchaseBillUnion represents purchase.bill.union model. +type PurchaseBillUnion struct { + Amount *Float `xmlrpc:"amount,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PurchaseOrderId *Many2One `xmlrpc:"purchase_order_id,omitempty"` + Reference *String `xmlrpc:"reference,omitempty"` + VendorBillId *Many2One `xmlrpc:"vendor_bill_id,omitempty"` +} + +// PurchaseBillUnions represents array of purchase.bill.union model. +type PurchaseBillUnions []PurchaseBillUnion + +// PurchaseBillUnionModel is the odoo model name. +const PurchaseBillUnionModel = "purchase.bill.union" + +// Many2One convert PurchaseBillUnion to *Many2One. +func (pbu *PurchaseBillUnion) Many2One() *Many2One { + return NewMany2One(pbu.Id.Get(), "") +} + +// CreatePurchaseBillUnion creates a new purchase.bill.union model and returns its id. +func (c *Client) CreatePurchaseBillUnion(pbu *PurchaseBillUnion) (int64, error) { + ids, err := c.CreatePurchaseBillUnions([]*PurchaseBillUnion{pbu}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePurchaseBillUnion creates a new purchase.bill.union model and returns its id. +func (c *Client) CreatePurchaseBillUnions(pbus []*PurchaseBillUnion) ([]int64, error) { + var vv []interface{} + for _, v := range pbus { + vv = append(vv, v) + } + return c.Create(PurchaseBillUnionModel, vv, nil) +} + +// UpdatePurchaseBillUnion updates an existing purchase.bill.union record. +func (c *Client) UpdatePurchaseBillUnion(pbu *PurchaseBillUnion) error { + return c.UpdatePurchaseBillUnions([]int64{pbu.Id.Get()}, pbu) +} + +// UpdatePurchaseBillUnions updates existing purchase.bill.union records. +// All records (represented by ids) will be updated by pbu values. +func (c *Client) UpdatePurchaseBillUnions(ids []int64, pbu *PurchaseBillUnion) error { + return c.Update(PurchaseBillUnionModel, ids, pbu, nil) +} + +// DeletePurchaseBillUnion deletes an existing purchase.bill.union record. +func (c *Client) DeletePurchaseBillUnion(id int64) error { + return c.DeletePurchaseBillUnions([]int64{id}) +} + +// DeletePurchaseBillUnions deletes existing purchase.bill.union records. +func (c *Client) DeletePurchaseBillUnions(ids []int64) error { + return c.Delete(PurchaseBillUnionModel, ids) +} + +// GetPurchaseBillUnion gets purchase.bill.union existing record. +func (c *Client) GetPurchaseBillUnion(id int64) (*PurchaseBillUnion, error) { + pbus, err := c.GetPurchaseBillUnions([]int64{id}) + if err != nil { + return nil, err + } + return &((*pbus)[0]), nil +} + +// GetPurchaseBillUnions gets purchase.bill.union existing records. +func (c *Client) GetPurchaseBillUnions(ids []int64) (*PurchaseBillUnions, error) { + pbus := &PurchaseBillUnions{} + if err := c.Read(PurchaseBillUnionModel, ids, nil, pbus); err != nil { + return nil, err + } + return pbus, nil +} + +// FindPurchaseBillUnion finds purchase.bill.union record by querying it with criteria. +func (c *Client) FindPurchaseBillUnion(criteria *Criteria) (*PurchaseBillUnion, error) { + pbus := &PurchaseBillUnions{} + if err := c.SearchRead(PurchaseBillUnionModel, criteria, NewOptions().Limit(1), pbus); err != nil { + return nil, err + } + return &((*pbus)[0]), nil +} + +// FindPurchaseBillUnions finds purchase.bill.union records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPurchaseBillUnions(criteria *Criteria, options *Options) (*PurchaseBillUnions, error) { + pbus := &PurchaseBillUnions{} + if err := c.SearchRead(PurchaseBillUnionModel, criteria, options, pbus); err != nil { + return nil, err + } + return pbus, nil +} + +// FindPurchaseBillUnionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPurchaseBillUnionIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PurchaseBillUnionModel, criteria, options) +} + +// FindPurchaseBillUnionId finds record id by querying it with criteria. +func (c *Client) FindPurchaseBillUnionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PurchaseBillUnionModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/purchase_order.go b/purchase_order.go new file mode 100644 index 0000000..e219890 --- /dev/null +++ b/purchase_order.go @@ -0,0 +1,185 @@ +package odoo + +// PurchaseOrder represents purchase.order model. +type PurchaseOrder struct { + AccessToken *String `xmlrpc:"access_token,omitempty"` + AccessUrl *String `xmlrpc:"access_url,omitempty"` + AccessWarning *String `xmlrpc:"access_warning,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AmountTax *Float `xmlrpc:"amount_tax,omitempty"` + AmountTotal *Float `xmlrpc:"amount_total,omitempty"` + AmountTotalCc *Float `xmlrpc:"amount_total_cc,omitempty"` + AmountUntaxed *Float `xmlrpc:"amount_untaxed,omitempty"` + CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanyPriceInclude *Selection `xmlrpc:"company_price_include,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + CurrencyRate *Float `xmlrpc:"currency_rate,omitempty"` + DateApprove *Time `xmlrpc:"date_approve,omitempty"` + DateCalendarStart *Time `xmlrpc:"date_calendar_start,omitempty"` + DateOrder *Time `xmlrpc:"date_order,omitempty"` + DatePlanned *Time `xmlrpc:"date_planned,omitempty"` + DestAddressId *Many2One `xmlrpc:"dest_address_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FiscalPositionId *Many2One `xmlrpc:"fiscal_position_id,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IncotermId *Many2One `xmlrpc:"incoterm_id,omitempty"` + InvoiceCount *Int `xmlrpc:"invoice_count,omitempty"` + InvoiceIds *Relation `xmlrpc:"invoice_ids,omitempty"` + InvoiceStatus *Selection `xmlrpc:"invoice_status,omitempty"` + MailReceptionConfirmed *Bool `xmlrpc:"mail_reception_confirmed,omitempty"` + MailReceptionDeclined *Bool `xmlrpc:"mail_reception_declined,omitempty"` + MailReminderConfirmed *Bool `xmlrpc:"mail_reminder_confirmed,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Notes *String `xmlrpc:"notes,omitempty"` + OrderLine *Relation `xmlrpc:"order_line,omitempty"` + Origin *String `xmlrpc:"origin,omitempty"` + PartnerBillCount *Int `xmlrpc:"partner_bill_count,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerRef *String `xmlrpc:"partner_ref,omitempty"` + PaymentTermId *Many2One `xmlrpc:"payment_term_id,omitempty"` + Priority *Selection `xmlrpc:"priority,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + ReceiptReminderEmail *Bool `xmlrpc:"receipt_reminder_email,omitempty"` + ReminderDateBeforeReceipt *Int `xmlrpc:"reminder_date_before_receipt,omitempty"` + SaleOrderCount *Int `xmlrpc:"sale_order_count,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TaxCalculationRoundingMethod *Selection `xmlrpc:"tax_calculation_rounding_method,omitempty"` + TaxCountryId *Many2One `xmlrpc:"tax_country_id,omitempty"` + TaxTotals *String `xmlrpc:"tax_totals,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PurchaseOrders represents array of purchase.order model. +type PurchaseOrders []PurchaseOrder + +// PurchaseOrderModel is the odoo model name. +const PurchaseOrderModel = "purchase.order" + +// Many2One convert PurchaseOrder to *Many2One. +func (po *PurchaseOrder) Many2One() *Many2One { + return NewMany2One(po.Id.Get(), "") +} + +// CreatePurchaseOrder creates a new purchase.order model and returns its id. +func (c *Client) CreatePurchaseOrder(po *PurchaseOrder) (int64, error) { + ids, err := c.CreatePurchaseOrders([]*PurchaseOrder{po}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePurchaseOrder creates a new purchase.order model and returns its id. +func (c *Client) CreatePurchaseOrders(pos []*PurchaseOrder) ([]int64, error) { + var vv []interface{} + for _, v := range pos { + vv = append(vv, v) + } + return c.Create(PurchaseOrderModel, vv, nil) +} + +// UpdatePurchaseOrder updates an existing purchase.order record. +func (c *Client) UpdatePurchaseOrder(po *PurchaseOrder) error { + return c.UpdatePurchaseOrders([]int64{po.Id.Get()}, po) +} + +// UpdatePurchaseOrders updates existing purchase.order records. +// All records (represented by ids) will be updated by po values. +func (c *Client) UpdatePurchaseOrders(ids []int64, po *PurchaseOrder) error { + return c.Update(PurchaseOrderModel, ids, po, nil) +} + +// DeletePurchaseOrder deletes an existing purchase.order record. +func (c *Client) DeletePurchaseOrder(id int64) error { + return c.DeletePurchaseOrders([]int64{id}) +} + +// DeletePurchaseOrders deletes existing purchase.order records. +func (c *Client) DeletePurchaseOrders(ids []int64) error { + return c.Delete(PurchaseOrderModel, ids) +} + +// GetPurchaseOrder gets purchase.order existing record. +func (c *Client) GetPurchaseOrder(id int64) (*PurchaseOrder, error) { + pos, err := c.GetPurchaseOrders([]int64{id}) + if err != nil { + return nil, err + } + return &((*pos)[0]), nil +} + +// GetPurchaseOrders gets purchase.order existing records. +func (c *Client) GetPurchaseOrders(ids []int64) (*PurchaseOrders, error) { + pos := &PurchaseOrders{} + if err := c.Read(PurchaseOrderModel, ids, nil, pos); err != nil { + return nil, err + } + return pos, nil +} + +// FindPurchaseOrder finds purchase.order record by querying it with criteria. +func (c *Client) FindPurchaseOrder(criteria *Criteria) (*PurchaseOrder, error) { + pos := &PurchaseOrders{} + if err := c.SearchRead(PurchaseOrderModel, criteria, NewOptions().Limit(1), pos); err != nil { + return nil, err + } + return &((*pos)[0]), nil +} + +// FindPurchaseOrders finds purchase.order records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPurchaseOrders(criteria *Criteria, options *Options) (*PurchaseOrders, error) { + pos := &PurchaseOrders{} + if err := c.SearchRead(PurchaseOrderModel, criteria, options, pos); err != nil { + return nil, err + } + return pos, nil +} + +// FindPurchaseOrderIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPurchaseOrderIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PurchaseOrderModel, criteria, options) +} + +// FindPurchaseOrderId finds record id by querying it with criteria. +func (c *Client) FindPurchaseOrderId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PurchaseOrderModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/purchase_order_line.go b/purchase_order_line.go new file mode 100644 index 0000000..5bffd10 --- /dev/null +++ b/purchase_order_line.go @@ -0,0 +1,157 @@ +package odoo + +// PurchaseOrderLine represents purchase.order.line model. +type PurchaseOrderLine struct { + AnalyticDistribution *String `xmlrpc:"analytic_distribution,omitempty"` + AnalyticPrecision *Int `xmlrpc:"analytic_precision,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DateApprove *Time `xmlrpc:"date_approve,omitempty"` + DateOrder *Time `xmlrpc:"date_order,omitempty"` + DatePlanned *Time `xmlrpc:"date_planned,omitempty"` + Discount *Float `xmlrpc:"discount,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayType *Selection `xmlrpc:"display_type,omitempty"` + DistributionAnalyticAccountIds *Relation `xmlrpc:"distribution_analytic_account_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceLines *Relation `xmlrpc:"invoice_lines,omitempty"` + IsDownpayment *Bool `xmlrpc:"is_downpayment,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OrderId *Many2One `xmlrpc:"order_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PriceSubtotal *Float `xmlrpc:"price_subtotal,omitempty"` + PriceTax *Float `xmlrpc:"price_tax,omitempty"` + PriceTotal *Float `xmlrpc:"price_total,omitempty"` + PriceUnit *Float `xmlrpc:"price_unit,omitempty"` + PriceUnitDiscounted *Float `xmlrpc:"price_unit_discounted,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductNoVariantAttributeValueIds *Relation `xmlrpc:"product_no_variant_attribute_value_ids,omitempty"` + ProductPackagingId *Many2One `xmlrpc:"product_packaging_id,omitempty"` + ProductPackagingQty *Float `xmlrpc:"product_packaging_qty,omitempty"` + ProductQty *Float `xmlrpc:"product_qty,omitempty"` + ProductTemplateAttributeValueIds *Relation `xmlrpc:"product_template_attribute_value_ids,omitempty"` + ProductType *Selection `xmlrpc:"product_type,omitempty"` + ProductUom *Many2One `xmlrpc:"product_uom,omitempty"` + ProductUomCategoryId *Many2One `xmlrpc:"product_uom_category_id,omitempty"` + ProductUomQty *Float `xmlrpc:"product_uom_qty,omitempty"` + QtyInvoiced *Float `xmlrpc:"qty_invoiced,omitempty"` + QtyReceived *Float `xmlrpc:"qty_received,omitempty"` + QtyReceivedManual *Float `xmlrpc:"qty_received_manual,omitempty"` + QtyReceivedMethod *Selection `xmlrpc:"qty_received_method,omitempty"` + QtyToInvoice *Float `xmlrpc:"qty_to_invoice,omitempty"` + SaleLineId *Many2One `xmlrpc:"sale_line_id,omitempty"` + SaleOrderId *Many2One `xmlrpc:"sale_order_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TaxCalculationRoundingMethod *Selection `xmlrpc:"tax_calculation_rounding_method,omitempty"` + TaxesId *Relation `xmlrpc:"taxes_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// PurchaseOrderLines represents array of purchase.order.line model. +type PurchaseOrderLines []PurchaseOrderLine + +// PurchaseOrderLineModel is the odoo model name. +const PurchaseOrderLineModel = "purchase.order.line" + +// Many2One convert PurchaseOrderLine to *Many2One. +func (pol *PurchaseOrderLine) Many2One() *Many2One { + return NewMany2One(pol.Id.Get(), "") +} + +// CreatePurchaseOrderLine creates a new purchase.order.line model and returns its id. +func (c *Client) CreatePurchaseOrderLine(pol *PurchaseOrderLine) (int64, error) { + ids, err := c.CreatePurchaseOrderLines([]*PurchaseOrderLine{pol}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePurchaseOrderLine creates a new purchase.order.line model and returns its id. +func (c *Client) CreatePurchaseOrderLines(pols []*PurchaseOrderLine) ([]int64, error) { + var vv []interface{} + for _, v := range pols { + vv = append(vv, v) + } + return c.Create(PurchaseOrderLineModel, vv, nil) +} + +// UpdatePurchaseOrderLine updates an existing purchase.order.line record. +func (c *Client) UpdatePurchaseOrderLine(pol *PurchaseOrderLine) error { + return c.UpdatePurchaseOrderLines([]int64{pol.Id.Get()}, pol) +} + +// UpdatePurchaseOrderLines updates existing purchase.order.line records. +// All records (represented by ids) will be updated by pol values. +func (c *Client) UpdatePurchaseOrderLines(ids []int64, pol *PurchaseOrderLine) error { + return c.Update(PurchaseOrderLineModel, ids, pol, nil) +} + +// DeletePurchaseOrderLine deletes an existing purchase.order.line record. +func (c *Client) DeletePurchaseOrderLine(id int64) error { + return c.DeletePurchaseOrderLines([]int64{id}) +} + +// DeletePurchaseOrderLines deletes existing purchase.order.line records. +func (c *Client) DeletePurchaseOrderLines(ids []int64) error { + return c.Delete(PurchaseOrderLineModel, ids) +} + +// GetPurchaseOrderLine gets purchase.order.line existing record. +func (c *Client) GetPurchaseOrderLine(id int64) (*PurchaseOrderLine, error) { + pols, err := c.GetPurchaseOrderLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*pols)[0]), nil +} + +// GetPurchaseOrderLines gets purchase.order.line existing records. +func (c *Client) GetPurchaseOrderLines(ids []int64) (*PurchaseOrderLines, error) { + pols := &PurchaseOrderLines{} + if err := c.Read(PurchaseOrderLineModel, ids, nil, pols); err != nil { + return nil, err + } + return pols, nil +} + +// FindPurchaseOrderLine finds purchase.order.line record by querying it with criteria. +func (c *Client) FindPurchaseOrderLine(criteria *Criteria) (*PurchaseOrderLine, error) { + pols := &PurchaseOrderLines{} + if err := c.SearchRead(PurchaseOrderLineModel, criteria, NewOptions().Limit(1), pols); err != nil { + return nil, err + } + return &((*pols)[0]), nil +} + +// FindPurchaseOrderLines finds purchase.order.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPurchaseOrderLines(criteria *Criteria, options *Options) (*PurchaseOrderLines, error) { + pols := &PurchaseOrderLines{} + if err := c.SearchRead(PurchaseOrderLineModel, criteria, options, pols); err != nil { + return nil, err + } + return pols, nil +} + +// FindPurchaseOrderLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPurchaseOrderLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PurchaseOrderLineModel, criteria, options) +} + +// FindPurchaseOrderLineId finds record id by querying it with criteria. +func (c *Client) FindPurchaseOrderLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PurchaseOrderLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/purchase_report.go b/purchase_report.go new file mode 100644 index 0000000..635759c --- /dev/null +++ b/purchase_report.go @@ -0,0 +1,139 @@ +package odoo + +// PurchaseReport represents purchase.report model. +type PurchaseReport struct { + CategoryId *Many2One `xmlrpc:"category_id,omitempty"` + CommercialPartnerId *Many2One `xmlrpc:"commercial_partner_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DateApprove *Time `xmlrpc:"date_approve,omitempty"` + DateOrder *Time `xmlrpc:"date_order,omitempty"` + Delay *Float `xmlrpc:"delay,omitempty"` + DelayPass *Float `xmlrpc:"delay_pass,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FiscalPositionId *Many2One `xmlrpc:"fiscal_position_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + NbrLines *Int `xmlrpc:"nbr_lines,omitempty"` + OrderId *Many2One `xmlrpc:"order_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PriceAverage *Float `xmlrpc:"price_average,omitempty"` + PriceTotal *Float `xmlrpc:"price_total,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,omitempty"` + ProductUom *Many2One `xmlrpc:"product_uom,omitempty"` + QtyBilled *Float `xmlrpc:"qty_billed,omitempty"` + QtyOrdered *Float `xmlrpc:"qty_ordered,omitempty"` + QtyReceived *Float `xmlrpc:"qty_received,omitempty"` + QtyToBeBilled *Float `xmlrpc:"qty_to_be_billed,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + UntaxedTotal *Float `xmlrpc:"untaxed_total,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + Volume *Float `xmlrpc:"volume,omitempty"` + Weight *Float `xmlrpc:"weight,omitempty"` +} + +// PurchaseReports represents array of purchase.report model. +type PurchaseReports []PurchaseReport + +// PurchaseReportModel is the odoo model name. +const PurchaseReportModel = "purchase.report" + +// Many2One convert PurchaseReport to *Many2One. +func (pr *PurchaseReport) Many2One() *Many2One { + return NewMany2One(pr.Id.Get(), "") +} + +// CreatePurchaseReport creates a new purchase.report model and returns its id. +func (c *Client) CreatePurchaseReport(pr *PurchaseReport) (int64, error) { + ids, err := c.CreatePurchaseReports([]*PurchaseReport{pr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreatePurchaseReport creates a new purchase.report model and returns its id. +func (c *Client) CreatePurchaseReports(prs []*PurchaseReport) ([]int64, error) { + var vv []interface{} + for _, v := range prs { + vv = append(vv, v) + } + return c.Create(PurchaseReportModel, vv, nil) +} + +// UpdatePurchaseReport updates an existing purchase.report record. +func (c *Client) UpdatePurchaseReport(pr *PurchaseReport) error { + return c.UpdatePurchaseReports([]int64{pr.Id.Get()}, pr) +} + +// UpdatePurchaseReports updates existing purchase.report records. +// All records (represented by ids) will be updated by pr values. +func (c *Client) UpdatePurchaseReports(ids []int64, pr *PurchaseReport) error { + return c.Update(PurchaseReportModel, ids, pr, nil) +} + +// DeletePurchaseReport deletes an existing purchase.report record. +func (c *Client) DeletePurchaseReport(id int64) error { + return c.DeletePurchaseReports([]int64{id}) +} + +// DeletePurchaseReports deletes existing purchase.report records. +func (c *Client) DeletePurchaseReports(ids []int64) error { + return c.Delete(PurchaseReportModel, ids) +} + +// GetPurchaseReport gets purchase.report existing record. +func (c *Client) GetPurchaseReport(id int64) (*PurchaseReport, error) { + prs, err := c.GetPurchaseReports([]int64{id}) + if err != nil { + return nil, err + } + return &((*prs)[0]), nil +} + +// GetPurchaseReports gets purchase.report existing records. +func (c *Client) GetPurchaseReports(ids []int64) (*PurchaseReports, error) { + prs := &PurchaseReports{} + if err := c.Read(PurchaseReportModel, ids, nil, prs); err != nil { + return nil, err + } + return prs, nil +} + +// FindPurchaseReport finds purchase.report record by querying it with criteria. +func (c *Client) FindPurchaseReport(criteria *Criteria) (*PurchaseReport, error) { + prs := &PurchaseReports{} + if err := c.SearchRead(PurchaseReportModel, criteria, NewOptions().Limit(1), prs); err != nil { + return nil, err + } + return &((*prs)[0]), nil +} + +// FindPurchaseReports finds purchase.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindPurchaseReports(criteria *Criteria, options *Options) (*PurchaseReports, error) { + prs := &PurchaseReports{} + if err := c.SearchRead(PurchaseReportModel, criteria, options, prs); err != nil { + return nil, err + } + return prs, nil +} + +// FindPurchaseReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindPurchaseReportIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(PurchaseReportModel, criteria, options) +} + +// FindPurchaseReportId finds record id by querying it with criteria. +func (c *Client) FindPurchaseReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(PurchaseReportModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/quotation_document.go b/quotation_document.go new file mode 100644 index 0000000..c19ffb9 --- /dev/null +++ b/quotation_document.go @@ -0,0 +1,147 @@ +package odoo + +// QuotationDocument represents quotation.document model. +type QuotationDocument struct { + AccessToken *String `xmlrpc:"access_token,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + Checksum *String `xmlrpc:"checksum,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Datas *String `xmlrpc:"datas,omitempty"` + DbDatas *String `xmlrpc:"db_datas,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DocumentType *Selection `xmlrpc:"document_type,omitempty"` + FileSize *Int `xmlrpc:"file_size,omitempty"` + FormFieldIds *Relation `xmlrpc:"form_field_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ImageHeight *Int `xmlrpc:"image_height,omitempty"` + ImageSrc *String `xmlrpc:"image_src,omitempty"` + ImageWidth *Int `xmlrpc:"image_width,omitempty"` + IndexContent *String `xmlrpc:"index_content,omitempty"` + IrAttachmentId *Many2One `xmlrpc:"ir_attachment_id,omitempty"` + LocalUrl *String `xmlrpc:"local_url,omitempty"` + Mimetype *String `xmlrpc:"mimetype,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OriginalId *Many2One `xmlrpc:"original_id,omitempty"` + Public *Bool `xmlrpc:"public,omitempty"` + QuotationTemplateIds *Relation `xmlrpc:"quotation_template_ids,omitempty"` + Raw *String `xmlrpc:"raw,omitempty"` + ResField *String `xmlrpc:"res_field,omitempty"` + ResId *Many2One `xmlrpc:"res_id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + ResName *String `xmlrpc:"res_name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + StoreFname *String `xmlrpc:"store_fname,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + Url *String `xmlrpc:"url,omitempty"` + VoiceIds *Relation `xmlrpc:"voice_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// QuotationDocuments represents array of quotation.document model. +type QuotationDocuments []QuotationDocument + +// QuotationDocumentModel is the odoo model name. +const QuotationDocumentModel = "quotation.document" + +// Many2One convert QuotationDocument to *Many2One. +func (qd *QuotationDocument) Many2One() *Many2One { + return NewMany2One(qd.Id.Get(), "") +} + +// CreateQuotationDocument creates a new quotation.document model and returns its id. +func (c *Client) CreateQuotationDocument(qd *QuotationDocument) (int64, error) { + ids, err := c.CreateQuotationDocuments([]*QuotationDocument{qd}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateQuotationDocument creates a new quotation.document model and returns its id. +func (c *Client) CreateQuotationDocuments(qds []*QuotationDocument) ([]int64, error) { + var vv []interface{} + for _, v := range qds { + vv = append(vv, v) + } + return c.Create(QuotationDocumentModel, vv, nil) +} + +// UpdateQuotationDocument updates an existing quotation.document record. +func (c *Client) UpdateQuotationDocument(qd *QuotationDocument) error { + return c.UpdateQuotationDocuments([]int64{qd.Id.Get()}, qd) +} + +// UpdateQuotationDocuments updates existing quotation.document records. +// All records (represented by ids) will be updated by qd values. +func (c *Client) UpdateQuotationDocuments(ids []int64, qd *QuotationDocument) error { + return c.Update(QuotationDocumentModel, ids, qd, nil) +} + +// DeleteQuotationDocument deletes an existing quotation.document record. +func (c *Client) DeleteQuotationDocument(id int64) error { + return c.DeleteQuotationDocuments([]int64{id}) +} + +// DeleteQuotationDocuments deletes existing quotation.document records. +func (c *Client) DeleteQuotationDocuments(ids []int64) error { + return c.Delete(QuotationDocumentModel, ids) +} + +// GetQuotationDocument gets quotation.document existing record. +func (c *Client) GetQuotationDocument(id int64) (*QuotationDocument, error) { + qds, err := c.GetQuotationDocuments([]int64{id}) + if err != nil { + return nil, err + } + return &((*qds)[0]), nil +} + +// GetQuotationDocuments gets quotation.document existing records. +func (c *Client) GetQuotationDocuments(ids []int64) (*QuotationDocuments, error) { + qds := &QuotationDocuments{} + if err := c.Read(QuotationDocumentModel, ids, nil, qds); err != nil { + return nil, err + } + return qds, nil +} + +// FindQuotationDocument finds quotation.document record by querying it with criteria. +func (c *Client) FindQuotationDocument(criteria *Criteria) (*QuotationDocument, error) { + qds := &QuotationDocuments{} + if err := c.SearchRead(QuotationDocumentModel, criteria, NewOptions().Limit(1), qds); err != nil { + return nil, err + } + return &((*qds)[0]), nil +} + +// FindQuotationDocuments finds quotation.document records by querying it +// and filtering it with criteria and options. +func (c *Client) FindQuotationDocuments(criteria *Criteria, options *Options) (*QuotationDocuments, error) { + qds := &QuotationDocuments{} + if err := c.SearchRead(QuotationDocumentModel, criteria, options, qds); err != nil { + return nil, err + } + return qds, nil +} + +// FindQuotationDocumentIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindQuotationDocumentIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(QuotationDocumentModel, criteria, options) +} + +// FindQuotationDocumentId finds record id by querying it with criteria. +func (c *Client) FindQuotationDocumentId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(QuotationDocumentModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/rating_rating.go b/rating_rating.go new file mode 100644 index 0000000..47ba29d --- /dev/null +++ b/rating_rating.go @@ -0,0 +1,141 @@ +package odoo + +// RatingRating represents rating.rating model. +type RatingRating struct { + AccessToken *String `xmlrpc:"access_token,omitempty"` + Consumed *Bool `xmlrpc:"consumed,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Feedback *String `xmlrpc:"feedback,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsInternal *Bool `xmlrpc:"is_internal,omitempty"` + MessageId *Many2One `xmlrpc:"message_id,omitempty"` + ParentRef *String `xmlrpc:"parent_ref,omitempty"` + ParentResId *Int `xmlrpc:"parent_res_id,omitempty"` + ParentResModel *String `xmlrpc:"parent_res_model,omitempty"` + ParentResModelId *Many2One `xmlrpc:"parent_res_model_id,omitempty"` + ParentResName *String `xmlrpc:"parent_res_name,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PublisherComment *String `xmlrpc:"publisher_comment,omitempty"` + PublisherDatetime *Time `xmlrpc:"publisher_datetime,omitempty"` + PublisherId *Many2One `xmlrpc:"publisher_id,omitempty"` + RatedPartnerId *Many2One `xmlrpc:"rated_partner_id,omitempty"` + RatedPartnerName *String `xmlrpc:"rated_partner_name,omitempty"` + Rating *Float `xmlrpc:"rating,omitempty"` + RatingImage *String `xmlrpc:"rating_image,omitempty"` + RatingImageUrl *String `xmlrpc:"rating_image_url,omitempty"` + RatingText *Selection `xmlrpc:"rating_text,omitempty"` + ResId *Many2One `xmlrpc:"res_id,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + ResModelId *Many2One `xmlrpc:"res_model_id,omitempty"` + ResName *String `xmlrpc:"res_name,omitempty"` + ResourceRef *String `xmlrpc:"resource_ref,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// RatingRatings represents array of rating.rating model. +type RatingRatings []RatingRating + +// RatingRatingModel is the odoo model name. +const RatingRatingModel = "rating.rating" + +// Many2One convert RatingRating to *Many2One. +func (rr *RatingRating) Many2One() *Many2One { + return NewMany2One(rr.Id.Get(), "") +} + +// CreateRatingRating creates a new rating.rating model and returns its id. +func (c *Client) CreateRatingRating(rr *RatingRating) (int64, error) { + ids, err := c.CreateRatingRatings([]*RatingRating{rr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateRatingRating creates a new rating.rating model and returns its id. +func (c *Client) CreateRatingRatings(rrs []*RatingRating) ([]int64, error) { + var vv []interface{} + for _, v := range rrs { + vv = append(vv, v) + } + return c.Create(RatingRatingModel, vv, nil) +} + +// UpdateRatingRating updates an existing rating.rating record. +func (c *Client) UpdateRatingRating(rr *RatingRating) error { + return c.UpdateRatingRatings([]int64{rr.Id.Get()}, rr) +} + +// UpdateRatingRatings updates existing rating.rating records. +// All records (represented by ids) will be updated by rr values. +func (c *Client) UpdateRatingRatings(ids []int64, rr *RatingRating) error { + return c.Update(RatingRatingModel, ids, rr, nil) +} + +// DeleteRatingRating deletes an existing rating.rating record. +func (c *Client) DeleteRatingRating(id int64) error { + return c.DeleteRatingRatings([]int64{id}) +} + +// DeleteRatingRatings deletes existing rating.rating records. +func (c *Client) DeleteRatingRatings(ids []int64) error { + return c.Delete(RatingRatingModel, ids) +} + +// GetRatingRating gets rating.rating existing record. +func (c *Client) GetRatingRating(id int64) (*RatingRating, error) { + rrs, err := c.GetRatingRatings([]int64{id}) + if err != nil { + return nil, err + } + return &((*rrs)[0]), nil +} + +// GetRatingRatings gets rating.rating existing records. +func (c *Client) GetRatingRatings(ids []int64) (*RatingRatings, error) { + rrs := &RatingRatings{} + if err := c.Read(RatingRatingModel, ids, nil, rrs); err != nil { + return nil, err + } + return rrs, nil +} + +// FindRatingRating finds rating.rating record by querying it with criteria. +func (c *Client) FindRatingRating(criteria *Criteria) (*RatingRating, error) { + rrs := &RatingRatings{} + if err := c.SearchRead(RatingRatingModel, criteria, NewOptions().Limit(1), rrs); err != nil { + return nil, err + } + return &((*rrs)[0]), nil +} + +// FindRatingRatings finds rating.rating records by querying it +// and filtering it with criteria and options. +func (c *Client) FindRatingRatings(criteria *Criteria, options *Options) (*RatingRatings, error) { + rrs := &RatingRatings{} + if err := c.SearchRead(RatingRatingModel, criteria, options, rrs); err != nil { + return nil, err + } + return rrs, nil +} + +// FindRatingRatingIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindRatingRatingIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(RatingRatingModel, criteria, options) +} + +// FindRatingRatingId finds record id by querying it with criteria. +func (c *Client) FindRatingRatingId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(RatingRatingModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/report_layout.go b/report_layout.go new file mode 100644 index 0000000..fc8cba3 --- /dev/null +++ b/report_layout.go @@ -0,0 +1,121 @@ +package odoo + +// ReportLayout represents report.layout model. +type ReportLayout struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Image *String `xmlrpc:"image,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Pdf *String `xmlrpc:"pdf,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + ViewId *Many2One `xmlrpc:"view_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ReportLayouts represents array of report.layout model. +type ReportLayouts []ReportLayout + +// ReportLayoutModel is the odoo model name. +const ReportLayoutModel = "report.layout" + +// Many2One convert ReportLayout to *Many2One. +func (rl *ReportLayout) Many2One() *Many2One { + return NewMany2One(rl.Id.Get(), "") +} + +// CreateReportLayout creates a new report.layout model and returns its id. +func (c *Client) CreateReportLayout(rl *ReportLayout) (int64, error) { + ids, err := c.CreateReportLayouts([]*ReportLayout{rl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateReportLayout creates a new report.layout model and returns its id. +func (c *Client) CreateReportLayouts(rls []*ReportLayout) ([]int64, error) { + var vv []interface{} + for _, v := range rls { + vv = append(vv, v) + } + return c.Create(ReportLayoutModel, vv, nil) +} + +// UpdateReportLayout updates an existing report.layout record. +func (c *Client) UpdateReportLayout(rl *ReportLayout) error { + return c.UpdateReportLayouts([]int64{rl.Id.Get()}, rl) +} + +// UpdateReportLayouts updates existing report.layout records. +// All records (represented by ids) will be updated by rl values. +func (c *Client) UpdateReportLayouts(ids []int64, rl *ReportLayout) error { + return c.Update(ReportLayoutModel, ids, rl, nil) +} + +// DeleteReportLayout deletes an existing report.layout record. +func (c *Client) DeleteReportLayout(id int64) error { + return c.DeleteReportLayouts([]int64{id}) +} + +// DeleteReportLayouts deletes existing report.layout records. +func (c *Client) DeleteReportLayouts(ids []int64) error { + return c.Delete(ReportLayoutModel, ids) +} + +// GetReportLayout gets report.layout existing record. +func (c *Client) GetReportLayout(id int64) (*ReportLayout, error) { + rls, err := c.GetReportLayouts([]int64{id}) + if err != nil { + return nil, err + } + return &((*rls)[0]), nil +} + +// GetReportLayouts gets report.layout existing records. +func (c *Client) GetReportLayouts(ids []int64) (*ReportLayouts, error) { + rls := &ReportLayouts{} + if err := c.Read(ReportLayoutModel, ids, nil, rls); err != nil { + return nil, err + } + return rls, nil +} + +// FindReportLayout finds report.layout record by querying it with criteria. +func (c *Client) FindReportLayout(criteria *Criteria) (*ReportLayout, error) { + rls := &ReportLayouts{} + if err := c.SearchRead(ReportLayoutModel, criteria, NewOptions().Limit(1), rls); err != nil { + return nil, err + } + return &((*rls)[0]), nil +} + +// FindReportLayouts finds report.layout records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportLayouts(criteria *Criteria, options *Options) (*ReportLayouts, error) { + rls := &ReportLayouts{} + if err := c.SearchRead(ReportLayoutModel, criteria, options, rls); err != nil { + return nil, err + } + return rls, nil +} + +// FindReportLayoutIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportLayoutIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ReportLayoutModel, criteria, options) +} + +// FindReportLayoutId finds record id by querying it with criteria. +func (c *Client) FindReportLayoutId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportLayoutModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/report_paperformat.go b/report_paperformat.go new file mode 100644 index 0000000..0bcc09b --- /dev/null +++ b/report_paperformat.go @@ -0,0 +1,134 @@ +package odoo + +// ReportPaperformat represents report.paperformat model. +type ReportPaperformat struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CssMargins *Bool `xmlrpc:"css_margins,omitempty"` + Default *Bool `xmlrpc:"default,omitempty"` + DisableShrinking *Bool `xmlrpc:"disable_shrinking,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Dpi *Int `xmlrpc:"dpi,omitempty"` + Format *Selection `xmlrpc:"format,omitempty"` + HeaderLine *Bool `xmlrpc:"header_line,omitempty"` + HeaderSpacing *Int `xmlrpc:"header_spacing,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MarginBottom *Float `xmlrpc:"margin_bottom,omitempty"` + MarginLeft *Float `xmlrpc:"margin_left,omitempty"` + MarginRight *Float `xmlrpc:"margin_right,omitempty"` + MarginTop *Float `xmlrpc:"margin_top,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Orientation *Selection `xmlrpc:"orientation,omitempty"` + PageHeight *Int `xmlrpc:"page_height,omitempty"` + PageWidth *Int `xmlrpc:"page_width,omitempty"` + PrintPageHeight *Float `xmlrpc:"print_page_height,omitempty"` + PrintPageWidth *Float `xmlrpc:"print_page_width,omitempty"` + ReportIds *Relation `xmlrpc:"report_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ReportPaperformats represents array of report.paperformat model. +type ReportPaperformats []ReportPaperformat + +// ReportPaperformatModel is the odoo model name. +const ReportPaperformatModel = "report.paperformat" + +// Many2One convert ReportPaperformat to *Many2One. +func (rp *ReportPaperformat) Many2One() *Many2One { + return NewMany2One(rp.Id.Get(), "") +} + +// CreateReportPaperformat creates a new report.paperformat model and returns its id. +func (c *Client) CreateReportPaperformat(rp *ReportPaperformat) (int64, error) { + ids, err := c.CreateReportPaperformats([]*ReportPaperformat{rp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateReportPaperformat creates a new report.paperformat model and returns its id. +func (c *Client) CreateReportPaperformats(rps []*ReportPaperformat) ([]int64, error) { + var vv []interface{} + for _, v := range rps { + vv = append(vv, v) + } + return c.Create(ReportPaperformatModel, vv, nil) +} + +// UpdateReportPaperformat updates an existing report.paperformat record. +func (c *Client) UpdateReportPaperformat(rp *ReportPaperformat) error { + return c.UpdateReportPaperformats([]int64{rp.Id.Get()}, rp) +} + +// UpdateReportPaperformats updates existing report.paperformat records. +// All records (represented by ids) will be updated by rp values. +func (c *Client) UpdateReportPaperformats(ids []int64, rp *ReportPaperformat) error { + return c.Update(ReportPaperformatModel, ids, rp, nil) +} + +// DeleteReportPaperformat deletes an existing report.paperformat record. +func (c *Client) DeleteReportPaperformat(id int64) error { + return c.DeleteReportPaperformats([]int64{id}) +} + +// DeleteReportPaperformats deletes existing report.paperformat records. +func (c *Client) DeleteReportPaperformats(ids []int64) error { + return c.Delete(ReportPaperformatModel, ids) +} + +// GetReportPaperformat gets report.paperformat existing record. +func (c *Client) GetReportPaperformat(id int64) (*ReportPaperformat, error) { + rps, err := c.GetReportPaperformats([]int64{id}) + if err != nil { + return nil, err + } + return &((*rps)[0]), nil +} + +// GetReportPaperformats gets report.paperformat existing records. +func (c *Client) GetReportPaperformats(ids []int64) (*ReportPaperformats, error) { + rps := &ReportPaperformats{} + if err := c.Read(ReportPaperformatModel, ids, nil, rps); err != nil { + return nil, err + } + return rps, nil +} + +// FindReportPaperformat finds report.paperformat record by querying it with criteria. +func (c *Client) FindReportPaperformat(criteria *Criteria) (*ReportPaperformat, error) { + rps := &ReportPaperformats{} + if err := c.SearchRead(ReportPaperformatModel, criteria, NewOptions().Limit(1), rps); err != nil { + return nil, err + } + return &((*rps)[0]), nil +} + +// FindReportPaperformats finds report.paperformat records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportPaperformats(criteria *Criteria, options *Options) (*ReportPaperformats, error) { + rps := &ReportPaperformats{} + if err := c.SearchRead(ReportPaperformatModel, criteria, options, rps); err != nil { + return nil, err + } + return rps, nil +} + +// FindReportPaperformatIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportPaperformatIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ReportPaperformatModel, criteria, options) +} + +// FindReportPaperformatId finds record id by querying it with criteria. +func (c *Client) FindReportPaperformatId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportPaperformatModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/report_project_task_user.go b/report_project_task_user.go new file mode 100644 index 0000000..d4686cf --- /dev/null +++ b/report_project_task_user.go @@ -0,0 +1,155 @@ +package odoo + +// ReportProjectTaskUser represents report.project.task.user model. +type ReportProjectTaskUser struct { + Active *Bool `xmlrpc:"active,omitempty"` + AllocatedHours *Float `xmlrpc:"allocated_hours,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + DateAssign *Time `xmlrpc:"date_assign,omitempty"` + DateDeadline *Time `xmlrpc:"date_deadline,omitempty"` + DateEnd *Time `xmlrpc:"date_end,omitempty"` + DateLastStageUpdate *Time `xmlrpc:"date_last_stage_update,omitempty"` + DelayEndingsDays *Float `xmlrpc:"delay_endings_days,omitempty"` + DependentIds *Relation `xmlrpc:"dependent_ids,omitempty"` + Description *String `xmlrpc:"description,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EffectiveHours *Float `xmlrpc:"effective_hours,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsClosed *Bool `xmlrpc:"is_closed,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MilestoneId *Many2One `xmlrpc:"milestone_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Nbr *Int `xmlrpc:"nbr,omitempty"` + Overtime *Float `xmlrpc:"overtime,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PersonalStageTypeIds *Relation `xmlrpc:"personal_stage_type_ids,omitempty"` + Priority *Selection `xmlrpc:"priority,omitempty"` + Progress *Float `xmlrpc:"progress,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + RatingAvg *Float `xmlrpc:"rating_avg,omitempty"` + RatingLastValue *Float `xmlrpc:"rating_last_value,omitempty"` + RemainingHours *Float `xmlrpc:"remaining_hours,omitempty"` + RemainingHoursPercentage *Float `xmlrpc:"remaining_hours_percentage,omitempty"` + RemainingHoursSo *Float `xmlrpc:"remaining_hours_so,omitempty"` + SaleLineId *Many2One `xmlrpc:"sale_line_id,omitempty"` + SaleOrderId *Many2One `xmlrpc:"sale_order_id,omitempty"` + StageId *Many2One `xmlrpc:"stage_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + SubtaskEffectiveHours *Float `xmlrpc:"subtask_effective_hours,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TaskId *Many2One `xmlrpc:"task_id,omitempty"` + TotalHoursSpent *Float `xmlrpc:"total_hours_spent,omitempty"` + UserIds *Relation `xmlrpc:"user_ids,omitempty"` + UserSkillIds *Relation `xmlrpc:"user_skill_ids,omitempty"` + WorkingDaysClose *Float `xmlrpc:"working_days_close,omitempty"` + WorkingDaysOpen *Float `xmlrpc:"working_days_open,omitempty"` + WorkingHoursClose *Float `xmlrpc:"working_hours_close,omitempty"` + WorkingHoursOpen *Float `xmlrpc:"working_hours_open,omitempty"` +} + +// ReportProjectTaskUsers represents array of report.project.task.user model. +type ReportProjectTaskUsers []ReportProjectTaskUser + +// ReportProjectTaskUserModel is the odoo model name. +const ReportProjectTaskUserModel = "report.project.task.user" + +// Many2One convert ReportProjectTaskUser to *Many2One. +func (rptu *ReportProjectTaskUser) Many2One() *Many2One { + return NewMany2One(rptu.Id.Get(), "") +} + +// CreateReportProjectTaskUser creates a new report.project.task.user model and returns its id. +func (c *Client) CreateReportProjectTaskUser(rptu *ReportProjectTaskUser) (int64, error) { + ids, err := c.CreateReportProjectTaskUsers([]*ReportProjectTaskUser{rptu}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateReportProjectTaskUser creates a new report.project.task.user model and returns its id. +func (c *Client) CreateReportProjectTaskUsers(rptus []*ReportProjectTaskUser) ([]int64, error) { + var vv []interface{} + for _, v := range rptus { + vv = append(vv, v) + } + return c.Create(ReportProjectTaskUserModel, vv, nil) +} + +// UpdateReportProjectTaskUser updates an existing report.project.task.user record. +func (c *Client) UpdateReportProjectTaskUser(rptu *ReportProjectTaskUser) error { + return c.UpdateReportProjectTaskUsers([]int64{rptu.Id.Get()}, rptu) +} + +// UpdateReportProjectTaskUsers updates existing report.project.task.user records. +// All records (represented by ids) will be updated by rptu values. +func (c *Client) UpdateReportProjectTaskUsers(ids []int64, rptu *ReportProjectTaskUser) error { + return c.Update(ReportProjectTaskUserModel, ids, rptu, nil) +} + +// DeleteReportProjectTaskUser deletes an existing report.project.task.user record. +func (c *Client) DeleteReportProjectTaskUser(id int64) error { + return c.DeleteReportProjectTaskUsers([]int64{id}) +} + +// DeleteReportProjectTaskUsers deletes existing report.project.task.user records. +func (c *Client) DeleteReportProjectTaskUsers(ids []int64) error { + return c.Delete(ReportProjectTaskUserModel, ids) +} + +// GetReportProjectTaskUser gets report.project.task.user existing record. +func (c *Client) GetReportProjectTaskUser(id int64) (*ReportProjectTaskUser, error) { + rptus, err := c.GetReportProjectTaskUsers([]int64{id}) + if err != nil { + return nil, err + } + return &((*rptus)[0]), nil +} + +// GetReportProjectTaskUsers gets report.project.task.user existing records. +func (c *Client) GetReportProjectTaskUsers(ids []int64) (*ReportProjectTaskUsers, error) { + rptus := &ReportProjectTaskUsers{} + if err := c.Read(ReportProjectTaskUserModel, ids, nil, rptus); err != nil { + return nil, err + } + return rptus, nil +} + +// FindReportProjectTaskUser finds report.project.task.user record by querying it with criteria. +func (c *Client) FindReportProjectTaskUser(criteria *Criteria) (*ReportProjectTaskUser, error) { + rptus := &ReportProjectTaskUsers{} + if err := c.SearchRead(ReportProjectTaskUserModel, criteria, NewOptions().Limit(1), rptus); err != nil { + return nil, err + } + return &((*rptus)[0]), nil +} + +// FindReportProjectTaskUsers finds report.project.task.user records by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportProjectTaskUsers(criteria *Criteria, options *Options) (*ReportProjectTaskUsers, error) { + rptus := &ReportProjectTaskUsers{} + if err := c.SearchRead(ReportProjectTaskUserModel, criteria, options, rptus); err != nil { + return nil, err + } + return rptus, nil +} + +// FindReportProjectTaskUserIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindReportProjectTaskUserIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ReportProjectTaskUserModel, criteria, options) +} + +// FindReportProjectTaskUserId finds record id by querying it with criteria. +func (c *Client) FindReportProjectTaskUserId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ReportProjectTaskUserModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_bank.go b/res_bank.go new file mode 100644 index 0000000..45334e4 --- /dev/null +++ b/res_bank.go @@ -0,0 +1,128 @@ +package odoo + +// ResBank represents res.bank model. +type ResBank struct { + Active *Bool `xmlrpc:"active,omitempty"` + Bic *String `xmlrpc:"bic,omitempty"` + City *String `xmlrpc:"city,omitempty"` + Country *Many2One `xmlrpc:"country,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Phone *String `xmlrpc:"phone,omitempty"` + State *Many2One `xmlrpc:"state,omitempty"` + Street *String `xmlrpc:"street,omitempty"` + Street2 *String `xmlrpc:"street2,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + Zip *String `xmlrpc:"zip,omitempty"` +} + +// ResBanks represents array of res.bank model. +type ResBanks []ResBank + +// ResBankModel is the odoo model name. +const ResBankModel = "res.bank" + +// Many2One convert ResBank to *Many2One. +func (rb *ResBank) Many2One() *Many2One { + return NewMany2One(rb.Id.Get(), "") +} + +// CreateResBank creates a new res.bank model and returns its id. +func (c *Client) CreateResBank(rb *ResBank) (int64, error) { + ids, err := c.CreateResBanks([]*ResBank{rb}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResBank creates a new res.bank model and returns its id. +func (c *Client) CreateResBanks(rbs []*ResBank) ([]int64, error) { + var vv []interface{} + for _, v := range rbs { + vv = append(vv, v) + } + return c.Create(ResBankModel, vv, nil) +} + +// UpdateResBank updates an existing res.bank record. +func (c *Client) UpdateResBank(rb *ResBank) error { + return c.UpdateResBanks([]int64{rb.Id.Get()}, rb) +} + +// UpdateResBanks updates existing res.bank records. +// All records (represented by ids) will be updated by rb values. +func (c *Client) UpdateResBanks(ids []int64, rb *ResBank) error { + return c.Update(ResBankModel, ids, rb, nil) +} + +// DeleteResBank deletes an existing res.bank record. +func (c *Client) DeleteResBank(id int64) error { + return c.DeleteResBanks([]int64{id}) +} + +// DeleteResBanks deletes existing res.bank records. +func (c *Client) DeleteResBanks(ids []int64) error { + return c.Delete(ResBankModel, ids) +} + +// GetResBank gets res.bank existing record. +func (c *Client) GetResBank(id int64) (*ResBank, error) { + rbs, err := c.GetResBanks([]int64{id}) + if err != nil { + return nil, err + } + return &((*rbs)[0]), nil +} + +// GetResBanks gets res.bank existing records. +func (c *Client) GetResBanks(ids []int64) (*ResBanks, error) { + rbs := &ResBanks{} + if err := c.Read(ResBankModel, ids, nil, rbs); err != nil { + return nil, err + } + return rbs, nil +} + +// FindResBank finds res.bank record by querying it with criteria. +func (c *Client) FindResBank(criteria *Criteria) (*ResBank, error) { + rbs := &ResBanks{} + if err := c.SearchRead(ResBankModel, criteria, NewOptions().Limit(1), rbs); err != nil { + return nil, err + } + return &((*rbs)[0]), nil +} + +// FindResBanks finds res.bank records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResBanks(criteria *Criteria, options *Options) (*ResBanks, error) { + rbs := &ResBanks{} + if err := c.SearchRead(ResBankModel, criteria, options, rbs); err != nil { + return nil, err + } + return rbs, nil +} + +// FindResBankIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResBankIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResBankModel, criteria, options) +} + +// FindResBankId finds record id by querying it with criteria. +func (c *Client) FindResBankId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResBankModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_company.go b/res_company.go new file mode 100644 index 0000000..02f9bfe --- /dev/null +++ b/res_company.go @@ -0,0 +1,280 @@ +package odoo + +// ResCompany represents res.company model. +type ResCompany struct { + AccountCashBasisBaseAccountId *Many2One `xmlrpc:"account_cash_basis_base_account_id,omitempty"` + AccountDefaultPosReceivableAccountId *Many2One `xmlrpc:"account_default_pos_receivable_account_id,omitempty"` + AccountDiscountExpenseAllocationId *Many2One `xmlrpc:"account_discount_expense_allocation_id,omitempty"` + AccountDiscountIncomeAllocationId *Many2One `xmlrpc:"account_discount_income_allocation_id,omitempty"` + AccountEnabledTaxCountryIds *Relation `xmlrpc:"account_enabled_tax_country_ids,omitempty"` + AccountFiscalCountryId *Many2One `xmlrpc:"account_fiscal_country_id,omitempty"` + AccountJournalEarlyPayDiscountGainAccountId *Many2One `xmlrpc:"account_journal_early_pay_discount_gain_account_id,omitempty"` + AccountJournalEarlyPayDiscountLossAccountId *Many2One `xmlrpc:"account_journal_early_pay_discount_loss_account_id,omitempty"` + AccountJournalSuspenseAccountId *Many2One `xmlrpc:"account_journal_suspense_account_id,omitempty"` + AccountOpeningDate *Time `xmlrpc:"account_opening_date,omitempty"` + AccountOpeningJournalId *Many2One `xmlrpc:"account_opening_journal_id,omitempty"` + AccountOpeningMoveId *Many2One `xmlrpc:"account_opening_move_id,omitempty"` + AccountPriceInclude *Selection `xmlrpc:"account_price_include,omitempty"` + AccountPurchaseTaxId *Many2One `xmlrpc:"account_purchase_tax_id,omitempty"` + AccountSaleTaxId *Many2One `xmlrpc:"account_sale_tax_id,omitempty"` + AccountStorno *Bool `xmlrpc:"account_storno,omitempty"` + AccountUseCreditLimit *Bool `xmlrpc:"account_use_credit_limit,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + AliasDomainId *Many2One `xmlrpc:"alias_domain_id,omitempty"` + AliasDomainName *String `xmlrpc:"alias_domain_name,omitempty"` + AllChildIds *Relation `xmlrpc:"all_child_ids,omitempty"` + AngloSaxonAccounting *Bool `xmlrpc:"anglo_saxon_accounting,omitempty"` + AutomaticEntryDefaultJournalId *Many2One `xmlrpc:"automatic_entry_default_journal_id,omitempty"` + AutopostBills *Bool `xmlrpc:"autopost_bills,omitempty"` + BankAccountCodePrefix *String `xmlrpc:"bank_account_code_prefix,omitempty"` + BankIds *Relation `xmlrpc:"bank_ids,omitempty"` + BankJournalIds *Relation `xmlrpc:"bank_journal_ids,omitempty"` + BatchPaymentSequenceId *Many2One `xmlrpc:"batch_payment_sequence_id,omitempty"` + BounceEmail *String `xmlrpc:"bounce_email,omitempty"` + BounceFormatted *String `xmlrpc:"bounce_formatted,omitempty"` + CandidatePropertiesDefinition interface{} `xmlrpc:"candidate_properties_definition,omitempty"` + CashAccountCodePrefix *String `xmlrpc:"cash_account_code_prefix,omitempty"` + CatchallEmail *String `xmlrpc:"catchall_email,omitempty"` + CatchallFormatted *String `xmlrpc:"catchall_formatted,omitempty"` + ChartTemplate *Selection `xmlrpc:"chart_template,omitempty"` + CheckAccountAuditTrail *Bool `xmlrpc:"check_account_audit_trail,omitempty"` + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + City *String `xmlrpc:"city,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyDetails *String `xmlrpc:"company_details,omitempty"` + CompanyExpenseAllowedPaymentMethodLineIds *Relation `xmlrpc:"company_expense_allowed_payment_method_line_ids,omitempty"` + CompanyRegistry *String `xmlrpc:"company_registry,omitempty"` + CompanyVatPlaceholder *String `xmlrpc:"company_vat_placeholder,omitempty"` + ContractExpirationNoticePeriod *Int `xmlrpc:"contract_expiration_notice_period,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyExchangeJournalId *Many2One `xmlrpc:"currency_exchange_journal_id,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DefaultCashDifferenceExpenseAccountId *Many2One `xmlrpc:"default_cash_difference_expense_account_id,omitempty"` + DefaultCashDifferenceIncomeAccountId *Many2One `xmlrpc:"default_cash_difference_income_account_id,omitempty"` + DefaultFromEmail *String `xmlrpc:"default_from_email,omitempty"` + DisplayInvoiceAmountTotalWords *Bool `xmlrpc:"display_invoice_amount_total_words,omitempty"` + DisplayInvoiceTaxCompanyCurrency *Bool `xmlrpc:"display_invoice_tax_company_currency,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + EmailFormatted *String `xmlrpc:"email_formatted,omitempty"` + EmailPrimaryColor *String `xmlrpc:"email_primary_color,omitempty"` + EmailSecondaryColor *String `xmlrpc:"email_secondary_color,omitempty"` + EmployeePropertiesDefinition interface{} `xmlrpc:"employee_properties_definition,omitempty"` + ExpectsChartOfAccounts *Bool `xmlrpc:"expects_chart_of_accounts,omitempty"` + ExpenseAccrualAccountId *Many2One `xmlrpc:"expense_accrual_account_id,omitempty"` + ExpenseCurrencyExchangeAccountId *Many2One `xmlrpc:"expense_currency_exchange_account_id,omitempty"` + ExpenseJournalId *Many2One `xmlrpc:"expense_journal_id,omitempty"` + ExpenseOutstandingAccountId *Many2One `xmlrpc:"expense_outstanding_account_id,omitempty"` + ExternalReportLayoutId *Many2One `xmlrpc:"external_report_layout_id,omitempty"` + FiscalPositionIds *Relation `xmlrpc:"fiscal_position_ids,omitempty"` + FiscalyearLastDay *Int `xmlrpc:"fiscalyear_last_day,omitempty"` + FiscalyearLastMonth *Selection `xmlrpc:"fiscalyear_last_month,omitempty"` + FiscalyearLockDate *Time `xmlrpc:"fiscalyear_lock_date,omitempty"` + Font *Selection `xmlrpc:"font,omitempty"` + HardLockDate *Time `xmlrpc:"hard_lock_date,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + HrPresenceControlAttendance *Bool `xmlrpc:"hr_presence_control_attendance,omitempty"` + HrPresenceControlEmail *Bool `xmlrpc:"hr_presence_control_email,omitempty"` + HrPresenceControlEmailAmount *Int `xmlrpc:"hr_presence_control_email_amount,omitempty"` + HrPresenceControlIp *Bool `xmlrpc:"hr_presence_control_ip,omitempty"` + HrPresenceControlIpList *String `xmlrpc:"hr_presence_control_ip_list,omitempty"` + HrPresenceControlLogin *Bool `xmlrpc:"hr_presence_control_login,omitempty"` + IapEnrichAutoDone *Bool `xmlrpc:"iap_enrich_auto_done,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IncomeCurrencyExchangeAccountId *Many2One `xmlrpc:"income_currency_exchange_account_id,omitempty"` + IncotermId *Many2One `xmlrpc:"incoterm_id,omitempty"` + InternalProjectId *Many2One `xmlrpc:"internal_project_id,omitempty"` + InvoiceTerms *String `xmlrpc:"invoice_terms,omitempty"` + InvoiceTermsHtml *String `xmlrpc:"invoice_terms_html,omitempty"` + IsCompanyDetailsEmpty *Bool `xmlrpc:"is_company_details_empty,omitempty"` + JobPropertiesDefinition interface{} `xmlrpc:"job_properties_definition,omitempty"` + LayoutBackground *Selection `xmlrpc:"layout_background,omitempty"` + LayoutBackgroundImage *String `xmlrpc:"layout_background_image,omitempty"` + LeaveTimesheetTaskId *Many2One `xmlrpc:"leave_timesheet_task_id,omitempty"` + Logo *String `xmlrpc:"logo,omitempty"` + LogoWeb *String `xmlrpc:"logo_web,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Mobile *String `xmlrpc:"mobile,omitempty"` + MultiVatForeignCountryIds *Relation `xmlrpc:"multi_vat_foreign_country_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PaperformatId *Many2One `xmlrpc:"paperformat_id,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + ParentIds *Relation `xmlrpc:"parent_ids,omitempty"` + ParentPath *String `xmlrpc:"parent_path,omitempty"` + PartnerGid *Int `xmlrpc:"partner_gid,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PaymentOnboardingPaymentMethod *Selection `xmlrpc:"payment_onboarding_payment_method,omitempty"` + Phone *String `xmlrpc:"phone,omitempty"` + PoDoubleValidation *Selection `xmlrpc:"po_double_validation,omitempty"` + PoDoubleValidationAmount *Float `xmlrpc:"po_double_validation_amount,omitempty"` + PoLead *Float `xmlrpc:"po_lead,omitempty"` + PoLock *Selection `xmlrpc:"po_lock,omitempty"` + PortalConfirmationPay *Bool `xmlrpc:"portal_confirmation_pay,omitempty"` + PortalConfirmationSign *Bool `xmlrpc:"portal_confirmation_sign,omitempty"` + PrepaymentPercent *Float `xmlrpc:"prepayment_percent,omitempty"` + PrimaryColor *String `xmlrpc:"primary_color,omitempty"` + ProjectTimeModeId *Many2One `xmlrpc:"project_time_mode_id,omitempty"` + PurchaseLockDate *Time `xmlrpc:"purchase_lock_date,omitempty"` + QrCode *Bool `xmlrpc:"qr_code,omitempty"` + QuickEditMode *Selection `xmlrpc:"quick_edit_mode,omitempty"` + QuotationValidityDays *Int `xmlrpc:"quotation_validity_days,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + ReportFooter *String `xmlrpc:"report_footer,omitempty"` + ReportHeader *String `xmlrpc:"report_header,omitempty"` + ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omitempty"` + ResourceCalendarIds *Relation `xmlrpc:"resource_calendar_ids,omitempty"` + RevenueAccrualAccountId *Many2One `xmlrpc:"revenue_accrual_account_id,omitempty"` + RootId *Many2One `xmlrpc:"root_id,omitempty"` + SaleDiscountProductId *Many2One `xmlrpc:"sale_discount_product_id,omitempty"` + SaleLockDate *Time `xmlrpc:"sale_lock_date,omitempty"` + SaleOnboardingPaymentMethod *Selection `xmlrpc:"sale_onboarding_payment_method,omitempty"` + SaleOrderTemplateId *Many2One `xmlrpc:"sale_order_template_id,omitempty"` + SecondaryColor *String `xmlrpc:"secondary_color,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SnailmailColor *Bool `xmlrpc:"snailmail_color,omitempty"` + SnailmailCover *Bool `xmlrpc:"snailmail_cover,omitempty"` + SnailmailDuplex *Bool `xmlrpc:"snailmail_duplex,omitempty"` + StateId *Many2One `xmlrpc:"state_id,omitempty"` + Street *String `xmlrpc:"street,omitempty"` + Street2 *String `xmlrpc:"street2,omitempty"` + TaxCalculationRoundingMethod *Selection `xmlrpc:"tax_calculation_rounding_method,omitempty"` + TaxCashBasisJournalId *Many2One `xmlrpc:"tax_cash_basis_journal_id,omitempty"` + TaxExigibility *Bool `xmlrpc:"tax_exigibility,omitempty"` + TaxLockDate *Time `xmlrpc:"tax_lock_date,omitempty"` + TermsType *Selection `xmlrpc:"terms_type,omitempty"` + TimesheetEncodeUomId *Many2One `xmlrpc:"timesheet_encode_uom_id,omitempty"` + TransferAccountCodePrefix *String `xmlrpc:"transfer_account_code_prefix,omitempty"` + TransferAccountId *Many2One `xmlrpc:"transfer_account_id,omitempty"` + UninstalledL10NModuleIds *Relation `xmlrpc:"uninstalled_l10n_module_ids,omitempty"` + UserFiscalyearLockDate *Time `xmlrpc:"user_fiscalyear_lock_date,omitempty"` + UserHardLockDate *Time `xmlrpc:"user_hard_lock_date,omitempty"` + UserIds *Relation `xmlrpc:"user_ids,omitempty"` + UserPurchaseLockDate *Time `xmlrpc:"user_purchase_lock_date,omitempty"` + UserSaleLockDate *Time `xmlrpc:"user_sale_lock_date,omitempty"` + UserTaxLockDate *Time `xmlrpc:"user_tax_lock_date,omitempty"` + UsesDefaultLogo *Bool `xmlrpc:"uses_default_logo,omitempty"` + Vat *String `xmlrpc:"vat,omitempty"` + Website *String `xmlrpc:"website,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WorkPermitExpirationNoticePeriod *Int `xmlrpc:"work_permit_expiration_notice_period,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + Zip *String `xmlrpc:"zip,omitempty"` +} + +// ResCompanys represents array of res.company model. +type ResCompanys []ResCompany + +// ResCompanyModel is the odoo model name. +const ResCompanyModel = "res.company" + +// Many2One convert ResCompany to *Many2One. +func (rc *ResCompany) Many2One() *Many2One { + return NewMany2One(rc.Id.Get(), "") +} + +// CreateResCompany creates a new res.company model and returns its id. +func (c *Client) CreateResCompany(rc *ResCompany) (int64, error) { + ids, err := c.CreateResCompanys([]*ResCompany{rc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResCompany creates a new res.company model and returns its id. +func (c *Client) CreateResCompanys(rcs []*ResCompany) ([]int64, error) { + var vv []interface{} + for _, v := range rcs { + vv = append(vv, v) + } + return c.Create(ResCompanyModel, vv, nil) +} + +// UpdateResCompany updates an existing res.company record. +func (c *Client) UpdateResCompany(rc *ResCompany) error { + return c.UpdateResCompanys([]int64{rc.Id.Get()}, rc) +} + +// UpdateResCompanys updates existing res.company records. +// All records (represented by ids) will be updated by rc values. +func (c *Client) UpdateResCompanys(ids []int64, rc *ResCompany) error { + return c.Update(ResCompanyModel, ids, rc, nil) +} + +// DeleteResCompany deletes an existing res.company record. +func (c *Client) DeleteResCompany(id int64) error { + return c.DeleteResCompanys([]int64{id}) +} + +// DeleteResCompanys deletes existing res.company records. +func (c *Client) DeleteResCompanys(ids []int64) error { + return c.Delete(ResCompanyModel, ids) +} + +// GetResCompany gets res.company existing record. +func (c *Client) GetResCompany(id int64) (*ResCompany, error) { + rcs, err := c.GetResCompanys([]int64{id}) + if err != nil { + return nil, err + } + return &((*rcs)[0]), nil +} + +// GetResCompanys gets res.company existing records. +func (c *Client) GetResCompanys(ids []int64) (*ResCompanys, error) { + rcs := &ResCompanys{} + if err := c.Read(ResCompanyModel, ids, nil, rcs); err != nil { + return nil, err + } + return rcs, nil +} + +// FindResCompany finds res.company record by querying it with criteria. +func (c *Client) FindResCompany(criteria *Criteria) (*ResCompany, error) { + rcs := &ResCompanys{} + if err := c.SearchRead(ResCompanyModel, criteria, NewOptions().Limit(1), rcs); err != nil { + return nil, err + } + return &((*rcs)[0]), nil +} + +// FindResCompanys finds res.company records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResCompanys(criteria *Criteria, options *Options) (*ResCompanys, error) { + rcs := &ResCompanys{} + if err := c.SearchRead(ResCompanyModel, criteria, options, rcs); err != nil { + return nil, err + } + return rcs, nil +} + +// FindResCompanyIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResCompanyIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResCompanyModel, criteria, options) +} + +// FindResCompanyId finds record id by querying it with criteria. +func (c *Client) FindResCompanyId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResCompanyModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_config.go b/res_config.go new file mode 100644 index 0000000..0d99f60 --- /dev/null +++ b/res_config.go @@ -0,0 +1,116 @@ +package odoo + +// ResConfig represents res.config model. +type ResConfig struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResConfigs represents array of res.config model. +type ResConfigs []ResConfig + +// ResConfigModel is the odoo model name. +const ResConfigModel = "res.config" + +// Many2One convert ResConfig to *Many2One. +func (rc *ResConfig) Many2One() *Many2One { + return NewMany2One(rc.Id.Get(), "") +} + +// CreateResConfig creates a new res.config model and returns its id. +func (c *Client) CreateResConfig(rc *ResConfig) (int64, error) { + ids, err := c.CreateResConfigs([]*ResConfig{rc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResConfig creates a new res.config model and returns its id. +func (c *Client) CreateResConfigs(rcs []*ResConfig) ([]int64, error) { + var vv []interface{} + for _, v := range rcs { + vv = append(vv, v) + } + return c.Create(ResConfigModel, vv, nil) +} + +// UpdateResConfig updates an existing res.config record. +func (c *Client) UpdateResConfig(rc *ResConfig) error { + return c.UpdateResConfigs([]int64{rc.Id.Get()}, rc) +} + +// UpdateResConfigs updates existing res.config records. +// All records (represented by ids) will be updated by rc values. +func (c *Client) UpdateResConfigs(ids []int64, rc *ResConfig) error { + return c.Update(ResConfigModel, ids, rc, nil) +} + +// DeleteResConfig deletes an existing res.config record. +func (c *Client) DeleteResConfig(id int64) error { + return c.DeleteResConfigs([]int64{id}) +} + +// DeleteResConfigs deletes existing res.config records. +func (c *Client) DeleteResConfigs(ids []int64) error { + return c.Delete(ResConfigModel, ids) +} + +// GetResConfig gets res.config existing record. +func (c *Client) GetResConfig(id int64) (*ResConfig, error) { + rcs, err := c.GetResConfigs([]int64{id}) + if err != nil { + return nil, err + } + return &((*rcs)[0]), nil +} + +// GetResConfigs gets res.config existing records. +func (c *Client) GetResConfigs(ids []int64) (*ResConfigs, error) { + rcs := &ResConfigs{} + if err := c.Read(ResConfigModel, ids, nil, rcs); err != nil { + return nil, err + } + return rcs, nil +} + +// FindResConfig finds res.config record by querying it with criteria. +func (c *Client) FindResConfig(criteria *Criteria) (*ResConfig, error) { + rcs := &ResConfigs{} + if err := c.SearchRead(ResConfigModel, criteria, NewOptions().Limit(1), rcs); err != nil { + return nil, err + } + return &((*rcs)[0]), nil +} + +// FindResConfigs finds res.config records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResConfigs(criteria *Criteria, options *Options) (*ResConfigs, error) { + rcs := &ResConfigs{} + if err := c.SearchRead(ResConfigModel, criteria, options, rcs); err != nil { + return nil, err + } + return rcs, nil +} + +// FindResConfigIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResConfigIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResConfigModel, criteria, options) +} + +// FindResConfigId finds record id by querying it with criteria. +func (c *Client) FindResConfigId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResConfigModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_config_settings.go b/res_config_settings.go new file mode 100644 index 0000000..4628af4 --- /dev/null +++ b/res_config_settings.go @@ -0,0 +1,352 @@ +package odoo + +// ResConfigSettings represents res.config.settings model. +type ResConfigSettings struct { + AccountCashBasisBaseAccountId *Many2One `xmlrpc:"account_cash_basis_base_account_id,omitempty"` + AccountDefaultCreditLimit *Float `xmlrpc:"account_default_credit_limit,omitempty"` + AccountDiscountExpenseAllocationId *Many2One `xmlrpc:"account_discount_expense_allocation_id,omitempty"` + AccountDiscountIncomeAllocationId *Many2One `xmlrpc:"account_discount_income_allocation_id,omitempty"` + AccountFiscalCountryId *Many2One `xmlrpc:"account_fiscal_country_id,omitempty"` + AccountJournalEarlyPayDiscountGainAccountId *Many2One `xmlrpc:"account_journal_early_pay_discount_gain_account_id,omitempty"` + AccountJournalEarlyPayDiscountLossAccountId *Many2One `xmlrpc:"account_journal_early_pay_discount_loss_account_id,omitempty"` + AccountJournalSuspenseAccountId *Many2One `xmlrpc:"account_journal_suspense_account_id,omitempty"` + AccountPriceInclude *Selection `xmlrpc:"account_price_include,omitempty"` + AccountStorno *Bool `xmlrpc:"account_storno,omitempty"` + AccountUseCreditLimit *Bool `xmlrpc:"account_use_credit_limit,omitempty"` + ActiveUserCount *Int `xmlrpc:"active_user_count,omitempty"` + AliasDomainId *Many2One `xmlrpc:"alias_domain_id,omitempty"` + AuthSignupResetPassword *Bool `xmlrpc:"auth_signup_reset_password,omitempty"` + AuthSignupTemplateUserId *Many2One `xmlrpc:"auth_signup_template_user_id,omitempty"` + AuthSignupUninvited *Selection `xmlrpc:"auth_signup_uninvited,omitempty"` + AutomaticInvoice *Bool `xmlrpc:"automatic_invoice,omitempty"` + AutopostBills *Bool `xmlrpc:"autopost_bills,omitempty"` + ChartTemplate *Selection `xmlrpc:"chart_template,omitempty"` + CheckAccountAuditTrail *Bool `xmlrpc:"check_account_audit_trail,omitempty"` + CompanyCount *Int `xmlrpc:"company_count,omitempty"` + CompanyCountryCode *String `xmlrpc:"company_country_code,omitempty"` + CompanyCurrencyId *Many2One `xmlrpc:"company_currency_id,omitempty"` + CompanyExpenseAllowedPaymentMethodLineIds *Relation `xmlrpc:"company_expense_allowed_payment_method_line_ids,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanyInformations *String `xmlrpc:"company_informations,omitempty"` + CompanyName *String `xmlrpc:"company_name,omitempty"` + CompanySoTemplateId *Many2One `xmlrpc:"company_so_template_id,omitempty"` + ContractExpirationNoticePeriod *Int `xmlrpc:"contract_expiration_notice_period,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CrmAutoAssignmentAction *Selection `xmlrpc:"crm_auto_assignment_action,omitempty"` + CrmAutoAssignmentIntervalNumber *Int `xmlrpc:"crm_auto_assignment_interval_number,omitempty"` + CrmAutoAssignmentIntervalType *Selection `xmlrpc:"crm_auto_assignment_interval_type,omitempty"` + CrmAutoAssignmentRunDatetime *Time `xmlrpc:"crm_auto_assignment_run_datetime,omitempty"` + CrmUseAutoAssignment *Bool `xmlrpc:"crm_use_auto_assignment,omitempty"` + CurrencyExchangeJournalId *Many2One `xmlrpc:"currency_exchange_journal_id,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DefaultInvoicePolicy *Selection `xmlrpc:"default_invoice_policy,omitempty"` + DefaultPurchaseMethod *Selection `xmlrpc:"default_purchase_method,omitempty"` + DigestEmails *Bool `xmlrpc:"digest_emails,omitempty"` + DigestId *Many2One `xmlrpc:"digest_id,omitempty"` + DisplayInvoiceAmountTotalWords *Bool `xmlrpc:"display_invoice_amount_total_words,omitempty"` + DisplayInvoiceTaxCompanyCurrency *Bool `xmlrpc:"display_invoice_tax_company_currency,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmailPrimaryColor *String `xmlrpc:"email_primary_color,omitempty"` + EmailSecondaryColor *String `xmlrpc:"email_secondary_color,omitempty"` + ExpenseCurrencyExchangeAccountId *Many2One `xmlrpc:"expense_currency_exchange_account_id,omitempty"` + ExpenseJournalId *Many2One `xmlrpc:"expense_journal_id,omitempty"` + ExpenseOutstandingAccountId *Many2One `xmlrpc:"expense_outstanding_account_id,omitempty"` + ExternalEmailServerDefault *Bool `xmlrpc:"external_email_server_default,omitempty"` + ExternalReportLayoutId *Many2One `xmlrpc:"external_report_layout_id,omitempty"` + FailCounter *Int `xmlrpc:"fail_counter,omitempty"` + GoogleGmailClientIdentifier *String `xmlrpc:"google_gmail_client_identifier,omitempty"` + GoogleGmailClientSecret *String `xmlrpc:"google_gmail_client_secret,omitempty"` + GoogleTranslateApiKey *String `xmlrpc:"google_translate_api_key,omitempty"` + GroupAnalyticAccounting *Bool `xmlrpc:"group_analytic_accounting,omitempty"` + GroupApplicantCvDisplay *Bool `xmlrpc:"group_applicant_cv_display,omitempty"` + GroupAutoDoneSetting *Bool `xmlrpc:"group_auto_done_setting,omitempty"` + GroupCashRounding *Bool `xmlrpc:"group_cash_rounding,omitempty"` + GroupDiscountPerSoLine *Bool `xmlrpc:"group_discount_per_so_line,omitempty"` + GroupMultiCurrency *Bool `xmlrpc:"group_multi_currency,omitempty"` + GroupProductPricelist *Bool `xmlrpc:"group_product_pricelist,omitempty"` + GroupProductVariant *Bool `xmlrpc:"group_product_variant,omitempty"` + GroupProformaSales *Bool `xmlrpc:"group_proforma_sales,omitempty"` + GroupProjectMilestone *Bool `xmlrpc:"group_project_milestone,omitempty"` + GroupProjectRating *Bool `xmlrpc:"group_project_rating,omitempty"` + GroupProjectRecurringTasks *Bool `xmlrpc:"group_project_recurring_tasks,omitempty"` + GroupProjectStages *Bool `xmlrpc:"group_project_stages,omitempty"` + GroupProjectTaskDependencies *Bool `xmlrpc:"group_project_task_dependencies,omitempty"` + GroupSaleDeliveryAddress *Bool `xmlrpc:"group_sale_delivery_address,omitempty"` + GroupSaleOrderTemplate *Bool `xmlrpc:"group_sale_order_template,omitempty"` + GroupSendReminder *Bool `xmlrpc:"group_send_reminder,omitempty"` + GroupShowPurchaseReceipts *Bool `xmlrpc:"group_show_purchase_receipts,omitempty"` + GroupShowSaleReceipts *Bool `xmlrpc:"group_show_sale_receipts,omitempty"` + GroupStockPackaging *Bool `xmlrpc:"group_stock_packaging,omitempty"` + GroupUom *Bool `xmlrpc:"group_uom,omitempty"` + GroupUseLead *Bool `xmlrpc:"group_use_lead,omitempty"` + GroupUseRecurringRevenues *Bool `xmlrpc:"group_use_recurring_revenues,omitempty"` + GroupWarningAccount *Bool `xmlrpc:"group_warning_account,omitempty"` + GroupWarningPurchase *Bool `xmlrpc:"group_warning_purchase,omitempty"` + GroupWarningSale *Bool `xmlrpc:"group_warning_sale,omitempty"` + HasAccountingEntries *Bool `xmlrpc:"has_accounting_entries,omitempty"` + HasChartOfAccounts *Bool `xmlrpc:"has_chart_of_accounts,omitempty"` + HrEmployeeSelfEdit *Bool `xmlrpc:"hr_employee_self_edit,omitempty"` + HrExpenseAliasPrefix *String `xmlrpc:"hr_expense_alias_prefix,omitempty"` + HrExpenseUseMailgateway *Bool `xmlrpc:"hr_expense_use_mailgateway,omitempty"` + HrPresenceControlEmail *Bool `xmlrpc:"hr_presence_control_email,omitempty"` + HrPresenceControlEmailAmount *Int `xmlrpc:"hr_presence_control_email_amount,omitempty"` + HrPresenceControlIp *Bool `xmlrpc:"hr_presence_control_ip,omitempty"` + HrPresenceControlIpList *String `xmlrpc:"hr_presence_control_ip_list,omitempty"` + HrPresenceControlLogin *Bool `xmlrpc:"hr_presence_control_login,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IncomeCurrencyExchangeAccountId *Many2One `xmlrpc:"income_currency_exchange_account_id,omitempty"` + IncotermId *Many2One `xmlrpc:"incoterm_id,omitempty"` + InternalProjectId *Many2One `xmlrpc:"internal_project_id,omitempty"` + InvoiceMailTemplateId *Many2One `xmlrpc:"invoice_mail_template_id,omitempty"` + InvoicePolicy *Bool `xmlrpc:"invoice_policy,omitempty"` + InvoiceTerms *String `xmlrpc:"invoice_terms,omitempty"` + InvoiceTermsHtml *String `xmlrpc:"invoice_terms_html,omitempty"` + IsAccountPeppolEligible *Bool `xmlrpc:"is_account_peppol_eligible,omitempty"` + IsEncodeUomDays *Bool `xmlrpc:"is_encode_uom_days,omitempty"` + IsMembershipMulti *Bool `xmlrpc:"is_membership_multi,omitempty"` + IsRootCompany *Bool `xmlrpc:"is_root_company,omitempty"` + LanguageCount *Int `xmlrpc:"language_count,omitempty"` + LeadEnrichAuto *Selection `xmlrpc:"lead_enrich_auto,omitempty"` + LeadMiningInPipeline *Bool `xmlrpc:"lead_mining_in_pipeline,omitempty"` + LeaveTimesheetTaskId *Many2One `xmlrpc:"leave_timesheet_task_id,omitempty"` + LockConfirmedPo *Bool `xmlrpc:"lock_confirmed_po,omitempty"` + ModuleAccount3WayMatch *Bool `xmlrpc:"module_account_3way_match,omitempty"` + ModuleAccountAccountant *Bool `xmlrpc:"module_account_accountant,omitempty"` + ModuleAccountBankStatementExtract *Bool `xmlrpc:"module_account_bank_statement_extract,omitempty"` + ModuleAccountBankStatementImportCamt *Bool `xmlrpc:"module_account_bank_statement_import_camt,omitempty"` + ModuleAccountBankStatementImportCsv *Bool `xmlrpc:"module_account_bank_statement_import_csv,omitempty"` + ModuleAccountBankStatementImportOfx *Bool `xmlrpc:"module_account_bank_statement_import_ofx,omitempty"` + ModuleAccountBankStatementImportQif *Bool `xmlrpc:"module_account_bank_statement_import_qif,omitempty"` + ModuleAccountBatchPayment *Bool `xmlrpc:"module_account_batch_payment,omitempty"` + ModuleAccountBudget *Bool `xmlrpc:"module_account_budget,omitempty"` + ModuleAccountCheckPrinting *Bool `xmlrpc:"module_account_check_printing,omitempty"` + ModuleAccountExtract *Bool `xmlrpc:"module_account_extract,omitempty"` + ModuleAccountInterCompanyRules *Bool `xmlrpc:"module_account_inter_company_rules,omitempty"` + ModuleAccountIntrastat *Bool `xmlrpc:"module_account_intrastat,omitempty"` + ModuleAccountInvoiceExtract *Bool `xmlrpc:"module_account_invoice_extract,omitempty"` + ModuleAccountIso20022 *Bool `xmlrpc:"module_account_iso20022,omitempty"` + ModuleAccountPayment *Bool `xmlrpc:"module_account_payment,omitempty"` + ModuleAccountPeppol *Bool `xmlrpc:"module_account_peppol,omitempty"` + ModuleAccountReports *Bool `xmlrpc:"module_account_reports,omitempty"` + ModuleAccountSepaDirectDebit *Bool `xmlrpc:"module_account_sepa_direct_debit,omitempty"` + ModuleAuthLdap *Bool `xmlrpc:"module_auth_ldap,omitempty"` + ModuleAuthOauth *Bool `xmlrpc:"module_auth_oauth,omitempty"` + ModuleBaseGeolocalize *Bool `xmlrpc:"module_base_geolocalize,omitempty"` + ModuleBaseImport *Bool `xmlrpc:"module_base_import,omitempty"` + ModuleCrmIapEnrich *Bool `xmlrpc:"module_crm_iap_enrich,omitempty"` + ModuleCrmIapMine *Bool `xmlrpc:"module_crm_iap_mine,omitempty"` + ModuleCurrencyRateLive *Bool `xmlrpc:"module_currency_rate_live,omitempty"` + ModuleDelivery *Bool `xmlrpc:"module_delivery,omitempty"` + ModuleDeliveryBpost *Bool `xmlrpc:"module_delivery_bpost,omitempty"` + ModuleDeliveryDhl *Bool `xmlrpc:"module_delivery_dhl,omitempty"` + ModuleDeliveryEasypost *Bool `xmlrpc:"module_delivery_easypost,omitempty"` + ModuleDeliveryFedex *Bool `xmlrpc:"module_delivery_fedex,omitempty"` + ModuleDeliverySendcloud *Bool `xmlrpc:"module_delivery_sendcloud,omitempty"` + ModuleDeliveryShiprocket *Bool `xmlrpc:"module_delivery_shiprocket,omitempty"` + ModuleDeliveryStarshipit *Bool `xmlrpc:"module_delivery_starshipit,omitempty"` + ModuleDeliveryUps *Bool `xmlrpc:"module_delivery_ups,omitempty"` + ModuleDeliveryUsps *Bool `xmlrpc:"module_delivery_usps,omitempty"` + ModuleGoogleCalendar *Bool `xmlrpc:"module_google_calendar,omitempty"` + ModuleGoogleGmail *Bool `xmlrpc:"module_google_gmail,omitempty"` + ModuleGoogleRecaptcha *Bool `xmlrpc:"module_google_recaptcha,omitempty"` + ModuleHrAttendance *Bool `xmlrpc:"module_hr_attendance,omitempty"` + ModuleHrExpenseExtract *Bool `xmlrpc:"module_hr_expense_extract,omitempty"` + ModuleHrHomeworking *Bool `xmlrpc:"module_hr_homeworking,omitempty"` + ModuleHrPayrollExpense *Bool `xmlrpc:"module_hr_payroll_expense,omitempty"` + ModuleHrPresence *Bool `xmlrpc:"module_hr_presence,omitempty"` + ModuleHrRecruitmentExtract *Bool `xmlrpc:"module_hr_recruitment_extract,omitempty"` + ModuleHrRecruitmentSurvey *Bool `xmlrpc:"module_hr_recruitment_survey,omitempty"` + ModuleHrSkills *Bool `xmlrpc:"module_hr_skills,omitempty"` + ModuleHrTimesheet *Bool `xmlrpc:"module_hr_timesheet,omitempty"` + ModuleL10NEuOss *Bool `xmlrpc:"module_l10n_eu_oss,omitempty"` + ModuleLoyalty *Bool `xmlrpc:"module_loyalty,omitempty"` + ModuleMailPlugin *Bool `xmlrpc:"module_mail_plugin,omitempty"` + ModuleMicrosoftCalendar *Bool `xmlrpc:"module_microsoft_calendar,omitempty"` + ModuleMicrosoftOutlook *Bool `xmlrpc:"module_microsoft_outlook,omitempty"` + ModulePartnerAutocomplete *Bool `xmlrpc:"module_partner_autocomplete,omitempty"` + ModuleProductEmailTemplate *Bool `xmlrpc:"module_product_email_template,omitempty"` + ModuleProductImages *Bool `xmlrpc:"module_product_images,omitempty"` + ModuleProductMargin *Bool `xmlrpc:"module_product_margin,omitempty"` + ModuleProjectTimesheetHolidays *Bool `xmlrpc:"module_project_timesheet_holidays,omitempty"` + ModulePurchaseProductMatrix *Bool `xmlrpc:"module_purchase_product_matrix,omitempty"` + ModulePurchaseRequisition *Bool `xmlrpc:"module_purchase_requisition,omitempty"` + ModuleSaleAmazon *Bool `xmlrpc:"module_sale_amazon,omitempty"` + ModuleSaleCommission *Bool `xmlrpc:"module_sale_commission,omitempty"` + ModuleSaleLoyalty *Bool `xmlrpc:"module_sale_loyalty,omitempty"` + ModuleSaleMargin *Bool `xmlrpc:"module_sale_margin,omitempty"` + ModuleSalePdfQuoteBuilder *Bool `xmlrpc:"module_sale_pdf_quote_builder,omitempty"` + ModuleSaleProductMatrix *Bool `xmlrpc:"module_sale_product_matrix,omitempty"` + ModuleSms *Bool `xmlrpc:"module_sms,omitempty"` + ModuleSnailmailAccount *Bool `xmlrpc:"module_snailmail_account,omitempty"` + ModuleVoip *Bool `xmlrpc:"module_voip,omitempty"` + ModuleWebUnsplash *Bool `xmlrpc:"module_web_unsplash,omitempty"` + ModuleWebsiteCfTurnstile *Bool `xmlrpc:"module_website_cf_turnstile,omitempty"` + ModuleWebsiteCrmIapReveal *Bool `xmlrpc:"module_website_crm_iap_reveal,omitempty"` + ModuleWebsiteHrRecruitment *Bool `xmlrpc:"module_website_hr_recruitment,omitempty"` + PartnerAutocompleteInsufficientCredit *Bool `xmlrpc:"partner_autocomplete_insufficient_credit,omitempty"` + PayInvoicesOnline *Bool `xmlrpc:"pay_invoices_online,omitempty"` + PoDoubleValidation *Selection `xmlrpc:"po_double_validation,omitempty"` + PoDoubleValidationAmount *Float `xmlrpc:"po_double_validation_amount,omitempty"` + PoLead *Float `xmlrpc:"po_lead,omitempty"` + PoLock *Selection `xmlrpc:"po_lock,omitempty"` + PoOrderApproval *Bool `xmlrpc:"po_order_approval,omitempty"` + PortalAllowApiKeys *Bool `xmlrpc:"portal_allow_api_keys,omitempty"` + PortalConfirmationPay *Bool `xmlrpc:"portal_confirmation_pay,omitempty"` + PortalConfirmationSign *Bool `xmlrpc:"portal_confirmation_sign,omitempty"` + PredictiveLeadScoringFieldLabels *String `xmlrpc:"predictive_lead_scoring_field_labels,omitempty"` + PredictiveLeadScoringFields *Relation `xmlrpc:"predictive_lead_scoring_fields,omitempty"` + PredictiveLeadScoringFieldsStr *String `xmlrpc:"predictive_lead_scoring_fields_str,omitempty"` + PredictiveLeadScoringStartDate *Time `xmlrpc:"predictive_lead_scoring_start_date,omitempty"` + PredictiveLeadScoringStartDateStr *String `xmlrpc:"predictive_lead_scoring_start_date_str,omitempty"` + PrepaymentPercent *Float `xmlrpc:"prepayment_percent,omitempty"` + PreviewReady *Bool `xmlrpc:"preview_ready,omitempty"` + ProductVolumeVolumeInCubicFeet *Selection `xmlrpc:"product_volume_volume_in_cubic_feet,omitempty"` + ProductWeightInLbs *Selection `xmlrpc:"product_weight_in_lbs,omitempty"` + ProfilingEnabledUntil *Time `xmlrpc:"profiling_enabled_until,omitempty"` + ProjectTimeModeId *Many2One `xmlrpc:"project_time_mode_id,omitempty"` + PurchaseTaxId *Many2One `xmlrpc:"purchase_tax_id,omitempty"` + QrCode *Bool `xmlrpc:"qr_code,omitempty"` + QuickEditMode *Selection `xmlrpc:"quick_edit_mode,omitempty"` + QuotationValidityDays *Int `xmlrpc:"quotation_validity_days,omitempty"` + ReminderAllow *Bool `xmlrpc:"reminder_allow,omitempty"` + ReminderUserAllow *Bool `xmlrpc:"reminder_user_allow,omitempty"` + ReportFooter *String `xmlrpc:"report_footer,omitempty"` + ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omitempty"` + RestrictTemplateRendering *Bool `xmlrpc:"restrict_template_rendering,omitempty"` + SaleTaxId *Many2One `xmlrpc:"sale_tax_id,omitempty"` + SfuServerKey *String `xmlrpc:"sfu_server_key,omitempty"` + SfuServerUrl *String `xmlrpc:"sfu_server_url,omitempty"` + ShowEffect *Bool `xmlrpc:"show_effect,omitempty"` + SnailmailColor *Bool `xmlrpc:"snailmail_color,omitempty"` + SnailmailCover *Bool `xmlrpc:"snailmail_cover,omitempty"` + SnailmailCoverReadonly *Bool `xmlrpc:"snailmail_cover_readonly,omitempty"` + SnailmailDuplex *Bool `xmlrpc:"snailmail_duplex,omitempty"` + TaxCalculationRoundingMethod *Selection `xmlrpc:"tax_calculation_rounding_method,omitempty"` + TaxCashBasisJournalId *Many2One `xmlrpc:"tax_cash_basis_journal_id,omitempty"` + TaxExigibility *Bool `xmlrpc:"tax_exigibility,omitempty"` + TenorApiKey *String `xmlrpc:"tenor_api_key,omitempty"` + TenorContentFilter *Selection `xmlrpc:"tenor_content_filter,omitempty"` + TenorGifLimit *Int `xmlrpc:"tenor_gif_limit,omitempty"` + TermsType *Selection `xmlrpc:"terms_type,omitempty"` + TimesheetEncodeMethod *Selection `xmlrpc:"timesheet_encode_method,omitempty"` + TransferAccountId *Many2One `xmlrpc:"transfer_account_id,omitempty"` + TwilioAccountSid *String `xmlrpc:"twilio_account_sid,omitempty"` + TwilioAccountToken *String `xmlrpc:"twilio_account_token,omitempty"` + UnsplashAccessKey *String `xmlrpc:"unsplash_access_key,omitempty"` + UnsplashAppId *String `xmlrpc:"unsplash_app_id,omitempty"` + UseInvoiceTerms *Bool `xmlrpc:"use_invoice_terms,omitempty"` + UsePoLead *Bool `xmlrpc:"use_po_lead,omitempty"` + UseTwilioRtcServers *Bool `xmlrpc:"use_twilio_rtc_servers,omitempty"` + UserDefaultRights *Bool `xmlrpc:"user_default_rights,omitempty"` + WebAppName *String `xmlrpc:"web_app_name,omitempty"` + WorkPermitExpirationNoticePeriod *Int `xmlrpc:"work_permit_expiration_notice_period,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResConfigSettingss represents array of res.config.settings model. +type ResConfigSettingss []ResConfigSettings + +// ResConfigSettingsModel is the odoo model name. +const ResConfigSettingsModel = "res.config.settings" + +// Many2One convert ResConfigSettings to *Many2One. +func (rcs *ResConfigSettings) Many2One() *Many2One { + return NewMany2One(rcs.Id.Get(), "") +} + +// CreateResConfigSettings creates a new res.config.settings model and returns its id. +func (c *Client) CreateResConfigSettings(rcs *ResConfigSettings) (int64, error) { + ids, err := c.CreateResConfigSettingss([]*ResConfigSettings{rcs}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResConfigSettings creates a new res.config.settings model and returns its id. +func (c *Client) CreateResConfigSettingss(rcss []*ResConfigSettings) ([]int64, error) { + var vv []interface{} + for _, v := range rcss { + vv = append(vv, v) + } + return c.Create(ResConfigSettingsModel, vv, nil) +} + +// UpdateResConfigSettings updates an existing res.config.settings record. +func (c *Client) UpdateResConfigSettings(rcs *ResConfigSettings) error { + return c.UpdateResConfigSettingss([]int64{rcs.Id.Get()}, rcs) +} + +// UpdateResConfigSettingss updates existing res.config.settings records. +// All records (represented by ids) will be updated by rcs values. +func (c *Client) UpdateResConfigSettingss(ids []int64, rcs *ResConfigSettings) error { + return c.Update(ResConfigSettingsModel, ids, rcs, nil) +} + +// DeleteResConfigSettings deletes an existing res.config.settings record. +func (c *Client) DeleteResConfigSettings(id int64) error { + return c.DeleteResConfigSettingss([]int64{id}) +} + +// DeleteResConfigSettingss deletes existing res.config.settings records. +func (c *Client) DeleteResConfigSettingss(ids []int64) error { + return c.Delete(ResConfigSettingsModel, ids) +} + +// GetResConfigSettings gets res.config.settings existing record. +func (c *Client) GetResConfigSettings(id int64) (*ResConfigSettings, error) { + rcss, err := c.GetResConfigSettingss([]int64{id}) + if err != nil { + return nil, err + } + return &((*rcss)[0]), nil +} + +// GetResConfigSettingss gets res.config.settings existing records. +func (c *Client) GetResConfigSettingss(ids []int64) (*ResConfigSettingss, error) { + rcss := &ResConfigSettingss{} + if err := c.Read(ResConfigSettingsModel, ids, nil, rcss); err != nil { + return nil, err + } + return rcss, nil +} + +// FindResConfigSettings finds res.config.settings record by querying it with criteria. +func (c *Client) FindResConfigSettings(criteria *Criteria) (*ResConfigSettings, error) { + rcss := &ResConfigSettingss{} + if err := c.SearchRead(ResConfigSettingsModel, criteria, NewOptions().Limit(1), rcss); err != nil { + return nil, err + } + return &((*rcss)[0]), nil +} + +// FindResConfigSettingss finds res.config.settings records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResConfigSettingss(criteria *Criteria, options *Options) (*ResConfigSettingss, error) { + rcss := &ResConfigSettingss{} + if err := c.SearchRead(ResConfigSettingsModel, criteria, options, rcss); err != nil { + return nil, err + } + return rcss, nil +} + +// FindResConfigSettingsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResConfigSettingsIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResConfigSettingsModel, criteria, options) +} + +// FindResConfigSettingsId finds record id by querying it with criteria. +func (c *Client) FindResConfigSettingsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResConfigSettingsModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_country.go b/res_country.go new file mode 100644 index 0000000..61b7224 --- /dev/null +++ b/res_country.go @@ -0,0 +1,130 @@ +package odoo + +// ResCountry represents res.country model. +type ResCountry struct { + AddressFormat *String `xmlrpc:"address_format,omitempty"` + AddressViewId *Many2One `xmlrpc:"address_view_id,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + CountryGroupIds *Relation `xmlrpc:"country_group_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ImageUrl *String `xmlrpc:"image_url,omitempty"` + IsStripeSupportedCountry *Bool `xmlrpc:"is_stripe_supported_country,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NamePosition *Selection `xmlrpc:"name_position,omitempty"` + PhoneCode *Int `xmlrpc:"phone_code,omitempty"` + StateIds *Relation `xmlrpc:"state_ids,omitempty"` + StateRequired *Bool `xmlrpc:"state_required,omitempty"` + VatLabel *String `xmlrpc:"vat_label,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + ZipRequired *Bool `xmlrpc:"zip_required,omitempty"` +} + +// ResCountrys represents array of res.country model. +type ResCountrys []ResCountry + +// ResCountryModel is the odoo model name. +const ResCountryModel = "res.country" + +// Many2One convert ResCountry to *Many2One. +func (rc *ResCountry) Many2One() *Many2One { + return NewMany2One(rc.Id.Get(), "") +} + +// CreateResCountry creates a new res.country model and returns its id. +func (c *Client) CreateResCountry(rc *ResCountry) (int64, error) { + ids, err := c.CreateResCountrys([]*ResCountry{rc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResCountry creates a new res.country model and returns its id. +func (c *Client) CreateResCountrys(rcs []*ResCountry) ([]int64, error) { + var vv []interface{} + for _, v := range rcs { + vv = append(vv, v) + } + return c.Create(ResCountryModel, vv, nil) +} + +// UpdateResCountry updates an existing res.country record. +func (c *Client) UpdateResCountry(rc *ResCountry) error { + return c.UpdateResCountrys([]int64{rc.Id.Get()}, rc) +} + +// UpdateResCountrys updates existing res.country records. +// All records (represented by ids) will be updated by rc values. +func (c *Client) UpdateResCountrys(ids []int64, rc *ResCountry) error { + return c.Update(ResCountryModel, ids, rc, nil) +} + +// DeleteResCountry deletes an existing res.country record. +func (c *Client) DeleteResCountry(id int64) error { + return c.DeleteResCountrys([]int64{id}) +} + +// DeleteResCountrys deletes existing res.country records. +func (c *Client) DeleteResCountrys(ids []int64) error { + return c.Delete(ResCountryModel, ids) +} + +// GetResCountry gets res.country existing record. +func (c *Client) GetResCountry(id int64) (*ResCountry, error) { + rcs, err := c.GetResCountrys([]int64{id}) + if err != nil { + return nil, err + } + return &((*rcs)[0]), nil +} + +// GetResCountrys gets res.country existing records. +func (c *Client) GetResCountrys(ids []int64) (*ResCountrys, error) { + rcs := &ResCountrys{} + if err := c.Read(ResCountryModel, ids, nil, rcs); err != nil { + return nil, err + } + return rcs, nil +} + +// FindResCountry finds res.country record by querying it with criteria. +func (c *Client) FindResCountry(criteria *Criteria) (*ResCountry, error) { + rcs := &ResCountrys{} + if err := c.SearchRead(ResCountryModel, criteria, NewOptions().Limit(1), rcs); err != nil { + return nil, err + } + return &((*rcs)[0]), nil +} + +// FindResCountrys finds res.country records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResCountrys(criteria *Criteria, options *Options) (*ResCountrys, error) { + rcs := &ResCountrys{} + if err := c.SearchRead(ResCountryModel, criteria, options, rcs); err != nil { + return nil, err + } + return rcs, nil +} + +// FindResCountryIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResCountryIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResCountryModel, criteria, options) +} + +// FindResCountryId finds record id by querying it with criteria. +func (c *Client) FindResCountryId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResCountryModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_country_group.go b/res_country_group.go new file mode 100644 index 0000000..7081000 --- /dev/null +++ b/res_country_group.go @@ -0,0 +1,119 @@ +package odoo + +// ResCountryGroup represents res.country.group model. +type ResCountryGroup struct { + CountryIds *Relation `xmlrpc:"country_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PricelistIds *Relation `xmlrpc:"pricelist_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResCountryGroups represents array of res.country.group model. +type ResCountryGroups []ResCountryGroup + +// ResCountryGroupModel is the odoo model name. +const ResCountryGroupModel = "res.country.group" + +// Many2One convert ResCountryGroup to *Many2One. +func (rcg *ResCountryGroup) Many2One() *Many2One { + return NewMany2One(rcg.Id.Get(), "") +} + +// CreateResCountryGroup creates a new res.country.group model and returns its id. +func (c *Client) CreateResCountryGroup(rcg *ResCountryGroup) (int64, error) { + ids, err := c.CreateResCountryGroups([]*ResCountryGroup{rcg}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResCountryGroup creates a new res.country.group model and returns its id. +func (c *Client) CreateResCountryGroups(rcgs []*ResCountryGroup) ([]int64, error) { + var vv []interface{} + for _, v := range rcgs { + vv = append(vv, v) + } + return c.Create(ResCountryGroupModel, vv, nil) +} + +// UpdateResCountryGroup updates an existing res.country.group record. +func (c *Client) UpdateResCountryGroup(rcg *ResCountryGroup) error { + return c.UpdateResCountryGroups([]int64{rcg.Id.Get()}, rcg) +} + +// UpdateResCountryGroups updates existing res.country.group records. +// All records (represented by ids) will be updated by rcg values. +func (c *Client) UpdateResCountryGroups(ids []int64, rcg *ResCountryGroup) error { + return c.Update(ResCountryGroupModel, ids, rcg, nil) +} + +// DeleteResCountryGroup deletes an existing res.country.group record. +func (c *Client) DeleteResCountryGroup(id int64) error { + return c.DeleteResCountryGroups([]int64{id}) +} + +// DeleteResCountryGroups deletes existing res.country.group records. +func (c *Client) DeleteResCountryGroups(ids []int64) error { + return c.Delete(ResCountryGroupModel, ids) +} + +// GetResCountryGroup gets res.country.group existing record. +func (c *Client) GetResCountryGroup(id int64) (*ResCountryGroup, error) { + rcgs, err := c.GetResCountryGroups([]int64{id}) + if err != nil { + return nil, err + } + return &((*rcgs)[0]), nil +} + +// GetResCountryGroups gets res.country.group existing records. +func (c *Client) GetResCountryGroups(ids []int64) (*ResCountryGroups, error) { + rcgs := &ResCountryGroups{} + if err := c.Read(ResCountryGroupModel, ids, nil, rcgs); err != nil { + return nil, err + } + return rcgs, nil +} + +// FindResCountryGroup finds res.country.group record by querying it with criteria. +func (c *Client) FindResCountryGroup(criteria *Criteria) (*ResCountryGroup, error) { + rcgs := &ResCountryGroups{} + if err := c.SearchRead(ResCountryGroupModel, criteria, NewOptions().Limit(1), rcgs); err != nil { + return nil, err + } + return &((*rcgs)[0]), nil +} + +// FindResCountryGroups finds res.country.group records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResCountryGroups(criteria *Criteria, options *Options) (*ResCountryGroups, error) { + rcgs := &ResCountryGroups{} + if err := c.SearchRead(ResCountryGroupModel, criteria, options, rcgs); err != nil { + return nil, err + } + return rcgs, nil +} + +// FindResCountryGroupIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResCountryGroupIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResCountryGroupModel, criteria, options) +} + +// FindResCountryGroupId finds record id by querying it with criteria. +func (c *Client) FindResCountryGroupId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResCountryGroupModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_country_state.go b/res_country_state.go new file mode 100644 index 0000000..1c6574e --- /dev/null +++ b/res_country_state.go @@ -0,0 +1,119 @@ +package odoo + +// ResCountryState represents res.country.state model. +type ResCountryState struct { + Code *String `xmlrpc:"code,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResCountryStates represents array of res.country.state model. +type ResCountryStates []ResCountryState + +// ResCountryStateModel is the odoo model name. +const ResCountryStateModel = "res.country.state" + +// Many2One convert ResCountryState to *Many2One. +func (rcs *ResCountryState) Many2One() *Many2One { + return NewMany2One(rcs.Id.Get(), "") +} + +// CreateResCountryState creates a new res.country.state model and returns its id. +func (c *Client) CreateResCountryState(rcs *ResCountryState) (int64, error) { + ids, err := c.CreateResCountryStates([]*ResCountryState{rcs}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResCountryState creates a new res.country.state model and returns its id. +func (c *Client) CreateResCountryStates(rcss []*ResCountryState) ([]int64, error) { + var vv []interface{} + for _, v := range rcss { + vv = append(vv, v) + } + return c.Create(ResCountryStateModel, vv, nil) +} + +// UpdateResCountryState updates an existing res.country.state record. +func (c *Client) UpdateResCountryState(rcs *ResCountryState) error { + return c.UpdateResCountryStates([]int64{rcs.Id.Get()}, rcs) +} + +// UpdateResCountryStates updates existing res.country.state records. +// All records (represented by ids) will be updated by rcs values. +func (c *Client) UpdateResCountryStates(ids []int64, rcs *ResCountryState) error { + return c.Update(ResCountryStateModel, ids, rcs, nil) +} + +// DeleteResCountryState deletes an existing res.country.state record. +func (c *Client) DeleteResCountryState(id int64) error { + return c.DeleteResCountryStates([]int64{id}) +} + +// DeleteResCountryStates deletes existing res.country.state records. +func (c *Client) DeleteResCountryStates(ids []int64) error { + return c.Delete(ResCountryStateModel, ids) +} + +// GetResCountryState gets res.country.state existing record. +func (c *Client) GetResCountryState(id int64) (*ResCountryState, error) { + rcss, err := c.GetResCountryStates([]int64{id}) + if err != nil { + return nil, err + } + return &((*rcss)[0]), nil +} + +// GetResCountryStates gets res.country.state existing records. +func (c *Client) GetResCountryStates(ids []int64) (*ResCountryStates, error) { + rcss := &ResCountryStates{} + if err := c.Read(ResCountryStateModel, ids, nil, rcss); err != nil { + return nil, err + } + return rcss, nil +} + +// FindResCountryState finds res.country.state record by querying it with criteria. +func (c *Client) FindResCountryState(criteria *Criteria) (*ResCountryState, error) { + rcss := &ResCountryStates{} + if err := c.SearchRead(ResCountryStateModel, criteria, NewOptions().Limit(1), rcss); err != nil { + return nil, err + } + return &((*rcss)[0]), nil +} + +// FindResCountryStates finds res.country.state records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResCountryStates(criteria *Criteria, options *Options) (*ResCountryStates, error) { + rcss := &ResCountryStates{} + if err := c.SearchRead(ResCountryStateModel, criteria, options, rcss); err != nil { + return nil, err + } + return rcss, nil +} + +// FindResCountryStateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResCountryStateIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResCountryStateModel, criteria, options) +} + +// FindResCountryStateId finds record id by querying it with criteria. +func (c *Client) FindResCountryStateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResCountryStateModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_currency.go b/res_currency.go new file mode 100644 index 0000000..b5cd23f --- /dev/null +++ b/res_currency.go @@ -0,0 +1,134 @@ +package odoo + +// ResCurrency represents res.currency model. +type ResCurrency struct { + Active *Bool `xmlrpc:"active,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencySubunitLabel *String `xmlrpc:"currency_subunit_label,omitempty"` + CurrencyUnitLabel *String `xmlrpc:"currency_unit_label,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DecimalPlaces *Int `xmlrpc:"decimal_places,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayRoundingWarning *Bool `xmlrpc:"display_rounding_warning,omitempty"` + FiscalCountryCodes *String `xmlrpc:"fiscal_country_codes,omitempty"` + FullName *String `xmlrpc:"full_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InverseRate *Float `xmlrpc:"inverse_rate,omitempty"` + IsCurrentCompanyCurrency *Bool `xmlrpc:"is_current_company_currency,omitempty"` + IsoNumeric *Int `xmlrpc:"iso_numeric,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Position *Selection `xmlrpc:"position,omitempty"` + Rate *Float `xmlrpc:"rate,omitempty"` + RateIds *Relation `xmlrpc:"rate_ids,omitempty"` + RateString *String `xmlrpc:"rate_string,omitempty"` + Rounding *Float `xmlrpc:"rounding,omitempty"` + Symbol *String `xmlrpc:"symbol,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResCurrencys represents array of res.currency model. +type ResCurrencys []ResCurrency + +// ResCurrencyModel is the odoo model name. +const ResCurrencyModel = "res.currency" + +// Many2One convert ResCurrency to *Many2One. +func (rc *ResCurrency) Many2One() *Many2One { + return NewMany2One(rc.Id.Get(), "") +} + +// CreateResCurrency creates a new res.currency model and returns its id. +func (c *Client) CreateResCurrency(rc *ResCurrency) (int64, error) { + ids, err := c.CreateResCurrencys([]*ResCurrency{rc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResCurrency creates a new res.currency model and returns its id. +func (c *Client) CreateResCurrencys(rcs []*ResCurrency) ([]int64, error) { + var vv []interface{} + for _, v := range rcs { + vv = append(vv, v) + } + return c.Create(ResCurrencyModel, vv, nil) +} + +// UpdateResCurrency updates an existing res.currency record. +func (c *Client) UpdateResCurrency(rc *ResCurrency) error { + return c.UpdateResCurrencys([]int64{rc.Id.Get()}, rc) +} + +// UpdateResCurrencys updates existing res.currency records. +// All records (represented by ids) will be updated by rc values. +func (c *Client) UpdateResCurrencys(ids []int64, rc *ResCurrency) error { + return c.Update(ResCurrencyModel, ids, rc, nil) +} + +// DeleteResCurrency deletes an existing res.currency record. +func (c *Client) DeleteResCurrency(id int64) error { + return c.DeleteResCurrencys([]int64{id}) +} + +// DeleteResCurrencys deletes existing res.currency records. +func (c *Client) DeleteResCurrencys(ids []int64) error { + return c.Delete(ResCurrencyModel, ids) +} + +// GetResCurrency gets res.currency existing record. +func (c *Client) GetResCurrency(id int64) (*ResCurrency, error) { + rcs, err := c.GetResCurrencys([]int64{id}) + if err != nil { + return nil, err + } + return &((*rcs)[0]), nil +} + +// GetResCurrencys gets res.currency existing records. +func (c *Client) GetResCurrencys(ids []int64) (*ResCurrencys, error) { + rcs := &ResCurrencys{} + if err := c.Read(ResCurrencyModel, ids, nil, rcs); err != nil { + return nil, err + } + return rcs, nil +} + +// FindResCurrency finds res.currency record by querying it with criteria. +func (c *Client) FindResCurrency(criteria *Criteria) (*ResCurrency, error) { + rcs := &ResCurrencys{} + if err := c.SearchRead(ResCurrencyModel, criteria, NewOptions().Limit(1), rcs); err != nil { + return nil, err + } + return &((*rcs)[0]), nil +} + +// FindResCurrencys finds res.currency records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResCurrencys(criteria *Criteria, options *Options) (*ResCurrencys, error) { + rcs := &ResCurrencys{} + if err := c.SearchRead(ResCurrencyModel, criteria, options, rcs); err != nil { + return nil, err + } + return rcs, nil +} + +// FindResCurrencyIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResCurrencyIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResCurrencyModel, criteria, options) +} + +// FindResCurrencyId finds record id by querying it with criteria. +func (c *Client) FindResCurrencyId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResCurrencyModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_currency_rate.go b/res_currency_rate.go new file mode 100644 index 0000000..2991cca --- /dev/null +++ b/res_currency_rate.go @@ -0,0 +1,122 @@ +package odoo + +// ResCurrencyRate represents res.currency.rate model. +type ResCurrencyRate struct { + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanyRate *Float `xmlrpc:"company_rate,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InverseCompanyRate *Float `xmlrpc:"inverse_company_rate,omitempty"` + Name *Time `xmlrpc:"name,omitempty"` + Rate *Float `xmlrpc:"rate,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResCurrencyRates represents array of res.currency.rate model. +type ResCurrencyRates []ResCurrencyRate + +// ResCurrencyRateModel is the odoo model name. +const ResCurrencyRateModel = "res.currency.rate" + +// Many2One convert ResCurrencyRate to *Many2One. +func (rcr *ResCurrencyRate) Many2One() *Many2One { + return NewMany2One(rcr.Id.Get(), "") +} + +// CreateResCurrencyRate creates a new res.currency.rate model and returns its id. +func (c *Client) CreateResCurrencyRate(rcr *ResCurrencyRate) (int64, error) { + ids, err := c.CreateResCurrencyRates([]*ResCurrencyRate{rcr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResCurrencyRate creates a new res.currency.rate model and returns its id. +func (c *Client) CreateResCurrencyRates(rcrs []*ResCurrencyRate) ([]int64, error) { + var vv []interface{} + for _, v := range rcrs { + vv = append(vv, v) + } + return c.Create(ResCurrencyRateModel, vv, nil) +} + +// UpdateResCurrencyRate updates an existing res.currency.rate record. +func (c *Client) UpdateResCurrencyRate(rcr *ResCurrencyRate) error { + return c.UpdateResCurrencyRates([]int64{rcr.Id.Get()}, rcr) +} + +// UpdateResCurrencyRates updates existing res.currency.rate records. +// All records (represented by ids) will be updated by rcr values. +func (c *Client) UpdateResCurrencyRates(ids []int64, rcr *ResCurrencyRate) error { + return c.Update(ResCurrencyRateModel, ids, rcr, nil) +} + +// DeleteResCurrencyRate deletes an existing res.currency.rate record. +func (c *Client) DeleteResCurrencyRate(id int64) error { + return c.DeleteResCurrencyRates([]int64{id}) +} + +// DeleteResCurrencyRates deletes existing res.currency.rate records. +func (c *Client) DeleteResCurrencyRates(ids []int64) error { + return c.Delete(ResCurrencyRateModel, ids) +} + +// GetResCurrencyRate gets res.currency.rate existing record. +func (c *Client) GetResCurrencyRate(id int64) (*ResCurrencyRate, error) { + rcrs, err := c.GetResCurrencyRates([]int64{id}) + if err != nil { + return nil, err + } + return &((*rcrs)[0]), nil +} + +// GetResCurrencyRates gets res.currency.rate existing records. +func (c *Client) GetResCurrencyRates(ids []int64) (*ResCurrencyRates, error) { + rcrs := &ResCurrencyRates{} + if err := c.Read(ResCurrencyRateModel, ids, nil, rcrs); err != nil { + return nil, err + } + return rcrs, nil +} + +// FindResCurrencyRate finds res.currency.rate record by querying it with criteria. +func (c *Client) FindResCurrencyRate(criteria *Criteria) (*ResCurrencyRate, error) { + rcrs := &ResCurrencyRates{} + if err := c.SearchRead(ResCurrencyRateModel, criteria, NewOptions().Limit(1), rcrs); err != nil { + return nil, err + } + return &((*rcrs)[0]), nil +} + +// FindResCurrencyRates finds res.currency.rate records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResCurrencyRates(criteria *Criteria, options *Options) (*ResCurrencyRates, error) { + rcrs := &ResCurrencyRates{} + if err := c.SearchRead(ResCurrencyRateModel, criteria, options, rcrs); err != nil { + return nil, err + } + return rcrs, nil +} + +// FindResCurrencyRateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResCurrencyRateIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResCurrencyRateModel, criteria, options) +} + +// FindResCurrencyRateId finds record id by querying it with criteria. +func (c *Client) FindResCurrencyRateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResCurrencyRateModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_device.go b/res_device.go new file mode 100644 index 0000000..a7adfd3 --- /dev/null +++ b/res_device.go @@ -0,0 +1,129 @@ +package odoo + +// ResDevice represents res.device model. +type ResDevice struct { + Browser *String `xmlrpc:"browser,omitempty"` + City *String `xmlrpc:"city,omitempty"` + Country *String `xmlrpc:"country,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DeviceType *Selection `xmlrpc:"device_type,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FirstActivity *Time `xmlrpc:"first_activity,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IpAddress *String `xmlrpc:"ip_address,omitempty"` + IsCurrent *Bool `xmlrpc:"is_current,omitempty"` + LastActivity *Time `xmlrpc:"last_activity,omitempty"` + LinkedIpAddresses *String `xmlrpc:"linked_ip_addresses,omitempty"` + Platform *String `xmlrpc:"platform,omitempty"` + Revoked *Bool `xmlrpc:"revoked,omitempty"` + SessionIdentifier *String `xmlrpc:"session_identifier,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResDevices represents array of res.device model. +type ResDevices []ResDevice + +// ResDeviceModel is the odoo model name. +const ResDeviceModel = "res.device" + +// Many2One convert ResDevice to *Many2One. +func (rd *ResDevice) Many2One() *Many2One { + return NewMany2One(rd.Id.Get(), "") +} + +// CreateResDevice creates a new res.device model and returns its id. +func (c *Client) CreateResDevice(rd *ResDevice) (int64, error) { + ids, err := c.CreateResDevices([]*ResDevice{rd}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResDevice creates a new res.device model and returns its id. +func (c *Client) CreateResDevices(rds []*ResDevice) ([]int64, error) { + var vv []interface{} + for _, v := range rds { + vv = append(vv, v) + } + return c.Create(ResDeviceModel, vv, nil) +} + +// UpdateResDevice updates an existing res.device record. +func (c *Client) UpdateResDevice(rd *ResDevice) error { + return c.UpdateResDevices([]int64{rd.Id.Get()}, rd) +} + +// UpdateResDevices updates existing res.device records. +// All records (represented by ids) will be updated by rd values. +func (c *Client) UpdateResDevices(ids []int64, rd *ResDevice) error { + return c.Update(ResDeviceModel, ids, rd, nil) +} + +// DeleteResDevice deletes an existing res.device record. +func (c *Client) DeleteResDevice(id int64) error { + return c.DeleteResDevices([]int64{id}) +} + +// DeleteResDevices deletes existing res.device records. +func (c *Client) DeleteResDevices(ids []int64) error { + return c.Delete(ResDeviceModel, ids) +} + +// GetResDevice gets res.device existing record. +func (c *Client) GetResDevice(id int64) (*ResDevice, error) { + rds, err := c.GetResDevices([]int64{id}) + if err != nil { + return nil, err + } + return &((*rds)[0]), nil +} + +// GetResDevices gets res.device existing records. +func (c *Client) GetResDevices(ids []int64) (*ResDevices, error) { + rds := &ResDevices{} + if err := c.Read(ResDeviceModel, ids, nil, rds); err != nil { + return nil, err + } + return rds, nil +} + +// FindResDevice finds res.device record by querying it with criteria. +func (c *Client) FindResDevice(criteria *Criteria) (*ResDevice, error) { + rds := &ResDevices{} + if err := c.SearchRead(ResDeviceModel, criteria, NewOptions().Limit(1), rds); err != nil { + return nil, err + } + return &((*rds)[0]), nil +} + +// FindResDevices finds res.device records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResDevices(criteria *Criteria, options *Options) (*ResDevices, error) { + rds := &ResDevices{} + if err := c.SearchRead(ResDeviceModel, criteria, options, rds); err != nil { + return nil, err + } + return rds, nil +} + +// FindResDeviceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResDeviceIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResDeviceModel, criteria, options) +} + +// FindResDeviceId finds record id by querying it with criteria. +func (c *Client) FindResDeviceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResDeviceModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_device_log.go b/res_device_log.go new file mode 100644 index 0000000..b0aa8af --- /dev/null +++ b/res_device_log.go @@ -0,0 +1,129 @@ +package odoo + +// ResDeviceLog represents res.device.log model. +type ResDeviceLog struct { + Browser *String `xmlrpc:"browser,omitempty"` + City *String `xmlrpc:"city,omitempty"` + Country *String `xmlrpc:"country,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DeviceType *Selection `xmlrpc:"device_type,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FirstActivity *Time `xmlrpc:"first_activity,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IpAddress *String `xmlrpc:"ip_address,omitempty"` + IsCurrent *Bool `xmlrpc:"is_current,omitempty"` + LastActivity *Time `xmlrpc:"last_activity,omitempty"` + LinkedIpAddresses *String `xmlrpc:"linked_ip_addresses,omitempty"` + Platform *String `xmlrpc:"platform,omitempty"` + Revoked *Bool `xmlrpc:"revoked,omitempty"` + SessionIdentifier *String `xmlrpc:"session_identifier,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResDeviceLogs represents array of res.device.log model. +type ResDeviceLogs []ResDeviceLog + +// ResDeviceLogModel is the odoo model name. +const ResDeviceLogModel = "res.device.log" + +// Many2One convert ResDeviceLog to *Many2One. +func (rdl *ResDeviceLog) Many2One() *Many2One { + return NewMany2One(rdl.Id.Get(), "") +} + +// CreateResDeviceLog creates a new res.device.log model and returns its id. +func (c *Client) CreateResDeviceLog(rdl *ResDeviceLog) (int64, error) { + ids, err := c.CreateResDeviceLogs([]*ResDeviceLog{rdl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResDeviceLog creates a new res.device.log model and returns its id. +func (c *Client) CreateResDeviceLogs(rdls []*ResDeviceLog) ([]int64, error) { + var vv []interface{} + for _, v := range rdls { + vv = append(vv, v) + } + return c.Create(ResDeviceLogModel, vv, nil) +} + +// UpdateResDeviceLog updates an existing res.device.log record. +func (c *Client) UpdateResDeviceLog(rdl *ResDeviceLog) error { + return c.UpdateResDeviceLogs([]int64{rdl.Id.Get()}, rdl) +} + +// UpdateResDeviceLogs updates existing res.device.log records. +// All records (represented by ids) will be updated by rdl values. +func (c *Client) UpdateResDeviceLogs(ids []int64, rdl *ResDeviceLog) error { + return c.Update(ResDeviceLogModel, ids, rdl, nil) +} + +// DeleteResDeviceLog deletes an existing res.device.log record. +func (c *Client) DeleteResDeviceLog(id int64) error { + return c.DeleteResDeviceLogs([]int64{id}) +} + +// DeleteResDeviceLogs deletes existing res.device.log records. +func (c *Client) DeleteResDeviceLogs(ids []int64) error { + return c.Delete(ResDeviceLogModel, ids) +} + +// GetResDeviceLog gets res.device.log existing record. +func (c *Client) GetResDeviceLog(id int64) (*ResDeviceLog, error) { + rdls, err := c.GetResDeviceLogs([]int64{id}) + if err != nil { + return nil, err + } + return &((*rdls)[0]), nil +} + +// GetResDeviceLogs gets res.device.log existing records. +func (c *Client) GetResDeviceLogs(ids []int64) (*ResDeviceLogs, error) { + rdls := &ResDeviceLogs{} + if err := c.Read(ResDeviceLogModel, ids, nil, rdls); err != nil { + return nil, err + } + return rdls, nil +} + +// FindResDeviceLog finds res.device.log record by querying it with criteria. +func (c *Client) FindResDeviceLog(criteria *Criteria) (*ResDeviceLog, error) { + rdls := &ResDeviceLogs{} + if err := c.SearchRead(ResDeviceLogModel, criteria, NewOptions().Limit(1), rdls); err != nil { + return nil, err + } + return &((*rdls)[0]), nil +} + +// FindResDeviceLogs finds res.device.log records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResDeviceLogs(criteria *Criteria, options *Options) (*ResDeviceLogs, error) { + rdls := &ResDeviceLogs{} + if err := c.SearchRead(ResDeviceLogModel, criteria, options, rdls); err != nil { + return nil, err + } + return rdls, nil +} + +// FindResDeviceLogIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResDeviceLogIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResDeviceLogModel, criteria, options) +} + +// FindResDeviceLogId finds record id by querying it with criteria. +func (c *Client) FindResDeviceLogId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResDeviceLogModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_groups.go b/res_groups.go new file mode 100644 index 0000000..c83d7fc --- /dev/null +++ b/res_groups.go @@ -0,0 +1,130 @@ +package odoo + +// ResGroups represents res.groups model. +type ResGroups struct { + ApiKeyDuration *Float `xmlrpc:"api_key_duration,omitempty"` + CategoryId *Many2One `xmlrpc:"category_id,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + Comment *String `xmlrpc:"comment,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FullName *String `xmlrpc:"full_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ImpliedIds *Relation `xmlrpc:"implied_ids,omitempty"` + MenuAccess *Relation `xmlrpc:"menu_access,omitempty"` + ModelAccess *Relation `xmlrpc:"model_access,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + RuleGroups *Relation `xmlrpc:"rule_groups,omitempty"` + Share *Bool `xmlrpc:"share,omitempty"` + TransImpliedIds *Relation `xmlrpc:"trans_implied_ids,omitempty"` + Users *Relation `xmlrpc:"users,omitempty"` + ViewAccess *Relation `xmlrpc:"view_access,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResGroupss represents array of res.groups model. +type ResGroupss []ResGroups + +// ResGroupsModel is the odoo model name. +const ResGroupsModel = "res.groups" + +// Many2One convert ResGroups to *Many2One. +func (rg *ResGroups) Many2One() *Many2One { + return NewMany2One(rg.Id.Get(), "") +} + +// CreateResGroups creates a new res.groups model and returns its id. +func (c *Client) CreateResGroups(rg *ResGroups) (int64, error) { + ids, err := c.CreateResGroupss([]*ResGroups{rg}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResGroups creates a new res.groups model and returns its id. +func (c *Client) CreateResGroupss(rgs []*ResGroups) ([]int64, error) { + var vv []interface{} + for _, v := range rgs { + vv = append(vv, v) + } + return c.Create(ResGroupsModel, vv, nil) +} + +// UpdateResGroups updates an existing res.groups record. +func (c *Client) UpdateResGroups(rg *ResGroups) error { + return c.UpdateResGroupss([]int64{rg.Id.Get()}, rg) +} + +// UpdateResGroupss updates existing res.groups records. +// All records (represented by ids) will be updated by rg values. +func (c *Client) UpdateResGroupss(ids []int64, rg *ResGroups) error { + return c.Update(ResGroupsModel, ids, rg, nil) +} + +// DeleteResGroups deletes an existing res.groups record. +func (c *Client) DeleteResGroups(id int64) error { + return c.DeleteResGroupss([]int64{id}) +} + +// DeleteResGroupss deletes existing res.groups records. +func (c *Client) DeleteResGroupss(ids []int64) error { + return c.Delete(ResGroupsModel, ids) +} + +// GetResGroups gets res.groups existing record. +func (c *Client) GetResGroups(id int64) (*ResGroups, error) { + rgs, err := c.GetResGroupss([]int64{id}) + if err != nil { + return nil, err + } + return &((*rgs)[0]), nil +} + +// GetResGroupss gets res.groups existing records. +func (c *Client) GetResGroupss(ids []int64) (*ResGroupss, error) { + rgs := &ResGroupss{} + if err := c.Read(ResGroupsModel, ids, nil, rgs); err != nil { + return nil, err + } + return rgs, nil +} + +// FindResGroups finds res.groups record by querying it with criteria. +func (c *Client) FindResGroups(criteria *Criteria) (*ResGroups, error) { + rgs := &ResGroupss{} + if err := c.SearchRead(ResGroupsModel, criteria, NewOptions().Limit(1), rgs); err != nil { + return nil, err + } + return &((*rgs)[0]), nil +} + +// FindResGroupss finds res.groups records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResGroupss(criteria *Criteria, options *Options) (*ResGroupss, error) { + rgs := &ResGroupss{} + if err := c.SearchRead(ResGroupsModel, criteria, options, rgs); err != nil { + return nil, err + } + return rgs, nil +} + +// FindResGroupsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResGroupsIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResGroupsModel, criteria, options) +} + +// FindResGroupsId finds record id by querying it with criteria. +func (c *Client) FindResGroupsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResGroupsModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_lang.go b/res_lang.go new file mode 100644 index 0000000..4e8541f --- /dev/null +++ b/res_lang.go @@ -0,0 +1,131 @@ +package odoo + +// ResLang represents res.lang model. +type ResLang struct { + Active *Bool `xmlrpc:"active,omitempty"` + Code *String `xmlrpc:"code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DateFormat *String `xmlrpc:"date_format,omitempty"` + DecimalPoint *String `xmlrpc:"decimal_point,omitempty"` + Direction *Selection `xmlrpc:"direction,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FlagImage *String `xmlrpc:"flag_image,omitempty"` + FlagImageUrl *String `xmlrpc:"flag_image_url,omitempty"` + Grouping *String `xmlrpc:"grouping,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsoCode *String `xmlrpc:"iso_code,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ShortTimeFormat *String `xmlrpc:"short_time_format,omitempty"` + ThousandsSep *String `xmlrpc:"thousands_sep,omitempty"` + TimeFormat *String `xmlrpc:"time_format,omitempty"` + UrlCode *String `xmlrpc:"url_code,omitempty"` + WeekStart *Selection `xmlrpc:"week_start,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResLangs represents array of res.lang model. +type ResLangs []ResLang + +// ResLangModel is the odoo model name. +const ResLangModel = "res.lang" + +// Many2One convert ResLang to *Many2One. +func (rl *ResLang) Many2One() *Many2One { + return NewMany2One(rl.Id.Get(), "") +} + +// CreateResLang creates a new res.lang model and returns its id. +func (c *Client) CreateResLang(rl *ResLang) (int64, error) { + ids, err := c.CreateResLangs([]*ResLang{rl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResLang creates a new res.lang model and returns its id. +func (c *Client) CreateResLangs(rls []*ResLang) ([]int64, error) { + var vv []interface{} + for _, v := range rls { + vv = append(vv, v) + } + return c.Create(ResLangModel, vv, nil) +} + +// UpdateResLang updates an existing res.lang record. +func (c *Client) UpdateResLang(rl *ResLang) error { + return c.UpdateResLangs([]int64{rl.Id.Get()}, rl) +} + +// UpdateResLangs updates existing res.lang records. +// All records (represented by ids) will be updated by rl values. +func (c *Client) UpdateResLangs(ids []int64, rl *ResLang) error { + return c.Update(ResLangModel, ids, rl, nil) +} + +// DeleteResLang deletes an existing res.lang record. +func (c *Client) DeleteResLang(id int64) error { + return c.DeleteResLangs([]int64{id}) +} + +// DeleteResLangs deletes existing res.lang records. +func (c *Client) DeleteResLangs(ids []int64) error { + return c.Delete(ResLangModel, ids) +} + +// GetResLang gets res.lang existing record. +func (c *Client) GetResLang(id int64) (*ResLang, error) { + rls, err := c.GetResLangs([]int64{id}) + if err != nil { + return nil, err + } + return &((*rls)[0]), nil +} + +// GetResLangs gets res.lang existing records. +func (c *Client) GetResLangs(ids []int64) (*ResLangs, error) { + rls := &ResLangs{} + if err := c.Read(ResLangModel, ids, nil, rls); err != nil { + return nil, err + } + return rls, nil +} + +// FindResLang finds res.lang record by querying it with criteria. +func (c *Client) FindResLang(criteria *Criteria) (*ResLang, error) { + rls := &ResLangs{} + if err := c.SearchRead(ResLangModel, criteria, NewOptions().Limit(1), rls); err != nil { + return nil, err + } + return &((*rls)[0]), nil +} + +// FindResLangs finds res.lang records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResLangs(criteria *Criteria, options *Options) (*ResLangs, error) { + rls := &ResLangs{} + if err := c.SearchRead(ResLangModel, criteria, options, rls); err != nil { + return nil, err + } + return rls, nil +} + +// FindResLangIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResLangIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResLangModel, criteria, options) +} + +// FindResLangId finds record id by querying it with criteria. +func (c *Client) FindResLangId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResLangModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_partner.go b/res_partner.go new file mode 100644 index 0000000..a1698a0 --- /dev/null +++ b/res_partner.go @@ -0,0 +1,285 @@ +package odoo + +// ResPartner represents res.partner model. +type ResPartner struct { + Active *Bool `xmlrpc:"active,omitempty"` + ActiveLangCount *Int `xmlrpc:"active_lang_count,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AdditionalInfo *String `xmlrpc:"additional_info,omitempty"` + AutopostBills *Selection `xmlrpc:"autopost_bills,omitempty"` + Avatar1024 *String `xmlrpc:"avatar_1024,omitempty"` + Avatar128 *String `xmlrpc:"avatar_128,omitempty"` + Avatar1920 *String `xmlrpc:"avatar_1920,omitempty"` + Avatar256 *String `xmlrpc:"avatar_256,omitempty"` + Avatar512 *String `xmlrpc:"avatar_512,omitempty"` + BankAccountCount *Int `xmlrpc:"bank_account_count,omitempty"` + BankIds *Relation `xmlrpc:"bank_ids,omitempty"` + Barcode *String `xmlrpc:"barcode,omitempty"` + BuyerId *Many2One `xmlrpc:"buyer_id,omitempty"` + CalendarLastNotifAck *Time `xmlrpc:"calendar_last_notif_ack,omitempty"` + CategoryId *Relation `xmlrpc:"category_id,omitempty"` + ChannelIds *Relation `xmlrpc:"channel_ids,omitempty"` + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + City *String `xmlrpc:"city,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + Comment *String `xmlrpc:"comment,omitempty"` + CommercialCompanyName *String `xmlrpc:"commercial_company_name,omitempty"` + CommercialPartnerId *Many2One `xmlrpc:"commercial_partner_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanyName *String `xmlrpc:"company_name,omitempty"` + CompanyRegistry *String `xmlrpc:"company_registry,omitempty"` + CompanyType *Selection `xmlrpc:"company_type,omitempty"` + CompleteName *String `xmlrpc:"complete_name,omitempty"` + ContactAddress *String `xmlrpc:"contact_address,omitempty"` + ContactAddressInline *String `xmlrpc:"contact_address_inline,omitempty"` + ContractIds *Relation `xmlrpc:"contract_ids,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Credit *Float `xmlrpc:"credit,omitempty"` + CreditLimit *Float `xmlrpc:"credit_limit,omitempty"` + CreditToInvoice *Float `xmlrpc:"credit_to_invoice,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + CustomerRank *Int `xmlrpc:"customer_rank,omitempty"` + DaysSalesOutstanding *Float `xmlrpc:"days_sales_outstanding,omitempty"` + Debit *Float `xmlrpc:"debit,omitempty"` + DebitLimit *Float `xmlrpc:"debit_limit,omitempty"` + DisplayInvoiceEdiFormat *Bool `xmlrpc:"display_invoice_edi_format,omitempty"` + DisplayInvoiceTemplatePdfReportId *Bool `xmlrpc:"display_invoice_template_pdf_report_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DuplicatedBankAccountPartnersCount *Int `xmlrpc:"duplicated_bank_account_partners_count,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + EmailFormatted *String `xmlrpc:"email_formatted,omitempty"` + EmailNormalized *String `xmlrpc:"email_normalized,omitempty"` + Employee *Bool `xmlrpc:"employee,omitempty"` + EmployeeIds *Relation `xmlrpc:"employee_ids,omitempty"` + EmployeesCount *Int `xmlrpc:"employees_count,omitempty"` + FiscalCountryCodes *String `xmlrpc:"fiscal_country_codes,omitempty"` + Function *String `xmlrpc:"function,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IgnoreAbnormalInvoiceAmount *Bool `xmlrpc:"ignore_abnormal_invoice_amount,omitempty"` + IgnoreAbnormalInvoiceDate *Bool `xmlrpc:"ignore_abnormal_invoice_date,omitempty"` + ImStatus *String `xmlrpc:"im_status,omitempty"` + Image1024 *String `xmlrpc:"image_1024,omitempty"` + Image128 *String `xmlrpc:"image_128,omitempty"` + Image1920 *String `xmlrpc:"image_1920,omitempty"` + Image256 *String `xmlrpc:"image_256,omitempty"` + Image512 *String `xmlrpc:"image_512,omitempty"` + IndustryId *Many2One `xmlrpc:"industry_id,omitempty"` + InvoiceEdiFormat *Selection `xmlrpc:"invoice_edi_format,omitempty"` + InvoiceEdiFormatStore *String `xmlrpc:"invoice_edi_format_store,omitempty"` + InvoiceIds *Relation `xmlrpc:"invoice_ids,omitempty"` + InvoiceSendingMethod *Selection `xmlrpc:"invoice_sending_method,omitempty"` + InvoiceTemplatePdfReportId *Many2One `xmlrpc:"invoice_template_pdf_report_id,omitempty"` + InvoiceWarn *Selection `xmlrpc:"invoice_warn,omitempty"` + InvoiceWarnMsg *String `xmlrpc:"invoice_warn_msg,omitempty"` + IsBlacklisted *Bool `xmlrpc:"is_blacklisted,omitempty"` + IsCompany *Bool `xmlrpc:"is_company,omitempty"` + IsPeppolEdiFormat *Bool `xmlrpc:"is_peppol_edi_format,omitempty"` + IsPublic *Bool `xmlrpc:"is_public,omitempty"` + IsUblFormat *Bool `xmlrpc:"is_ubl_format,omitempty"` + JournalItemCount *Int `xmlrpc:"journal_item_count,omitempty"` + Lang *Selection `xmlrpc:"lang,omitempty"` + MeetingCount *Int `xmlrpc:"meeting_count,omitempty"` + MeetingIds *Relation `xmlrpc:"meeting_ids,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageBounce *Int `xmlrpc:"message_bounce,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Mobile *String `xmlrpc:"mobile,omitempty"` + MobileBlacklisted *Bool `xmlrpc:"mobile_blacklisted,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OpportunityCount *Int `xmlrpc:"opportunity_count,omitempty"` + OpportunityIds *Relation `xmlrpc:"opportunity_ids,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + ParentName *String `xmlrpc:"parent_name,omitempty"` + PartnerGid *Int `xmlrpc:"partner_gid,omitempty"` + PartnerLatitude *Float `xmlrpc:"partner_latitude,omitempty"` + PartnerLongitude *Float `xmlrpc:"partner_longitude,omitempty"` + PartnerShare *Bool `xmlrpc:"partner_share,omitempty"` + PartnerVatPlaceholder *String `xmlrpc:"partner_vat_placeholder,omitempty"` + PaymentTokenCount *Int `xmlrpc:"payment_token_count,omitempty"` + PaymentTokenIds *Relation `xmlrpc:"payment_token_ids,omitempty"` + PeppolEas *Selection `xmlrpc:"peppol_eas,omitempty"` + PeppolEndpoint *String `xmlrpc:"peppol_endpoint,omitempty"` + Phone *String `xmlrpc:"phone,omitempty"` + PhoneBlacklisted *Bool `xmlrpc:"phone_blacklisted,omitempty"` + PhoneMobileSearch *String `xmlrpc:"phone_mobile_search,omitempty"` + PhoneSanitized *String `xmlrpc:"phone_sanitized,omitempty"` + PhoneSanitizedBlacklisted *Bool `xmlrpc:"phone_sanitized_blacklisted,omitempty"` + ProjectIds *Relation `xmlrpc:"project_ids,omitempty"` + PropertyAccountPayableId *Many2One `xmlrpc:"property_account_payable_id,omitempty"` + PropertyAccountPositionId *Many2One `xmlrpc:"property_account_position_id,omitempty"` + PropertyAccountReceivableId *Many2One `xmlrpc:"property_account_receivable_id,omitempty"` + PropertyInboundPaymentMethodLineId *Many2One `xmlrpc:"property_inbound_payment_method_line_id,omitempty"` + PropertyOutboundPaymentMethodLineId *Many2One `xmlrpc:"property_outbound_payment_method_line_id,omitempty"` + PropertyPaymentTermId *Many2One `xmlrpc:"property_payment_term_id,omitempty"` + PropertyProductPricelist *Many2One `xmlrpc:"property_product_pricelist,omitempty"` + PropertyPurchaseCurrencyId *Many2One `xmlrpc:"property_purchase_currency_id,omitempty"` + PropertySupplierPaymentTermId *Many2One `xmlrpc:"property_supplier_payment_term_id,omitempty"` + PurchaseOrderCount *Int `xmlrpc:"purchase_order_count,omitempty"` + PurchaseWarn *Selection `xmlrpc:"purchase_warn,omitempty"` + PurchaseWarnMsg *String `xmlrpc:"purchase_warn_msg,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + ReceiptReminderEmail *Bool `xmlrpc:"receipt_reminder_email,omitempty"` + Ref *String `xmlrpc:"ref,omitempty"` + RefCompanyIds *Relation `xmlrpc:"ref_company_ids,omitempty"` + ReminderDateBeforeReceipt *Int `xmlrpc:"reminder_date_before_receipt,omitempty"` + SaleOrderCount *Int `xmlrpc:"sale_order_count,omitempty"` + SaleOrderIds *Relation `xmlrpc:"sale_order_ids,omitempty"` + SaleWarn *Selection `xmlrpc:"sale_warn,omitempty"` + SaleWarnMsg *String `xmlrpc:"sale_warn_msg,omitempty"` + SameCompanyRegistryPartnerId *Many2One `xmlrpc:"same_company_registry_partner_id,omitempty"` + SameVatPartnerId *Many2One `xmlrpc:"same_vat_partner_id,omitempty"` + Self *Many2One `xmlrpc:"self,omitempty"` + ShowCreditLimit *Bool `xmlrpc:"show_credit_limit,omitempty"` + SignupType *String `xmlrpc:"signup_type,omitempty"` + SpecificPropertyProductPricelist *Many2One `xmlrpc:"specific_property_product_pricelist,omitempty"` + StarredMessageIds *Relation `xmlrpc:"starred_message_ids,omitempty"` + StateId *Many2One `xmlrpc:"state_id,omitempty"` + Street *String `xmlrpc:"street,omitempty"` + Street2 *String `xmlrpc:"street2,omitempty"` + SupplierInvoiceCount *Int `xmlrpc:"supplier_invoice_count,omitempty"` + SupplierRank *Int `xmlrpc:"supplier_rank,omitempty"` + TaskCount *Int `xmlrpc:"task_count,omitempty"` + TaskIds *Relation `xmlrpc:"task_ids,omitempty"` + Title *Many2One `xmlrpc:"title,omitempty"` + TotalInvoiced *Float `xmlrpc:"total_invoiced,omitempty"` + Trust *Selection `xmlrpc:"trust,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + Tz *Selection `xmlrpc:"tz,omitempty"` + TzOffset *String `xmlrpc:"tz_offset,omitempty"` + UsePartnerCreditLimit *Bool `xmlrpc:"use_partner_credit_limit,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + UserIds *Relation `xmlrpc:"user_ids,omitempty"` + Vat *String `xmlrpc:"vat,omitempty"` + Website *String `xmlrpc:"website,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + Zip *String `xmlrpc:"zip,omitempty"` +} + +// ResPartners represents array of res.partner model. +type ResPartners []ResPartner + +// ResPartnerModel is the odoo model name. +const ResPartnerModel = "res.partner" + +// Many2One convert ResPartner to *Many2One. +func (rp *ResPartner) Many2One() *Many2One { + return NewMany2One(rp.Id.Get(), "") +} + +// CreateResPartner creates a new res.partner model and returns its id. +func (c *Client) CreateResPartner(rp *ResPartner) (int64, error) { + ids, err := c.CreateResPartners([]*ResPartner{rp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResPartner creates a new res.partner model and returns its id. +func (c *Client) CreateResPartners(rps []*ResPartner) ([]int64, error) { + var vv []interface{} + for _, v := range rps { + vv = append(vv, v) + } + return c.Create(ResPartnerModel, vv, nil) +} + +// UpdateResPartner updates an existing res.partner record. +func (c *Client) UpdateResPartner(rp *ResPartner) error { + return c.UpdateResPartners([]int64{rp.Id.Get()}, rp) +} + +// UpdateResPartners updates existing res.partner records. +// All records (represented by ids) will be updated by rp values. +func (c *Client) UpdateResPartners(ids []int64, rp *ResPartner) error { + return c.Update(ResPartnerModel, ids, rp, nil) +} + +// DeleteResPartner deletes an existing res.partner record. +func (c *Client) DeleteResPartner(id int64) error { + return c.DeleteResPartners([]int64{id}) +} + +// DeleteResPartners deletes existing res.partner records. +func (c *Client) DeleteResPartners(ids []int64) error { + return c.Delete(ResPartnerModel, ids) +} + +// GetResPartner gets res.partner existing record. +func (c *Client) GetResPartner(id int64) (*ResPartner, error) { + rps, err := c.GetResPartners([]int64{id}) + if err != nil { + return nil, err + } + return &((*rps)[0]), nil +} + +// GetResPartners gets res.partner existing records. +func (c *Client) GetResPartners(ids []int64) (*ResPartners, error) { + rps := &ResPartners{} + if err := c.Read(ResPartnerModel, ids, nil, rps); err != nil { + return nil, err + } + return rps, nil +} + +// FindResPartner finds res.partner record by querying it with criteria. +func (c *Client) FindResPartner(criteria *Criteria) (*ResPartner, error) { + rps := &ResPartners{} + if err := c.SearchRead(ResPartnerModel, criteria, NewOptions().Limit(1), rps); err != nil { + return nil, err + } + return &((*rps)[0]), nil +} + +// FindResPartners finds res.partner records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResPartners(criteria *Criteria, options *Options) (*ResPartners, error) { + rps := &ResPartners{} + if err := c.SearchRead(ResPartnerModel, criteria, options, rps); err != nil { + return nil, err + } + return rps, nil +} + +// FindResPartnerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResPartnerIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResPartnerModel, criteria, options) +} + +// FindResPartnerId finds record id by querying it with criteria. +func (c *Client) FindResPartnerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResPartnerModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_partner_autocomplete_sync.go b/res_partner_autocomplete_sync.go new file mode 100644 index 0000000..e3e75a5 --- /dev/null +++ b/res_partner_autocomplete_sync.go @@ -0,0 +1,118 @@ +package odoo + +// ResPartnerAutocompleteSync represents res.partner.autocomplete.sync model. +type ResPartnerAutocompleteSync struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + Synched *Bool `xmlrpc:"synched,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResPartnerAutocompleteSyncs represents array of res.partner.autocomplete.sync model. +type ResPartnerAutocompleteSyncs []ResPartnerAutocompleteSync + +// ResPartnerAutocompleteSyncModel is the odoo model name. +const ResPartnerAutocompleteSyncModel = "res.partner.autocomplete.sync" + +// Many2One convert ResPartnerAutocompleteSync to *Many2One. +func (rpas *ResPartnerAutocompleteSync) Many2One() *Many2One { + return NewMany2One(rpas.Id.Get(), "") +} + +// CreateResPartnerAutocompleteSync creates a new res.partner.autocomplete.sync model and returns its id. +func (c *Client) CreateResPartnerAutocompleteSync(rpas *ResPartnerAutocompleteSync) (int64, error) { + ids, err := c.CreateResPartnerAutocompleteSyncs([]*ResPartnerAutocompleteSync{rpas}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResPartnerAutocompleteSync creates a new res.partner.autocomplete.sync model and returns its id. +func (c *Client) CreateResPartnerAutocompleteSyncs(rpass []*ResPartnerAutocompleteSync) ([]int64, error) { + var vv []interface{} + for _, v := range rpass { + vv = append(vv, v) + } + return c.Create(ResPartnerAutocompleteSyncModel, vv, nil) +} + +// UpdateResPartnerAutocompleteSync updates an existing res.partner.autocomplete.sync record. +func (c *Client) UpdateResPartnerAutocompleteSync(rpas *ResPartnerAutocompleteSync) error { + return c.UpdateResPartnerAutocompleteSyncs([]int64{rpas.Id.Get()}, rpas) +} + +// UpdateResPartnerAutocompleteSyncs updates existing res.partner.autocomplete.sync records. +// All records (represented by ids) will be updated by rpas values. +func (c *Client) UpdateResPartnerAutocompleteSyncs(ids []int64, rpas *ResPartnerAutocompleteSync) error { + return c.Update(ResPartnerAutocompleteSyncModel, ids, rpas, nil) +} + +// DeleteResPartnerAutocompleteSync deletes an existing res.partner.autocomplete.sync record. +func (c *Client) DeleteResPartnerAutocompleteSync(id int64) error { + return c.DeleteResPartnerAutocompleteSyncs([]int64{id}) +} + +// DeleteResPartnerAutocompleteSyncs deletes existing res.partner.autocomplete.sync records. +func (c *Client) DeleteResPartnerAutocompleteSyncs(ids []int64) error { + return c.Delete(ResPartnerAutocompleteSyncModel, ids) +} + +// GetResPartnerAutocompleteSync gets res.partner.autocomplete.sync existing record. +func (c *Client) GetResPartnerAutocompleteSync(id int64) (*ResPartnerAutocompleteSync, error) { + rpass, err := c.GetResPartnerAutocompleteSyncs([]int64{id}) + if err != nil { + return nil, err + } + return &((*rpass)[0]), nil +} + +// GetResPartnerAutocompleteSyncs gets res.partner.autocomplete.sync existing records. +func (c *Client) GetResPartnerAutocompleteSyncs(ids []int64) (*ResPartnerAutocompleteSyncs, error) { + rpass := &ResPartnerAutocompleteSyncs{} + if err := c.Read(ResPartnerAutocompleteSyncModel, ids, nil, rpass); err != nil { + return nil, err + } + return rpass, nil +} + +// FindResPartnerAutocompleteSync finds res.partner.autocomplete.sync record by querying it with criteria. +func (c *Client) FindResPartnerAutocompleteSync(criteria *Criteria) (*ResPartnerAutocompleteSync, error) { + rpass := &ResPartnerAutocompleteSyncs{} + if err := c.SearchRead(ResPartnerAutocompleteSyncModel, criteria, NewOptions().Limit(1), rpass); err != nil { + return nil, err + } + return &((*rpass)[0]), nil +} + +// FindResPartnerAutocompleteSyncs finds res.partner.autocomplete.sync records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResPartnerAutocompleteSyncs(criteria *Criteria, options *Options) (*ResPartnerAutocompleteSyncs, error) { + rpass := &ResPartnerAutocompleteSyncs{} + if err := c.SearchRead(ResPartnerAutocompleteSyncModel, criteria, options, rpass); err != nil { + return nil, err + } + return rpass, nil +} + +// FindResPartnerAutocompleteSyncIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResPartnerAutocompleteSyncIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResPartnerAutocompleteSyncModel, criteria, options) +} + +// FindResPartnerAutocompleteSyncId finds record id by querying it with criteria. +func (c *Client) FindResPartnerAutocompleteSyncId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResPartnerAutocompleteSyncModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_partner_bank.go b/res_partner_bank.go new file mode 100644 index 0000000..07a7e69 --- /dev/null +++ b/res_partner_bank.go @@ -0,0 +1,166 @@ +package odoo + +// ResPartnerBank represents res.partner.bank model. +type ResPartnerBank struct { + AccHolderName *String `xmlrpc:"acc_holder_name,omitempty"` + AccNumber *String `xmlrpc:"acc_number,omitempty"` + AccType *Selection `xmlrpc:"acc_type,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AllowOutPayment *Bool `xmlrpc:"allow_out_payment,omitempty"` + BankBic *String `xmlrpc:"bank_bic,omitempty"` + BankId *Many2One `xmlrpc:"bank_id,omitempty"` + BankName *String `xmlrpc:"bank_name,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasIbanWarning *Bool `xmlrpc:"has_iban_warning,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + HasMoneyTransferWarning *Bool `xmlrpc:"has_money_transfer_warning,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalId *Relation `xmlrpc:"journal_id,omitempty"` + L10NChDisplayQrBankOptions *Bool `xmlrpc:"l10n_ch_display_qr_bank_options,omitempty"` + L10NChQrIban *String `xmlrpc:"l10n_ch_qr_iban,omitempty"` + LockTrustFields *Bool `xmlrpc:"lock_trust_fields,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MoneyTransferService *String `xmlrpc:"money_transfer_service,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + PartnerCountryName *String `xmlrpc:"partner_country_name,omitempty"` + PartnerCustomerRank *Int `xmlrpc:"partner_customer_rank,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerSupplierRank *Int `xmlrpc:"partner_supplier_rank,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + RelatedMoves *Relation `xmlrpc:"related_moves,omitempty"` + SanitizedAccNumber *String `xmlrpc:"sanitized_acc_number,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + UserHasGroupValidateBankAccount *Bool `xmlrpc:"user_has_group_validate_bank_account,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResPartnerBanks represents array of res.partner.bank model. +type ResPartnerBanks []ResPartnerBank + +// ResPartnerBankModel is the odoo model name. +const ResPartnerBankModel = "res.partner.bank" + +// Many2One convert ResPartnerBank to *Many2One. +func (rpb *ResPartnerBank) Many2One() *Many2One { + return NewMany2One(rpb.Id.Get(), "") +} + +// CreateResPartnerBank creates a new res.partner.bank model and returns its id. +func (c *Client) CreateResPartnerBank(rpb *ResPartnerBank) (int64, error) { + ids, err := c.CreateResPartnerBanks([]*ResPartnerBank{rpb}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResPartnerBank creates a new res.partner.bank model and returns its id. +func (c *Client) CreateResPartnerBanks(rpbs []*ResPartnerBank) ([]int64, error) { + var vv []interface{} + for _, v := range rpbs { + vv = append(vv, v) + } + return c.Create(ResPartnerBankModel, vv, nil) +} + +// UpdateResPartnerBank updates an existing res.partner.bank record. +func (c *Client) UpdateResPartnerBank(rpb *ResPartnerBank) error { + return c.UpdateResPartnerBanks([]int64{rpb.Id.Get()}, rpb) +} + +// UpdateResPartnerBanks updates existing res.partner.bank records. +// All records (represented by ids) will be updated by rpb values. +func (c *Client) UpdateResPartnerBanks(ids []int64, rpb *ResPartnerBank) error { + return c.Update(ResPartnerBankModel, ids, rpb, nil) +} + +// DeleteResPartnerBank deletes an existing res.partner.bank record. +func (c *Client) DeleteResPartnerBank(id int64) error { + return c.DeleteResPartnerBanks([]int64{id}) +} + +// DeleteResPartnerBanks deletes existing res.partner.bank records. +func (c *Client) DeleteResPartnerBanks(ids []int64) error { + return c.Delete(ResPartnerBankModel, ids) +} + +// GetResPartnerBank gets res.partner.bank existing record. +func (c *Client) GetResPartnerBank(id int64) (*ResPartnerBank, error) { + rpbs, err := c.GetResPartnerBanks([]int64{id}) + if err != nil { + return nil, err + } + return &((*rpbs)[0]), nil +} + +// GetResPartnerBanks gets res.partner.bank existing records. +func (c *Client) GetResPartnerBanks(ids []int64) (*ResPartnerBanks, error) { + rpbs := &ResPartnerBanks{} + if err := c.Read(ResPartnerBankModel, ids, nil, rpbs); err != nil { + return nil, err + } + return rpbs, nil +} + +// FindResPartnerBank finds res.partner.bank record by querying it with criteria. +func (c *Client) FindResPartnerBank(criteria *Criteria) (*ResPartnerBank, error) { + rpbs := &ResPartnerBanks{} + if err := c.SearchRead(ResPartnerBankModel, criteria, NewOptions().Limit(1), rpbs); err != nil { + return nil, err + } + return &((*rpbs)[0]), nil +} + +// FindResPartnerBanks finds res.partner.bank records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResPartnerBanks(criteria *Criteria, options *Options) (*ResPartnerBanks, error) { + rpbs := &ResPartnerBanks{} + if err := c.SearchRead(ResPartnerBankModel, criteria, options, rpbs); err != nil { + return nil, err + } + return rpbs, nil +} + +// FindResPartnerBankIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResPartnerBankIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResPartnerBankModel, criteria, options) +} + +// FindResPartnerBankId finds record id by querying it with criteria. +func (c *Client) FindResPartnerBankId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResPartnerBankModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_partner_category.go b/res_partner_category.go new file mode 100644 index 0000000..37ee428 --- /dev/null +++ b/res_partner_category.go @@ -0,0 +1,123 @@ +package odoo + +// ResPartnerCategory represents res.partner.category model. +type ResPartnerCategory struct { + Active *Bool `xmlrpc:"active,omitempty"` + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + ParentPath *String `xmlrpc:"parent_path,omitempty"` + PartnerIds *Relation `xmlrpc:"partner_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResPartnerCategorys represents array of res.partner.category model. +type ResPartnerCategorys []ResPartnerCategory + +// ResPartnerCategoryModel is the odoo model name. +const ResPartnerCategoryModel = "res.partner.category" + +// Many2One convert ResPartnerCategory to *Many2One. +func (rpc *ResPartnerCategory) Many2One() *Many2One { + return NewMany2One(rpc.Id.Get(), "") +} + +// CreateResPartnerCategory creates a new res.partner.category model and returns its id. +func (c *Client) CreateResPartnerCategory(rpc *ResPartnerCategory) (int64, error) { + ids, err := c.CreateResPartnerCategorys([]*ResPartnerCategory{rpc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResPartnerCategory creates a new res.partner.category model and returns its id. +func (c *Client) CreateResPartnerCategorys(rpcs []*ResPartnerCategory) ([]int64, error) { + var vv []interface{} + for _, v := range rpcs { + vv = append(vv, v) + } + return c.Create(ResPartnerCategoryModel, vv, nil) +} + +// UpdateResPartnerCategory updates an existing res.partner.category record. +func (c *Client) UpdateResPartnerCategory(rpc *ResPartnerCategory) error { + return c.UpdateResPartnerCategorys([]int64{rpc.Id.Get()}, rpc) +} + +// UpdateResPartnerCategorys updates existing res.partner.category records. +// All records (represented by ids) will be updated by rpc values. +func (c *Client) UpdateResPartnerCategorys(ids []int64, rpc *ResPartnerCategory) error { + return c.Update(ResPartnerCategoryModel, ids, rpc, nil) +} + +// DeleteResPartnerCategory deletes an existing res.partner.category record. +func (c *Client) DeleteResPartnerCategory(id int64) error { + return c.DeleteResPartnerCategorys([]int64{id}) +} + +// DeleteResPartnerCategorys deletes existing res.partner.category records. +func (c *Client) DeleteResPartnerCategorys(ids []int64) error { + return c.Delete(ResPartnerCategoryModel, ids) +} + +// GetResPartnerCategory gets res.partner.category existing record. +func (c *Client) GetResPartnerCategory(id int64) (*ResPartnerCategory, error) { + rpcs, err := c.GetResPartnerCategorys([]int64{id}) + if err != nil { + return nil, err + } + return &((*rpcs)[0]), nil +} + +// GetResPartnerCategorys gets res.partner.category existing records. +func (c *Client) GetResPartnerCategorys(ids []int64) (*ResPartnerCategorys, error) { + rpcs := &ResPartnerCategorys{} + if err := c.Read(ResPartnerCategoryModel, ids, nil, rpcs); err != nil { + return nil, err + } + return rpcs, nil +} + +// FindResPartnerCategory finds res.partner.category record by querying it with criteria. +func (c *Client) FindResPartnerCategory(criteria *Criteria) (*ResPartnerCategory, error) { + rpcs := &ResPartnerCategorys{} + if err := c.SearchRead(ResPartnerCategoryModel, criteria, NewOptions().Limit(1), rpcs); err != nil { + return nil, err + } + return &((*rpcs)[0]), nil +} + +// FindResPartnerCategorys finds res.partner.category records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResPartnerCategorys(criteria *Criteria, options *Options) (*ResPartnerCategorys, error) { + rpcs := &ResPartnerCategorys{} + if err := c.SearchRead(ResPartnerCategoryModel, criteria, options, rpcs); err != nil { + return nil, err + } + return rpcs, nil +} + +// FindResPartnerCategoryIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResPartnerCategoryIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResPartnerCategoryModel, criteria, options) +} + +// FindResPartnerCategoryId finds record id by querying it with criteria. +func (c *Client) FindResPartnerCategoryId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResPartnerCategoryModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_partner_industry.go b/res_partner_industry.go new file mode 100644 index 0000000..0be799f --- /dev/null +++ b/res_partner_industry.go @@ -0,0 +1,119 @@ +package odoo + +// ResPartnerIndustry represents res.partner.industry model. +type ResPartnerIndustry struct { + Active *Bool `xmlrpc:"active,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FullName *String `xmlrpc:"full_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResPartnerIndustrys represents array of res.partner.industry model. +type ResPartnerIndustrys []ResPartnerIndustry + +// ResPartnerIndustryModel is the odoo model name. +const ResPartnerIndustryModel = "res.partner.industry" + +// Many2One convert ResPartnerIndustry to *Many2One. +func (rpi *ResPartnerIndustry) Many2One() *Many2One { + return NewMany2One(rpi.Id.Get(), "") +} + +// CreateResPartnerIndustry creates a new res.partner.industry model and returns its id. +func (c *Client) CreateResPartnerIndustry(rpi *ResPartnerIndustry) (int64, error) { + ids, err := c.CreateResPartnerIndustrys([]*ResPartnerIndustry{rpi}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResPartnerIndustry creates a new res.partner.industry model and returns its id. +func (c *Client) CreateResPartnerIndustrys(rpis []*ResPartnerIndustry) ([]int64, error) { + var vv []interface{} + for _, v := range rpis { + vv = append(vv, v) + } + return c.Create(ResPartnerIndustryModel, vv, nil) +} + +// UpdateResPartnerIndustry updates an existing res.partner.industry record. +func (c *Client) UpdateResPartnerIndustry(rpi *ResPartnerIndustry) error { + return c.UpdateResPartnerIndustrys([]int64{rpi.Id.Get()}, rpi) +} + +// UpdateResPartnerIndustrys updates existing res.partner.industry records. +// All records (represented by ids) will be updated by rpi values. +func (c *Client) UpdateResPartnerIndustrys(ids []int64, rpi *ResPartnerIndustry) error { + return c.Update(ResPartnerIndustryModel, ids, rpi, nil) +} + +// DeleteResPartnerIndustry deletes an existing res.partner.industry record. +func (c *Client) DeleteResPartnerIndustry(id int64) error { + return c.DeleteResPartnerIndustrys([]int64{id}) +} + +// DeleteResPartnerIndustrys deletes existing res.partner.industry records. +func (c *Client) DeleteResPartnerIndustrys(ids []int64) error { + return c.Delete(ResPartnerIndustryModel, ids) +} + +// GetResPartnerIndustry gets res.partner.industry existing record. +func (c *Client) GetResPartnerIndustry(id int64) (*ResPartnerIndustry, error) { + rpis, err := c.GetResPartnerIndustrys([]int64{id}) + if err != nil { + return nil, err + } + return &((*rpis)[0]), nil +} + +// GetResPartnerIndustrys gets res.partner.industry existing records. +func (c *Client) GetResPartnerIndustrys(ids []int64) (*ResPartnerIndustrys, error) { + rpis := &ResPartnerIndustrys{} + if err := c.Read(ResPartnerIndustryModel, ids, nil, rpis); err != nil { + return nil, err + } + return rpis, nil +} + +// FindResPartnerIndustry finds res.partner.industry record by querying it with criteria. +func (c *Client) FindResPartnerIndustry(criteria *Criteria) (*ResPartnerIndustry, error) { + rpis := &ResPartnerIndustrys{} + if err := c.SearchRead(ResPartnerIndustryModel, criteria, NewOptions().Limit(1), rpis); err != nil { + return nil, err + } + return &((*rpis)[0]), nil +} + +// FindResPartnerIndustrys finds res.partner.industry records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResPartnerIndustrys(criteria *Criteria, options *Options) (*ResPartnerIndustrys, error) { + rpis := &ResPartnerIndustrys{} + if err := c.SearchRead(ResPartnerIndustryModel, criteria, options, rpis); err != nil { + return nil, err + } + return rpis, nil +} + +// FindResPartnerIndustryIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResPartnerIndustryIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResPartnerIndustryModel, criteria, options) +} + +// FindResPartnerIndustryId finds record id by querying it with criteria. +func (c *Client) FindResPartnerIndustryId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResPartnerIndustryModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_partner_title.go b/res_partner_title.go new file mode 100644 index 0000000..c33426d --- /dev/null +++ b/res_partner_title.go @@ -0,0 +1,118 @@ +package odoo + +// ResPartnerTitle represents res.partner.title model. +type ResPartnerTitle struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Shortcut *String `xmlrpc:"shortcut,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResPartnerTitles represents array of res.partner.title model. +type ResPartnerTitles []ResPartnerTitle + +// ResPartnerTitleModel is the odoo model name. +const ResPartnerTitleModel = "res.partner.title" + +// Many2One convert ResPartnerTitle to *Many2One. +func (rpt *ResPartnerTitle) Many2One() *Many2One { + return NewMany2One(rpt.Id.Get(), "") +} + +// CreateResPartnerTitle creates a new res.partner.title model and returns its id. +func (c *Client) CreateResPartnerTitle(rpt *ResPartnerTitle) (int64, error) { + ids, err := c.CreateResPartnerTitles([]*ResPartnerTitle{rpt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResPartnerTitle creates a new res.partner.title model and returns its id. +func (c *Client) CreateResPartnerTitles(rpts []*ResPartnerTitle) ([]int64, error) { + var vv []interface{} + for _, v := range rpts { + vv = append(vv, v) + } + return c.Create(ResPartnerTitleModel, vv, nil) +} + +// UpdateResPartnerTitle updates an existing res.partner.title record. +func (c *Client) UpdateResPartnerTitle(rpt *ResPartnerTitle) error { + return c.UpdateResPartnerTitles([]int64{rpt.Id.Get()}, rpt) +} + +// UpdateResPartnerTitles updates existing res.partner.title records. +// All records (represented by ids) will be updated by rpt values. +func (c *Client) UpdateResPartnerTitles(ids []int64, rpt *ResPartnerTitle) error { + return c.Update(ResPartnerTitleModel, ids, rpt, nil) +} + +// DeleteResPartnerTitle deletes an existing res.partner.title record. +func (c *Client) DeleteResPartnerTitle(id int64) error { + return c.DeleteResPartnerTitles([]int64{id}) +} + +// DeleteResPartnerTitles deletes existing res.partner.title records. +func (c *Client) DeleteResPartnerTitles(ids []int64) error { + return c.Delete(ResPartnerTitleModel, ids) +} + +// GetResPartnerTitle gets res.partner.title existing record. +func (c *Client) GetResPartnerTitle(id int64) (*ResPartnerTitle, error) { + rpts, err := c.GetResPartnerTitles([]int64{id}) + if err != nil { + return nil, err + } + return &((*rpts)[0]), nil +} + +// GetResPartnerTitles gets res.partner.title existing records. +func (c *Client) GetResPartnerTitles(ids []int64) (*ResPartnerTitles, error) { + rpts := &ResPartnerTitles{} + if err := c.Read(ResPartnerTitleModel, ids, nil, rpts); err != nil { + return nil, err + } + return rpts, nil +} + +// FindResPartnerTitle finds res.partner.title record by querying it with criteria. +func (c *Client) FindResPartnerTitle(criteria *Criteria) (*ResPartnerTitle, error) { + rpts := &ResPartnerTitles{} + if err := c.SearchRead(ResPartnerTitleModel, criteria, NewOptions().Limit(1), rpts); err != nil { + return nil, err + } + return &((*rpts)[0]), nil +} + +// FindResPartnerTitles finds res.partner.title records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResPartnerTitles(criteria *Criteria, options *Options) (*ResPartnerTitles, error) { + rpts := &ResPartnerTitles{} + if err := c.SearchRead(ResPartnerTitleModel, criteria, options, rpts); err != nil { + return nil, err + } + return rpts, nil +} + +// FindResPartnerTitleIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResPartnerTitleIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResPartnerTitleModel, criteria, options) +} + +// FindResPartnerTitleId finds record id by querying it with criteria. +func (c *Client) FindResPartnerTitleId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResPartnerTitleModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_users.go b/res_users.go new file mode 100644 index 0000000..383486c --- /dev/null +++ b/res_users.go @@ -0,0 +1,396 @@ +package odoo + +// ResUsers represents res.users model. +type ResUsers struct { + AccessesCount *Int `xmlrpc:"accesses_count,omitempty"` + ActionId *Many2One `xmlrpc:"action_id,omitempty"` + Active *Bool `xmlrpc:"active,omitempty"` + ActiveLangCount *Int `xmlrpc:"active_lang_count,omitempty"` + ActivePartner *Bool `xmlrpc:"active_partner,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AdditionalInfo *String `xmlrpc:"additional_info,omitempty"` + AdditionalNote *String `xmlrpc:"additional_note,omitempty"` + AddressId *Many2One `xmlrpc:"address_id,omitempty"` + AllocationCount *Float `xmlrpc:"allocation_count,omitempty"` + AllocationDisplay *String `xmlrpc:"allocation_display,omitempty"` + AllocationRemainingDisplay *String `xmlrpc:"allocation_remaining_display,omitempty"` + ApiKeyIds *Relation `xmlrpc:"api_key_ids,omitempty"` + AutopostBills *Selection `xmlrpc:"autopost_bills,omitempty"` + Avatar1024 *String `xmlrpc:"avatar_1024,omitempty"` + Avatar128 *String `xmlrpc:"avatar_128,omitempty"` + Avatar1920 *String `xmlrpc:"avatar_1920,omitempty"` + Avatar256 *String `xmlrpc:"avatar_256,omitempty"` + Avatar512 *String `xmlrpc:"avatar_512,omitempty"` + BankAccountCount *Int `xmlrpc:"bank_account_count,omitempty"` + BankAccountId *Many2One `xmlrpc:"bank_account_id,omitempty"` + BankIds *Relation `xmlrpc:"bank_ids,omitempty"` + Barcode *String `xmlrpc:"barcode,omitempty"` + Birthday *Time `xmlrpc:"birthday,omitempty"` + BuyerId *Many2One `xmlrpc:"buyer_id,omitempty"` + CalendarDefaultPrivacy *Selection `xmlrpc:"calendar_default_privacy,omitempty"` + CalendarLastNotifAck *Time `xmlrpc:"calendar_last_notif_ack,omitempty"` + CanEdit *Bool `xmlrpc:"can_edit,omitempty"` + CategoryId *Relation `xmlrpc:"category_id,omitempty"` + CategoryIds *Relation `xmlrpc:"category_ids,omitempty"` + Certificate *Selection `xmlrpc:"certificate,omitempty"` + ChannelIds *Relation `xmlrpc:"channel_ids,omitempty"` + ChildIds *Relation `xmlrpc:"child_ids,omitempty"` + Children *Int `xmlrpc:"children,omitempty"` + City *String `xmlrpc:"city,omitempty"` + CoachId *Many2One `xmlrpc:"coach_id,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + Comment *String `xmlrpc:"comment,omitempty"` + CommercialCompanyName *String `xmlrpc:"commercial_company_name,omitempty"` + CommercialPartnerId *Many2One `xmlrpc:"commercial_partner_id,omitempty"` + CompaniesCount *Int `xmlrpc:"companies_count,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanyIds *Relation `xmlrpc:"company_ids,omitempty"` + CompanyName *String `xmlrpc:"company_name,omitempty"` + CompanyRegistry *String `xmlrpc:"company_registry,omitempty"` + CompanyType *Selection `xmlrpc:"company_type,omitempty"` + CompleteName *String `xmlrpc:"complete_name,omitempty"` + ContactAddress *String `xmlrpc:"contact_address,omitempty"` + ContactAddressInline *String `xmlrpc:"contact_address_inline,omitempty"` + ContractIds *Relation `xmlrpc:"contract_ids,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CountryOfBirth *Many2One `xmlrpc:"country_of_birth,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateEmployee *Bool `xmlrpc:"create_employee,omitempty"` + CreateEmployeeId *Many2One `xmlrpc:"create_employee_id,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Credit *Float `xmlrpc:"credit,omitempty"` + CreditLimit *Float `xmlrpc:"credit_limit,omitempty"` + CreditToInvoice *Float `xmlrpc:"credit_to_invoice,omitempty"` + CrmTeamIds *Relation `xmlrpc:"crm_team_ids,omitempty"` + CrmTeamMemberIds *Relation `xmlrpc:"crm_team_member_ids,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + CurrentLeaveState *Selection `xmlrpc:"current_leave_state,omitempty"` + CustomerRank *Int `xmlrpc:"customer_rank,omitempty"` + DaysSalesOutstanding *Float `xmlrpc:"days_sales_outstanding,omitempty"` + Debit *Float `xmlrpc:"debit,omitempty"` + DebitLimit *Float `xmlrpc:"debit_limit,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DeviceIds *Relation `xmlrpc:"device_ids,omitempty"` + DisplayInvoiceEdiFormat *Bool `xmlrpc:"display_invoice_edi_format,omitempty"` + DisplayInvoiceTemplatePdfReportId *Bool `xmlrpc:"display_invoice_template_pdf_report_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DistanceHomeWork *Int `xmlrpc:"distance_home_work,omitempty"` + DistanceHomeWorkUnit *Selection `xmlrpc:"distance_home_work_unit,omitempty"` + DuplicatedBankAccountPartnersCount *Int `xmlrpc:"duplicated_bank_account_partners_count,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + EmailFormatted *String `xmlrpc:"email_formatted,omitempty"` + EmailNormalized *String `xmlrpc:"email_normalized,omitempty"` + EmergencyContact *String `xmlrpc:"emergency_contact,omitempty"` + EmergencyPhone *String `xmlrpc:"emergency_phone,omitempty"` + Employee *Bool `xmlrpc:"employee,omitempty"` + EmployeeBankAccountId *Many2One `xmlrpc:"employee_bank_account_id,omitempty"` + EmployeeCount *Int `xmlrpc:"employee_count,omitempty"` + EmployeeCountryId *Many2One `xmlrpc:"employee_country_id,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + EmployeeIds *Relation `xmlrpc:"employee_ids,omitempty"` + EmployeeParentId *Many2One `xmlrpc:"employee_parent_id,omitempty"` + EmployeeResourceCalendarId *Many2One `xmlrpc:"employee_resource_calendar_id,omitempty"` + EmployeeSkillIds *Relation `xmlrpc:"employee_skill_ids,omitempty"` + EmployeeType *Selection `xmlrpc:"employee_type,omitempty"` + EmployeesCount *Int `xmlrpc:"employees_count,omitempty"` + ExpenseManagerId *Many2One `xmlrpc:"expense_manager_id,omitempty"` + FiscalCountryCodes *String `xmlrpc:"fiscal_country_codes,omitempty"` + Function *String `xmlrpc:"function,omitempty"` + Gender *Selection `xmlrpc:"gender,omitempty"` + GroupsCount *Int `xmlrpc:"groups_count,omitempty"` + GroupsId *Relation `xmlrpc:"groups_id,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + HrIconDisplay *Selection `xmlrpc:"hr_icon_display,omitempty"` + HrPresenceState *Selection `xmlrpc:"hr_presence_state,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IdentificationId *String `xmlrpc:"identification_id,omitempty"` + IgnoreAbnormalInvoiceAmount *Bool `xmlrpc:"ignore_abnormal_invoice_amount,omitempty"` + IgnoreAbnormalInvoiceDate *Bool `xmlrpc:"ignore_abnormal_invoice_date,omitempty"` + ImStatus *String `xmlrpc:"im_status,omitempty"` + Image1024 *String `xmlrpc:"image_1024,omitempty"` + Image128 *String `xmlrpc:"image_128,omitempty"` + Image1920 *String `xmlrpc:"image_1920,omitempty"` + Image256 *String `xmlrpc:"image_256,omitempty"` + Image512 *String `xmlrpc:"image_512,omitempty"` + IndustryId *Many2One `xmlrpc:"industry_id,omitempty"` + InvoiceEdiFormat *Selection `xmlrpc:"invoice_edi_format,omitempty"` + InvoiceEdiFormatStore *String `xmlrpc:"invoice_edi_format_store,omitempty"` + InvoiceIds *Relation `xmlrpc:"invoice_ids,omitempty"` + InvoiceSendingMethod *Selection `xmlrpc:"invoice_sending_method,omitempty"` + InvoiceTemplatePdfReportId *Many2One `xmlrpc:"invoice_template_pdf_report_id,omitempty"` + InvoiceWarn *Selection `xmlrpc:"invoice_warn,omitempty"` + InvoiceWarnMsg *String `xmlrpc:"invoice_warn_msg,omitempty"` + IsAbsent *Bool `xmlrpc:"is_absent,omitempty"` + IsBlacklisted *Bool `xmlrpc:"is_blacklisted,omitempty"` + IsCompany *Bool `xmlrpc:"is_company,omitempty"` + IsPeppolEdiFormat *Bool `xmlrpc:"is_peppol_edi_format,omitempty"` + IsPublic *Bool `xmlrpc:"is_public,omitempty"` + IsSystem *Bool `xmlrpc:"is_system,omitempty"` + IsUblFormat *Bool `xmlrpc:"is_ubl_format,omitempty"` + JobTitle *String `xmlrpc:"job_title,omitempty"` + JournalItemCount *Int `xmlrpc:"journal_item_count,omitempty"` + KmHomeWork *Int `xmlrpc:"km_home_work,omitempty"` + Lang *Selection `xmlrpc:"lang,omitempty"` + LastActivity *Time `xmlrpc:"last_activity,omitempty"` + LastActivityTime *String `xmlrpc:"last_activity_time,omitempty"` + LeaveDateTo *Time `xmlrpc:"leave_date_to,omitempty"` + LeaveManagerId *Many2One `xmlrpc:"leave_manager_id,omitempty"` + LogIds *Relation `xmlrpc:"log_ids,omitempty"` + Login *String `xmlrpc:"login,omitempty"` + LoginDate *Time `xmlrpc:"login_date,omitempty"` + Marital *Selection `xmlrpc:"marital,omitempty"` + MeetingCount *Int `xmlrpc:"meeting_count,omitempty"` + MeetingIds *Relation `xmlrpc:"meeting_ids,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageBounce *Int `xmlrpc:"message_bounce,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + Mobile *String `xmlrpc:"mobile,omitempty"` + MobileBlacklisted *Bool `xmlrpc:"mobile_blacklisted,omitempty"` + MobilePhone *String `xmlrpc:"mobile_phone,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NewPassword *String `xmlrpc:"new_password,omitempty"` + NotificationType *Selection `xmlrpc:"notification_type,omitempty"` + OdoobotFailed *Bool `xmlrpc:"odoobot_failed,omitempty"` + OdoobotState *Selection `xmlrpc:"odoobot_state,omitempty"` + OpportunityCount *Int `xmlrpc:"opportunity_count,omitempty"` + OpportunityIds *Relation `xmlrpc:"opportunity_ids,omitempty"` + ParentId *Many2One `xmlrpc:"parent_id,omitempty"` + ParentName *String `xmlrpc:"parent_name,omitempty"` + PartnerGid *Int `xmlrpc:"partner_gid,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerLatitude *Float `xmlrpc:"partner_latitude,omitempty"` + PartnerLongitude *Float `xmlrpc:"partner_longitude,omitempty"` + PartnerShare *Bool `xmlrpc:"partner_share,omitempty"` + PartnerVatPlaceholder *String `xmlrpc:"partner_vat_placeholder,omitempty"` + PassportId *String `xmlrpc:"passport_id,omitempty"` + Password *String `xmlrpc:"password,omitempty"` + PaymentTokenCount *Int `xmlrpc:"payment_token_count,omitempty"` + PaymentTokenIds *Relation `xmlrpc:"payment_token_ids,omitempty"` + PeppolEas *Selection `xmlrpc:"peppol_eas,omitempty"` + PeppolEndpoint *String `xmlrpc:"peppol_endpoint,omitempty"` + PermitNo *String `xmlrpc:"permit_no,omitempty"` + Phone *String `xmlrpc:"phone,omitempty"` + PhoneBlacklisted *Bool `xmlrpc:"phone_blacklisted,omitempty"` + PhoneMobileSearch *String `xmlrpc:"phone_mobile_search,omitempty"` + PhoneSanitized *String `xmlrpc:"phone_sanitized,omitempty"` + PhoneSanitizedBlacklisted *Bool `xmlrpc:"phone_sanitized_blacklisted,omitempty"` + Pin *String `xmlrpc:"pin,omitempty"` + PlaceOfBirth *String `xmlrpc:"place_of_birth,omitempty"` + PrivateCity *String `xmlrpc:"private_city,omitempty"` + PrivateCountryId *Many2One `xmlrpc:"private_country_id,omitempty"` + PrivateEmail *String `xmlrpc:"private_email,omitempty"` + PrivateLang *Selection `xmlrpc:"private_lang,omitempty"` + PrivatePhone *String `xmlrpc:"private_phone,omitempty"` + PrivateStateId *Many2One `xmlrpc:"private_state_id,omitempty"` + PrivateStreet *String `xmlrpc:"private_street,omitempty"` + PrivateStreet2 *String `xmlrpc:"private_street2,omitempty"` + PrivateZip *String `xmlrpc:"private_zip,omitempty"` + ProjectIds *Relation `xmlrpc:"project_ids,omitempty"` + PropertyAccountPayableId *Many2One `xmlrpc:"property_account_payable_id,omitempty"` + PropertyAccountPositionId *Many2One `xmlrpc:"property_account_position_id,omitempty"` + PropertyAccountReceivableId *Many2One `xmlrpc:"property_account_receivable_id,omitempty"` + PropertyInboundPaymentMethodLineId *Many2One `xmlrpc:"property_inbound_payment_method_line_id,omitempty"` + PropertyOutboundPaymentMethodLineId *Many2One `xmlrpc:"property_outbound_payment_method_line_id,omitempty"` + PropertyPaymentTermId *Many2One `xmlrpc:"property_payment_term_id,omitempty"` + PropertyProductPricelist *Many2One `xmlrpc:"property_product_pricelist,omitempty"` + PropertyPurchaseCurrencyId *Many2One `xmlrpc:"property_purchase_currency_id,omitempty"` + PropertySupplierPaymentTermId *Many2One `xmlrpc:"property_supplier_payment_term_id,omitempty"` + PurchaseOrderCount *Int `xmlrpc:"purchase_order_count,omitempty"` + PurchaseWarn *Selection `xmlrpc:"purchase_warn,omitempty"` + PurchaseWarnMsg *String `xmlrpc:"purchase_warn_msg,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + ReceiptReminderEmail *Bool `xmlrpc:"receipt_reminder_email,omitempty"` + Ref *String `xmlrpc:"ref,omitempty"` + RefCompanyIds *Relation `xmlrpc:"ref_company_ids,omitempty"` + ReminderDateBeforeReceipt *Int `xmlrpc:"reminder_date_before_receipt,omitempty"` + ResUsersSettingsId *Many2One `xmlrpc:"res_users_settings_id,omitempty"` + ResUsersSettingsIds *Relation `xmlrpc:"res_users_settings_ids,omitempty"` + ResourceCalendarId *Many2One `xmlrpc:"resource_calendar_id,omitempty"` + ResourceIds *Relation `xmlrpc:"resource_ids,omitempty"` + ResumeLineIds *Relation `xmlrpc:"resume_line_ids,omitempty"` + RulesCount *Int `xmlrpc:"rules_count,omitempty"` + SaleOrderCount *Int `xmlrpc:"sale_order_count,omitempty"` + SaleOrderIds *Relation `xmlrpc:"sale_order_ids,omitempty"` + SaleTeamId *Many2One `xmlrpc:"sale_team_id,omitempty"` + SaleWarn *Selection `xmlrpc:"sale_warn,omitempty"` + SaleWarnMsg *String `xmlrpc:"sale_warn_msg,omitempty"` + SameCompanyRegistryPartnerId *Many2One `xmlrpc:"same_company_registry_partner_id,omitempty"` + SameVatPartnerId *Many2One `xmlrpc:"same_vat_partner_id,omitempty"` + Self *Many2One `xmlrpc:"self,omitempty"` + Share *Bool `xmlrpc:"share,omitempty"` + ShowCreditLimit *Bool `xmlrpc:"show_credit_limit,omitempty"` + ShowLeaves *Bool `xmlrpc:"show_leaves,omitempty"` + Signature *String `xmlrpc:"signature,omitempty"` + SignupType *String `xmlrpc:"signup_type,omitempty"` + SpecificPropertyProductPricelist *Many2One `xmlrpc:"specific_property_product_pricelist,omitempty"` + SpouseBirthdate *Time `xmlrpc:"spouse_birthdate,omitempty"` + SpouseCompleteName *String `xmlrpc:"spouse_complete_name,omitempty"` + Ssnid *String `xmlrpc:"ssnid,omitempty"` + StarredMessageIds *Relation `xmlrpc:"starred_message_ids,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StateId *Many2One `xmlrpc:"state_id,omitempty"` + Street *String `xmlrpc:"street,omitempty"` + Street2 *String `xmlrpc:"street2,omitempty"` + StudyField *String `xmlrpc:"study_field,omitempty"` + StudySchool *String `xmlrpc:"study_school,omitempty"` + SupplierInvoiceCount *Int `xmlrpc:"supplier_invoice_count,omitempty"` + SupplierRank *Int `xmlrpc:"supplier_rank,omitempty"` + TargetSalesDone *Int `xmlrpc:"target_sales_done,omitempty"` + TargetSalesInvoiced *Int `xmlrpc:"target_sales_invoiced,omitempty"` + TargetSalesWon *Int `xmlrpc:"target_sales_won,omitempty"` + TaskCount *Int `xmlrpc:"task_count,omitempty"` + TaskIds *Relation `xmlrpc:"task_ids,omitempty"` + Title *Many2One `xmlrpc:"title,omitempty"` + TotalInvoiced *Float `xmlrpc:"total_invoiced,omitempty"` + TotpEnabled *Bool `xmlrpc:"totp_enabled,omitempty"` + TotpSecret *String `xmlrpc:"totp_secret,omitempty"` + TotpTrustedDeviceIds *Relation `xmlrpc:"totp_trusted_device_ids,omitempty"` + TourEnabled *Bool `xmlrpc:"tour_enabled,omitempty"` + Trust *Selection `xmlrpc:"trust,omitempty"` + Type *Selection `xmlrpc:"type,omitempty"` + Tz *Selection `xmlrpc:"tz,omitempty"` + TzOffset *String `xmlrpc:"tz_offset,omitempty"` + UsePartnerCreditLimit *Bool `xmlrpc:"use_partner_credit_limit,omitempty"` + UserGroupWarning *String `xmlrpc:"user_group_warning,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + UserIds *Relation `xmlrpc:"user_ids,omitempty"` + Vat *String `xmlrpc:"vat,omitempty"` + Vehicle *String `xmlrpc:"vehicle,omitempty"` + VisaExpire *Time `xmlrpc:"visa_expire,omitempty"` + VisaNo *String `xmlrpc:"visa_no,omitempty"` + Website *String `xmlrpc:"website,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WorkContactId *Many2One `xmlrpc:"work_contact_id,omitempty"` + WorkEmail *String `xmlrpc:"work_email,omitempty"` + WorkLocationId *Many2One `xmlrpc:"work_location_id,omitempty"` + WorkLocationName *String `xmlrpc:"work_location_name,omitempty"` + WorkLocationType *Selection `xmlrpc:"work_location_type,omitempty"` + WorkPhone *String `xmlrpc:"work_phone,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + Zip *String `xmlrpc:"zip,omitempty"` +} + +// ResUserss represents array of res.users model. +type ResUserss []ResUsers + +// ResUsersModel is the odoo model name. +const ResUsersModel = "res.users" + +// Many2One convert ResUsers to *Many2One. +func (ru *ResUsers) Many2One() *Many2One { + return NewMany2One(ru.Id.Get(), "") +} + +// CreateResUsers creates a new res.users model and returns its id. +func (c *Client) CreateResUsers(ru *ResUsers) (int64, error) { + ids, err := c.CreateResUserss([]*ResUsers{ru}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResUsers creates a new res.users model and returns its id. +func (c *Client) CreateResUserss(rus []*ResUsers) ([]int64, error) { + var vv []interface{} + for _, v := range rus { + vv = append(vv, v) + } + return c.Create(ResUsersModel, vv, nil) +} + +// UpdateResUsers updates an existing res.users record. +func (c *Client) UpdateResUsers(ru *ResUsers) error { + return c.UpdateResUserss([]int64{ru.Id.Get()}, ru) +} + +// UpdateResUserss updates existing res.users records. +// All records (represented by ids) will be updated by ru values. +func (c *Client) UpdateResUserss(ids []int64, ru *ResUsers) error { + return c.Update(ResUsersModel, ids, ru, nil) +} + +// DeleteResUsers deletes an existing res.users record. +func (c *Client) DeleteResUsers(id int64) error { + return c.DeleteResUserss([]int64{id}) +} + +// DeleteResUserss deletes existing res.users records. +func (c *Client) DeleteResUserss(ids []int64) error { + return c.Delete(ResUsersModel, ids) +} + +// GetResUsers gets res.users existing record. +func (c *Client) GetResUsers(id int64) (*ResUsers, error) { + rus, err := c.GetResUserss([]int64{id}) + if err != nil { + return nil, err + } + return &((*rus)[0]), nil +} + +// GetResUserss gets res.users existing records. +func (c *Client) GetResUserss(ids []int64) (*ResUserss, error) { + rus := &ResUserss{} + if err := c.Read(ResUsersModel, ids, nil, rus); err != nil { + return nil, err + } + return rus, nil +} + +// FindResUsers finds res.users record by querying it with criteria. +func (c *Client) FindResUsers(criteria *Criteria) (*ResUsers, error) { + rus := &ResUserss{} + if err := c.SearchRead(ResUsersModel, criteria, NewOptions().Limit(1), rus); err != nil { + return nil, err + } + return &((*rus)[0]), nil +} + +// FindResUserss finds res.users records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUserss(criteria *Criteria, options *Options) (*ResUserss, error) { + rus := &ResUserss{} + if err := c.SearchRead(ResUsersModel, criteria, options, rus); err != nil { + return nil, err + } + return rus, nil +} + +// FindResUsersIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResUsersModel, criteria, options) +} + +// FindResUsersId finds record id by querying it with criteria. +func (c *Client) FindResUsersId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResUsersModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_users_apikeys.go b/res_users_apikeys.go new file mode 100644 index 0000000..0cd03ed --- /dev/null +++ b/res_users_apikeys.go @@ -0,0 +1,117 @@ +package odoo + +// ResUsersApikeys represents res.users.apikeys model. +type ResUsersApikeys struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExpirationDate *Time `xmlrpc:"expiration_date,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Scope *String `xmlrpc:"scope,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` +} + +// ResUsersApikeyss represents array of res.users.apikeys model. +type ResUsersApikeyss []ResUsersApikeys + +// ResUsersApikeysModel is the odoo model name. +const ResUsersApikeysModel = "res.users.apikeys" + +// Many2One convert ResUsersApikeys to *Many2One. +func (rua *ResUsersApikeys) Many2One() *Many2One { + return NewMany2One(rua.Id.Get(), "") +} + +// CreateResUsersApikeys creates a new res.users.apikeys model and returns its id. +func (c *Client) CreateResUsersApikeys(rua *ResUsersApikeys) (int64, error) { + ids, err := c.CreateResUsersApikeyss([]*ResUsersApikeys{rua}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResUsersApikeys creates a new res.users.apikeys model and returns its id. +func (c *Client) CreateResUsersApikeyss(ruas []*ResUsersApikeys) ([]int64, error) { + var vv []interface{} + for _, v := range ruas { + vv = append(vv, v) + } + return c.Create(ResUsersApikeysModel, vv, nil) +} + +// UpdateResUsersApikeys updates an existing res.users.apikeys record. +func (c *Client) UpdateResUsersApikeys(rua *ResUsersApikeys) error { + return c.UpdateResUsersApikeyss([]int64{rua.Id.Get()}, rua) +} + +// UpdateResUsersApikeyss updates existing res.users.apikeys records. +// All records (represented by ids) will be updated by rua values. +func (c *Client) UpdateResUsersApikeyss(ids []int64, rua *ResUsersApikeys) error { + return c.Update(ResUsersApikeysModel, ids, rua, nil) +} + +// DeleteResUsersApikeys deletes an existing res.users.apikeys record. +func (c *Client) DeleteResUsersApikeys(id int64) error { + return c.DeleteResUsersApikeyss([]int64{id}) +} + +// DeleteResUsersApikeyss deletes existing res.users.apikeys records. +func (c *Client) DeleteResUsersApikeyss(ids []int64) error { + return c.Delete(ResUsersApikeysModel, ids) +} + +// GetResUsersApikeys gets res.users.apikeys existing record. +func (c *Client) GetResUsersApikeys(id int64) (*ResUsersApikeys, error) { + ruas, err := c.GetResUsersApikeyss([]int64{id}) + if err != nil { + return nil, err + } + return &((*ruas)[0]), nil +} + +// GetResUsersApikeyss gets res.users.apikeys existing records. +func (c *Client) GetResUsersApikeyss(ids []int64) (*ResUsersApikeyss, error) { + ruas := &ResUsersApikeyss{} + if err := c.Read(ResUsersApikeysModel, ids, nil, ruas); err != nil { + return nil, err + } + return ruas, nil +} + +// FindResUsersApikeys finds res.users.apikeys record by querying it with criteria. +func (c *Client) FindResUsersApikeys(criteria *Criteria) (*ResUsersApikeys, error) { + ruas := &ResUsersApikeyss{} + if err := c.SearchRead(ResUsersApikeysModel, criteria, NewOptions().Limit(1), ruas); err != nil { + return nil, err + } + return &((*ruas)[0]), nil +} + +// FindResUsersApikeyss finds res.users.apikeys records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersApikeyss(criteria *Criteria, options *Options) (*ResUsersApikeyss, error) { + ruas := &ResUsersApikeyss{} + if err := c.SearchRead(ResUsersApikeysModel, criteria, options, ruas); err != nil { + return nil, err + } + return ruas, nil +} + +// FindResUsersApikeysIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersApikeysIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResUsersApikeysModel, criteria, options) +} + +// FindResUsersApikeysId finds record id by querying it with criteria. +func (c *Client) FindResUsersApikeysId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResUsersApikeysModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_users_apikeys_description.go b/res_users_apikeys_description.go new file mode 100644 index 0000000..bbedd95 --- /dev/null +++ b/res_users_apikeys_description.go @@ -0,0 +1,119 @@ +package odoo + +// ResUsersApikeysDescription represents res.users.apikeys.description model. +type ResUsersApikeysDescription struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Duration *Selection `xmlrpc:"duration,omitempty"` + ExpirationDate *Time `xmlrpc:"expiration_date,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResUsersApikeysDescriptions represents array of res.users.apikeys.description model. +type ResUsersApikeysDescriptions []ResUsersApikeysDescription + +// ResUsersApikeysDescriptionModel is the odoo model name. +const ResUsersApikeysDescriptionModel = "res.users.apikeys.description" + +// Many2One convert ResUsersApikeysDescription to *Many2One. +func (ruad *ResUsersApikeysDescription) Many2One() *Many2One { + return NewMany2One(ruad.Id.Get(), "") +} + +// CreateResUsersApikeysDescription creates a new res.users.apikeys.description model and returns its id. +func (c *Client) CreateResUsersApikeysDescription(ruad *ResUsersApikeysDescription) (int64, error) { + ids, err := c.CreateResUsersApikeysDescriptions([]*ResUsersApikeysDescription{ruad}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResUsersApikeysDescription creates a new res.users.apikeys.description model and returns its id. +func (c *Client) CreateResUsersApikeysDescriptions(ruads []*ResUsersApikeysDescription) ([]int64, error) { + var vv []interface{} + for _, v := range ruads { + vv = append(vv, v) + } + return c.Create(ResUsersApikeysDescriptionModel, vv, nil) +} + +// UpdateResUsersApikeysDescription updates an existing res.users.apikeys.description record. +func (c *Client) UpdateResUsersApikeysDescription(ruad *ResUsersApikeysDescription) error { + return c.UpdateResUsersApikeysDescriptions([]int64{ruad.Id.Get()}, ruad) +} + +// UpdateResUsersApikeysDescriptions updates existing res.users.apikeys.description records. +// All records (represented by ids) will be updated by ruad values. +func (c *Client) UpdateResUsersApikeysDescriptions(ids []int64, ruad *ResUsersApikeysDescription) error { + return c.Update(ResUsersApikeysDescriptionModel, ids, ruad, nil) +} + +// DeleteResUsersApikeysDescription deletes an existing res.users.apikeys.description record. +func (c *Client) DeleteResUsersApikeysDescription(id int64) error { + return c.DeleteResUsersApikeysDescriptions([]int64{id}) +} + +// DeleteResUsersApikeysDescriptions deletes existing res.users.apikeys.description records. +func (c *Client) DeleteResUsersApikeysDescriptions(ids []int64) error { + return c.Delete(ResUsersApikeysDescriptionModel, ids) +} + +// GetResUsersApikeysDescription gets res.users.apikeys.description existing record. +func (c *Client) GetResUsersApikeysDescription(id int64) (*ResUsersApikeysDescription, error) { + ruads, err := c.GetResUsersApikeysDescriptions([]int64{id}) + if err != nil { + return nil, err + } + return &((*ruads)[0]), nil +} + +// GetResUsersApikeysDescriptions gets res.users.apikeys.description existing records. +func (c *Client) GetResUsersApikeysDescriptions(ids []int64) (*ResUsersApikeysDescriptions, error) { + ruads := &ResUsersApikeysDescriptions{} + if err := c.Read(ResUsersApikeysDescriptionModel, ids, nil, ruads); err != nil { + return nil, err + } + return ruads, nil +} + +// FindResUsersApikeysDescription finds res.users.apikeys.description record by querying it with criteria. +func (c *Client) FindResUsersApikeysDescription(criteria *Criteria) (*ResUsersApikeysDescription, error) { + ruads := &ResUsersApikeysDescriptions{} + if err := c.SearchRead(ResUsersApikeysDescriptionModel, criteria, NewOptions().Limit(1), ruads); err != nil { + return nil, err + } + return &((*ruads)[0]), nil +} + +// FindResUsersApikeysDescriptions finds res.users.apikeys.description records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersApikeysDescriptions(criteria *Criteria, options *Options) (*ResUsersApikeysDescriptions, error) { + ruads := &ResUsersApikeysDescriptions{} + if err := c.SearchRead(ResUsersApikeysDescriptionModel, criteria, options, ruads); err != nil { + return nil, err + } + return ruads, nil +} + +// FindResUsersApikeysDescriptionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersApikeysDescriptionIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResUsersApikeysDescriptionModel, criteria, options) +} + +// FindResUsersApikeysDescriptionId finds record id by querying it with criteria. +func (c *Client) FindResUsersApikeysDescriptionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResUsersApikeysDescriptionModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_users_apikeys_show.go b/res_users_apikeys_show.go new file mode 100644 index 0000000..1762a99 --- /dev/null +++ b/res_users_apikeys_show.go @@ -0,0 +1,112 @@ +package odoo + +// ResUsersApikeysShow represents res.users.apikeys.show model. +type ResUsersApikeysShow struct { + Id *Int `xmlrpc:"id,omitempty"` + Key *String `xmlrpc:"key,omitempty"` +} + +// ResUsersApikeysShows represents array of res.users.apikeys.show model. +type ResUsersApikeysShows []ResUsersApikeysShow + +// ResUsersApikeysShowModel is the odoo model name. +const ResUsersApikeysShowModel = "res.users.apikeys.show" + +// Many2One convert ResUsersApikeysShow to *Many2One. +func (ruas *ResUsersApikeysShow) Many2One() *Many2One { + return NewMany2One(ruas.Id.Get(), "") +} + +// CreateResUsersApikeysShow creates a new res.users.apikeys.show model and returns its id. +func (c *Client) CreateResUsersApikeysShow(ruas *ResUsersApikeysShow) (int64, error) { + ids, err := c.CreateResUsersApikeysShows([]*ResUsersApikeysShow{ruas}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResUsersApikeysShow creates a new res.users.apikeys.show model and returns its id. +func (c *Client) CreateResUsersApikeysShows(ruass []*ResUsersApikeysShow) ([]int64, error) { + var vv []interface{} + for _, v := range ruass { + vv = append(vv, v) + } + return c.Create(ResUsersApikeysShowModel, vv, nil) +} + +// UpdateResUsersApikeysShow updates an existing res.users.apikeys.show record. +func (c *Client) UpdateResUsersApikeysShow(ruas *ResUsersApikeysShow) error { + return c.UpdateResUsersApikeysShows([]int64{ruas.Id.Get()}, ruas) +} + +// UpdateResUsersApikeysShows updates existing res.users.apikeys.show records. +// All records (represented by ids) will be updated by ruas values. +func (c *Client) UpdateResUsersApikeysShows(ids []int64, ruas *ResUsersApikeysShow) error { + return c.Update(ResUsersApikeysShowModel, ids, ruas, nil) +} + +// DeleteResUsersApikeysShow deletes an existing res.users.apikeys.show record. +func (c *Client) DeleteResUsersApikeysShow(id int64) error { + return c.DeleteResUsersApikeysShows([]int64{id}) +} + +// DeleteResUsersApikeysShows deletes existing res.users.apikeys.show records. +func (c *Client) DeleteResUsersApikeysShows(ids []int64) error { + return c.Delete(ResUsersApikeysShowModel, ids) +} + +// GetResUsersApikeysShow gets res.users.apikeys.show existing record. +func (c *Client) GetResUsersApikeysShow(id int64) (*ResUsersApikeysShow, error) { + ruass, err := c.GetResUsersApikeysShows([]int64{id}) + if err != nil { + return nil, err + } + return &((*ruass)[0]), nil +} + +// GetResUsersApikeysShows gets res.users.apikeys.show existing records. +func (c *Client) GetResUsersApikeysShows(ids []int64) (*ResUsersApikeysShows, error) { + ruass := &ResUsersApikeysShows{} + if err := c.Read(ResUsersApikeysShowModel, ids, nil, ruass); err != nil { + return nil, err + } + return ruass, nil +} + +// FindResUsersApikeysShow finds res.users.apikeys.show record by querying it with criteria. +func (c *Client) FindResUsersApikeysShow(criteria *Criteria) (*ResUsersApikeysShow, error) { + ruass := &ResUsersApikeysShows{} + if err := c.SearchRead(ResUsersApikeysShowModel, criteria, NewOptions().Limit(1), ruass); err != nil { + return nil, err + } + return &((*ruass)[0]), nil +} + +// FindResUsersApikeysShows finds res.users.apikeys.show records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersApikeysShows(criteria *Criteria, options *Options) (*ResUsersApikeysShows, error) { + ruass := &ResUsersApikeysShows{} + if err := c.SearchRead(ResUsersApikeysShowModel, criteria, options, ruass); err != nil { + return nil, err + } + return ruass, nil +} + +// FindResUsersApikeysShowIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersApikeysShowIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResUsersApikeysShowModel, criteria, options) +} + +// FindResUsersApikeysShowId finds record id by querying it with criteria. +func (c *Client) FindResUsersApikeysShowId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResUsersApikeysShowModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_users_deletion.go b/res_users_deletion.go new file mode 100644 index 0000000..ab838aa --- /dev/null +++ b/res_users_deletion.go @@ -0,0 +1,119 @@ +package odoo + +// ResUsersDeletion represents res.users.deletion model. +type ResUsersDeletion struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + UserIdInt *Int `xmlrpc:"user_id_int,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResUsersDeletions represents array of res.users.deletion model. +type ResUsersDeletions []ResUsersDeletion + +// ResUsersDeletionModel is the odoo model name. +const ResUsersDeletionModel = "res.users.deletion" + +// Many2One convert ResUsersDeletion to *Many2One. +func (rud *ResUsersDeletion) Many2One() *Many2One { + return NewMany2One(rud.Id.Get(), "") +} + +// CreateResUsersDeletion creates a new res.users.deletion model and returns its id. +func (c *Client) CreateResUsersDeletion(rud *ResUsersDeletion) (int64, error) { + ids, err := c.CreateResUsersDeletions([]*ResUsersDeletion{rud}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResUsersDeletion creates a new res.users.deletion model and returns its id. +func (c *Client) CreateResUsersDeletions(ruds []*ResUsersDeletion) ([]int64, error) { + var vv []interface{} + for _, v := range ruds { + vv = append(vv, v) + } + return c.Create(ResUsersDeletionModel, vv, nil) +} + +// UpdateResUsersDeletion updates an existing res.users.deletion record. +func (c *Client) UpdateResUsersDeletion(rud *ResUsersDeletion) error { + return c.UpdateResUsersDeletions([]int64{rud.Id.Get()}, rud) +} + +// UpdateResUsersDeletions updates existing res.users.deletion records. +// All records (represented by ids) will be updated by rud values. +func (c *Client) UpdateResUsersDeletions(ids []int64, rud *ResUsersDeletion) error { + return c.Update(ResUsersDeletionModel, ids, rud, nil) +} + +// DeleteResUsersDeletion deletes an existing res.users.deletion record. +func (c *Client) DeleteResUsersDeletion(id int64) error { + return c.DeleteResUsersDeletions([]int64{id}) +} + +// DeleteResUsersDeletions deletes existing res.users.deletion records. +func (c *Client) DeleteResUsersDeletions(ids []int64) error { + return c.Delete(ResUsersDeletionModel, ids) +} + +// GetResUsersDeletion gets res.users.deletion existing record. +func (c *Client) GetResUsersDeletion(id int64) (*ResUsersDeletion, error) { + ruds, err := c.GetResUsersDeletions([]int64{id}) + if err != nil { + return nil, err + } + return &((*ruds)[0]), nil +} + +// GetResUsersDeletions gets res.users.deletion existing records. +func (c *Client) GetResUsersDeletions(ids []int64) (*ResUsersDeletions, error) { + ruds := &ResUsersDeletions{} + if err := c.Read(ResUsersDeletionModel, ids, nil, ruds); err != nil { + return nil, err + } + return ruds, nil +} + +// FindResUsersDeletion finds res.users.deletion record by querying it with criteria. +func (c *Client) FindResUsersDeletion(criteria *Criteria) (*ResUsersDeletion, error) { + ruds := &ResUsersDeletions{} + if err := c.SearchRead(ResUsersDeletionModel, criteria, NewOptions().Limit(1), ruds); err != nil { + return nil, err + } + return &((*ruds)[0]), nil +} + +// FindResUsersDeletions finds res.users.deletion records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersDeletions(criteria *Criteria, options *Options) (*ResUsersDeletions, error) { + ruds := &ResUsersDeletions{} + if err := c.SearchRead(ResUsersDeletionModel, criteria, options, ruds); err != nil { + return nil, err + } + return ruds, nil +} + +// FindResUsersDeletionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersDeletionIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResUsersDeletionModel, criteria, options) +} + +// FindResUsersDeletionId finds record id by querying it with criteria. +func (c *Client) FindResUsersDeletionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResUsersDeletionModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_users_identitycheck.go b/res_users_identitycheck.go new file mode 100644 index 0000000..6ab27a3 --- /dev/null +++ b/res_users_identitycheck.go @@ -0,0 +1,119 @@ +package odoo + +// ResUsersIdentitycheck represents res.users.identitycheck model. +type ResUsersIdentitycheck struct { + AuthMethod *Selection `xmlrpc:"auth_method,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Password *String `xmlrpc:"password,omitempty"` + Request *String `xmlrpc:"request,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResUsersIdentitychecks represents array of res.users.identitycheck model. +type ResUsersIdentitychecks []ResUsersIdentitycheck + +// ResUsersIdentitycheckModel is the odoo model name. +const ResUsersIdentitycheckModel = "res.users.identitycheck" + +// Many2One convert ResUsersIdentitycheck to *Many2One. +func (rui *ResUsersIdentitycheck) Many2One() *Many2One { + return NewMany2One(rui.Id.Get(), "") +} + +// CreateResUsersIdentitycheck creates a new res.users.identitycheck model and returns its id. +func (c *Client) CreateResUsersIdentitycheck(rui *ResUsersIdentitycheck) (int64, error) { + ids, err := c.CreateResUsersIdentitychecks([]*ResUsersIdentitycheck{rui}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResUsersIdentitycheck creates a new res.users.identitycheck model and returns its id. +func (c *Client) CreateResUsersIdentitychecks(ruis []*ResUsersIdentitycheck) ([]int64, error) { + var vv []interface{} + for _, v := range ruis { + vv = append(vv, v) + } + return c.Create(ResUsersIdentitycheckModel, vv, nil) +} + +// UpdateResUsersIdentitycheck updates an existing res.users.identitycheck record. +func (c *Client) UpdateResUsersIdentitycheck(rui *ResUsersIdentitycheck) error { + return c.UpdateResUsersIdentitychecks([]int64{rui.Id.Get()}, rui) +} + +// UpdateResUsersIdentitychecks updates existing res.users.identitycheck records. +// All records (represented by ids) will be updated by rui values. +func (c *Client) UpdateResUsersIdentitychecks(ids []int64, rui *ResUsersIdentitycheck) error { + return c.Update(ResUsersIdentitycheckModel, ids, rui, nil) +} + +// DeleteResUsersIdentitycheck deletes an existing res.users.identitycheck record. +func (c *Client) DeleteResUsersIdentitycheck(id int64) error { + return c.DeleteResUsersIdentitychecks([]int64{id}) +} + +// DeleteResUsersIdentitychecks deletes existing res.users.identitycheck records. +func (c *Client) DeleteResUsersIdentitychecks(ids []int64) error { + return c.Delete(ResUsersIdentitycheckModel, ids) +} + +// GetResUsersIdentitycheck gets res.users.identitycheck existing record. +func (c *Client) GetResUsersIdentitycheck(id int64) (*ResUsersIdentitycheck, error) { + ruis, err := c.GetResUsersIdentitychecks([]int64{id}) + if err != nil { + return nil, err + } + return &((*ruis)[0]), nil +} + +// GetResUsersIdentitychecks gets res.users.identitycheck existing records. +func (c *Client) GetResUsersIdentitychecks(ids []int64) (*ResUsersIdentitychecks, error) { + ruis := &ResUsersIdentitychecks{} + if err := c.Read(ResUsersIdentitycheckModel, ids, nil, ruis); err != nil { + return nil, err + } + return ruis, nil +} + +// FindResUsersIdentitycheck finds res.users.identitycheck record by querying it with criteria. +func (c *Client) FindResUsersIdentitycheck(criteria *Criteria) (*ResUsersIdentitycheck, error) { + ruis := &ResUsersIdentitychecks{} + if err := c.SearchRead(ResUsersIdentitycheckModel, criteria, NewOptions().Limit(1), ruis); err != nil { + return nil, err + } + return &((*ruis)[0]), nil +} + +// FindResUsersIdentitychecks finds res.users.identitycheck records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersIdentitychecks(criteria *Criteria, options *Options) (*ResUsersIdentitychecks, error) { + ruis := &ResUsersIdentitychecks{} + if err := c.SearchRead(ResUsersIdentitycheckModel, criteria, options, ruis); err != nil { + return nil, err + } + return ruis, nil +} + +// FindResUsersIdentitycheckIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersIdentitycheckIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResUsersIdentitycheckModel, criteria, options) +} + +// FindResUsersIdentitycheckId finds record id by querying it with criteria. +func (c *Client) FindResUsersIdentitycheckId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResUsersIdentitycheckModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_users_log.go b/res_users_log.go new file mode 100644 index 0000000..1f7affd --- /dev/null +++ b/res_users_log.go @@ -0,0 +1,116 @@ +package odoo + +// ResUsersLog represents res.users.log model. +type ResUsersLog struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResUsersLogs represents array of res.users.log model. +type ResUsersLogs []ResUsersLog + +// ResUsersLogModel is the odoo model name. +const ResUsersLogModel = "res.users.log" + +// Many2One convert ResUsersLog to *Many2One. +func (rul *ResUsersLog) Many2One() *Many2One { + return NewMany2One(rul.Id.Get(), "") +} + +// CreateResUsersLog creates a new res.users.log model and returns its id. +func (c *Client) CreateResUsersLog(rul *ResUsersLog) (int64, error) { + ids, err := c.CreateResUsersLogs([]*ResUsersLog{rul}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResUsersLog creates a new res.users.log model and returns its id. +func (c *Client) CreateResUsersLogs(ruls []*ResUsersLog) ([]int64, error) { + var vv []interface{} + for _, v := range ruls { + vv = append(vv, v) + } + return c.Create(ResUsersLogModel, vv, nil) +} + +// UpdateResUsersLog updates an existing res.users.log record. +func (c *Client) UpdateResUsersLog(rul *ResUsersLog) error { + return c.UpdateResUsersLogs([]int64{rul.Id.Get()}, rul) +} + +// UpdateResUsersLogs updates existing res.users.log records. +// All records (represented by ids) will be updated by rul values. +func (c *Client) UpdateResUsersLogs(ids []int64, rul *ResUsersLog) error { + return c.Update(ResUsersLogModel, ids, rul, nil) +} + +// DeleteResUsersLog deletes an existing res.users.log record. +func (c *Client) DeleteResUsersLog(id int64) error { + return c.DeleteResUsersLogs([]int64{id}) +} + +// DeleteResUsersLogs deletes existing res.users.log records. +func (c *Client) DeleteResUsersLogs(ids []int64) error { + return c.Delete(ResUsersLogModel, ids) +} + +// GetResUsersLog gets res.users.log existing record. +func (c *Client) GetResUsersLog(id int64) (*ResUsersLog, error) { + ruls, err := c.GetResUsersLogs([]int64{id}) + if err != nil { + return nil, err + } + return &((*ruls)[0]), nil +} + +// GetResUsersLogs gets res.users.log existing records. +func (c *Client) GetResUsersLogs(ids []int64) (*ResUsersLogs, error) { + ruls := &ResUsersLogs{} + if err := c.Read(ResUsersLogModel, ids, nil, ruls); err != nil { + return nil, err + } + return ruls, nil +} + +// FindResUsersLog finds res.users.log record by querying it with criteria. +func (c *Client) FindResUsersLog(criteria *Criteria) (*ResUsersLog, error) { + ruls := &ResUsersLogs{} + if err := c.SearchRead(ResUsersLogModel, criteria, NewOptions().Limit(1), ruls); err != nil { + return nil, err + } + return &((*ruls)[0]), nil +} + +// FindResUsersLogs finds res.users.log records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersLogs(criteria *Criteria, options *Options) (*ResUsersLogs, error) { + ruls := &ResUsersLogs{} + if err := c.SearchRead(ResUsersLogModel, criteria, options, ruls); err != nil { + return nil, err + } + return ruls, nil +} + +// FindResUsersLogIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersLogIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResUsersLogModel, criteria, options) +} + +// FindResUsersLogId finds record id by querying it with criteria. +func (c *Client) FindResUsersLogId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResUsersLogModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_users_settings.go b/res_users_settings.go new file mode 100644 index 0000000..55c7714 --- /dev/null +++ b/res_users_settings.go @@ -0,0 +1,126 @@ +package odoo + +// ResUsersSettings represents res.users.settings model. +type ResUsersSettings struct { + CalendarDefaultPrivacy *Selection `xmlrpc:"calendar_default_privacy,omitempty"` + ChannelNotifications *Selection `xmlrpc:"channel_notifications,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsDiscussSidebarCategoryChannelOpen *Bool `xmlrpc:"is_discuss_sidebar_category_channel_open,omitempty"` + IsDiscussSidebarCategoryChatOpen *Bool `xmlrpc:"is_discuss_sidebar_category_chat_open,omitempty"` + MuteUntilDt *Time `xmlrpc:"mute_until_dt,omitempty"` + PushToTalkKey *String `xmlrpc:"push_to_talk_key,omitempty"` + UsePushToTalk *Bool `xmlrpc:"use_push_to_talk,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + VoiceActiveDuration *Int `xmlrpc:"voice_active_duration,omitempty"` + VolumeSettingsIds *Relation `xmlrpc:"volume_settings_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResUsersSettingss represents array of res.users.settings model. +type ResUsersSettingss []ResUsersSettings + +// ResUsersSettingsModel is the odoo model name. +const ResUsersSettingsModel = "res.users.settings" + +// Many2One convert ResUsersSettings to *Many2One. +func (rus *ResUsersSettings) Many2One() *Many2One { + return NewMany2One(rus.Id.Get(), "") +} + +// CreateResUsersSettings creates a new res.users.settings model and returns its id. +func (c *Client) CreateResUsersSettings(rus *ResUsersSettings) (int64, error) { + ids, err := c.CreateResUsersSettingss([]*ResUsersSettings{rus}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResUsersSettings creates a new res.users.settings model and returns its id. +func (c *Client) CreateResUsersSettingss(russ []*ResUsersSettings) ([]int64, error) { + var vv []interface{} + for _, v := range russ { + vv = append(vv, v) + } + return c.Create(ResUsersSettingsModel, vv, nil) +} + +// UpdateResUsersSettings updates an existing res.users.settings record. +func (c *Client) UpdateResUsersSettings(rus *ResUsersSettings) error { + return c.UpdateResUsersSettingss([]int64{rus.Id.Get()}, rus) +} + +// UpdateResUsersSettingss updates existing res.users.settings records. +// All records (represented by ids) will be updated by rus values. +func (c *Client) UpdateResUsersSettingss(ids []int64, rus *ResUsersSettings) error { + return c.Update(ResUsersSettingsModel, ids, rus, nil) +} + +// DeleteResUsersSettings deletes an existing res.users.settings record. +func (c *Client) DeleteResUsersSettings(id int64) error { + return c.DeleteResUsersSettingss([]int64{id}) +} + +// DeleteResUsersSettingss deletes existing res.users.settings records. +func (c *Client) DeleteResUsersSettingss(ids []int64) error { + return c.Delete(ResUsersSettingsModel, ids) +} + +// GetResUsersSettings gets res.users.settings existing record. +func (c *Client) GetResUsersSettings(id int64) (*ResUsersSettings, error) { + russ, err := c.GetResUsersSettingss([]int64{id}) + if err != nil { + return nil, err + } + return &((*russ)[0]), nil +} + +// GetResUsersSettingss gets res.users.settings existing records. +func (c *Client) GetResUsersSettingss(ids []int64) (*ResUsersSettingss, error) { + russ := &ResUsersSettingss{} + if err := c.Read(ResUsersSettingsModel, ids, nil, russ); err != nil { + return nil, err + } + return russ, nil +} + +// FindResUsersSettings finds res.users.settings record by querying it with criteria. +func (c *Client) FindResUsersSettings(criteria *Criteria) (*ResUsersSettings, error) { + russ := &ResUsersSettingss{} + if err := c.SearchRead(ResUsersSettingsModel, criteria, NewOptions().Limit(1), russ); err != nil { + return nil, err + } + return &((*russ)[0]), nil +} + +// FindResUsersSettingss finds res.users.settings records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersSettingss(criteria *Criteria, options *Options) (*ResUsersSettingss, error) { + russ := &ResUsersSettingss{} + if err := c.SearchRead(ResUsersSettingsModel, criteria, options, russ); err != nil { + return nil, err + } + return russ, nil +} + +// FindResUsersSettingsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersSettingsIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResUsersSettingsModel, criteria, options) +} + +// FindResUsersSettingsId finds record id by querying it with criteria. +func (c *Client) FindResUsersSettingsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResUsersSettingsModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/res_users_settings_volumes.go b/res_users_settings_volumes.go new file mode 100644 index 0000000..d4b8fed --- /dev/null +++ b/res_users_settings_volumes.go @@ -0,0 +1,120 @@ +package odoo + +// ResUsersSettingsVolumes represents res.users.settings.volumes model. +type ResUsersSettingsVolumes struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + GuestId *Many2One `xmlrpc:"guest_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + UserSettingId *Many2One `xmlrpc:"user_setting_id,omitempty"` + Volume *Float `xmlrpc:"volume,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResUsersSettingsVolumess represents array of res.users.settings.volumes model. +type ResUsersSettingsVolumess []ResUsersSettingsVolumes + +// ResUsersSettingsVolumesModel is the odoo model name. +const ResUsersSettingsVolumesModel = "res.users.settings.volumes" + +// Many2One convert ResUsersSettingsVolumes to *Many2One. +func (rusv *ResUsersSettingsVolumes) Many2One() *Many2One { + return NewMany2One(rusv.Id.Get(), "") +} + +// CreateResUsersSettingsVolumes creates a new res.users.settings.volumes model and returns its id. +func (c *Client) CreateResUsersSettingsVolumes(rusv *ResUsersSettingsVolumes) (int64, error) { + ids, err := c.CreateResUsersSettingsVolumess([]*ResUsersSettingsVolumes{rusv}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResUsersSettingsVolumes creates a new res.users.settings.volumes model and returns its id. +func (c *Client) CreateResUsersSettingsVolumess(rusvs []*ResUsersSettingsVolumes) ([]int64, error) { + var vv []interface{} + for _, v := range rusvs { + vv = append(vv, v) + } + return c.Create(ResUsersSettingsVolumesModel, vv, nil) +} + +// UpdateResUsersSettingsVolumes updates an existing res.users.settings.volumes record. +func (c *Client) UpdateResUsersSettingsVolumes(rusv *ResUsersSettingsVolumes) error { + return c.UpdateResUsersSettingsVolumess([]int64{rusv.Id.Get()}, rusv) +} + +// UpdateResUsersSettingsVolumess updates existing res.users.settings.volumes records. +// All records (represented by ids) will be updated by rusv values. +func (c *Client) UpdateResUsersSettingsVolumess(ids []int64, rusv *ResUsersSettingsVolumes) error { + return c.Update(ResUsersSettingsVolumesModel, ids, rusv, nil) +} + +// DeleteResUsersSettingsVolumes deletes an existing res.users.settings.volumes record. +func (c *Client) DeleteResUsersSettingsVolumes(id int64) error { + return c.DeleteResUsersSettingsVolumess([]int64{id}) +} + +// DeleteResUsersSettingsVolumess deletes existing res.users.settings.volumes records. +func (c *Client) DeleteResUsersSettingsVolumess(ids []int64) error { + return c.Delete(ResUsersSettingsVolumesModel, ids) +} + +// GetResUsersSettingsVolumes gets res.users.settings.volumes existing record. +func (c *Client) GetResUsersSettingsVolumes(id int64) (*ResUsersSettingsVolumes, error) { + rusvs, err := c.GetResUsersSettingsVolumess([]int64{id}) + if err != nil { + return nil, err + } + return &((*rusvs)[0]), nil +} + +// GetResUsersSettingsVolumess gets res.users.settings.volumes existing records. +func (c *Client) GetResUsersSettingsVolumess(ids []int64) (*ResUsersSettingsVolumess, error) { + rusvs := &ResUsersSettingsVolumess{} + if err := c.Read(ResUsersSettingsVolumesModel, ids, nil, rusvs); err != nil { + return nil, err + } + return rusvs, nil +} + +// FindResUsersSettingsVolumes finds res.users.settings.volumes record by querying it with criteria. +func (c *Client) FindResUsersSettingsVolumes(criteria *Criteria) (*ResUsersSettingsVolumes, error) { + rusvs := &ResUsersSettingsVolumess{} + if err := c.SearchRead(ResUsersSettingsVolumesModel, criteria, NewOptions().Limit(1), rusvs); err != nil { + return nil, err + } + return &((*rusvs)[0]), nil +} + +// FindResUsersSettingsVolumess finds res.users.settings.volumes records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersSettingsVolumess(criteria *Criteria, options *Options) (*ResUsersSettingsVolumess, error) { + rusvs := &ResUsersSettingsVolumess{} + if err := c.SearchRead(ResUsersSettingsVolumesModel, criteria, options, rusvs); err != nil { + return nil, err + } + return rusvs, nil +} + +// FindResUsersSettingsVolumesIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResUsersSettingsVolumesIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResUsersSettingsVolumesModel, criteria, options) +} + +// FindResUsersSettingsVolumesId finds record id by querying it with criteria. +func (c *Client) FindResUsersSettingsVolumesId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResUsersSettingsVolumesModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/reset_view_arch_wizard.go b/reset_view_arch_wizard.go new file mode 100644 index 0000000..0633ce5 --- /dev/null +++ b/reset_view_arch_wizard.go @@ -0,0 +1,123 @@ +package odoo + +// ResetViewArchWizard represents reset.view.arch.wizard model. +type ResetViewArchWizard struct { + ArchDiff *String `xmlrpc:"arch_diff,omitempty"` + ArchToCompare *String `xmlrpc:"arch_to_compare,omitempty"` + CompareViewId *Many2One `xmlrpc:"compare_view_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasDiff *Bool `xmlrpc:"has_diff,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ResetMode *Selection `xmlrpc:"reset_mode,omitempty"` + ViewId *Many2One `xmlrpc:"view_id,omitempty"` + ViewName *String `xmlrpc:"view_name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResetViewArchWizards represents array of reset.view.arch.wizard model. +type ResetViewArchWizards []ResetViewArchWizard + +// ResetViewArchWizardModel is the odoo model name. +const ResetViewArchWizardModel = "reset.view.arch.wizard" + +// Many2One convert ResetViewArchWizard to *Many2One. +func (rvaw *ResetViewArchWizard) Many2One() *Many2One { + return NewMany2One(rvaw.Id.Get(), "") +} + +// CreateResetViewArchWizard creates a new reset.view.arch.wizard model and returns its id. +func (c *Client) CreateResetViewArchWizard(rvaw *ResetViewArchWizard) (int64, error) { + ids, err := c.CreateResetViewArchWizards([]*ResetViewArchWizard{rvaw}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResetViewArchWizard creates a new reset.view.arch.wizard model and returns its id. +func (c *Client) CreateResetViewArchWizards(rvaws []*ResetViewArchWizard) ([]int64, error) { + var vv []interface{} + for _, v := range rvaws { + vv = append(vv, v) + } + return c.Create(ResetViewArchWizardModel, vv, nil) +} + +// UpdateResetViewArchWizard updates an existing reset.view.arch.wizard record. +func (c *Client) UpdateResetViewArchWizard(rvaw *ResetViewArchWizard) error { + return c.UpdateResetViewArchWizards([]int64{rvaw.Id.Get()}, rvaw) +} + +// UpdateResetViewArchWizards updates existing reset.view.arch.wizard records. +// All records (represented by ids) will be updated by rvaw values. +func (c *Client) UpdateResetViewArchWizards(ids []int64, rvaw *ResetViewArchWizard) error { + return c.Update(ResetViewArchWizardModel, ids, rvaw, nil) +} + +// DeleteResetViewArchWizard deletes an existing reset.view.arch.wizard record. +func (c *Client) DeleteResetViewArchWizard(id int64) error { + return c.DeleteResetViewArchWizards([]int64{id}) +} + +// DeleteResetViewArchWizards deletes existing reset.view.arch.wizard records. +func (c *Client) DeleteResetViewArchWizards(ids []int64) error { + return c.Delete(ResetViewArchWizardModel, ids) +} + +// GetResetViewArchWizard gets reset.view.arch.wizard existing record. +func (c *Client) GetResetViewArchWizard(id int64) (*ResetViewArchWizard, error) { + rvaws, err := c.GetResetViewArchWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*rvaws)[0]), nil +} + +// GetResetViewArchWizards gets reset.view.arch.wizard existing records. +func (c *Client) GetResetViewArchWizards(ids []int64) (*ResetViewArchWizards, error) { + rvaws := &ResetViewArchWizards{} + if err := c.Read(ResetViewArchWizardModel, ids, nil, rvaws); err != nil { + return nil, err + } + return rvaws, nil +} + +// FindResetViewArchWizard finds reset.view.arch.wizard record by querying it with criteria. +func (c *Client) FindResetViewArchWizard(criteria *Criteria) (*ResetViewArchWizard, error) { + rvaws := &ResetViewArchWizards{} + if err := c.SearchRead(ResetViewArchWizardModel, criteria, NewOptions().Limit(1), rvaws); err != nil { + return nil, err + } + return &((*rvaws)[0]), nil +} + +// FindResetViewArchWizards finds reset.view.arch.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResetViewArchWizards(criteria *Criteria, options *Options) (*ResetViewArchWizards, error) { + rvaws := &ResetViewArchWizards{} + if err := c.SearchRead(ResetViewArchWizardModel, criteria, options, rvaws); err != nil { + return nil, err + } + return rvaws, nil +} + +// FindResetViewArchWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResetViewArchWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResetViewArchWizardModel, criteria, options) +} + +// FindResetViewArchWizardId finds record id by querying it with criteria. +func (c *Client) FindResetViewArchWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResetViewArchWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/resource_calendar.go b/resource_calendar.go new file mode 100644 index 0000000..15649ee --- /dev/null +++ b/resource_calendar.go @@ -0,0 +1,131 @@ +package odoo + +// ResourceCalendar represents resource.calendar model. +type ResourceCalendar struct { + Active *Bool `xmlrpc:"active,omitempty"` + AssociatedLeavesCount *Int `xmlrpc:"associated_leaves_count,omitempty"` + AttendanceIds *Relation `xmlrpc:"attendance_ids,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + ContractsCount *Int `xmlrpc:"contracts_count,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FlexibleHours *Bool `xmlrpc:"flexible_hours,omitempty"` + FullTimeRequiredHours *Float `xmlrpc:"full_time_required_hours,omitempty"` + GlobalLeaveIds *Relation `xmlrpc:"global_leave_ids,omitempty"` + HoursPerDay *Float `xmlrpc:"hours_per_day,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LeaveIds *Relation `xmlrpc:"leave_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + TwoWeeksCalendar *Bool `xmlrpc:"two_weeks_calendar,omitempty"` + TwoWeeksExplanation *String `xmlrpc:"two_weeks_explanation,omitempty"` + Tz *Selection `xmlrpc:"tz,omitempty"` + TzOffset *String `xmlrpc:"tz_offset,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResourceCalendars represents array of resource.calendar model. +type ResourceCalendars []ResourceCalendar + +// ResourceCalendarModel is the odoo model name. +const ResourceCalendarModel = "resource.calendar" + +// Many2One convert ResourceCalendar to *Many2One. +func (rc *ResourceCalendar) Many2One() *Many2One { + return NewMany2One(rc.Id.Get(), "") +} + +// CreateResourceCalendar creates a new resource.calendar model and returns its id. +func (c *Client) CreateResourceCalendar(rc *ResourceCalendar) (int64, error) { + ids, err := c.CreateResourceCalendars([]*ResourceCalendar{rc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResourceCalendar creates a new resource.calendar model and returns its id. +func (c *Client) CreateResourceCalendars(rcs []*ResourceCalendar) ([]int64, error) { + var vv []interface{} + for _, v := range rcs { + vv = append(vv, v) + } + return c.Create(ResourceCalendarModel, vv, nil) +} + +// UpdateResourceCalendar updates an existing resource.calendar record. +func (c *Client) UpdateResourceCalendar(rc *ResourceCalendar) error { + return c.UpdateResourceCalendars([]int64{rc.Id.Get()}, rc) +} + +// UpdateResourceCalendars updates existing resource.calendar records. +// All records (represented by ids) will be updated by rc values. +func (c *Client) UpdateResourceCalendars(ids []int64, rc *ResourceCalendar) error { + return c.Update(ResourceCalendarModel, ids, rc, nil) +} + +// DeleteResourceCalendar deletes an existing resource.calendar record. +func (c *Client) DeleteResourceCalendar(id int64) error { + return c.DeleteResourceCalendars([]int64{id}) +} + +// DeleteResourceCalendars deletes existing resource.calendar records. +func (c *Client) DeleteResourceCalendars(ids []int64) error { + return c.Delete(ResourceCalendarModel, ids) +} + +// GetResourceCalendar gets resource.calendar existing record. +func (c *Client) GetResourceCalendar(id int64) (*ResourceCalendar, error) { + rcs, err := c.GetResourceCalendars([]int64{id}) + if err != nil { + return nil, err + } + return &((*rcs)[0]), nil +} + +// GetResourceCalendars gets resource.calendar existing records. +func (c *Client) GetResourceCalendars(ids []int64) (*ResourceCalendars, error) { + rcs := &ResourceCalendars{} + if err := c.Read(ResourceCalendarModel, ids, nil, rcs); err != nil { + return nil, err + } + return rcs, nil +} + +// FindResourceCalendar finds resource.calendar record by querying it with criteria. +func (c *Client) FindResourceCalendar(criteria *Criteria) (*ResourceCalendar, error) { + rcs := &ResourceCalendars{} + if err := c.SearchRead(ResourceCalendarModel, criteria, NewOptions().Limit(1), rcs); err != nil { + return nil, err + } + return &((*rcs)[0]), nil +} + +// FindResourceCalendars finds resource.calendar records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResourceCalendars(criteria *Criteria, options *Options) (*ResourceCalendars, error) { + rcs := &ResourceCalendars{} + if err := c.SearchRead(ResourceCalendarModel, criteria, options, rcs); err != nil { + return nil, err + } + return rcs, nil +} + +// FindResourceCalendarIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResourceCalendarIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResourceCalendarModel, criteria, options) +} + +// FindResourceCalendarId finds record id by querying it with criteria. +func (c *Client) FindResourceCalendarId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResourceCalendarModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/resource_calendar_attendance.go b/resource_calendar_attendance.go new file mode 100644 index 0000000..f91991c --- /dev/null +++ b/resource_calendar_attendance.go @@ -0,0 +1,131 @@ +package odoo + +// ResourceCalendarAttendance represents resource.calendar.attendance model. +type ResourceCalendarAttendance struct { + CalendarId *Many2One `xmlrpc:"calendar_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"` + DayPeriod *Selection `xmlrpc:"day_period,omitempty"` + Dayofweek *Selection `xmlrpc:"dayofweek,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayType *Selection `xmlrpc:"display_type,omitempty"` + DurationDays *Float `xmlrpc:"duration_days,omitempty"` + DurationHours *Float `xmlrpc:"duration_hours,omitempty"` + HourFrom *Float `xmlrpc:"hour_from,omitempty"` + HourTo *Float `xmlrpc:"hour_to,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ResourceId *Many2One `xmlrpc:"resource_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TwoWeeksCalendar *Bool `xmlrpc:"two_weeks_calendar,omitempty"` + WeekType *Selection `xmlrpc:"week_type,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResourceCalendarAttendances represents array of resource.calendar.attendance model. +type ResourceCalendarAttendances []ResourceCalendarAttendance + +// ResourceCalendarAttendanceModel is the odoo model name. +const ResourceCalendarAttendanceModel = "resource.calendar.attendance" + +// Many2One convert ResourceCalendarAttendance to *Many2One. +func (rca *ResourceCalendarAttendance) Many2One() *Many2One { + return NewMany2One(rca.Id.Get(), "") +} + +// CreateResourceCalendarAttendance creates a new resource.calendar.attendance model and returns its id. +func (c *Client) CreateResourceCalendarAttendance(rca *ResourceCalendarAttendance) (int64, error) { + ids, err := c.CreateResourceCalendarAttendances([]*ResourceCalendarAttendance{rca}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResourceCalendarAttendance creates a new resource.calendar.attendance model and returns its id. +func (c *Client) CreateResourceCalendarAttendances(rcas []*ResourceCalendarAttendance) ([]int64, error) { + var vv []interface{} + for _, v := range rcas { + vv = append(vv, v) + } + return c.Create(ResourceCalendarAttendanceModel, vv, nil) +} + +// UpdateResourceCalendarAttendance updates an existing resource.calendar.attendance record. +func (c *Client) UpdateResourceCalendarAttendance(rca *ResourceCalendarAttendance) error { + return c.UpdateResourceCalendarAttendances([]int64{rca.Id.Get()}, rca) +} + +// UpdateResourceCalendarAttendances updates existing resource.calendar.attendance records. +// All records (represented by ids) will be updated by rca values. +func (c *Client) UpdateResourceCalendarAttendances(ids []int64, rca *ResourceCalendarAttendance) error { + return c.Update(ResourceCalendarAttendanceModel, ids, rca, nil) +} + +// DeleteResourceCalendarAttendance deletes an existing resource.calendar.attendance record. +func (c *Client) DeleteResourceCalendarAttendance(id int64) error { + return c.DeleteResourceCalendarAttendances([]int64{id}) +} + +// DeleteResourceCalendarAttendances deletes existing resource.calendar.attendance records. +func (c *Client) DeleteResourceCalendarAttendances(ids []int64) error { + return c.Delete(ResourceCalendarAttendanceModel, ids) +} + +// GetResourceCalendarAttendance gets resource.calendar.attendance existing record. +func (c *Client) GetResourceCalendarAttendance(id int64) (*ResourceCalendarAttendance, error) { + rcas, err := c.GetResourceCalendarAttendances([]int64{id}) + if err != nil { + return nil, err + } + return &((*rcas)[0]), nil +} + +// GetResourceCalendarAttendances gets resource.calendar.attendance existing records. +func (c *Client) GetResourceCalendarAttendances(ids []int64) (*ResourceCalendarAttendances, error) { + rcas := &ResourceCalendarAttendances{} + if err := c.Read(ResourceCalendarAttendanceModel, ids, nil, rcas); err != nil { + return nil, err + } + return rcas, nil +} + +// FindResourceCalendarAttendance finds resource.calendar.attendance record by querying it with criteria. +func (c *Client) FindResourceCalendarAttendance(criteria *Criteria) (*ResourceCalendarAttendance, error) { + rcas := &ResourceCalendarAttendances{} + if err := c.SearchRead(ResourceCalendarAttendanceModel, criteria, NewOptions().Limit(1), rcas); err != nil { + return nil, err + } + return &((*rcas)[0]), nil +} + +// FindResourceCalendarAttendances finds resource.calendar.attendance records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResourceCalendarAttendances(criteria *Criteria, options *Options) (*ResourceCalendarAttendances, error) { + rcas := &ResourceCalendarAttendances{} + if err := c.SearchRead(ResourceCalendarAttendanceModel, criteria, options, rcas); err != nil { + return nil, err + } + return rcas, nil +} + +// FindResourceCalendarAttendanceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResourceCalendarAttendanceIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResourceCalendarAttendanceModel, criteria, options) +} + +// FindResourceCalendarAttendanceId finds record id by querying it with criteria. +func (c *Client) FindResourceCalendarAttendanceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResourceCalendarAttendanceModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/resource_calendar_leaves.go b/resource_calendar_leaves.go new file mode 100644 index 0000000..f7433e8 --- /dev/null +++ b/resource_calendar_leaves.go @@ -0,0 +1,125 @@ +package odoo + +// ResourceCalendarLeaves represents resource.calendar.leaves model. +type ResourceCalendarLeaves struct { + CalendarId *Many2One `xmlrpc:"calendar_id,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"` + HolidayId *Many2One `xmlrpc:"holiday_id,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ResourceId *Many2One `xmlrpc:"resource_id,omitempty"` + TimeType *Selection `xmlrpc:"time_type,omitempty"` + TimesheetIds *Relation `xmlrpc:"timesheet_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResourceCalendarLeavess represents array of resource.calendar.leaves model. +type ResourceCalendarLeavess []ResourceCalendarLeaves + +// ResourceCalendarLeavesModel is the odoo model name. +const ResourceCalendarLeavesModel = "resource.calendar.leaves" + +// Many2One convert ResourceCalendarLeaves to *Many2One. +func (rcl *ResourceCalendarLeaves) Many2One() *Many2One { + return NewMany2One(rcl.Id.Get(), "") +} + +// CreateResourceCalendarLeaves creates a new resource.calendar.leaves model and returns its id. +func (c *Client) CreateResourceCalendarLeaves(rcl *ResourceCalendarLeaves) (int64, error) { + ids, err := c.CreateResourceCalendarLeavess([]*ResourceCalendarLeaves{rcl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResourceCalendarLeaves creates a new resource.calendar.leaves model and returns its id. +func (c *Client) CreateResourceCalendarLeavess(rcls []*ResourceCalendarLeaves) ([]int64, error) { + var vv []interface{} + for _, v := range rcls { + vv = append(vv, v) + } + return c.Create(ResourceCalendarLeavesModel, vv, nil) +} + +// UpdateResourceCalendarLeaves updates an existing resource.calendar.leaves record. +func (c *Client) UpdateResourceCalendarLeaves(rcl *ResourceCalendarLeaves) error { + return c.UpdateResourceCalendarLeavess([]int64{rcl.Id.Get()}, rcl) +} + +// UpdateResourceCalendarLeavess updates existing resource.calendar.leaves records. +// All records (represented by ids) will be updated by rcl values. +func (c *Client) UpdateResourceCalendarLeavess(ids []int64, rcl *ResourceCalendarLeaves) error { + return c.Update(ResourceCalendarLeavesModel, ids, rcl, nil) +} + +// DeleteResourceCalendarLeaves deletes an existing resource.calendar.leaves record. +func (c *Client) DeleteResourceCalendarLeaves(id int64) error { + return c.DeleteResourceCalendarLeavess([]int64{id}) +} + +// DeleteResourceCalendarLeavess deletes existing resource.calendar.leaves records. +func (c *Client) DeleteResourceCalendarLeavess(ids []int64) error { + return c.Delete(ResourceCalendarLeavesModel, ids) +} + +// GetResourceCalendarLeaves gets resource.calendar.leaves existing record. +func (c *Client) GetResourceCalendarLeaves(id int64) (*ResourceCalendarLeaves, error) { + rcls, err := c.GetResourceCalendarLeavess([]int64{id}) + if err != nil { + return nil, err + } + return &((*rcls)[0]), nil +} + +// GetResourceCalendarLeavess gets resource.calendar.leaves existing records. +func (c *Client) GetResourceCalendarLeavess(ids []int64) (*ResourceCalendarLeavess, error) { + rcls := &ResourceCalendarLeavess{} + if err := c.Read(ResourceCalendarLeavesModel, ids, nil, rcls); err != nil { + return nil, err + } + return rcls, nil +} + +// FindResourceCalendarLeaves finds resource.calendar.leaves record by querying it with criteria. +func (c *Client) FindResourceCalendarLeaves(criteria *Criteria) (*ResourceCalendarLeaves, error) { + rcls := &ResourceCalendarLeavess{} + if err := c.SearchRead(ResourceCalendarLeavesModel, criteria, NewOptions().Limit(1), rcls); err != nil { + return nil, err + } + return &((*rcls)[0]), nil +} + +// FindResourceCalendarLeavess finds resource.calendar.leaves records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResourceCalendarLeavess(criteria *Criteria, options *Options) (*ResourceCalendarLeavess, error) { + rcls := &ResourceCalendarLeavess{} + if err := c.SearchRead(ResourceCalendarLeavesModel, criteria, options, rcls); err != nil { + return nil, err + } + return rcls, nil +} + +// FindResourceCalendarLeavesIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResourceCalendarLeavesIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResourceCalendarLeavesModel, criteria, options) +} + +// FindResourceCalendarLeavesId finds record id by querying it with criteria. +func (c *Client) FindResourceCalendarLeavesId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResourceCalendarLeavesModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/resource_resource.go b/resource_resource.go new file mode 100644 index 0000000..fadb8a6 --- /dev/null +++ b/resource_resource.go @@ -0,0 +1,137 @@ +package odoo + +// ResourceResource represents resource.resource model. +type ResourceResource struct { + Active *Bool `xmlrpc:"active,omitempty"` + Avatar128 *String `xmlrpc:"avatar_128,omitempty"` + CalendarId *Many2One `xmlrpc:"calendar_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Email *String `xmlrpc:"email,omitempty"` + EmployeeId *Relation `xmlrpc:"employee_id,omitempty"` + EmployeeSkillIds *Relation `xmlrpc:"employee_skill_ids,omitempty"` + HrIconDisplay *Selection `xmlrpc:"hr_icon_display,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ImStatus *String `xmlrpc:"im_status,omitempty"` + JobTitle *String `xmlrpc:"job_title,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Phone *String `xmlrpc:"phone,omitempty"` + ResourceType *Selection `xmlrpc:"resource_type,omitempty"` + Share *Bool `xmlrpc:"share,omitempty"` + ShowHrIconDisplay *Bool `xmlrpc:"show_hr_icon_display,omitempty"` + TimeEfficiency *Float `xmlrpc:"time_efficiency,omitempty"` + Tz *Selection `xmlrpc:"tz,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WorkEmail *String `xmlrpc:"work_email,omitempty"` + WorkPhone *String `xmlrpc:"work_phone,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ResourceResources represents array of resource.resource model. +type ResourceResources []ResourceResource + +// ResourceResourceModel is the odoo model name. +const ResourceResourceModel = "resource.resource" + +// Many2One convert ResourceResource to *Many2One. +func (rr *ResourceResource) Many2One() *Many2One { + return NewMany2One(rr.Id.Get(), "") +} + +// CreateResourceResource creates a new resource.resource model and returns its id. +func (c *Client) CreateResourceResource(rr *ResourceResource) (int64, error) { + ids, err := c.CreateResourceResources([]*ResourceResource{rr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateResourceResource creates a new resource.resource model and returns its id. +func (c *Client) CreateResourceResources(rrs []*ResourceResource) ([]int64, error) { + var vv []interface{} + for _, v := range rrs { + vv = append(vv, v) + } + return c.Create(ResourceResourceModel, vv, nil) +} + +// UpdateResourceResource updates an existing resource.resource record. +func (c *Client) UpdateResourceResource(rr *ResourceResource) error { + return c.UpdateResourceResources([]int64{rr.Id.Get()}, rr) +} + +// UpdateResourceResources updates existing resource.resource records. +// All records (represented by ids) will be updated by rr values. +func (c *Client) UpdateResourceResources(ids []int64, rr *ResourceResource) error { + return c.Update(ResourceResourceModel, ids, rr, nil) +} + +// DeleteResourceResource deletes an existing resource.resource record. +func (c *Client) DeleteResourceResource(id int64) error { + return c.DeleteResourceResources([]int64{id}) +} + +// DeleteResourceResources deletes existing resource.resource records. +func (c *Client) DeleteResourceResources(ids []int64) error { + return c.Delete(ResourceResourceModel, ids) +} + +// GetResourceResource gets resource.resource existing record. +func (c *Client) GetResourceResource(id int64) (*ResourceResource, error) { + rrs, err := c.GetResourceResources([]int64{id}) + if err != nil { + return nil, err + } + return &((*rrs)[0]), nil +} + +// GetResourceResources gets resource.resource existing records. +func (c *Client) GetResourceResources(ids []int64) (*ResourceResources, error) { + rrs := &ResourceResources{} + if err := c.Read(ResourceResourceModel, ids, nil, rrs); err != nil { + return nil, err + } + return rrs, nil +} + +// FindResourceResource finds resource.resource record by querying it with criteria. +func (c *Client) FindResourceResource(criteria *Criteria) (*ResourceResource, error) { + rrs := &ResourceResources{} + if err := c.SearchRead(ResourceResourceModel, criteria, NewOptions().Limit(1), rrs); err != nil { + return nil, err + } + return &((*rrs)[0]), nil +} + +// FindResourceResources finds resource.resource records by querying it +// and filtering it with criteria and options. +func (c *Client) FindResourceResources(criteria *Criteria, options *Options) (*ResourceResources, error) { + rrs := &ResourceResources{} + if err := c.SearchRead(ResourceResourceModel, criteria, options, rrs); err != nil { + return nil, err + } + return rrs, nil +} + +// FindResourceResourceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindResourceResourceIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ResourceResourceModel, criteria, options) +} + +// FindResourceResourceId finds record id by querying it with criteria. +func (c *Client) FindResourceResourceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ResourceResourceModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sale_advance_payment_inv.go b/sale_advance_payment_inv.go new file mode 100644 index 0000000..7217e08 --- /dev/null +++ b/sale_advance_payment_inv.go @@ -0,0 +1,133 @@ +package odoo + +// SaleAdvancePaymentInv represents sale.advance.payment.inv model. +type SaleAdvancePaymentInv struct { + AdvancePaymentMethod *Selection `xmlrpc:"advance_payment_method,omitempty"` + Amount *Float `xmlrpc:"amount,omitempty"` + AmountInvoiced *Float `xmlrpc:"amount_invoiced,omitempty"` + AmountToInvoice *Float `xmlrpc:"amount_to_invoice,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + ConsolidatedBilling *Bool `xmlrpc:"consolidated_billing,omitempty"` + Count *Int `xmlrpc:"count,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DateEndInvoiceTimesheet *Time `xmlrpc:"date_end_invoice_timesheet,omitempty"` + DateStartInvoiceTimesheet *Time `xmlrpc:"date_start_invoice_timesheet,omitempty"` + DeductDownPayments *Bool `xmlrpc:"deduct_down_payments,omitempty"` + DisplayDraftInvoiceWarning *Bool `xmlrpc:"display_draft_invoice_warning,omitempty"` + DisplayInvoiceAmountWarning *Bool `xmlrpc:"display_invoice_amount_warning,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FixedAmount *Float `xmlrpc:"fixed_amount,omitempty"` + HasDownPayments *Bool `xmlrpc:"has_down_payments,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoicingTimesheetEnabled *Bool `xmlrpc:"invoicing_timesheet_enabled,omitempty"` + SaleOrderIds *Relation `xmlrpc:"sale_order_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SaleAdvancePaymentInvs represents array of sale.advance.payment.inv model. +type SaleAdvancePaymentInvs []SaleAdvancePaymentInv + +// SaleAdvancePaymentInvModel is the odoo model name. +const SaleAdvancePaymentInvModel = "sale.advance.payment.inv" + +// Many2One convert SaleAdvancePaymentInv to *Many2One. +func (sapi *SaleAdvancePaymentInv) Many2One() *Many2One { + return NewMany2One(sapi.Id.Get(), "") +} + +// CreateSaleAdvancePaymentInv creates a new sale.advance.payment.inv model and returns its id. +func (c *Client) CreateSaleAdvancePaymentInv(sapi *SaleAdvancePaymentInv) (int64, error) { + ids, err := c.CreateSaleAdvancePaymentInvs([]*SaleAdvancePaymentInv{sapi}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSaleAdvancePaymentInv creates a new sale.advance.payment.inv model and returns its id. +func (c *Client) CreateSaleAdvancePaymentInvs(sapis []*SaleAdvancePaymentInv) ([]int64, error) { + var vv []interface{} + for _, v := range sapis { + vv = append(vv, v) + } + return c.Create(SaleAdvancePaymentInvModel, vv, nil) +} + +// UpdateSaleAdvancePaymentInv updates an existing sale.advance.payment.inv record. +func (c *Client) UpdateSaleAdvancePaymentInv(sapi *SaleAdvancePaymentInv) error { + return c.UpdateSaleAdvancePaymentInvs([]int64{sapi.Id.Get()}, sapi) +} + +// UpdateSaleAdvancePaymentInvs updates existing sale.advance.payment.inv records. +// All records (represented by ids) will be updated by sapi values. +func (c *Client) UpdateSaleAdvancePaymentInvs(ids []int64, sapi *SaleAdvancePaymentInv) error { + return c.Update(SaleAdvancePaymentInvModel, ids, sapi, nil) +} + +// DeleteSaleAdvancePaymentInv deletes an existing sale.advance.payment.inv record. +func (c *Client) DeleteSaleAdvancePaymentInv(id int64) error { + return c.DeleteSaleAdvancePaymentInvs([]int64{id}) +} + +// DeleteSaleAdvancePaymentInvs deletes existing sale.advance.payment.inv records. +func (c *Client) DeleteSaleAdvancePaymentInvs(ids []int64) error { + return c.Delete(SaleAdvancePaymentInvModel, ids) +} + +// GetSaleAdvancePaymentInv gets sale.advance.payment.inv existing record. +func (c *Client) GetSaleAdvancePaymentInv(id int64) (*SaleAdvancePaymentInv, error) { + sapis, err := c.GetSaleAdvancePaymentInvs([]int64{id}) + if err != nil { + return nil, err + } + return &((*sapis)[0]), nil +} + +// GetSaleAdvancePaymentInvs gets sale.advance.payment.inv existing records. +func (c *Client) GetSaleAdvancePaymentInvs(ids []int64) (*SaleAdvancePaymentInvs, error) { + sapis := &SaleAdvancePaymentInvs{} + if err := c.Read(SaleAdvancePaymentInvModel, ids, nil, sapis); err != nil { + return nil, err + } + return sapis, nil +} + +// FindSaleAdvancePaymentInv finds sale.advance.payment.inv record by querying it with criteria. +func (c *Client) FindSaleAdvancePaymentInv(criteria *Criteria) (*SaleAdvancePaymentInv, error) { + sapis := &SaleAdvancePaymentInvs{} + if err := c.SearchRead(SaleAdvancePaymentInvModel, criteria, NewOptions().Limit(1), sapis); err != nil { + return nil, err + } + return &((*sapis)[0]), nil +} + +// FindSaleAdvancePaymentInvs finds sale.advance.payment.inv records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleAdvancePaymentInvs(criteria *Criteria, options *Options) (*SaleAdvancePaymentInvs, error) { + sapis := &SaleAdvancePaymentInvs{} + if err := c.SearchRead(SaleAdvancePaymentInvModel, criteria, options, sapis); err != nil { + return nil, err + } + return sapis, nil +} + +// FindSaleAdvancePaymentInvIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleAdvancePaymentInvIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SaleAdvancePaymentInvModel, criteria, options) +} + +// FindSaleAdvancePaymentInvId finds record id by querying it with criteria. +func (c *Client) FindSaleAdvancePaymentInvId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SaleAdvancePaymentInvModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sale_mass_cancel_orders.go b/sale_mass_cancel_orders.go new file mode 100644 index 0000000..0275b0d --- /dev/null +++ b/sale_mass_cancel_orders.go @@ -0,0 +1,119 @@ +package odoo + +// SaleMassCancelOrders represents sale.mass.cancel.orders model. +type SaleMassCancelOrders struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasConfirmedOrder *Bool `xmlrpc:"has_confirmed_order,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + SaleOrderIds *Relation `xmlrpc:"sale_order_ids,omitempty"` + SaleOrdersCount *Int `xmlrpc:"sale_orders_count,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SaleMassCancelOrderss represents array of sale.mass.cancel.orders model. +type SaleMassCancelOrderss []SaleMassCancelOrders + +// SaleMassCancelOrdersModel is the odoo model name. +const SaleMassCancelOrdersModel = "sale.mass.cancel.orders" + +// Many2One convert SaleMassCancelOrders to *Many2One. +func (smco *SaleMassCancelOrders) Many2One() *Many2One { + return NewMany2One(smco.Id.Get(), "") +} + +// CreateSaleMassCancelOrders creates a new sale.mass.cancel.orders model and returns its id. +func (c *Client) CreateSaleMassCancelOrders(smco *SaleMassCancelOrders) (int64, error) { + ids, err := c.CreateSaleMassCancelOrderss([]*SaleMassCancelOrders{smco}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSaleMassCancelOrders creates a new sale.mass.cancel.orders model and returns its id. +func (c *Client) CreateSaleMassCancelOrderss(smcos []*SaleMassCancelOrders) ([]int64, error) { + var vv []interface{} + for _, v := range smcos { + vv = append(vv, v) + } + return c.Create(SaleMassCancelOrdersModel, vv, nil) +} + +// UpdateSaleMassCancelOrders updates an existing sale.mass.cancel.orders record. +func (c *Client) UpdateSaleMassCancelOrders(smco *SaleMassCancelOrders) error { + return c.UpdateSaleMassCancelOrderss([]int64{smco.Id.Get()}, smco) +} + +// UpdateSaleMassCancelOrderss updates existing sale.mass.cancel.orders records. +// All records (represented by ids) will be updated by smco values. +func (c *Client) UpdateSaleMassCancelOrderss(ids []int64, smco *SaleMassCancelOrders) error { + return c.Update(SaleMassCancelOrdersModel, ids, smco, nil) +} + +// DeleteSaleMassCancelOrders deletes an existing sale.mass.cancel.orders record. +func (c *Client) DeleteSaleMassCancelOrders(id int64) error { + return c.DeleteSaleMassCancelOrderss([]int64{id}) +} + +// DeleteSaleMassCancelOrderss deletes existing sale.mass.cancel.orders records. +func (c *Client) DeleteSaleMassCancelOrderss(ids []int64) error { + return c.Delete(SaleMassCancelOrdersModel, ids) +} + +// GetSaleMassCancelOrders gets sale.mass.cancel.orders existing record. +func (c *Client) GetSaleMassCancelOrders(id int64) (*SaleMassCancelOrders, error) { + smcos, err := c.GetSaleMassCancelOrderss([]int64{id}) + if err != nil { + return nil, err + } + return &((*smcos)[0]), nil +} + +// GetSaleMassCancelOrderss gets sale.mass.cancel.orders existing records. +func (c *Client) GetSaleMassCancelOrderss(ids []int64) (*SaleMassCancelOrderss, error) { + smcos := &SaleMassCancelOrderss{} + if err := c.Read(SaleMassCancelOrdersModel, ids, nil, smcos); err != nil { + return nil, err + } + return smcos, nil +} + +// FindSaleMassCancelOrders finds sale.mass.cancel.orders record by querying it with criteria. +func (c *Client) FindSaleMassCancelOrders(criteria *Criteria) (*SaleMassCancelOrders, error) { + smcos := &SaleMassCancelOrderss{} + if err := c.SearchRead(SaleMassCancelOrdersModel, criteria, NewOptions().Limit(1), smcos); err != nil { + return nil, err + } + return &((*smcos)[0]), nil +} + +// FindSaleMassCancelOrderss finds sale.mass.cancel.orders records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleMassCancelOrderss(criteria *Criteria, options *Options) (*SaleMassCancelOrderss, error) { + smcos := &SaleMassCancelOrderss{} + if err := c.SearchRead(SaleMassCancelOrdersModel, criteria, options, smcos); err != nil { + return nil, err + } + return smcos, nil +} + +// FindSaleMassCancelOrdersIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleMassCancelOrdersIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SaleMassCancelOrdersModel, criteria, options) +} + +// FindSaleMassCancelOrdersId finds record id by querying it with criteria. +func (c *Client) FindSaleMassCancelOrdersId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SaleMassCancelOrdersModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sale_order.go b/sale_order.go new file mode 100644 index 0000000..f1c68de --- /dev/null +++ b/sale_order.go @@ -0,0 +1,232 @@ +package odoo + +// SaleOrder represents sale.order model. +type SaleOrder struct { + AccessToken *String `xmlrpc:"access_token,omitempty"` + AccessUrl *String `xmlrpc:"access_url,omitempty"` + AccessWarning *String `xmlrpc:"access_warning,omitempty"` + ActivityCalendarEventId *Many2One `xmlrpc:"activity_calendar_event_id,omitempty"` + ActivityDateDeadline *Time `xmlrpc:"activity_date_deadline,omitempty"` + ActivityExceptionDecoration *Selection `xmlrpc:"activity_exception_decoration,omitempty"` + ActivityExceptionIcon *String `xmlrpc:"activity_exception_icon,omitempty"` + ActivityIds *Relation `xmlrpc:"activity_ids,omitempty"` + ActivityState *Selection `xmlrpc:"activity_state,omitempty"` + ActivitySummary *String `xmlrpc:"activity_summary,omitempty"` + ActivityTypeIcon *String `xmlrpc:"activity_type_icon,omitempty"` + ActivityTypeId *Many2One `xmlrpc:"activity_type_id,omitempty"` + ActivityUserId *Many2One `xmlrpc:"activity_user_id,omitempty"` + AmountInvoiced *Float `xmlrpc:"amount_invoiced,omitempty"` + AmountPaid *Float `xmlrpc:"amount_paid,omitempty"` + AmountTax *Float `xmlrpc:"amount_tax,omitempty"` + AmountToInvoice *Float `xmlrpc:"amount_to_invoice,omitempty"` + AmountTotal *Float `xmlrpc:"amount_total,omitempty"` + AmountUndiscounted *Float `xmlrpc:"amount_undiscounted,omitempty"` + AmountUntaxed *Float `xmlrpc:"amount_untaxed,omitempty"` + AuthorizedTransactionIds *Relation `xmlrpc:"authorized_transaction_ids,omitempty"` + AvailableProductDocumentIds *Relation `xmlrpc:"available_product_document_ids,omitempty"` + CampaignId *Many2One `xmlrpc:"campaign_id,omitempty"` + ClientOrderRef *String `xmlrpc:"client_order_ref,omitempty"` + ClosedTaskCount *Int `xmlrpc:"closed_task_count,omitempty"` + CommitmentDate *Time `xmlrpc:"commitment_date,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanyPriceInclude *Selection `xmlrpc:"company_price_include,omitempty"` + CompletedTaskPercentage *Float `xmlrpc:"completed_task_percentage,omitempty"` + CountryCode *String `xmlrpc:"country_code,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + CurrencyRate *Float `xmlrpc:"currency_rate,omitempty"` + CustomizablePdfFormFields *String `xmlrpc:"customizable_pdf_form_fields,omitempty"` + DateOrder *Time `xmlrpc:"date_order,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DuplicatedOrderIds *Relation `xmlrpc:"duplicated_order_ids,omitempty"` + ExpectedDate *Time `xmlrpc:"expected_date,omitempty"` + ExpenseCount *Int `xmlrpc:"expense_count,omitempty"` + ExpenseIds *Relation `xmlrpc:"expense_ids,omitempty"` + FiscalPositionId *Many2One `xmlrpc:"fiscal_position_id,omitempty"` + HasActivePricelist *Bool `xmlrpc:"has_active_pricelist,omitempty"` + HasArchivedProducts *Bool `xmlrpc:"has_archived_products,omitempty"` + HasMessage *Bool `xmlrpc:"has_message,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceCount *Int `xmlrpc:"invoice_count,omitempty"` + InvoiceIds *Relation `xmlrpc:"invoice_ids,omitempty"` + InvoiceStatus *Selection `xmlrpc:"invoice_status,omitempty"` + IsExpired *Bool `xmlrpc:"is_expired,omitempty"` + IsPdfQuoteBuilderAvailable *Bool `xmlrpc:"is_pdf_quote_builder_available,omitempty"` + IsProductMilestone *Bool `xmlrpc:"is_product_milestone,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + Locked *Bool `xmlrpc:"locked,omitempty"` + MediumId *Many2One `xmlrpc:"medium_id,omitempty"` + MessageAttachmentCount *Int `xmlrpc:"message_attachment_count,omitempty"` + MessageFollowerIds *Relation `xmlrpc:"message_follower_ids,omitempty"` + MessageHasError *Bool `xmlrpc:"message_has_error,omitempty"` + MessageHasErrorCounter *Int `xmlrpc:"message_has_error_counter,omitempty"` + MessageHasSmsError *Bool `xmlrpc:"message_has_sms_error,omitempty"` + MessageIds *Relation `xmlrpc:"message_ids,omitempty"` + MessageIsFollower *Bool `xmlrpc:"message_is_follower,omitempty"` + MessageNeedaction *Bool `xmlrpc:"message_needaction,omitempty"` + MessageNeedactionCounter *Int `xmlrpc:"message_needaction_counter,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MilestoneCount *Int `xmlrpc:"milestone_count,omitempty"` + MyActivityDateDeadline *Time `xmlrpc:"my_activity_date_deadline,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + OpportunityId *Many2One `xmlrpc:"opportunity_id,omitempty"` + OrderLine *Relation `xmlrpc:"order_line,omitempty"` + Origin *String `xmlrpc:"origin,omitempty"` + PartnerCreditWarning *String `xmlrpc:"partner_credit_warning,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerInvoiceId *Many2One `xmlrpc:"partner_invoice_id,omitempty"` + PartnerShippingId *Many2One `xmlrpc:"partner_shipping_id,omitempty"` + PaymentTermId *Many2One `xmlrpc:"payment_term_id,omitempty"` + PendingEmailTemplateId *Many2One `xmlrpc:"pending_email_template_id,omitempty"` + PrepaymentPercent *Float `xmlrpc:"prepayment_percent,omitempty"` + PricelistId *Many2One `xmlrpc:"pricelist_id,omitempty"` + ProjectAccountId *Many2One `xmlrpc:"project_account_id,omitempty"` + ProjectCount *Int `xmlrpc:"project_count,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + ProjectIds *Relation `xmlrpc:"project_ids,omitempty"` + PurchaseOrderCount *Int `xmlrpc:"purchase_order_count,omitempty"` + QuotationDocumentIds *Relation `xmlrpc:"quotation_document_ids,omitempty"` + RatingIds *Relation `xmlrpc:"rating_ids,omitempty"` + Reference *String `xmlrpc:"reference,omitempty"` + RequirePayment *Bool `xmlrpc:"require_payment,omitempty"` + RequireSignature *Bool `xmlrpc:"require_signature,omitempty"` + SaleOrderOptionIds *Relation `xmlrpc:"sale_order_option_ids,omitempty"` + SaleOrderTemplateId *Many2One `xmlrpc:"sale_order_template_id,omitempty"` + ShowCreateProjectButton *Bool `xmlrpc:"show_create_project_button,omitempty"` + ShowHoursRecordedButton *Bool `xmlrpc:"show_hours_recorded_button,omitempty"` + ShowProjectButton *Bool `xmlrpc:"show_project_button,omitempty"` + ShowTaskButton *Bool `xmlrpc:"show_task_button,omitempty"` + ShowUpdateFpos *Bool `xmlrpc:"show_update_fpos,omitempty"` + ShowUpdatePricelist *Bool `xmlrpc:"show_update_pricelist,omitempty"` + Signature *String `xmlrpc:"signature,omitempty"` + SignedBy *String `xmlrpc:"signed_by,omitempty"` + SignedOn *Time `xmlrpc:"signed_on,omitempty"` + SourceId *Many2One `xmlrpc:"source_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + TasksCount *Int `xmlrpc:"tasks_count,omitempty"` + TasksIds *Relation `xmlrpc:"tasks_ids,omitempty"` + TaxCalculationRoundingMethod *Selection `xmlrpc:"tax_calculation_rounding_method,omitempty"` + TaxCountryId *Many2One `xmlrpc:"tax_country_id,omitempty"` + TaxTotals *String `xmlrpc:"tax_totals,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + TermsType *Selection `xmlrpc:"terms_type,omitempty"` + TimesheetCount *Float `xmlrpc:"timesheet_count,omitempty"` + TimesheetEncodeUomId *Many2One `xmlrpc:"timesheet_encode_uom_id,omitempty"` + TimesheetTotalDuration *Int `xmlrpc:"timesheet_total_duration,omitempty"` + TransactionIds *Relation `xmlrpc:"transaction_ids,omitempty"` + TypeName *String `xmlrpc:"type_name,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + ValidityDate *Time `xmlrpc:"validity_date,omitempty"` + VisibleProject *Bool `xmlrpc:"visible_project,omitempty"` + WebsiteMessageIds *Relation `xmlrpc:"website_message_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SaleOrders represents array of sale.order model. +type SaleOrders []SaleOrder + +// SaleOrderModel is the odoo model name. +const SaleOrderModel = "sale.order" + +// Many2One convert SaleOrder to *Many2One. +func (so *SaleOrder) Many2One() *Many2One { + return NewMany2One(so.Id.Get(), "") +} + +// CreateSaleOrder creates a new sale.order model and returns its id. +func (c *Client) CreateSaleOrder(so *SaleOrder) (int64, error) { + ids, err := c.CreateSaleOrders([]*SaleOrder{so}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSaleOrder creates a new sale.order model and returns its id. +func (c *Client) CreateSaleOrders(sos []*SaleOrder) ([]int64, error) { + var vv []interface{} + for _, v := range sos { + vv = append(vv, v) + } + return c.Create(SaleOrderModel, vv, nil) +} + +// UpdateSaleOrder updates an existing sale.order record. +func (c *Client) UpdateSaleOrder(so *SaleOrder) error { + return c.UpdateSaleOrders([]int64{so.Id.Get()}, so) +} + +// UpdateSaleOrders updates existing sale.order records. +// All records (represented by ids) will be updated by so values. +func (c *Client) UpdateSaleOrders(ids []int64, so *SaleOrder) error { + return c.Update(SaleOrderModel, ids, so, nil) +} + +// DeleteSaleOrder deletes an existing sale.order record. +func (c *Client) DeleteSaleOrder(id int64) error { + return c.DeleteSaleOrders([]int64{id}) +} + +// DeleteSaleOrders deletes existing sale.order records. +func (c *Client) DeleteSaleOrders(ids []int64) error { + return c.Delete(SaleOrderModel, ids) +} + +// GetSaleOrder gets sale.order existing record. +func (c *Client) GetSaleOrder(id int64) (*SaleOrder, error) { + sos, err := c.GetSaleOrders([]int64{id}) + if err != nil { + return nil, err + } + return &((*sos)[0]), nil +} + +// GetSaleOrders gets sale.order existing records. +func (c *Client) GetSaleOrders(ids []int64) (*SaleOrders, error) { + sos := &SaleOrders{} + if err := c.Read(SaleOrderModel, ids, nil, sos); err != nil { + return nil, err + } + return sos, nil +} + +// FindSaleOrder finds sale.order record by querying it with criteria. +func (c *Client) FindSaleOrder(criteria *Criteria) (*SaleOrder, error) { + sos := &SaleOrders{} + if err := c.SearchRead(SaleOrderModel, criteria, NewOptions().Limit(1), sos); err != nil { + return nil, err + } + return &((*sos)[0]), nil +} + +// FindSaleOrders finds sale.order records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleOrders(criteria *Criteria, options *Options) (*SaleOrders, error) { + sos := &SaleOrders{} + if err := c.SearchRead(SaleOrderModel, criteria, options, sos); err != nil { + return nil, err + } + return sos, nil +} + +// FindSaleOrderIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleOrderIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SaleOrderModel, criteria, options) +} + +// FindSaleOrderId finds record id by querying it with criteria. +func (c *Client) FindSaleOrderId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SaleOrderModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sale_order_cancel.go b/sale_order_cancel.go new file mode 100644 index 0000000..d5f49fe --- /dev/null +++ b/sale_order_cancel.go @@ -0,0 +1,129 @@ +package odoo + +// SaleOrderCancel represents sale.order.cancel model. +type SaleOrderCancel struct { + AuthorId *Many2One `xmlrpc:"author_id,omitempty"` + Body *String `xmlrpc:"body,omitempty"` + BodyHasTemplateValue *Bool `xmlrpc:"body_has_template_value,omitempty"` + CanEditBody *Bool `xmlrpc:"can_edit_body,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayInvoiceAlert *Bool `xmlrpc:"display_invoice_alert,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayPurchaseOrdersAlert *Bool `xmlrpc:"display_purchase_orders_alert,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsMailTemplateEditor *Bool `xmlrpc:"is_mail_template_editor,omitempty"` + Lang *String `xmlrpc:"lang,omitempty"` + OrderId *Many2One `xmlrpc:"order_id,omitempty"` + RecipientIds *Relation `xmlrpc:"recipient_ids,omitempty"` + RenderModel *String `xmlrpc:"render_model,omitempty"` + Subject *String `xmlrpc:"subject,omitempty"` + TemplateId *Many2One `xmlrpc:"template_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SaleOrderCancels represents array of sale.order.cancel model. +type SaleOrderCancels []SaleOrderCancel + +// SaleOrderCancelModel is the odoo model name. +const SaleOrderCancelModel = "sale.order.cancel" + +// Many2One convert SaleOrderCancel to *Many2One. +func (soc *SaleOrderCancel) Many2One() *Many2One { + return NewMany2One(soc.Id.Get(), "") +} + +// CreateSaleOrderCancel creates a new sale.order.cancel model and returns its id. +func (c *Client) CreateSaleOrderCancel(soc *SaleOrderCancel) (int64, error) { + ids, err := c.CreateSaleOrderCancels([]*SaleOrderCancel{soc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSaleOrderCancel creates a new sale.order.cancel model and returns its id. +func (c *Client) CreateSaleOrderCancels(socs []*SaleOrderCancel) ([]int64, error) { + var vv []interface{} + for _, v := range socs { + vv = append(vv, v) + } + return c.Create(SaleOrderCancelModel, vv, nil) +} + +// UpdateSaleOrderCancel updates an existing sale.order.cancel record. +func (c *Client) UpdateSaleOrderCancel(soc *SaleOrderCancel) error { + return c.UpdateSaleOrderCancels([]int64{soc.Id.Get()}, soc) +} + +// UpdateSaleOrderCancels updates existing sale.order.cancel records. +// All records (represented by ids) will be updated by soc values. +func (c *Client) UpdateSaleOrderCancels(ids []int64, soc *SaleOrderCancel) error { + return c.Update(SaleOrderCancelModel, ids, soc, nil) +} + +// DeleteSaleOrderCancel deletes an existing sale.order.cancel record. +func (c *Client) DeleteSaleOrderCancel(id int64) error { + return c.DeleteSaleOrderCancels([]int64{id}) +} + +// DeleteSaleOrderCancels deletes existing sale.order.cancel records. +func (c *Client) DeleteSaleOrderCancels(ids []int64) error { + return c.Delete(SaleOrderCancelModel, ids) +} + +// GetSaleOrderCancel gets sale.order.cancel existing record. +func (c *Client) GetSaleOrderCancel(id int64) (*SaleOrderCancel, error) { + socs, err := c.GetSaleOrderCancels([]int64{id}) + if err != nil { + return nil, err + } + return &((*socs)[0]), nil +} + +// GetSaleOrderCancels gets sale.order.cancel existing records. +func (c *Client) GetSaleOrderCancels(ids []int64) (*SaleOrderCancels, error) { + socs := &SaleOrderCancels{} + if err := c.Read(SaleOrderCancelModel, ids, nil, socs); err != nil { + return nil, err + } + return socs, nil +} + +// FindSaleOrderCancel finds sale.order.cancel record by querying it with criteria. +func (c *Client) FindSaleOrderCancel(criteria *Criteria) (*SaleOrderCancel, error) { + socs := &SaleOrderCancels{} + if err := c.SearchRead(SaleOrderCancelModel, criteria, NewOptions().Limit(1), socs); err != nil { + return nil, err + } + return &((*socs)[0]), nil +} + +// FindSaleOrderCancels finds sale.order.cancel records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleOrderCancels(criteria *Criteria, options *Options) (*SaleOrderCancels, error) { + socs := &SaleOrderCancels{} + if err := c.SearchRead(SaleOrderCancelModel, criteria, options, socs); err != nil { + return nil, err + } + return socs, nil +} + +// FindSaleOrderCancelIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleOrderCancelIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SaleOrderCancelModel, criteria, options) +} + +// FindSaleOrderCancelId finds record id by querying it with criteria. +func (c *Client) FindSaleOrderCancelId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SaleOrderCancelModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sale_order_discount.go b/sale_order_discount.go new file mode 100644 index 0000000..ad6c52e --- /dev/null +++ b/sale_order_discount.go @@ -0,0 +1,123 @@ +package odoo + +// SaleOrderDiscount represents sale.order.discount model. +type SaleOrderDiscount struct { + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DiscountAmount *Float `xmlrpc:"discount_amount,omitempty"` + DiscountPercentage *Float `xmlrpc:"discount_percentage,omitempty"` + DiscountType *Selection `xmlrpc:"discount_type,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + SaleOrderId *Many2One `xmlrpc:"sale_order_id,omitempty"` + TaxIds *Relation `xmlrpc:"tax_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SaleOrderDiscounts represents array of sale.order.discount model. +type SaleOrderDiscounts []SaleOrderDiscount + +// SaleOrderDiscountModel is the odoo model name. +const SaleOrderDiscountModel = "sale.order.discount" + +// Many2One convert SaleOrderDiscount to *Many2One. +func (sod *SaleOrderDiscount) Many2One() *Many2One { + return NewMany2One(sod.Id.Get(), "") +} + +// CreateSaleOrderDiscount creates a new sale.order.discount model and returns its id. +func (c *Client) CreateSaleOrderDiscount(sod *SaleOrderDiscount) (int64, error) { + ids, err := c.CreateSaleOrderDiscounts([]*SaleOrderDiscount{sod}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSaleOrderDiscount creates a new sale.order.discount model and returns its id. +func (c *Client) CreateSaleOrderDiscounts(sods []*SaleOrderDiscount) ([]int64, error) { + var vv []interface{} + for _, v := range sods { + vv = append(vv, v) + } + return c.Create(SaleOrderDiscountModel, vv, nil) +} + +// UpdateSaleOrderDiscount updates an existing sale.order.discount record. +func (c *Client) UpdateSaleOrderDiscount(sod *SaleOrderDiscount) error { + return c.UpdateSaleOrderDiscounts([]int64{sod.Id.Get()}, sod) +} + +// UpdateSaleOrderDiscounts updates existing sale.order.discount records. +// All records (represented by ids) will be updated by sod values. +func (c *Client) UpdateSaleOrderDiscounts(ids []int64, sod *SaleOrderDiscount) error { + return c.Update(SaleOrderDiscountModel, ids, sod, nil) +} + +// DeleteSaleOrderDiscount deletes an existing sale.order.discount record. +func (c *Client) DeleteSaleOrderDiscount(id int64) error { + return c.DeleteSaleOrderDiscounts([]int64{id}) +} + +// DeleteSaleOrderDiscounts deletes existing sale.order.discount records. +func (c *Client) DeleteSaleOrderDiscounts(ids []int64) error { + return c.Delete(SaleOrderDiscountModel, ids) +} + +// GetSaleOrderDiscount gets sale.order.discount existing record. +func (c *Client) GetSaleOrderDiscount(id int64) (*SaleOrderDiscount, error) { + sods, err := c.GetSaleOrderDiscounts([]int64{id}) + if err != nil { + return nil, err + } + return &((*sods)[0]), nil +} + +// GetSaleOrderDiscounts gets sale.order.discount existing records. +func (c *Client) GetSaleOrderDiscounts(ids []int64) (*SaleOrderDiscounts, error) { + sods := &SaleOrderDiscounts{} + if err := c.Read(SaleOrderDiscountModel, ids, nil, sods); err != nil { + return nil, err + } + return sods, nil +} + +// FindSaleOrderDiscount finds sale.order.discount record by querying it with criteria. +func (c *Client) FindSaleOrderDiscount(criteria *Criteria) (*SaleOrderDiscount, error) { + sods := &SaleOrderDiscounts{} + if err := c.SearchRead(SaleOrderDiscountModel, criteria, NewOptions().Limit(1), sods); err != nil { + return nil, err + } + return &((*sods)[0]), nil +} + +// FindSaleOrderDiscounts finds sale.order.discount records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleOrderDiscounts(criteria *Criteria, options *Options) (*SaleOrderDiscounts, error) { + sods := &SaleOrderDiscounts{} + if err := c.SearchRead(SaleOrderDiscountModel, criteria, options, sods); err != nil { + return nil, err + } + return sods, nil +} + +// FindSaleOrderDiscountIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleOrderDiscountIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SaleOrderDiscountModel, criteria, options) +} + +// FindSaleOrderDiscountId finds record id by querying it with criteria. +func (c *Client) FindSaleOrderDiscountId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SaleOrderDiscountModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sale_order_line.go b/sale_order_line.go new file mode 100644 index 0000000..2a3ff1a --- /dev/null +++ b/sale_order_line.go @@ -0,0 +1,191 @@ +package odoo + +// SaleOrderLine represents sale.order.line model. +type SaleOrderLine struct { + AmountInvoiced *Float `xmlrpc:"amount_invoiced,omitempty"` + AmountToInvoice *Float `xmlrpc:"amount_to_invoice,omitempty"` + AnalyticDistribution *String `xmlrpc:"analytic_distribution,omitempty"` + AnalyticLineIds *Relation `xmlrpc:"analytic_line_ids,omitempty"` + AnalyticPrecision *Int `xmlrpc:"analytic_precision,omitempty"` + AvailableProductDocumentIds *Relation `xmlrpc:"available_product_document_ids,omitempty"` + ComboItemId *Many2One `xmlrpc:"combo_item_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CompanyPriceInclude *Selection `xmlrpc:"company_price_include,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + CustomerLead *Float `xmlrpc:"customer_lead,omitempty"` + Discount *Float `xmlrpc:"discount,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayType *Selection `xmlrpc:"display_type,omitempty"` + DistributionAnalyticAccountIds *Relation `xmlrpc:"distribution_analytic_account_ids,omitempty"` + HasDisplayedWarningUpsell *Bool `xmlrpc:"has_displayed_warning_upsell,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceLines *Relation `xmlrpc:"invoice_lines,omitempty"` + InvoiceStatus *Selection `xmlrpc:"invoice_status,omitempty"` + IsConfigurableProduct *Bool `xmlrpc:"is_configurable_product,omitempty"` + IsDownpayment *Bool `xmlrpc:"is_downpayment,omitempty"` + IsExpense *Bool `xmlrpc:"is_expense,omitempty"` + IsProductArchived *Bool `xmlrpc:"is_product_archived,omitempty"` + IsService *Bool `xmlrpc:"is_service,omitempty"` + LinkedLineId *Many2One `xmlrpc:"linked_line_id,omitempty"` + LinkedLineIds *Relation `xmlrpc:"linked_line_ids,omitempty"` + LinkedVirtualId *String `xmlrpc:"linked_virtual_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OrderId *Many2One `xmlrpc:"order_id,omitempty"` + OrderPartnerId *Many2One `xmlrpc:"order_partner_id,omitempty"` + PriceReduceTaxexcl *Float `xmlrpc:"price_reduce_taxexcl,omitempty"` + PriceReduceTaxinc *Float `xmlrpc:"price_reduce_taxinc,omitempty"` + PriceSubtotal *Float `xmlrpc:"price_subtotal,omitempty"` + PriceTax *Float `xmlrpc:"price_tax,omitempty"` + PriceTotal *Float `xmlrpc:"price_total,omitempty"` + PriceUnit *Float `xmlrpc:"price_unit,omitempty"` + PricelistItemId *Many2One `xmlrpc:"pricelist_item_id,omitempty"` + ProductCustomAttributeValueIds *Relation `xmlrpc:"product_custom_attribute_value_ids,omitempty"` + ProductDocumentIds *Relation `xmlrpc:"product_document_ids,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductNoVariantAttributeValueIds *Relation `xmlrpc:"product_no_variant_attribute_value_ids,omitempty"` + ProductPackagingId *Many2One `xmlrpc:"product_packaging_id,omitempty"` + ProductPackagingQty *Float `xmlrpc:"product_packaging_qty,omitempty"` + ProductTemplateAttributeValueIds *Relation `xmlrpc:"product_template_attribute_value_ids,omitempty"` + ProductTemplateId *Many2One `xmlrpc:"product_template_id,omitempty"` + ProductType *Selection `xmlrpc:"product_type,omitempty"` + ProductUom *Many2One `xmlrpc:"product_uom,omitempty"` + ProductUomCategoryId *Many2One `xmlrpc:"product_uom_category_id,omitempty"` + ProductUomQty *Float `xmlrpc:"product_uom_qty,omitempty"` + ProductUomReadonly *Bool `xmlrpc:"product_uom_readonly,omitempty"` + ProductUpdatable *Bool `xmlrpc:"product_updatable,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + PurchaseLineCount *Int `xmlrpc:"purchase_line_count,omitempty"` + PurchaseLineIds *Relation `xmlrpc:"purchase_line_ids,omitempty"` + QtyDelivered *Float `xmlrpc:"qty_delivered,omitempty"` + QtyDeliveredMethod *Selection `xmlrpc:"qty_delivered_method,omitempty"` + QtyInvoiced *Float `xmlrpc:"qty_invoiced,omitempty"` + QtyInvoicedPosted *Float `xmlrpc:"qty_invoiced_posted,omitempty"` + QtyToInvoice *Float `xmlrpc:"qty_to_invoice,omitempty"` + ReachedMilestonesIds *Relation `xmlrpc:"reached_milestones_ids,omitempty"` + RemainingHours *Float `xmlrpc:"remaining_hours,omitempty"` + RemainingHoursAvailable *Bool `xmlrpc:"remaining_hours_available,omitempty"` + SaleOrderOptionIds *Relation `xmlrpc:"sale_order_option_ids,omitempty"` + SalesmanId *Many2One `xmlrpc:"salesman_id,omitempty"` + SelectedComboItems *String `xmlrpc:"selected_combo_items,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + ServiceTracking *Selection `xmlrpc:"service_tracking,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + TaskId *Many2One `xmlrpc:"task_id,omitempty"` + TaxCalculationRoundingMethod *Selection `xmlrpc:"tax_calculation_rounding_method,omitempty"` + TaxCountryId *Many2One `xmlrpc:"tax_country_id,omitempty"` + TaxId *Relation `xmlrpc:"tax_id,omitempty"` + TechnicalPriceUnit *Float `xmlrpc:"technical_price_unit,omitempty"` + TimesheetIds *Relation `xmlrpc:"timesheet_ids,omitempty"` + UntaxedAmountInvoiced *Float `xmlrpc:"untaxed_amount_invoiced,omitempty"` + UntaxedAmountToInvoice *Float `xmlrpc:"untaxed_amount_to_invoice,omitempty"` + VirtualId *String `xmlrpc:"virtual_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SaleOrderLines represents array of sale.order.line model. +type SaleOrderLines []SaleOrderLine + +// SaleOrderLineModel is the odoo model name. +const SaleOrderLineModel = "sale.order.line" + +// Many2One convert SaleOrderLine to *Many2One. +func (sol *SaleOrderLine) Many2One() *Many2One { + return NewMany2One(sol.Id.Get(), "") +} + +// CreateSaleOrderLine creates a new sale.order.line model and returns its id. +func (c *Client) CreateSaleOrderLine(sol *SaleOrderLine) (int64, error) { + ids, err := c.CreateSaleOrderLines([]*SaleOrderLine{sol}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSaleOrderLine creates a new sale.order.line model and returns its id. +func (c *Client) CreateSaleOrderLines(sols []*SaleOrderLine) ([]int64, error) { + var vv []interface{} + for _, v := range sols { + vv = append(vv, v) + } + return c.Create(SaleOrderLineModel, vv, nil) +} + +// UpdateSaleOrderLine updates an existing sale.order.line record. +func (c *Client) UpdateSaleOrderLine(sol *SaleOrderLine) error { + return c.UpdateSaleOrderLines([]int64{sol.Id.Get()}, sol) +} + +// UpdateSaleOrderLines updates existing sale.order.line records. +// All records (represented by ids) will be updated by sol values. +func (c *Client) UpdateSaleOrderLines(ids []int64, sol *SaleOrderLine) error { + return c.Update(SaleOrderLineModel, ids, sol, nil) +} + +// DeleteSaleOrderLine deletes an existing sale.order.line record. +func (c *Client) DeleteSaleOrderLine(id int64) error { + return c.DeleteSaleOrderLines([]int64{id}) +} + +// DeleteSaleOrderLines deletes existing sale.order.line records. +func (c *Client) DeleteSaleOrderLines(ids []int64) error { + return c.Delete(SaleOrderLineModel, ids) +} + +// GetSaleOrderLine gets sale.order.line existing record. +func (c *Client) GetSaleOrderLine(id int64) (*SaleOrderLine, error) { + sols, err := c.GetSaleOrderLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*sols)[0]), nil +} + +// GetSaleOrderLines gets sale.order.line existing records. +func (c *Client) GetSaleOrderLines(ids []int64) (*SaleOrderLines, error) { + sols := &SaleOrderLines{} + if err := c.Read(SaleOrderLineModel, ids, nil, sols); err != nil { + return nil, err + } + return sols, nil +} + +// FindSaleOrderLine finds sale.order.line record by querying it with criteria. +func (c *Client) FindSaleOrderLine(criteria *Criteria) (*SaleOrderLine, error) { + sols := &SaleOrderLines{} + if err := c.SearchRead(SaleOrderLineModel, criteria, NewOptions().Limit(1), sols); err != nil { + return nil, err + } + return &((*sols)[0]), nil +} + +// FindSaleOrderLines finds sale.order.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleOrderLines(criteria *Criteria, options *Options) (*SaleOrderLines, error) { + sols := &SaleOrderLines{} + if err := c.SearchRead(SaleOrderLineModel, criteria, options, sols); err != nil { + return nil, err + } + return sols, nil +} + +// FindSaleOrderLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleOrderLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SaleOrderLineModel, criteria, options) +} + +// FindSaleOrderLineId finds record id by querying it with criteria. +func (c *Client) FindSaleOrderLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SaleOrderLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sale_order_option.go b/sale_order_option.go new file mode 100644 index 0000000..8c8e16b --- /dev/null +++ b/sale_order_option.go @@ -0,0 +1,127 @@ +package odoo + +// SaleOrderOption represents sale.order.option model. +type SaleOrderOption struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Discount *Float `xmlrpc:"discount,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsPresent *Bool `xmlrpc:"is_present,omitempty"` + LineId *Many2One `xmlrpc:"line_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OrderId *Many2One `xmlrpc:"order_id,omitempty"` + PriceUnit *Float `xmlrpc:"price_unit,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductUomCategoryId *Many2One `xmlrpc:"product_uom_category_id,omitempty"` + Quantity *Float `xmlrpc:"quantity,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + UomId *Many2One `xmlrpc:"uom_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SaleOrderOptions represents array of sale.order.option model. +type SaleOrderOptions []SaleOrderOption + +// SaleOrderOptionModel is the odoo model name. +const SaleOrderOptionModel = "sale.order.option" + +// Many2One convert SaleOrderOption to *Many2One. +func (soo *SaleOrderOption) Many2One() *Many2One { + return NewMany2One(soo.Id.Get(), "") +} + +// CreateSaleOrderOption creates a new sale.order.option model and returns its id. +func (c *Client) CreateSaleOrderOption(soo *SaleOrderOption) (int64, error) { + ids, err := c.CreateSaleOrderOptions([]*SaleOrderOption{soo}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSaleOrderOption creates a new sale.order.option model and returns its id. +func (c *Client) CreateSaleOrderOptions(soos []*SaleOrderOption) ([]int64, error) { + var vv []interface{} + for _, v := range soos { + vv = append(vv, v) + } + return c.Create(SaleOrderOptionModel, vv, nil) +} + +// UpdateSaleOrderOption updates an existing sale.order.option record. +func (c *Client) UpdateSaleOrderOption(soo *SaleOrderOption) error { + return c.UpdateSaleOrderOptions([]int64{soo.Id.Get()}, soo) +} + +// UpdateSaleOrderOptions updates existing sale.order.option records. +// All records (represented by ids) will be updated by soo values. +func (c *Client) UpdateSaleOrderOptions(ids []int64, soo *SaleOrderOption) error { + return c.Update(SaleOrderOptionModel, ids, soo, nil) +} + +// DeleteSaleOrderOption deletes an existing sale.order.option record. +func (c *Client) DeleteSaleOrderOption(id int64) error { + return c.DeleteSaleOrderOptions([]int64{id}) +} + +// DeleteSaleOrderOptions deletes existing sale.order.option records. +func (c *Client) DeleteSaleOrderOptions(ids []int64) error { + return c.Delete(SaleOrderOptionModel, ids) +} + +// GetSaleOrderOption gets sale.order.option existing record. +func (c *Client) GetSaleOrderOption(id int64) (*SaleOrderOption, error) { + soos, err := c.GetSaleOrderOptions([]int64{id}) + if err != nil { + return nil, err + } + return &((*soos)[0]), nil +} + +// GetSaleOrderOptions gets sale.order.option existing records. +func (c *Client) GetSaleOrderOptions(ids []int64) (*SaleOrderOptions, error) { + soos := &SaleOrderOptions{} + if err := c.Read(SaleOrderOptionModel, ids, nil, soos); err != nil { + return nil, err + } + return soos, nil +} + +// FindSaleOrderOption finds sale.order.option record by querying it with criteria. +func (c *Client) FindSaleOrderOption(criteria *Criteria) (*SaleOrderOption, error) { + soos := &SaleOrderOptions{} + if err := c.SearchRead(SaleOrderOptionModel, criteria, NewOptions().Limit(1), soos); err != nil { + return nil, err + } + return &((*soos)[0]), nil +} + +// FindSaleOrderOptions finds sale.order.option records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleOrderOptions(criteria *Criteria, options *Options) (*SaleOrderOptions, error) { + soos := &SaleOrderOptions{} + if err := c.SearchRead(SaleOrderOptionModel, criteria, options, soos); err != nil { + return nil, err + } + return soos, nil +} + +// FindSaleOrderOptionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleOrderOptionIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SaleOrderOptionModel, criteria, options) +} + +// FindSaleOrderOptionId finds record id by querying it with criteria. +func (c *Client) FindSaleOrderOptionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SaleOrderOptionModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sale_order_template.go b/sale_order_template.go new file mode 100644 index 0000000..5dccc73 --- /dev/null +++ b/sale_order_template.go @@ -0,0 +1,130 @@ +package odoo + +// SaleOrderTemplate represents sale.order.template model. +type SaleOrderTemplate struct { + Active *Bool `xmlrpc:"active,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalId *Many2One `xmlrpc:"journal_id,omitempty"` + MailTemplateId *Many2One `xmlrpc:"mail_template_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Note *String `xmlrpc:"note,omitempty"` + NumberOfDays *Int `xmlrpc:"number_of_days,omitempty"` + PrepaymentPercent *Float `xmlrpc:"prepayment_percent,omitempty"` + QuotationDocumentIds *Relation `xmlrpc:"quotation_document_ids,omitempty"` + RequirePayment *Bool `xmlrpc:"require_payment,omitempty"` + RequireSignature *Bool `xmlrpc:"require_signature,omitempty"` + SaleOrderTemplateLineIds *Relation `xmlrpc:"sale_order_template_line_ids,omitempty"` + SaleOrderTemplateOptionIds *Relation `xmlrpc:"sale_order_template_option_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SaleOrderTemplates represents array of sale.order.template model. +type SaleOrderTemplates []SaleOrderTemplate + +// SaleOrderTemplateModel is the odoo model name. +const SaleOrderTemplateModel = "sale.order.template" + +// Many2One convert SaleOrderTemplate to *Many2One. +func (sot *SaleOrderTemplate) Many2One() *Many2One { + return NewMany2One(sot.Id.Get(), "") +} + +// CreateSaleOrderTemplate creates a new sale.order.template model and returns its id. +func (c *Client) CreateSaleOrderTemplate(sot *SaleOrderTemplate) (int64, error) { + ids, err := c.CreateSaleOrderTemplates([]*SaleOrderTemplate{sot}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSaleOrderTemplate creates a new sale.order.template model and returns its id. +func (c *Client) CreateSaleOrderTemplates(sots []*SaleOrderTemplate) ([]int64, error) { + var vv []interface{} + for _, v := range sots { + vv = append(vv, v) + } + return c.Create(SaleOrderTemplateModel, vv, nil) +} + +// UpdateSaleOrderTemplate updates an existing sale.order.template record. +func (c *Client) UpdateSaleOrderTemplate(sot *SaleOrderTemplate) error { + return c.UpdateSaleOrderTemplates([]int64{sot.Id.Get()}, sot) +} + +// UpdateSaleOrderTemplates updates existing sale.order.template records. +// All records (represented by ids) will be updated by sot values. +func (c *Client) UpdateSaleOrderTemplates(ids []int64, sot *SaleOrderTemplate) error { + return c.Update(SaleOrderTemplateModel, ids, sot, nil) +} + +// DeleteSaleOrderTemplate deletes an existing sale.order.template record. +func (c *Client) DeleteSaleOrderTemplate(id int64) error { + return c.DeleteSaleOrderTemplates([]int64{id}) +} + +// DeleteSaleOrderTemplates deletes existing sale.order.template records. +func (c *Client) DeleteSaleOrderTemplates(ids []int64) error { + return c.Delete(SaleOrderTemplateModel, ids) +} + +// GetSaleOrderTemplate gets sale.order.template existing record. +func (c *Client) GetSaleOrderTemplate(id int64) (*SaleOrderTemplate, error) { + sots, err := c.GetSaleOrderTemplates([]int64{id}) + if err != nil { + return nil, err + } + return &((*sots)[0]), nil +} + +// GetSaleOrderTemplates gets sale.order.template existing records. +func (c *Client) GetSaleOrderTemplates(ids []int64) (*SaleOrderTemplates, error) { + sots := &SaleOrderTemplates{} + if err := c.Read(SaleOrderTemplateModel, ids, nil, sots); err != nil { + return nil, err + } + return sots, nil +} + +// FindSaleOrderTemplate finds sale.order.template record by querying it with criteria. +func (c *Client) FindSaleOrderTemplate(criteria *Criteria) (*SaleOrderTemplate, error) { + sots := &SaleOrderTemplates{} + if err := c.SearchRead(SaleOrderTemplateModel, criteria, NewOptions().Limit(1), sots); err != nil { + return nil, err + } + return &((*sots)[0]), nil +} + +// FindSaleOrderTemplates finds sale.order.template records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleOrderTemplates(criteria *Criteria, options *Options) (*SaleOrderTemplates, error) { + sots := &SaleOrderTemplates{} + if err := c.SearchRead(SaleOrderTemplateModel, criteria, options, sots); err != nil { + return nil, err + } + return sots, nil +} + +// FindSaleOrderTemplateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleOrderTemplateIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SaleOrderTemplateModel, criteria, options) +} + +// FindSaleOrderTemplateId finds record id by querying it with criteria. +func (c *Client) FindSaleOrderTemplateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SaleOrderTemplateModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sale_order_template_line.go b/sale_order_template_line.go new file mode 100644 index 0000000..9fbbeec --- /dev/null +++ b/sale_order_template_line.go @@ -0,0 +1,125 @@ +package odoo + +// SaleOrderTemplateLine represents sale.order.template.line model. +type SaleOrderTemplateLine struct { + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DisplayType *Selection `xmlrpc:"display_type,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductUomCategoryId *Many2One `xmlrpc:"product_uom_category_id,omitempty"` + ProductUomId *Many2One `xmlrpc:"product_uom_id,omitempty"` + ProductUomQty *Float `xmlrpc:"product_uom_qty,omitempty"` + SaleOrderTemplateId *Many2One `xmlrpc:"sale_order_template_id,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SaleOrderTemplateLines represents array of sale.order.template.line model. +type SaleOrderTemplateLines []SaleOrderTemplateLine + +// SaleOrderTemplateLineModel is the odoo model name. +const SaleOrderTemplateLineModel = "sale.order.template.line" + +// Many2One convert SaleOrderTemplateLine to *Many2One. +func (sotl *SaleOrderTemplateLine) Many2One() *Many2One { + return NewMany2One(sotl.Id.Get(), "") +} + +// CreateSaleOrderTemplateLine creates a new sale.order.template.line model and returns its id. +func (c *Client) CreateSaleOrderTemplateLine(sotl *SaleOrderTemplateLine) (int64, error) { + ids, err := c.CreateSaleOrderTemplateLines([]*SaleOrderTemplateLine{sotl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSaleOrderTemplateLine creates a new sale.order.template.line model and returns its id. +func (c *Client) CreateSaleOrderTemplateLines(sotls []*SaleOrderTemplateLine) ([]int64, error) { + var vv []interface{} + for _, v := range sotls { + vv = append(vv, v) + } + return c.Create(SaleOrderTemplateLineModel, vv, nil) +} + +// UpdateSaleOrderTemplateLine updates an existing sale.order.template.line record. +func (c *Client) UpdateSaleOrderTemplateLine(sotl *SaleOrderTemplateLine) error { + return c.UpdateSaleOrderTemplateLines([]int64{sotl.Id.Get()}, sotl) +} + +// UpdateSaleOrderTemplateLines updates existing sale.order.template.line records. +// All records (represented by ids) will be updated by sotl values. +func (c *Client) UpdateSaleOrderTemplateLines(ids []int64, sotl *SaleOrderTemplateLine) error { + return c.Update(SaleOrderTemplateLineModel, ids, sotl, nil) +} + +// DeleteSaleOrderTemplateLine deletes an existing sale.order.template.line record. +func (c *Client) DeleteSaleOrderTemplateLine(id int64) error { + return c.DeleteSaleOrderTemplateLines([]int64{id}) +} + +// DeleteSaleOrderTemplateLines deletes existing sale.order.template.line records. +func (c *Client) DeleteSaleOrderTemplateLines(ids []int64) error { + return c.Delete(SaleOrderTemplateLineModel, ids) +} + +// GetSaleOrderTemplateLine gets sale.order.template.line existing record. +func (c *Client) GetSaleOrderTemplateLine(id int64) (*SaleOrderTemplateLine, error) { + sotls, err := c.GetSaleOrderTemplateLines([]int64{id}) + if err != nil { + return nil, err + } + return &((*sotls)[0]), nil +} + +// GetSaleOrderTemplateLines gets sale.order.template.line existing records. +func (c *Client) GetSaleOrderTemplateLines(ids []int64) (*SaleOrderTemplateLines, error) { + sotls := &SaleOrderTemplateLines{} + if err := c.Read(SaleOrderTemplateLineModel, ids, nil, sotls); err != nil { + return nil, err + } + return sotls, nil +} + +// FindSaleOrderTemplateLine finds sale.order.template.line record by querying it with criteria. +func (c *Client) FindSaleOrderTemplateLine(criteria *Criteria) (*SaleOrderTemplateLine, error) { + sotls := &SaleOrderTemplateLines{} + if err := c.SearchRead(SaleOrderTemplateLineModel, criteria, NewOptions().Limit(1), sotls); err != nil { + return nil, err + } + return &((*sotls)[0]), nil +} + +// FindSaleOrderTemplateLines finds sale.order.template.line records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleOrderTemplateLines(criteria *Criteria, options *Options) (*SaleOrderTemplateLines, error) { + sotls := &SaleOrderTemplateLines{} + if err := c.SearchRead(SaleOrderTemplateLineModel, criteria, options, sotls); err != nil { + return nil, err + } + return sotls, nil +} + +// FindSaleOrderTemplateLineIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleOrderTemplateLineIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SaleOrderTemplateLineModel, criteria, options) +} + +// FindSaleOrderTemplateLineId finds record id by querying it with criteria. +func (c *Client) FindSaleOrderTemplateLineId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SaleOrderTemplateLineModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sale_order_template_option.go b/sale_order_template_option.go new file mode 100644 index 0000000..69fe54d --- /dev/null +++ b/sale_order_template_option.go @@ -0,0 +1,123 @@ +package odoo + +// SaleOrderTemplateOption represents sale.order.template.option model. +type SaleOrderTemplateOption struct { + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductUomCategoryId *Many2One `xmlrpc:"product_uom_category_id,omitempty"` + Quantity *Float `xmlrpc:"quantity,omitempty"` + SaleOrderTemplateId *Many2One `xmlrpc:"sale_order_template_id,omitempty"` + UomId *Many2One `xmlrpc:"uom_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SaleOrderTemplateOptions represents array of sale.order.template.option model. +type SaleOrderTemplateOptions []SaleOrderTemplateOption + +// SaleOrderTemplateOptionModel is the odoo model name. +const SaleOrderTemplateOptionModel = "sale.order.template.option" + +// Many2One convert SaleOrderTemplateOption to *Many2One. +func (soto *SaleOrderTemplateOption) Many2One() *Many2One { + return NewMany2One(soto.Id.Get(), "") +} + +// CreateSaleOrderTemplateOption creates a new sale.order.template.option model and returns its id. +func (c *Client) CreateSaleOrderTemplateOption(soto *SaleOrderTemplateOption) (int64, error) { + ids, err := c.CreateSaleOrderTemplateOptions([]*SaleOrderTemplateOption{soto}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSaleOrderTemplateOption creates a new sale.order.template.option model and returns its id. +func (c *Client) CreateSaleOrderTemplateOptions(sotos []*SaleOrderTemplateOption) ([]int64, error) { + var vv []interface{} + for _, v := range sotos { + vv = append(vv, v) + } + return c.Create(SaleOrderTemplateOptionModel, vv, nil) +} + +// UpdateSaleOrderTemplateOption updates an existing sale.order.template.option record. +func (c *Client) UpdateSaleOrderTemplateOption(soto *SaleOrderTemplateOption) error { + return c.UpdateSaleOrderTemplateOptions([]int64{soto.Id.Get()}, soto) +} + +// UpdateSaleOrderTemplateOptions updates existing sale.order.template.option records. +// All records (represented by ids) will be updated by soto values. +func (c *Client) UpdateSaleOrderTemplateOptions(ids []int64, soto *SaleOrderTemplateOption) error { + return c.Update(SaleOrderTemplateOptionModel, ids, soto, nil) +} + +// DeleteSaleOrderTemplateOption deletes an existing sale.order.template.option record. +func (c *Client) DeleteSaleOrderTemplateOption(id int64) error { + return c.DeleteSaleOrderTemplateOptions([]int64{id}) +} + +// DeleteSaleOrderTemplateOptions deletes existing sale.order.template.option records. +func (c *Client) DeleteSaleOrderTemplateOptions(ids []int64) error { + return c.Delete(SaleOrderTemplateOptionModel, ids) +} + +// GetSaleOrderTemplateOption gets sale.order.template.option existing record. +func (c *Client) GetSaleOrderTemplateOption(id int64) (*SaleOrderTemplateOption, error) { + sotos, err := c.GetSaleOrderTemplateOptions([]int64{id}) + if err != nil { + return nil, err + } + return &((*sotos)[0]), nil +} + +// GetSaleOrderTemplateOptions gets sale.order.template.option existing records. +func (c *Client) GetSaleOrderTemplateOptions(ids []int64) (*SaleOrderTemplateOptions, error) { + sotos := &SaleOrderTemplateOptions{} + if err := c.Read(SaleOrderTemplateOptionModel, ids, nil, sotos); err != nil { + return nil, err + } + return sotos, nil +} + +// FindSaleOrderTemplateOption finds sale.order.template.option record by querying it with criteria. +func (c *Client) FindSaleOrderTemplateOption(criteria *Criteria) (*SaleOrderTemplateOption, error) { + sotos := &SaleOrderTemplateOptions{} + if err := c.SearchRead(SaleOrderTemplateOptionModel, criteria, NewOptions().Limit(1), sotos); err != nil { + return nil, err + } + return &((*sotos)[0]), nil +} + +// FindSaleOrderTemplateOptions finds sale.order.template.option records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleOrderTemplateOptions(criteria *Criteria, options *Options) (*SaleOrderTemplateOptions, error) { + sotos := &SaleOrderTemplateOptions{} + if err := c.SearchRead(SaleOrderTemplateOptionModel, criteria, options, sotos); err != nil { + return nil, err + } + return sotos, nil +} + +// FindSaleOrderTemplateOptionIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleOrderTemplateOptionIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SaleOrderTemplateOptionModel, criteria, options) +} + +// FindSaleOrderTemplateOptionId finds record id by querying it with criteria. +func (c *Client) FindSaleOrderTemplateOptionId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SaleOrderTemplateOptionModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sale_payment_provider_onboarding_wizard.go b/sale_payment_provider_onboarding_wizard.go new file mode 100644 index 0000000..daa5cca --- /dev/null +++ b/sale_payment_provider_onboarding_wizard.go @@ -0,0 +1,123 @@ +package odoo + +// SalePaymentProviderOnboardingWizard represents sale.payment.provider.onboarding.wizard model. +type SalePaymentProviderOnboardingWizard struct { + DataFetched *Bool `xmlrpc:"_data_fetched,omitempty"` + AccNumber *String `xmlrpc:"acc_number,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + JournalName *String `xmlrpc:"journal_name,omitempty"` + ManualName *String `xmlrpc:"manual_name,omitempty"` + ManualPostMsg *String `xmlrpc:"manual_post_msg,omitempty"` + PaymentMethod *Selection `xmlrpc:"payment_method,omitempty"` + PaypalEmailAccount *String `xmlrpc:"paypal_email_account,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SalePaymentProviderOnboardingWizards represents array of sale.payment.provider.onboarding.wizard model. +type SalePaymentProviderOnboardingWizards []SalePaymentProviderOnboardingWizard + +// SalePaymentProviderOnboardingWizardModel is the odoo model name. +const SalePaymentProviderOnboardingWizardModel = "sale.payment.provider.onboarding.wizard" + +// Many2One convert SalePaymentProviderOnboardingWizard to *Many2One. +func (sppow *SalePaymentProviderOnboardingWizard) Many2One() *Many2One { + return NewMany2One(sppow.Id.Get(), "") +} + +// CreateSalePaymentProviderOnboardingWizard creates a new sale.payment.provider.onboarding.wizard model and returns its id. +func (c *Client) CreateSalePaymentProviderOnboardingWizard(sppow *SalePaymentProviderOnboardingWizard) (int64, error) { + ids, err := c.CreateSalePaymentProviderOnboardingWizards([]*SalePaymentProviderOnboardingWizard{sppow}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSalePaymentProviderOnboardingWizard creates a new sale.payment.provider.onboarding.wizard model and returns its id. +func (c *Client) CreateSalePaymentProviderOnboardingWizards(sppows []*SalePaymentProviderOnboardingWizard) ([]int64, error) { + var vv []interface{} + for _, v := range sppows { + vv = append(vv, v) + } + return c.Create(SalePaymentProviderOnboardingWizardModel, vv, nil) +} + +// UpdateSalePaymentProviderOnboardingWizard updates an existing sale.payment.provider.onboarding.wizard record. +func (c *Client) UpdateSalePaymentProviderOnboardingWizard(sppow *SalePaymentProviderOnboardingWizard) error { + return c.UpdateSalePaymentProviderOnboardingWizards([]int64{sppow.Id.Get()}, sppow) +} + +// UpdateSalePaymentProviderOnboardingWizards updates existing sale.payment.provider.onboarding.wizard records. +// All records (represented by ids) will be updated by sppow values. +func (c *Client) UpdateSalePaymentProviderOnboardingWizards(ids []int64, sppow *SalePaymentProviderOnboardingWizard) error { + return c.Update(SalePaymentProviderOnboardingWizardModel, ids, sppow, nil) +} + +// DeleteSalePaymentProviderOnboardingWizard deletes an existing sale.payment.provider.onboarding.wizard record. +func (c *Client) DeleteSalePaymentProviderOnboardingWizard(id int64) error { + return c.DeleteSalePaymentProviderOnboardingWizards([]int64{id}) +} + +// DeleteSalePaymentProviderOnboardingWizards deletes existing sale.payment.provider.onboarding.wizard records. +func (c *Client) DeleteSalePaymentProviderOnboardingWizards(ids []int64) error { + return c.Delete(SalePaymentProviderOnboardingWizardModel, ids) +} + +// GetSalePaymentProviderOnboardingWizard gets sale.payment.provider.onboarding.wizard existing record. +func (c *Client) GetSalePaymentProviderOnboardingWizard(id int64) (*SalePaymentProviderOnboardingWizard, error) { + sppows, err := c.GetSalePaymentProviderOnboardingWizards([]int64{id}) + if err != nil { + return nil, err + } + return &((*sppows)[0]), nil +} + +// GetSalePaymentProviderOnboardingWizards gets sale.payment.provider.onboarding.wizard existing records. +func (c *Client) GetSalePaymentProviderOnboardingWizards(ids []int64) (*SalePaymentProviderOnboardingWizards, error) { + sppows := &SalePaymentProviderOnboardingWizards{} + if err := c.Read(SalePaymentProviderOnboardingWizardModel, ids, nil, sppows); err != nil { + return nil, err + } + return sppows, nil +} + +// FindSalePaymentProviderOnboardingWizard finds sale.payment.provider.onboarding.wizard record by querying it with criteria. +func (c *Client) FindSalePaymentProviderOnboardingWizard(criteria *Criteria) (*SalePaymentProviderOnboardingWizard, error) { + sppows := &SalePaymentProviderOnboardingWizards{} + if err := c.SearchRead(SalePaymentProviderOnboardingWizardModel, criteria, NewOptions().Limit(1), sppows); err != nil { + return nil, err + } + return &((*sppows)[0]), nil +} + +// FindSalePaymentProviderOnboardingWizards finds sale.payment.provider.onboarding.wizard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSalePaymentProviderOnboardingWizards(criteria *Criteria, options *Options) (*SalePaymentProviderOnboardingWizards, error) { + sppows := &SalePaymentProviderOnboardingWizards{} + if err := c.SearchRead(SalePaymentProviderOnboardingWizardModel, criteria, options, sppows); err != nil { + return nil, err + } + return sppows, nil +} + +// FindSalePaymentProviderOnboardingWizardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSalePaymentProviderOnboardingWizardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SalePaymentProviderOnboardingWizardModel, criteria, options) +} + +// FindSalePaymentProviderOnboardingWizardId finds record id by querying it with criteria. +func (c *Client) FindSalePaymentProviderOnboardingWizardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SalePaymentProviderOnboardingWizardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sale_pdf_form_field.go b/sale_pdf_form_field.go new file mode 100644 index 0000000..3d81ff9 --- /dev/null +++ b/sale_pdf_form_field.go @@ -0,0 +1,121 @@ +package odoo + +// SalePdfFormField represents sale.pdf.form.field model. +type SalePdfFormField struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + DocumentType *Selection `xmlrpc:"document_type,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Path *String `xmlrpc:"path,omitempty"` + ProductDocumentIds *Relation `xmlrpc:"product_document_ids,omitempty"` + QuotationDocumentIds *Relation `xmlrpc:"quotation_document_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SalePdfFormFields represents array of sale.pdf.form.field model. +type SalePdfFormFields []SalePdfFormField + +// SalePdfFormFieldModel is the odoo model name. +const SalePdfFormFieldModel = "sale.pdf.form.field" + +// Many2One convert SalePdfFormField to *Many2One. +func (spff *SalePdfFormField) Many2One() *Many2One { + return NewMany2One(spff.Id.Get(), "") +} + +// CreateSalePdfFormField creates a new sale.pdf.form.field model and returns its id. +func (c *Client) CreateSalePdfFormField(spff *SalePdfFormField) (int64, error) { + ids, err := c.CreateSalePdfFormFields([]*SalePdfFormField{spff}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSalePdfFormField creates a new sale.pdf.form.field model and returns its id. +func (c *Client) CreateSalePdfFormFields(spffs []*SalePdfFormField) ([]int64, error) { + var vv []interface{} + for _, v := range spffs { + vv = append(vv, v) + } + return c.Create(SalePdfFormFieldModel, vv, nil) +} + +// UpdateSalePdfFormField updates an existing sale.pdf.form.field record. +func (c *Client) UpdateSalePdfFormField(spff *SalePdfFormField) error { + return c.UpdateSalePdfFormFields([]int64{spff.Id.Get()}, spff) +} + +// UpdateSalePdfFormFields updates existing sale.pdf.form.field records. +// All records (represented by ids) will be updated by spff values. +func (c *Client) UpdateSalePdfFormFields(ids []int64, spff *SalePdfFormField) error { + return c.Update(SalePdfFormFieldModel, ids, spff, nil) +} + +// DeleteSalePdfFormField deletes an existing sale.pdf.form.field record. +func (c *Client) DeleteSalePdfFormField(id int64) error { + return c.DeleteSalePdfFormFields([]int64{id}) +} + +// DeleteSalePdfFormFields deletes existing sale.pdf.form.field records. +func (c *Client) DeleteSalePdfFormFields(ids []int64) error { + return c.Delete(SalePdfFormFieldModel, ids) +} + +// GetSalePdfFormField gets sale.pdf.form.field existing record. +func (c *Client) GetSalePdfFormField(id int64) (*SalePdfFormField, error) { + spffs, err := c.GetSalePdfFormFields([]int64{id}) + if err != nil { + return nil, err + } + return &((*spffs)[0]), nil +} + +// GetSalePdfFormFields gets sale.pdf.form.field existing records. +func (c *Client) GetSalePdfFormFields(ids []int64) (*SalePdfFormFields, error) { + spffs := &SalePdfFormFields{} + if err := c.Read(SalePdfFormFieldModel, ids, nil, spffs); err != nil { + return nil, err + } + return spffs, nil +} + +// FindSalePdfFormField finds sale.pdf.form.field record by querying it with criteria. +func (c *Client) FindSalePdfFormField(criteria *Criteria) (*SalePdfFormField, error) { + spffs := &SalePdfFormFields{} + if err := c.SearchRead(SalePdfFormFieldModel, criteria, NewOptions().Limit(1), spffs); err != nil { + return nil, err + } + return &((*spffs)[0]), nil +} + +// FindSalePdfFormFields finds sale.pdf.form.field records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSalePdfFormFields(criteria *Criteria, options *Options) (*SalePdfFormFields, error) { + spffs := &SalePdfFormFields{} + if err := c.SearchRead(SalePdfFormFieldModel, criteria, options, spffs); err != nil { + return nil, err + } + return spffs, nil +} + +// FindSalePdfFormFieldIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSalePdfFormFieldIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SalePdfFormFieldModel, criteria, options) +} + +// FindSalePdfFormFieldId finds record id by querying it with criteria. +func (c *Client) FindSalePdfFormFieldId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SalePdfFormFieldModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sale_report.go b/sale_report.go new file mode 100644 index 0000000..977cd0d --- /dev/null +++ b/sale_report.go @@ -0,0 +1,152 @@ +package odoo + +// SaleReport represents sale.report model. +type SaleReport struct { + CampaignId *Many2One `xmlrpc:"campaign_id,omitempty"` + CategId *Many2One `xmlrpc:"categ_id,omitempty"` + CommercialPartnerId *Many2One `xmlrpc:"commercial_partner_id,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + Discount *Float `xmlrpc:"discount,omitempty"` + DiscountAmount *Float `xmlrpc:"discount_amount,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IndustryId *Many2One `xmlrpc:"industry_id,omitempty"` + InvoiceStatus *Selection `xmlrpc:"invoice_status,omitempty"` + LineInvoiceStatus *Selection `xmlrpc:"line_invoice_status,omitempty"` + MediumId *Many2One `xmlrpc:"medium_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Nbr *Int `xmlrpc:"nbr,omitempty"` + OrderReference *String `xmlrpc:"order_reference,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerZip *String `xmlrpc:"partner_zip,omitempty"` + PriceSubtotal *Float `xmlrpc:"price_subtotal,omitempty"` + PriceTotal *Float `xmlrpc:"price_total,omitempty"` + PriceUnit *Float `xmlrpc:"price_unit,omitempty"` + PricelistId *Many2One `xmlrpc:"pricelist_id,omitempty"` + ProductId *Many2One `xmlrpc:"product_id,omitempty"` + ProductTmplId *Many2One `xmlrpc:"product_tmpl_id,omitempty"` + ProductUom *Many2One `xmlrpc:"product_uom,omitempty"` + ProductUomQty *Float `xmlrpc:"product_uom_qty,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + QtyDelivered *Float `xmlrpc:"qty_delivered,omitempty"` + QtyInvoiced *Float `xmlrpc:"qty_invoiced,omitempty"` + QtyToDeliver *Float `xmlrpc:"qty_to_deliver,omitempty"` + QtyToInvoice *Float `xmlrpc:"qty_to_invoice,omitempty"` + SourceId *Many2One `xmlrpc:"source_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StateId *Many2One `xmlrpc:"state_id,omitempty"` + TeamId *Many2One `xmlrpc:"team_id,omitempty"` + UntaxedAmountInvoiced *Float `xmlrpc:"untaxed_amount_invoiced,omitempty"` + UntaxedAmountToInvoice *Float `xmlrpc:"untaxed_amount_to_invoice,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + Volume *Float `xmlrpc:"volume,omitempty"` + Weight *Float `xmlrpc:"weight,omitempty"` +} + +// SaleReports represents array of sale.report model. +type SaleReports []SaleReport + +// SaleReportModel is the odoo model name. +const SaleReportModel = "sale.report" + +// Many2One convert SaleReport to *Many2One. +func (sr *SaleReport) Many2One() *Many2One { + return NewMany2One(sr.Id.Get(), "") +} + +// CreateSaleReport creates a new sale.report model and returns its id. +func (c *Client) CreateSaleReport(sr *SaleReport) (int64, error) { + ids, err := c.CreateSaleReports([]*SaleReport{sr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSaleReport creates a new sale.report model and returns its id. +func (c *Client) CreateSaleReports(srs []*SaleReport) ([]int64, error) { + var vv []interface{} + for _, v := range srs { + vv = append(vv, v) + } + return c.Create(SaleReportModel, vv, nil) +} + +// UpdateSaleReport updates an existing sale.report record. +func (c *Client) UpdateSaleReport(sr *SaleReport) error { + return c.UpdateSaleReports([]int64{sr.Id.Get()}, sr) +} + +// UpdateSaleReports updates existing sale.report records. +// All records (represented by ids) will be updated by sr values. +func (c *Client) UpdateSaleReports(ids []int64, sr *SaleReport) error { + return c.Update(SaleReportModel, ids, sr, nil) +} + +// DeleteSaleReport deletes an existing sale.report record. +func (c *Client) DeleteSaleReport(id int64) error { + return c.DeleteSaleReports([]int64{id}) +} + +// DeleteSaleReports deletes existing sale.report records. +func (c *Client) DeleteSaleReports(ids []int64) error { + return c.Delete(SaleReportModel, ids) +} + +// GetSaleReport gets sale.report existing record. +func (c *Client) GetSaleReport(id int64) (*SaleReport, error) { + srs, err := c.GetSaleReports([]int64{id}) + if err != nil { + return nil, err + } + return &((*srs)[0]), nil +} + +// GetSaleReports gets sale.report existing records. +func (c *Client) GetSaleReports(ids []int64) (*SaleReports, error) { + srs := &SaleReports{} + if err := c.Read(SaleReportModel, ids, nil, srs); err != nil { + return nil, err + } + return srs, nil +} + +// FindSaleReport finds sale.report record by querying it with criteria. +func (c *Client) FindSaleReport(criteria *Criteria) (*SaleReport, error) { + srs := &SaleReports{} + if err := c.SearchRead(SaleReportModel, criteria, NewOptions().Limit(1), srs); err != nil { + return nil, err + } + return &((*srs)[0]), nil +} + +// FindSaleReports finds sale.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleReports(criteria *Criteria, options *Options) (*SaleReports, error) { + srs := &SaleReports{} + if err := c.SearchRead(SaleReportModel, criteria, options, srs); err != nil { + return nil, err + } + return srs, nil +} + +// FindSaleReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSaleReportIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SaleReportModel, criteria, options) +} + +// FindSaleReportId finds record id by querying it with criteria. +func (c *Client) FindSaleReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SaleReportModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sms_account_code.go b/sms_account_code.go new file mode 100644 index 0000000..43d86c1 --- /dev/null +++ b/sms_account_code.go @@ -0,0 +1,118 @@ +package odoo + +// SmsAccountCode represents sms.account.code model. +type SmsAccountCode struct { + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + VerificationCode *String `xmlrpc:"verification_code,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SmsAccountCodes represents array of sms.account.code model. +type SmsAccountCodes []SmsAccountCode + +// SmsAccountCodeModel is the odoo model name. +const SmsAccountCodeModel = "sms.account.code" + +// Many2One convert SmsAccountCode to *Many2One. +func (sac *SmsAccountCode) Many2One() *Many2One { + return NewMany2One(sac.Id.Get(), "") +} + +// CreateSmsAccountCode creates a new sms.account.code model and returns its id. +func (c *Client) CreateSmsAccountCode(sac *SmsAccountCode) (int64, error) { + ids, err := c.CreateSmsAccountCodes([]*SmsAccountCode{sac}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSmsAccountCode creates a new sms.account.code model and returns its id. +func (c *Client) CreateSmsAccountCodes(sacs []*SmsAccountCode) ([]int64, error) { + var vv []interface{} + for _, v := range sacs { + vv = append(vv, v) + } + return c.Create(SmsAccountCodeModel, vv, nil) +} + +// UpdateSmsAccountCode updates an existing sms.account.code record. +func (c *Client) UpdateSmsAccountCode(sac *SmsAccountCode) error { + return c.UpdateSmsAccountCodes([]int64{sac.Id.Get()}, sac) +} + +// UpdateSmsAccountCodes updates existing sms.account.code records. +// All records (represented by ids) will be updated by sac values. +func (c *Client) UpdateSmsAccountCodes(ids []int64, sac *SmsAccountCode) error { + return c.Update(SmsAccountCodeModel, ids, sac, nil) +} + +// DeleteSmsAccountCode deletes an existing sms.account.code record. +func (c *Client) DeleteSmsAccountCode(id int64) error { + return c.DeleteSmsAccountCodes([]int64{id}) +} + +// DeleteSmsAccountCodes deletes existing sms.account.code records. +func (c *Client) DeleteSmsAccountCodes(ids []int64) error { + return c.Delete(SmsAccountCodeModel, ids) +} + +// GetSmsAccountCode gets sms.account.code existing record. +func (c *Client) GetSmsAccountCode(id int64) (*SmsAccountCode, error) { + sacs, err := c.GetSmsAccountCodes([]int64{id}) + if err != nil { + return nil, err + } + return &((*sacs)[0]), nil +} + +// GetSmsAccountCodes gets sms.account.code existing records. +func (c *Client) GetSmsAccountCodes(ids []int64) (*SmsAccountCodes, error) { + sacs := &SmsAccountCodes{} + if err := c.Read(SmsAccountCodeModel, ids, nil, sacs); err != nil { + return nil, err + } + return sacs, nil +} + +// FindSmsAccountCode finds sms.account.code record by querying it with criteria. +func (c *Client) FindSmsAccountCode(criteria *Criteria) (*SmsAccountCode, error) { + sacs := &SmsAccountCodes{} + if err := c.SearchRead(SmsAccountCodeModel, criteria, NewOptions().Limit(1), sacs); err != nil { + return nil, err + } + return &((*sacs)[0]), nil +} + +// FindSmsAccountCodes finds sms.account.code records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsAccountCodes(criteria *Criteria, options *Options) (*SmsAccountCodes, error) { + sacs := &SmsAccountCodes{} + if err := c.SearchRead(SmsAccountCodeModel, criteria, options, sacs); err != nil { + return nil, err + } + return sacs, nil +} + +// FindSmsAccountCodeIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsAccountCodeIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SmsAccountCodeModel, criteria, options) +} + +// FindSmsAccountCodeId finds record id by querying it with criteria. +func (c *Client) FindSmsAccountCodeId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SmsAccountCodeModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sms_account_phone.go b/sms_account_phone.go new file mode 100644 index 0000000..96e55ea --- /dev/null +++ b/sms_account_phone.go @@ -0,0 +1,118 @@ +package odoo + +// SmsAccountPhone represents sms.account.phone model. +type SmsAccountPhone struct { + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + PhoneNumber *String `xmlrpc:"phone_number,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SmsAccountPhones represents array of sms.account.phone model. +type SmsAccountPhones []SmsAccountPhone + +// SmsAccountPhoneModel is the odoo model name. +const SmsAccountPhoneModel = "sms.account.phone" + +// Many2One convert SmsAccountPhone to *Many2One. +func (sap *SmsAccountPhone) Many2One() *Many2One { + return NewMany2One(sap.Id.Get(), "") +} + +// CreateSmsAccountPhone creates a new sms.account.phone model and returns its id. +func (c *Client) CreateSmsAccountPhone(sap *SmsAccountPhone) (int64, error) { + ids, err := c.CreateSmsAccountPhones([]*SmsAccountPhone{sap}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSmsAccountPhone creates a new sms.account.phone model and returns its id. +func (c *Client) CreateSmsAccountPhones(saps []*SmsAccountPhone) ([]int64, error) { + var vv []interface{} + for _, v := range saps { + vv = append(vv, v) + } + return c.Create(SmsAccountPhoneModel, vv, nil) +} + +// UpdateSmsAccountPhone updates an existing sms.account.phone record. +func (c *Client) UpdateSmsAccountPhone(sap *SmsAccountPhone) error { + return c.UpdateSmsAccountPhones([]int64{sap.Id.Get()}, sap) +} + +// UpdateSmsAccountPhones updates existing sms.account.phone records. +// All records (represented by ids) will be updated by sap values. +func (c *Client) UpdateSmsAccountPhones(ids []int64, sap *SmsAccountPhone) error { + return c.Update(SmsAccountPhoneModel, ids, sap, nil) +} + +// DeleteSmsAccountPhone deletes an existing sms.account.phone record. +func (c *Client) DeleteSmsAccountPhone(id int64) error { + return c.DeleteSmsAccountPhones([]int64{id}) +} + +// DeleteSmsAccountPhones deletes existing sms.account.phone records. +func (c *Client) DeleteSmsAccountPhones(ids []int64) error { + return c.Delete(SmsAccountPhoneModel, ids) +} + +// GetSmsAccountPhone gets sms.account.phone existing record. +func (c *Client) GetSmsAccountPhone(id int64) (*SmsAccountPhone, error) { + saps, err := c.GetSmsAccountPhones([]int64{id}) + if err != nil { + return nil, err + } + return &((*saps)[0]), nil +} + +// GetSmsAccountPhones gets sms.account.phone existing records. +func (c *Client) GetSmsAccountPhones(ids []int64) (*SmsAccountPhones, error) { + saps := &SmsAccountPhones{} + if err := c.Read(SmsAccountPhoneModel, ids, nil, saps); err != nil { + return nil, err + } + return saps, nil +} + +// FindSmsAccountPhone finds sms.account.phone record by querying it with criteria. +func (c *Client) FindSmsAccountPhone(criteria *Criteria) (*SmsAccountPhone, error) { + saps := &SmsAccountPhones{} + if err := c.SearchRead(SmsAccountPhoneModel, criteria, NewOptions().Limit(1), saps); err != nil { + return nil, err + } + return &((*saps)[0]), nil +} + +// FindSmsAccountPhones finds sms.account.phone records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsAccountPhones(criteria *Criteria, options *Options) (*SmsAccountPhones, error) { + saps := &SmsAccountPhones{} + if err := c.SearchRead(SmsAccountPhoneModel, criteria, options, saps); err != nil { + return nil, err + } + return saps, nil +} + +// FindSmsAccountPhoneIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsAccountPhoneIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SmsAccountPhoneModel, criteria, options) +} + +// FindSmsAccountPhoneId finds record id by querying it with criteria. +func (c *Client) FindSmsAccountPhoneId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SmsAccountPhoneModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sms_account_sender.go b/sms_account_sender.go new file mode 100644 index 0000000..3340ca8 --- /dev/null +++ b/sms_account_sender.go @@ -0,0 +1,118 @@ +package odoo + +// SmsAccountSender represents sms.account.sender model. +type SmsAccountSender struct { + AccountId *Many2One `xmlrpc:"account_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + SenderName *String `xmlrpc:"sender_name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SmsAccountSenders represents array of sms.account.sender model. +type SmsAccountSenders []SmsAccountSender + +// SmsAccountSenderModel is the odoo model name. +const SmsAccountSenderModel = "sms.account.sender" + +// Many2One convert SmsAccountSender to *Many2One. +func (sas *SmsAccountSender) Many2One() *Many2One { + return NewMany2One(sas.Id.Get(), "") +} + +// CreateSmsAccountSender creates a new sms.account.sender model and returns its id. +func (c *Client) CreateSmsAccountSender(sas *SmsAccountSender) (int64, error) { + ids, err := c.CreateSmsAccountSenders([]*SmsAccountSender{sas}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSmsAccountSender creates a new sms.account.sender model and returns its id. +func (c *Client) CreateSmsAccountSenders(sass []*SmsAccountSender) ([]int64, error) { + var vv []interface{} + for _, v := range sass { + vv = append(vv, v) + } + return c.Create(SmsAccountSenderModel, vv, nil) +} + +// UpdateSmsAccountSender updates an existing sms.account.sender record. +func (c *Client) UpdateSmsAccountSender(sas *SmsAccountSender) error { + return c.UpdateSmsAccountSenders([]int64{sas.Id.Get()}, sas) +} + +// UpdateSmsAccountSenders updates existing sms.account.sender records. +// All records (represented by ids) will be updated by sas values. +func (c *Client) UpdateSmsAccountSenders(ids []int64, sas *SmsAccountSender) error { + return c.Update(SmsAccountSenderModel, ids, sas, nil) +} + +// DeleteSmsAccountSender deletes an existing sms.account.sender record. +func (c *Client) DeleteSmsAccountSender(id int64) error { + return c.DeleteSmsAccountSenders([]int64{id}) +} + +// DeleteSmsAccountSenders deletes existing sms.account.sender records. +func (c *Client) DeleteSmsAccountSenders(ids []int64) error { + return c.Delete(SmsAccountSenderModel, ids) +} + +// GetSmsAccountSender gets sms.account.sender existing record. +func (c *Client) GetSmsAccountSender(id int64) (*SmsAccountSender, error) { + sass, err := c.GetSmsAccountSenders([]int64{id}) + if err != nil { + return nil, err + } + return &((*sass)[0]), nil +} + +// GetSmsAccountSenders gets sms.account.sender existing records. +func (c *Client) GetSmsAccountSenders(ids []int64) (*SmsAccountSenders, error) { + sass := &SmsAccountSenders{} + if err := c.Read(SmsAccountSenderModel, ids, nil, sass); err != nil { + return nil, err + } + return sass, nil +} + +// FindSmsAccountSender finds sms.account.sender record by querying it with criteria. +func (c *Client) FindSmsAccountSender(criteria *Criteria) (*SmsAccountSender, error) { + sass := &SmsAccountSenders{} + if err := c.SearchRead(SmsAccountSenderModel, criteria, NewOptions().Limit(1), sass); err != nil { + return nil, err + } + return &((*sass)[0]), nil +} + +// FindSmsAccountSenders finds sms.account.sender records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsAccountSenders(criteria *Criteria, options *Options) (*SmsAccountSenders, error) { + sass := &SmsAccountSenders{} + if err := c.SearchRead(SmsAccountSenderModel, criteria, options, sass); err != nil { + return nil, err + } + return sass, nil +} + +// FindSmsAccountSenderIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsAccountSenderIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SmsAccountSenderModel, criteria, options) +} + +// FindSmsAccountSenderId finds record id by querying it with criteria. +func (c *Client) FindSmsAccountSenderId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SmsAccountSenderModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sms_composer.go b/sms_composer.go new file mode 100644 index 0000000..8763c46 --- /dev/null +++ b/sms_composer.go @@ -0,0 +1,137 @@ +package odoo + +// SmsComposer represents sms.composer model. +type SmsComposer struct { + Body *String `xmlrpc:"body,omitempty"` + CommentSingleRecipient *Bool `xmlrpc:"comment_single_recipient,omitempty"` + CompositionMode *Selection `xmlrpc:"composition_mode,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MassForceSend *Bool `xmlrpc:"mass_force_send,omitempty"` + MassKeepLog *Bool `xmlrpc:"mass_keep_log,omitempty"` + MassUseBlacklist *Bool `xmlrpc:"mass_use_blacklist,omitempty"` + NumberFieldName *String `xmlrpc:"number_field_name,omitempty"` + Numbers *String `xmlrpc:"numbers,omitempty"` + RecipientInvalidCount *Int `xmlrpc:"recipient_invalid_count,omitempty"` + RecipientSingleDescription *String `xmlrpc:"recipient_single_description,omitempty"` + RecipientSingleNumber *String `xmlrpc:"recipient_single_number,omitempty"` + RecipientSingleNumberItf *String `xmlrpc:"recipient_single_number_itf,omitempty"` + RecipientSingleValid *Bool `xmlrpc:"recipient_single_valid,omitempty"` + RecipientValidCount *Int `xmlrpc:"recipient_valid_count,omitempty"` + ResId *Int `xmlrpc:"res_id,omitempty"` + ResIds *String `xmlrpc:"res_ids,omitempty"` + ResIdsCount *Int `xmlrpc:"res_ids_count,omitempty"` + ResModel *String `xmlrpc:"res_model,omitempty"` + ResModelDescription *String `xmlrpc:"res_model_description,omitempty"` + SanitizedNumbers *String `xmlrpc:"sanitized_numbers,omitempty"` + TemplateId *Many2One `xmlrpc:"template_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SmsComposers represents array of sms.composer model. +type SmsComposers []SmsComposer + +// SmsComposerModel is the odoo model name. +const SmsComposerModel = "sms.composer" + +// Many2One convert SmsComposer to *Many2One. +func (sc *SmsComposer) Many2One() *Many2One { + return NewMany2One(sc.Id.Get(), "") +} + +// CreateSmsComposer creates a new sms.composer model and returns its id. +func (c *Client) CreateSmsComposer(sc *SmsComposer) (int64, error) { + ids, err := c.CreateSmsComposers([]*SmsComposer{sc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSmsComposer creates a new sms.composer model and returns its id. +func (c *Client) CreateSmsComposers(scs []*SmsComposer) ([]int64, error) { + var vv []interface{} + for _, v := range scs { + vv = append(vv, v) + } + return c.Create(SmsComposerModel, vv, nil) +} + +// UpdateSmsComposer updates an existing sms.composer record. +func (c *Client) UpdateSmsComposer(sc *SmsComposer) error { + return c.UpdateSmsComposers([]int64{sc.Id.Get()}, sc) +} + +// UpdateSmsComposers updates existing sms.composer records. +// All records (represented by ids) will be updated by sc values. +func (c *Client) UpdateSmsComposers(ids []int64, sc *SmsComposer) error { + return c.Update(SmsComposerModel, ids, sc, nil) +} + +// DeleteSmsComposer deletes an existing sms.composer record. +func (c *Client) DeleteSmsComposer(id int64) error { + return c.DeleteSmsComposers([]int64{id}) +} + +// DeleteSmsComposers deletes existing sms.composer records. +func (c *Client) DeleteSmsComposers(ids []int64) error { + return c.Delete(SmsComposerModel, ids) +} + +// GetSmsComposer gets sms.composer existing record. +func (c *Client) GetSmsComposer(id int64) (*SmsComposer, error) { + scs, err := c.GetSmsComposers([]int64{id}) + if err != nil { + return nil, err + } + return &((*scs)[0]), nil +} + +// GetSmsComposers gets sms.composer existing records. +func (c *Client) GetSmsComposers(ids []int64) (*SmsComposers, error) { + scs := &SmsComposers{} + if err := c.Read(SmsComposerModel, ids, nil, scs); err != nil { + return nil, err + } + return scs, nil +} + +// FindSmsComposer finds sms.composer record by querying it with criteria. +func (c *Client) FindSmsComposer(criteria *Criteria) (*SmsComposer, error) { + scs := &SmsComposers{} + if err := c.SearchRead(SmsComposerModel, criteria, NewOptions().Limit(1), scs); err != nil { + return nil, err + } + return &((*scs)[0]), nil +} + +// FindSmsComposers finds sms.composer records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsComposers(criteria *Criteria, options *Options) (*SmsComposers, error) { + scs := &SmsComposers{} + if err := c.SearchRead(SmsComposerModel, criteria, options, scs); err != nil { + return nil, err + } + return scs, nil +} + +// FindSmsComposerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsComposerIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SmsComposerModel, criteria, options) +} + +// FindSmsComposerId finds record id by querying it with criteria. +func (c *Client) FindSmsComposerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SmsComposerModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sms_resend.go b/sms_resend.go new file mode 100644 index 0000000..b9fe9d2 --- /dev/null +++ b/sms_resend.go @@ -0,0 +1,122 @@ +package odoo + +// SmsResend represents sms.resend model. +type SmsResend struct { + CanCancel *Bool `xmlrpc:"can_cancel,omitempty"` + CanResend *Bool `xmlrpc:"can_resend,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + HasInsufficientCredit *Bool `xmlrpc:"has_insufficient_credit,omitempty"` + HasUnregisteredAccount *Bool `xmlrpc:"has_unregistered_account,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MailMessageId *Many2One `xmlrpc:"mail_message_id,omitempty"` + RecipientIds *Relation `xmlrpc:"recipient_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SmsResends represents array of sms.resend model. +type SmsResends []SmsResend + +// SmsResendModel is the odoo model name. +const SmsResendModel = "sms.resend" + +// Many2One convert SmsResend to *Many2One. +func (sr *SmsResend) Many2One() *Many2One { + return NewMany2One(sr.Id.Get(), "") +} + +// CreateSmsResend creates a new sms.resend model and returns its id. +func (c *Client) CreateSmsResend(sr *SmsResend) (int64, error) { + ids, err := c.CreateSmsResends([]*SmsResend{sr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSmsResend creates a new sms.resend model and returns its id. +func (c *Client) CreateSmsResends(srs []*SmsResend) ([]int64, error) { + var vv []interface{} + for _, v := range srs { + vv = append(vv, v) + } + return c.Create(SmsResendModel, vv, nil) +} + +// UpdateSmsResend updates an existing sms.resend record. +func (c *Client) UpdateSmsResend(sr *SmsResend) error { + return c.UpdateSmsResends([]int64{sr.Id.Get()}, sr) +} + +// UpdateSmsResends updates existing sms.resend records. +// All records (represented by ids) will be updated by sr values. +func (c *Client) UpdateSmsResends(ids []int64, sr *SmsResend) error { + return c.Update(SmsResendModel, ids, sr, nil) +} + +// DeleteSmsResend deletes an existing sms.resend record. +func (c *Client) DeleteSmsResend(id int64) error { + return c.DeleteSmsResends([]int64{id}) +} + +// DeleteSmsResends deletes existing sms.resend records. +func (c *Client) DeleteSmsResends(ids []int64) error { + return c.Delete(SmsResendModel, ids) +} + +// GetSmsResend gets sms.resend existing record. +func (c *Client) GetSmsResend(id int64) (*SmsResend, error) { + srs, err := c.GetSmsResends([]int64{id}) + if err != nil { + return nil, err + } + return &((*srs)[0]), nil +} + +// GetSmsResends gets sms.resend existing records. +func (c *Client) GetSmsResends(ids []int64) (*SmsResends, error) { + srs := &SmsResends{} + if err := c.Read(SmsResendModel, ids, nil, srs); err != nil { + return nil, err + } + return srs, nil +} + +// FindSmsResend finds sms.resend record by querying it with criteria. +func (c *Client) FindSmsResend(criteria *Criteria) (*SmsResend, error) { + srs := &SmsResends{} + if err := c.SearchRead(SmsResendModel, criteria, NewOptions().Limit(1), srs); err != nil { + return nil, err + } + return &((*srs)[0]), nil +} + +// FindSmsResends finds sms.resend records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsResends(criteria *Criteria, options *Options) (*SmsResends, error) { + srs := &SmsResends{} + if err := c.SearchRead(SmsResendModel, criteria, options, srs); err != nil { + return nil, err + } + return srs, nil +} + +// FindSmsResendIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsResendIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SmsResendModel, criteria, options) +} + +// FindSmsResendId finds record id by querying it with criteria. +func (c *Client) FindSmsResendId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SmsResendModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sms_resend_recipient.go b/sms_resend_recipient.go new file mode 100644 index 0000000..076262f --- /dev/null +++ b/sms_resend_recipient.go @@ -0,0 +1,123 @@ +package odoo + +// SmsResendRecipient represents sms.resend.recipient model. +type SmsResendRecipient struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FailureType *Selection `xmlrpc:"failure_type,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + NotificationId *Many2One `xmlrpc:"notification_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PartnerName *String `xmlrpc:"partner_name,omitempty"` + Resend *Bool `xmlrpc:"resend,omitempty"` + SmsNumber *String `xmlrpc:"sms_number,omitempty"` + SmsResendId *Many2One `xmlrpc:"sms_resend_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SmsResendRecipients represents array of sms.resend.recipient model. +type SmsResendRecipients []SmsResendRecipient + +// SmsResendRecipientModel is the odoo model name. +const SmsResendRecipientModel = "sms.resend.recipient" + +// Many2One convert SmsResendRecipient to *Many2One. +func (srr *SmsResendRecipient) Many2One() *Many2One { + return NewMany2One(srr.Id.Get(), "") +} + +// CreateSmsResendRecipient creates a new sms.resend.recipient model and returns its id. +func (c *Client) CreateSmsResendRecipient(srr *SmsResendRecipient) (int64, error) { + ids, err := c.CreateSmsResendRecipients([]*SmsResendRecipient{srr}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSmsResendRecipient creates a new sms.resend.recipient model and returns its id. +func (c *Client) CreateSmsResendRecipients(srrs []*SmsResendRecipient) ([]int64, error) { + var vv []interface{} + for _, v := range srrs { + vv = append(vv, v) + } + return c.Create(SmsResendRecipientModel, vv, nil) +} + +// UpdateSmsResendRecipient updates an existing sms.resend.recipient record. +func (c *Client) UpdateSmsResendRecipient(srr *SmsResendRecipient) error { + return c.UpdateSmsResendRecipients([]int64{srr.Id.Get()}, srr) +} + +// UpdateSmsResendRecipients updates existing sms.resend.recipient records. +// All records (represented by ids) will be updated by srr values. +func (c *Client) UpdateSmsResendRecipients(ids []int64, srr *SmsResendRecipient) error { + return c.Update(SmsResendRecipientModel, ids, srr, nil) +} + +// DeleteSmsResendRecipient deletes an existing sms.resend.recipient record. +func (c *Client) DeleteSmsResendRecipient(id int64) error { + return c.DeleteSmsResendRecipients([]int64{id}) +} + +// DeleteSmsResendRecipients deletes existing sms.resend.recipient records. +func (c *Client) DeleteSmsResendRecipients(ids []int64) error { + return c.Delete(SmsResendRecipientModel, ids) +} + +// GetSmsResendRecipient gets sms.resend.recipient existing record. +func (c *Client) GetSmsResendRecipient(id int64) (*SmsResendRecipient, error) { + srrs, err := c.GetSmsResendRecipients([]int64{id}) + if err != nil { + return nil, err + } + return &((*srrs)[0]), nil +} + +// GetSmsResendRecipients gets sms.resend.recipient existing records. +func (c *Client) GetSmsResendRecipients(ids []int64) (*SmsResendRecipients, error) { + srrs := &SmsResendRecipients{} + if err := c.Read(SmsResendRecipientModel, ids, nil, srrs); err != nil { + return nil, err + } + return srrs, nil +} + +// FindSmsResendRecipient finds sms.resend.recipient record by querying it with criteria. +func (c *Client) FindSmsResendRecipient(criteria *Criteria) (*SmsResendRecipient, error) { + srrs := &SmsResendRecipients{} + if err := c.SearchRead(SmsResendRecipientModel, criteria, NewOptions().Limit(1), srrs); err != nil { + return nil, err + } + return &((*srrs)[0]), nil +} + +// FindSmsResendRecipients finds sms.resend.recipient records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsResendRecipients(criteria *Criteria, options *Options) (*SmsResendRecipients, error) { + srrs := &SmsResendRecipients{} + if err := c.SearchRead(SmsResendRecipientModel, criteria, options, srrs); err != nil { + return nil, err + } + return srrs, nil +} + +// FindSmsResendRecipientIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsResendRecipientIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SmsResendRecipientModel, criteria, options) +} + +// FindSmsResendRecipientId finds record id by querying it with criteria. +func (c *Client) FindSmsResendRecipientId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SmsResendRecipientModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sms_sms.go b/sms_sms.go new file mode 100644 index 0000000..265397a --- /dev/null +++ b/sms_sms.go @@ -0,0 +1,125 @@ +package odoo + +// SmsSms represents sms.sms model. +type SmsSms struct { + Body *String `xmlrpc:"body,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + FailureType *Selection `xmlrpc:"failure_type,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MailMessageId *Many2One `xmlrpc:"mail_message_id,omitempty"` + Number *String `xmlrpc:"number,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + SmsTrackerId *Many2One `xmlrpc:"sms_tracker_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + ToDelete *Bool `xmlrpc:"to_delete,omitempty"` + Uuid *String `xmlrpc:"uuid,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SmsSmss represents array of sms.sms model. +type SmsSmss []SmsSms + +// SmsSmsModel is the odoo model name. +const SmsSmsModel = "sms.sms" + +// Many2One convert SmsSms to *Many2One. +func (ss *SmsSms) Many2One() *Many2One { + return NewMany2One(ss.Id.Get(), "") +} + +// CreateSmsSms creates a new sms.sms model and returns its id. +func (c *Client) CreateSmsSms(ss *SmsSms) (int64, error) { + ids, err := c.CreateSmsSmss([]*SmsSms{ss}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSmsSms creates a new sms.sms model and returns its id. +func (c *Client) CreateSmsSmss(sss []*SmsSms) ([]int64, error) { + var vv []interface{} + for _, v := range sss { + vv = append(vv, v) + } + return c.Create(SmsSmsModel, vv, nil) +} + +// UpdateSmsSms updates an existing sms.sms record. +func (c *Client) UpdateSmsSms(ss *SmsSms) error { + return c.UpdateSmsSmss([]int64{ss.Id.Get()}, ss) +} + +// UpdateSmsSmss updates existing sms.sms records. +// All records (represented by ids) will be updated by ss values. +func (c *Client) UpdateSmsSmss(ids []int64, ss *SmsSms) error { + return c.Update(SmsSmsModel, ids, ss, nil) +} + +// DeleteSmsSms deletes an existing sms.sms record. +func (c *Client) DeleteSmsSms(id int64) error { + return c.DeleteSmsSmss([]int64{id}) +} + +// DeleteSmsSmss deletes existing sms.sms records. +func (c *Client) DeleteSmsSmss(ids []int64) error { + return c.Delete(SmsSmsModel, ids) +} + +// GetSmsSms gets sms.sms existing record. +func (c *Client) GetSmsSms(id int64) (*SmsSms, error) { + sss, err := c.GetSmsSmss([]int64{id}) + if err != nil { + return nil, err + } + return &((*sss)[0]), nil +} + +// GetSmsSmss gets sms.sms existing records. +func (c *Client) GetSmsSmss(ids []int64) (*SmsSmss, error) { + sss := &SmsSmss{} + if err := c.Read(SmsSmsModel, ids, nil, sss); err != nil { + return nil, err + } + return sss, nil +} + +// FindSmsSms finds sms.sms record by querying it with criteria. +func (c *Client) FindSmsSms(criteria *Criteria) (*SmsSms, error) { + sss := &SmsSmss{} + if err := c.SearchRead(SmsSmsModel, criteria, NewOptions().Limit(1), sss); err != nil { + return nil, err + } + return &((*sss)[0]), nil +} + +// FindSmsSmss finds sms.sms records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsSmss(criteria *Criteria, options *Options) (*SmsSmss, error) { + sss := &SmsSmss{} + if err := c.SearchRead(SmsSmsModel, criteria, options, sss); err != nil { + return nil, err + } + return sss, nil +} + +// FindSmsSmsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsSmsIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SmsSmsModel, criteria, options) +} + +// FindSmsSmsId finds record id by querying it with criteria. +func (c *Client) FindSmsSmsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SmsSmsModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sms_template.go b/sms_template.go new file mode 100644 index 0000000..27f1e5c --- /dev/null +++ b/sms_template.go @@ -0,0 +1,124 @@ +package odoo + +// SmsTemplate represents sms.template model. +type SmsTemplate struct { + Body *String `xmlrpc:"body,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Lang *String `xmlrpc:"lang,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + RenderModel *String `xmlrpc:"render_model,omitempty"` + SidebarActionId *Many2One `xmlrpc:"sidebar_action_id,omitempty"` + TemplateFs *String `xmlrpc:"template_fs,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SmsTemplates represents array of sms.template model. +type SmsTemplates []SmsTemplate + +// SmsTemplateModel is the odoo model name. +const SmsTemplateModel = "sms.template" + +// Many2One convert SmsTemplate to *Many2One. +func (st *SmsTemplate) Many2One() *Many2One { + return NewMany2One(st.Id.Get(), "") +} + +// CreateSmsTemplate creates a new sms.template model and returns its id. +func (c *Client) CreateSmsTemplate(st *SmsTemplate) (int64, error) { + ids, err := c.CreateSmsTemplates([]*SmsTemplate{st}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSmsTemplate creates a new sms.template model and returns its id. +func (c *Client) CreateSmsTemplates(sts []*SmsTemplate) ([]int64, error) { + var vv []interface{} + for _, v := range sts { + vv = append(vv, v) + } + return c.Create(SmsTemplateModel, vv, nil) +} + +// UpdateSmsTemplate updates an existing sms.template record. +func (c *Client) UpdateSmsTemplate(st *SmsTemplate) error { + return c.UpdateSmsTemplates([]int64{st.Id.Get()}, st) +} + +// UpdateSmsTemplates updates existing sms.template records. +// All records (represented by ids) will be updated by st values. +func (c *Client) UpdateSmsTemplates(ids []int64, st *SmsTemplate) error { + return c.Update(SmsTemplateModel, ids, st, nil) +} + +// DeleteSmsTemplate deletes an existing sms.template record. +func (c *Client) DeleteSmsTemplate(id int64) error { + return c.DeleteSmsTemplates([]int64{id}) +} + +// DeleteSmsTemplates deletes existing sms.template records. +func (c *Client) DeleteSmsTemplates(ids []int64) error { + return c.Delete(SmsTemplateModel, ids) +} + +// GetSmsTemplate gets sms.template existing record. +func (c *Client) GetSmsTemplate(id int64) (*SmsTemplate, error) { + sts, err := c.GetSmsTemplates([]int64{id}) + if err != nil { + return nil, err + } + return &((*sts)[0]), nil +} + +// GetSmsTemplates gets sms.template existing records. +func (c *Client) GetSmsTemplates(ids []int64) (*SmsTemplates, error) { + sts := &SmsTemplates{} + if err := c.Read(SmsTemplateModel, ids, nil, sts); err != nil { + return nil, err + } + return sts, nil +} + +// FindSmsTemplate finds sms.template record by querying it with criteria. +func (c *Client) FindSmsTemplate(criteria *Criteria) (*SmsTemplate, error) { + sts := &SmsTemplates{} + if err := c.SearchRead(SmsTemplateModel, criteria, NewOptions().Limit(1), sts); err != nil { + return nil, err + } + return &((*sts)[0]), nil +} + +// FindSmsTemplates finds sms.template records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsTemplates(criteria *Criteria, options *Options) (*SmsTemplates, error) { + sts := &SmsTemplates{} + if err := c.SearchRead(SmsTemplateModel, criteria, options, sts); err != nil { + return nil, err + } + return sts, nil +} + +// FindSmsTemplateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsTemplateIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SmsTemplateModel, criteria, options) +} + +// FindSmsTemplateId finds record id by querying it with criteria. +func (c *Client) FindSmsTemplateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SmsTemplateModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sms_template_preview.go b/sms_template_preview.go new file mode 100644 index 0000000..a12efcf --- /dev/null +++ b/sms_template_preview.go @@ -0,0 +1,122 @@ +package odoo + +// SmsTemplatePreview represents sms.template.preview model. +type SmsTemplatePreview struct { + Body *String `xmlrpc:"body,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Lang *Selection `xmlrpc:"lang,omitempty"` + ModelId *Many2One `xmlrpc:"model_id,omitempty"` + NoRecord *Bool `xmlrpc:"no_record,omitempty"` + ResourceRef *String `xmlrpc:"resource_ref,omitempty"` + SmsTemplateId *Many2One `xmlrpc:"sms_template_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SmsTemplatePreviews represents array of sms.template.preview model. +type SmsTemplatePreviews []SmsTemplatePreview + +// SmsTemplatePreviewModel is the odoo model name. +const SmsTemplatePreviewModel = "sms.template.preview" + +// Many2One convert SmsTemplatePreview to *Many2One. +func (stp *SmsTemplatePreview) Many2One() *Many2One { + return NewMany2One(stp.Id.Get(), "") +} + +// CreateSmsTemplatePreview creates a new sms.template.preview model and returns its id. +func (c *Client) CreateSmsTemplatePreview(stp *SmsTemplatePreview) (int64, error) { + ids, err := c.CreateSmsTemplatePreviews([]*SmsTemplatePreview{stp}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSmsTemplatePreview creates a new sms.template.preview model and returns its id. +func (c *Client) CreateSmsTemplatePreviews(stps []*SmsTemplatePreview) ([]int64, error) { + var vv []interface{} + for _, v := range stps { + vv = append(vv, v) + } + return c.Create(SmsTemplatePreviewModel, vv, nil) +} + +// UpdateSmsTemplatePreview updates an existing sms.template.preview record. +func (c *Client) UpdateSmsTemplatePreview(stp *SmsTemplatePreview) error { + return c.UpdateSmsTemplatePreviews([]int64{stp.Id.Get()}, stp) +} + +// UpdateSmsTemplatePreviews updates existing sms.template.preview records. +// All records (represented by ids) will be updated by stp values. +func (c *Client) UpdateSmsTemplatePreviews(ids []int64, stp *SmsTemplatePreview) error { + return c.Update(SmsTemplatePreviewModel, ids, stp, nil) +} + +// DeleteSmsTemplatePreview deletes an existing sms.template.preview record. +func (c *Client) DeleteSmsTemplatePreview(id int64) error { + return c.DeleteSmsTemplatePreviews([]int64{id}) +} + +// DeleteSmsTemplatePreviews deletes existing sms.template.preview records. +func (c *Client) DeleteSmsTemplatePreviews(ids []int64) error { + return c.Delete(SmsTemplatePreviewModel, ids) +} + +// GetSmsTemplatePreview gets sms.template.preview existing record. +func (c *Client) GetSmsTemplatePreview(id int64) (*SmsTemplatePreview, error) { + stps, err := c.GetSmsTemplatePreviews([]int64{id}) + if err != nil { + return nil, err + } + return &((*stps)[0]), nil +} + +// GetSmsTemplatePreviews gets sms.template.preview existing records. +func (c *Client) GetSmsTemplatePreviews(ids []int64) (*SmsTemplatePreviews, error) { + stps := &SmsTemplatePreviews{} + if err := c.Read(SmsTemplatePreviewModel, ids, nil, stps); err != nil { + return nil, err + } + return stps, nil +} + +// FindSmsTemplatePreview finds sms.template.preview record by querying it with criteria. +func (c *Client) FindSmsTemplatePreview(criteria *Criteria) (*SmsTemplatePreview, error) { + stps := &SmsTemplatePreviews{} + if err := c.SearchRead(SmsTemplatePreviewModel, criteria, NewOptions().Limit(1), stps); err != nil { + return nil, err + } + return &((*stps)[0]), nil +} + +// FindSmsTemplatePreviews finds sms.template.preview records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsTemplatePreviews(criteria *Criteria, options *Options) (*SmsTemplatePreviews, error) { + stps := &SmsTemplatePreviews{} + if err := c.SearchRead(SmsTemplatePreviewModel, criteria, options, stps); err != nil { + return nil, err + } + return stps, nil +} + +// FindSmsTemplatePreviewIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsTemplatePreviewIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SmsTemplatePreviewModel, criteria, options) +} + +// FindSmsTemplatePreviewId finds record id by querying it with criteria. +func (c *Client) FindSmsTemplatePreviewId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SmsTemplatePreviewModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sms_template_reset.go b/sms_template_reset.go new file mode 100644 index 0000000..097df02 --- /dev/null +++ b/sms_template_reset.go @@ -0,0 +1,117 @@ +package odoo + +// SmsTemplateReset represents sms.template.reset model. +type SmsTemplateReset struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + TemplateIds *Relation `xmlrpc:"template_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SmsTemplateResets represents array of sms.template.reset model. +type SmsTemplateResets []SmsTemplateReset + +// SmsTemplateResetModel is the odoo model name. +const SmsTemplateResetModel = "sms.template.reset" + +// Many2One convert SmsTemplateReset to *Many2One. +func (str *SmsTemplateReset) Many2One() *Many2One { + return NewMany2One(str.Id.Get(), "") +} + +// CreateSmsTemplateReset creates a new sms.template.reset model and returns its id. +func (c *Client) CreateSmsTemplateReset(str *SmsTemplateReset) (int64, error) { + ids, err := c.CreateSmsTemplateResets([]*SmsTemplateReset{str}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSmsTemplateReset creates a new sms.template.reset model and returns its id. +func (c *Client) CreateSmsTemplateResets(strs []*SmsTemplateReset) ([]int64, error) { + var vv []interface{} + for _, v := range strs { + vv = append(vv, v) + } + return c.Create(SmsTemplateResetModel, vv, nil) +} + +// UpdateSmsTemplateReset updates an existing sms.template.reset record. +func (c *Client) UpdateSmsTemplateReset(str *SmsTemplateReset) error { + return c.UpdateSmsTemplateResets([]int64{str.Id.Get()}, str) +} + +// UpdateSmsTemplateResets updates existing sms.template.reset records. +// All records (represented by ids) will be updated by str values. +func (c *Client) UpdateSmsTemplateResets(ids []int64, str *SmsTemplateReset) error { + return c.Update(SmsTemplateResetModel, ids, str, nil) +} + +// DeleteSmsTemplateReset deletes an existing sms.template.reset record. +func (c *Client) DeleteSmsTemplateReset(id int64) error { + return c.DeleteSmsTemplateResets([]int64{id}) +} + +// DeleteSmsTemplateResets deletes existing sms.template.reset records. +func (c *Client) DeleteSmsTemplateResets(ids []int64) error { + return c.Delete(SmsTemplateResetModel, ids) +} + +// GetSmsTemplateReset gets sms.template.reset existing record. +func (c *Client) GetSmsTemplateReset(id int64) (*SmsTemplateReset, error) { + strs, err := c.GetSmsTemplateResets([]int64{id}) + if err != nil { + return nil, err + } + return &((*strs)[0]), nil +} + +// GetSmsTemplateResets gets sms.template.reset existing records. +func (c *Client) GetSmsTemplateResets(ids []int64) (*SmsTemplateResets, error) { + strs := &SmsTemplateResets{} + if err := c.Read(SmsTemplateResetModel, ids, nil, strs); err != nil { + return nil, err + } + return strs, nil +} + +// FindSmsTemplateReset finds sms.template.reset record by querying it with criteria. +func (c *Client) FindSmsTemplateReset(criteria *Criteria) (*SmsTemplateReset, error) { + strs := &SmsTemplateResets{} + if err := c.SearchRead(SmsTemplateResetModel, criteria, NewOptions().Limit(1), strs); err != nil { + return nil, err + } + return &((*strs)[0]), nil +} + +// FindSmsTemplateResets finds sms.template.reset records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsTemplateResets(criteria *Criteria, options *Options) (*SmsTemplateResets, error) { + strs := &SmsTemplateResets{} + if err := c.SearchRead(SmsTemplateResetModel, criteria, options, strs); err != nil { + return nil, err + } + return strs, nil +} + +// FindSmsTemplateResetIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsTemplateResetIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SmsTemplateResetModel, criteria, options) +} + +// FindSmsTemplateResetId finds record id by querying it with criteria. +func (c *Client) FindSmsTemplateResetId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SmsTemplateResetModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/sms_tracker.go b/sms_tracker.go new file mode 100644 index 0000000..a670434 --- /dev/null +++ b/sms_tracker.go @@ -0,0 +1,118 @@ +package odoo + +// SmsTracker represents sms.tracker model. +type SmsTracker struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MailNotificationId *Many2One `xmlrpc:"mail_notification_id,omitempty"` + SmsUuid *String `xmlrpc:"sms_uuid,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SmsTrackers represents array of sms.tracker model. +type SmsTrackers []SmsTracker + +// SmsTrackerModel is the odoo model name. +const SmsTrackerModel = "sms.tracker" + +// Many2One convert SmsTracker to *Many2One. +func (st *SmsTracker) Many2One() *Many2One { + return NewMany2One(st.Id.Get(), "") +} + +// CreateSmsTracker creates a new sms.tracker model and returns its id. +func (c *Client) CreateSmsTracker(st *SmsTracker) (int64, error) { + ids, err := c.CreateSmsTrackers([]*SmsTracker{st}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSmsTracker creates a new sms.tracker model and returns its id. +func (c *Client) CreateSmsTrackers(sts []*SmsTracker) ([]int64, error) { + var vv []interface{} + for _, v := range sts { + vv = append(vv, v) + } + return c.Create(SmsTrackerModel, vv, nil) +} + +// UpdateSmsTracker updates an existing sms.tracker record. +func (c *Client) UpdateSmsTracker(st *SmsTracker) error { + return c.UpdateSmsTrackers([]int64{st.Id.Get()}, st) +} + +// UpdateSmsTrackers updates existing sms.tracker records. +// All records (represented by ids) will be updated by st values. +func (c *Client) UpdateSmsTrackers(ids []int64, st *SmsTracker) error { + return c.Update(SmsTrackerModel, ids, st, nil) +} + +// DeleteSmsTracker deletes an existing sms.tracker record. +func (c *Client) DeleteSmsTracker(id int64) error { + return c.DeleteSmsTrackers([]int64{id}) +} + +// DeleteSmsTrackers deletes existing sms.tracker records. +func (c *Client) DeleteSmsTrackers(ids []int64) error { + return c.Delete(SmsTrackerModel, ids) +} + +// GetSmsTracker gets sms.tracker existing record. +func (c *Client) GetSmsTracker(id int64) (*SmsTracker, error) { + sts, err := c.GetSmsTrackers([]int64{id}) + if err != nil { + return nil, err + } + return &((*sts)[0]), nil +} + +// GetSmsTrackers gets sms.tracker existing records. +func (c *Client) GetSmsTrackers(ids []int64) (*SmsTrackers, error) { + sts := &SmsTrackers{} + if err := c.Read(SmsTrackerModel, ids, nil, sts); err != nil { + return nil, err + } + return sts, nil +} + +// FindSmsTracker finds sms.tracker record by querying it with criteria. +func (c *Client) FindSmsTracker(criteria *Criteria) (*SmsTracker, error) { + sts := &SmsTrackers{} + if err := c.SearchRead(SmsTrackerModel, criteria, NewOptions().Limit(1), sts); err != nil { + return nil, err + } + return &((*sts)[0]), nil +} + +// FindSmsTrackers finds sms.tracker records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsTrackers(criteria *Criteria, options *Options) (*SmsTrackers, error) { + sts := &SmsTrackers{} + if err := c.SearchRead(SmsTrackerModel, criteria, options, sts); err != nil { + return nil, err + } + return sts, nil +} + +// FindSmsTrackerIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSmsTrackerIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SmsTrackerModel, criteria, options) +} + +// FindSmsTrackerId finds record id by querying it with criteria. +func (c *Client) FindSmsTrackerId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SmsTrackerModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/snailmail_letter.go b/snailmail_letter.go new file mode 100644 index 0000000..7f02074 --- /dev/null +++ b/snailmail_letter.go @@ -0,0 +1,140 @@ +package odoo + +// SnailmailLetter represents snailmail.letter model. +type SnailmailLetter struct { + AttachmentDatas *String `xmlrpc:"attachment_datas,omitempty"` + AttachmentFname *String `xmlrpc:"attachment_fname,omitempty"` + AttachmentId *Many2One `xmlrpc:"attachment_id,omitempty"` + City *String `xmlrpc:"city,omitempty"` + Color *Bool `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + Cover *Bool `xmlrpc:"cover,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Duplex *Bool `xmlrpc:"duplex,omitempty"` + ErrorCode *Selection `xmlrpc:"error_code,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InfoMsg *String `xmlrpc:"info_msg,omitempty"` + MessageId *Many2One `xmlrpc:"message_id,omitempty"` + Model *String `xmlrpc:"model,omitempty"` + NotificationIds *Relation `xmlrpc:"notification_ids,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + Reference *String `xmlrpc:"reference,omitempty"` + ReportTemplate *Many2One `xmlrpc:"report_template,omitempty"` + ResId *Int `xmlrpc:"res_id,omitempty"` + State *Selection `xmlrpc:"state,omitempty"` + StateId *Many2One `xmlrpc:"state_id,omitempty"` + Street *String `xmlrpc:"street,omitempty"` + Street2 *String `xmlrpc:"street2,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + Zip *String `xmlrpc:"zip,omitempty"` +} + +// SnailmailLetters represents array of snailmail.letter model. +type SnailmailLetters []SnailmailLetter + +// SnailmailLetterModel is the odoo model name. +const SnailmailLetterModel = "snailmail.letter" + +// Many2One convert SnailmailLetter to *Many2One. +func (sl *SnailmailLetter) Many2One() *Many2One { + return NewMany2One(sl.Id.Get(), "") +} + +// CreateSnailmailLetter creates a new snailmail.letter model and returns its id. +func (c *Client) CreateSnailmailLetter(sl *SnailmailLetter) (int64, error) { + ids, err := c.CreateSnailmailLetters([]*SnailmailLetter{sl}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSnailmailLetter creates a new snailmail.letter model and returns its id. +func (c *Client) CreateSnailmailLetters(sls []*SnailmailLetter) ([]int64, error) { + var vv []interface{} + for _, v := range sls { + vv = append(vv, v) + } + return c.Create(SnailmailLetterModel, vv, nil) +} + +// UpdateSnailmailLetter updates an existing snailmail.letter record. +func (c *Client) UpdateSnailmailLetter(sl *SnailmailLetter) error { + return c.UpdateSnailmailLetters([]int64{sl.Id.Get()}, sl) +} + +// UpdateSnailmailLetters updates existing snailmail.letter records. +// All records (represented by ids) will be updated by sl values. +func (c *Client) UpdateSnailmailLetters(ids []int64, sl *SnailmailLetter) error { + return c.Update(SnailmailLetterModel, ids, sl, nil) +} + +// DeleteSnailmailLetter deletes an existing snailmail.letter record. +func (c *Client) DeleteSnailmailLetter(id int64) error { + return c.DeleteSnailmailLetters([]int64{id}) +} + +// DeleteSnailmailLetters deletes existing snailmail.letter records. +func (c *Client) DeleteSnailmailLetters(ids []int64) error { + return c.Delete(SnailmailLetterModel, ids) +} + +// GetSnailmailLetter gets snailmail.letter existing record. +func (c *Client) GetSnailmailLetter(id int64) (*SnailmailLetter, error) { + sls, err := c.GetSnailmailLetters([]int64{id}) + if err != nil { + return nil, err + } + return &((*sls)[0]), nil +} + +// GetSnailmailLetters gets snailmail.letter existing records. +func (c *Client) GetSnailmailLetters(ids []int64) (*SnailmailLetters, error) { + sls := &SnailmailLetters{} + if err := c.Read(SnailmailLetterModel, ids, nil, sls); err != nil { + return nil, err + } + return sls, nil +} + +// FindSnailmailLetter finds snailmail.letter record by querying it with criteria. +func (c *Client) FindSnailmailLetter(criteria *Criteria) (*SnailmailLetter, error) { + sls := &SnailmailLetters{} + if err := c.SearchRead(SnailmailLetterModel, criteria, NewOptions().Limit(1), sls); err != nil { + return nil, err + } + return &((*sls)[0]), nil +} + +// FindSnailmailLetters finds snailmail.letter records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSnailmailLetters(criteria *Criteria, options *Options) (*SnailmailLetters, error) { + sls := &SnailmailLetters{} + if err := c.SearchRead(SnailmailLetterModel, criteria, options, sls); err != nil { + return nil, err + } + return sls, nil +} + +// FindSnailmailLetterIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSnailmailLetterIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SnailmailLetterModel, criteria, options) +} + +// FindSnailmailLetterId finds record id by querying it with criteria. +func (c *Client) FindSnailmailLetterId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SnailmailLetterModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/snailmail_letter_format_error.go b/snailmail_letter_format_error.go new file mode 100644 index 0000000..18da40f --- /dev/null +++ b/snailmail_letter_format_error.go @@ -0,0 +1,118 @@ +package odoo + +// SnailmailLetterFormatError represents snailmail.letter.format.error model. +type SnailmailLetterFormatError struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MessageId *Many2One `xmlrpc:"message_id,omitempty"` + SnailmailCover *Bool `xmlrpc:"snailmail_cover,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SnailmailLetterFormatErrors represents array of snailmail.letter.format.error model. +type SnailmailLetterFormatErrors []SnailmailLetterFormatError + +// SnailmailLetterFormatErrorModel is the odoo model name. +const SnailmailLetterFormatErrorModel = "snailmail.letter.format.error" + +// Many2One convert SnailmailLetterFormatError to *Many2One. +func (slfe *SnailmailLetterFormatError) Many2One() *Many2One { + return NewMany2One(slfe.Id.Get(), "") +} + +// CreateSnailmailLetterFormatError creates a new snailmail.letter.format.error model and returns its id. +func (c *Client) CreateSnailmailLetterFormatError(slfe *SnailmailLetterFormatError) (int64, error) { + ids, err := c.CreateSnailmailLetterFormatErrors([]*SnailmailLetterFormatError{slfe}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSnailmailLetterFormatError creates a new snailmail.letter.format.error model and returns its id. +func (c *Client) CreateSnailmailLetterFormatErrors(slfes []*SnailmailLetterFormatError) ([]int64, error) { + var vv []interface{} + for _, v := range slfes { + vv = append(vv, v) + } + return c.Create(SnailmailLetterFormatErrorModel, vv, nil) +} + +// UpdateSnailmailLetterFormatError updates an existing snailmail.letter.format.error record. +func (c *Client) UpdateSnailmailLetterFormatError(slfe *SnailmailLetterFormatError) error { + return c.UpdateSnailmailLetterFormatErrors([]int64{slfe.Id.Get()}, slfe) +} + +// UpdateSnailmailLetterFormatErrors updates existing snailmail.letter.format.error records. +// All records (represented by ids) will be updated by slfe values. +func (c *Client) UpdateSnailmailLetterFormatErrors(ids []int64, slfe *SnailmailLetterFormatError) error { + return c.Update(SnailmailLetterFormatErrorModel, ids, slfe, nil) +} + +// DeleteSnailmailLetterFormatError deletes an existing snailmail.letter.format.error record. +func (c *Client) DeleteSnailmailLetterFormatError(id int64) error { + return c.DeleteSnailmailLetterFormatErrors([]int64{id}) +} + +// DeleteSnailmailLetterFormatErrors deletes existing snailmail.letter.format.error records. +func (c *Client) DeleteSnailmailLetterFormatErrors(ids []int64) error { + return c.Delete(SnailmailLetterFormatErrorModel, ids) +} + +// GetSnailmailLetterFormatError gets snailmail.letter.format.error existing record. +func (c *Client) GetSnailmailLetterFormatError(id int64) (*SnailmailLetterFormatError, error) { + slfes, err := c.GetSnailmailLetterFormatErrors([]int64{id}) + if err != nil { + return nil, err + } + return &((*slfes)[0]), nil +} + +// GetSnailmailLetterFormatErrors gets snailmail.letter.format.error existing records. +func (c *Client) GetSnailmailLetterFormatErrors(ids []int64) (*SnailmailLetterFormatErrors, error) { + slfes := &SnailmailLetterFormatErrors{} + if err := c.Read(SnailmailLetterFormatErrorModel, ids, nil, slfes); err != nil { + return nil, err + } + return slfes, nil +} + +// FindSnailmailLetterFormatError finds snailmail.letter.format.error record by querying it with criteria. +func (c *Client) FindSnailmailLetterFormatError(criteria *Criteria) (*SnailmailLetterFormatError, error) { + slfes := &SnailmailLetterFormatErrors{} + if err := c.SearchRead(SnailmailLetterFormatErrorModel, criteria, NewOptions().Limit(1), slfes); err != nil { + return nil, err + } + return &((*slfes)[0]), nil +} + +// FindSnailmailLetterFormatErrors finds snailmail.letter.format.error records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSnailmailLetterFormatErrors(criteria *Criteria, options *Options) (*SnailmailLetterFormatErrors, error) { + slfes := &SnailmailLetterFormatErrors{} + if err := c.SearchRead(SnailmailLetterFormatErrorModel, criteria, options, slfes); err != nil { + return nil, err + } + return slfes, nil +} + +// FindSnailmailLetterFormatErrorIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSnailmailLetterFormatErrorIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SnailmailLetterFormatErrorModel, criteria, options) +} + +// FindSnailmailLetterFormatErrorId finds record id by querying it with criteria. +func (c *Client) FindSnailmailLetterFormatErrorId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SnailmailLetterFormatErrorModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/snailmail_letter_missing_required_fields.go b/snailmail_letter_missing_required_fields.go new file mode 100644 index 0000000..e405574 --- /dev/null +++ b/snailmail_letter_missing_required_fields.go @@ -0,0 +1,124 @@ +package odoo + +// SnailmailLetterMissingRequiredFields represents snailmail.letter.missing.required.fields model. +type SnailmailLetterMissingRequiredFields struct { + City *String `xmlrpc:"city,omitempty"` + CountryId *Many2One `xmlrpc:"country_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + LetterId *Many2One `xmlrpc:"letter_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + StateId *Many2One `xmlrpc:"state_id,omitempty"` + Street *String `xmlrpc:"street,omitempty"` + Street2 *String `xmlrpc:"street2,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` + Zip *String `xmlrpc:"zip,omitempty"` +} + +// SnailmailLetterMissingRequiredFieldss represents array of snailmail.letter.missing.required.fields model. +type SnailmailLetterMissingRequiredFieldss []SnailmailLetterMissingRequiredFields + +// SnailmailLetterMissingRequiredFieldsModel is the odoo model name. +const SnailmailLetterMissingRequiredFieldsModel = "snailmail.letter.missing.required.fields" + +// Many2One convert SnailmailLetterMissingRequiredFields to *Many2One. +func (slmrf *SnailmailLetterMissingRequiredFields) Many2One() *Many2One { + return NewMany2One(slmrf.Id.Get(), "") +} + +// CreateSnailmailLetterMissingRequiredFields creates a new snailmail.letter.missing.required.fields model and returns its id. +func (c *Client) CreateSnailmailLetterMissingRequiredFields(slmrf *SnailmailLetterMissingRequiredFields) (int64, error) { + ids, err := c.CreateSnailmailLetterMissingRequiredFieldss([]*SnailmailLetterMissingRequiredFields{slmrf}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSnailmailLetterMissingRequiredFields creates a new snailmail.letter.missing.required.fields model and returns its id. +func (c *Client) CreateSnailmailLetterMissingRequiredFieldss(slmrfs []*SnailmailLetterMissingRequiredFields) ([]int64, error) { + var vv []interface{} + for _, v := range slmrfs { + vv = append(vv, v) + } + return c.Create(SnailmailLetterMissingRequiredFieldsModel, vv, nil) +} + +// UpdateSnailmailLetterMissingRequiredFields updates an existing snailmail.letter.missing.required.fields record. +func (c *Client) UpdateSnailmailLetterMissingRequiredFields(slmrf *SnailmailLetterMissingRequiredFields) error { + return c.UpdateSnailmailLetterMissingRequiredFieldss([]int64{slmrf.Id.Get()}, slmrf) +} + +// UpdateSnailmailLetterMissingRequiredFieldss updates existing snailmail.letter.missing.required.fields records. +// All records (represented by ids) will be updated by slmrf values. +func (c *Client) UpdateSnailmailLetterMissingRequiredFieldss(ids []int64, slmrf *SnailmailLetterMissingRequiredFields) error { + return c.Update(SnailmailLetterMissingRequiredFieldsModel, ids, slmrf, nil) +} + +// DeleteSnailmailLetterMissingRequiredFields deletes an existing snailmail.letter.missing.required.fields record. +func (c *Client) DeleteSnailmailLetterMissingRequiredFields(id int64) error { + return c.DeleteSnailmailLetterMissingRequiredFieldss([]int64{id}) +} + +// DeleteSnailmailLetterMissingRequiredFieldss deletes existing snailmail.letter.missing.required.fields records. +func (c *Client) DeleteSnailmailLetterMissingRequiredFieldss(ids []int64) error { + return c.Delete(SnailmailLetterMissingRequiredFieldsModel, ids) +} + +// GetSnailmailLetterMissingRequiredFields gets snailmail.letter.missing.required.fields existing record. +func (c *Client) GetSnailmailLetterMissingRequiredFields(id int64) (*SnailmailLetterMissingRequiredFields, error) { + slmrfs, err := c.GetSnailmailLetterMissingRequiredFieldss([]int64{id}) + if err != nil { + return nil, err + } + return &((*slmrfs)[0]), nil +} + +// GetSnailmailLetterMissingRequiredFieldss gets snailmail.letter.missing.required.fields existing records. +func (c *Client) GetSnailmailLetterMissingRequiredFieldss(ids []int64) (*SnailmailLetterMissingRequiredFieldss, error) { + slmrfs := &SnailmailLetterMissingRequiredFieldss{} + if err := c.Read(SnailmailLetterMissingRequiredFieldsModel, ids, nil, slmrfs); err != nil { + return nil, err + } + return slmrfs, nil +} + +// FindSnailmailLetterMissingRequiredFields finds snailmail.letter.missing.required.fields record by querying it with criteria. +func (c *Client) FindSnailmailLetterMissingRequiredFields(criteria *Criteria) (*SnailmailLetterMissingRequiredFields, error) { + slmrfs := &SnailmailLetterMissingRequiredFieldss{} + if err := c.SearchRead(SnailmailLetterMissingRequiredFieldsModel, criteria, NewOptions().Limit(1), slmrfs); err != nil { + return nil, err + } + return &((*slmrfs)[0]), nil +} + +// FindSnailmailLetterMissingRequiredFieldss finds snailmail.letter.missing.required.fields records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSnailmailLetterMissingRequiredFieldss(criteria *Criteria, options *Options) (*SnailmailLetterMissingRequiredFieldss, error) { + slmrfs := &SnailmailLetterMissingRequiredFieldss{} + if err := c.SearchRead(SnailmailLetterMissingRequiredFieldsModel, criteria, options, slmrfs); err != nil { + return nil, err + } + return slmrfs, nil +} + +// FindSnailmailLetterMissingRequiredFieldsIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSnailmailLetterMissingRequiredFieldsIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SnailmailLetterMissingRequiredFieldsModel, criteria, options) +} + +// FindSnailmailLetterMissingRequiredFieldsId finds record id by querying it with criteria. +func (c *Client) FindSnailmailLetterMissingRequiredFieldsId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SnailmailLetterMissingRequiredFieldsModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/spreadsheet_dashboard.go b/spreadsheet_dashboard.go new file mode 100644 index 0000000..d9072e8 --- /dev/null +++ b/spreadsheet_dashboard.go @@ -0,0 +1,128 @@ +package odoo + +// SpreadsheetDashboard represents spreadsheet.dashboard model. +type SpreadsheetDashboard struct { + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DashboardGroupId *Many2One `xmlrpc:"dashboard_group_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + GroupIds *Relation `xmlrpc:"group_ids,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IsPublished *Bool `xmlrpc:"is_published,omitempty"` + MainDataModelIds *Relation `xmlrpc:"main_data_model_ids,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + SampleDashboardFilePath *String `xmlrpc:"sample_dashboard_file_path,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SpreadsheetBinaryData *String `xmlrpc:"spreadsheet_binary_data,omitempty"` + SpreadsheetData *String `xmlrpc:"spreadsheet_data,omitempty"` + SpreadsheetFileName *String `xmlrpc:"spreadsheet_file_name,omitempty"` + Thumbnail *String `xmlrpc:"thumbnail,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SpreadsheetDashboards represents array of spreadsheet.dashboard model. +type SpreadsheetDashboards []SpreadsheetDashboard + +// SpreadsheetDashboardModel is the odoo model name. +const SpreadsheetDashboardModel = "spreadsheet.dashboard" + +// Many2One convert SpreadsheetDashboard to *Many2One. +func (sd *SpreadsheetDashboard) Many2One() *Many2One { + return NewMany2One(sd.Id.Get(), "") +} + +// CreateSpreadsheetDashboard creates a new spreadsheet.dashboard model and returns its id. +func (c *Client) CreateSpreadsheetDashboard(sd *SpreadsheetDashboard) (int64, error) { + ids, err := c.CreateSpreadsheetDashboards([]*SpreadsheetDashboard{sd}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSpreadsheetDashboard creates a new spreadsheet.dashboard model and returns its id. +func (c *Client) CreateSpreadsheetDashboards(sds []*SpreadsheetDashboard) ([]int64, error) { + var vv []interface{} + for _, v := range sds { + vv = append(vv, v) + } + return c.Create(SpreadsheetDashboardModel, vv, nil) +} + +// UpdateSpreadsheetDashboard updates an existing spreadsheet.dashboard record. +func (c *Client) UpdateSpreadsheetDashboard(sd *SpreadsheetDashboard) error { + return c.UpdateSpreadsheetDashboards([]int64{sd.Id.Get()}, sd) +} + +// UpdateSpreadsheetDashboards updates existing spreadsheet.dashboard records. +// All records (represented by ids) will be updated by sd values. +func (c *Client) UpdateSpreadsheetDashboards(ids []int64, sd *SpreadsheetDashboard) error { + return c.Update(SpreadsheetDashboardModel, ids, sd, nil) +} + +// DeleteSpreadsheetDashboard deletes an existing spreadsheet.dashboard record. +func (c *Client) DeleteSpreadsheetDashboard(id int64) error { + return c.DeleteSpreadsheetDashboards([]int64{id}) +} + +// DeleteSpreadsheetDashboards deletes existing spreadsheet.dashboard records. +func (c *Client) DeleteSpreadsheetDashboards(ids []int64) error { + return c.Delete(SpreadsheetDashboardModel, ids) +} + +// GetSpreadsheetDashboard gets spreadsheet.dashboard existing record. +func (c *Client) GetSpreadsheetDashboard(id int64) (*SpreadsheetDashboard, error) { + sds, err := c.GetSpreadsheetDashboards([]int64{id}) + if err != nil { + return nil, err + } + return &((*sds)[0]), nil +} + +// GetSpreadsheetDashboards gets spreadsheet.dashboard existing records. +func (c *Client) GetSpreadsheetDashboards(ids []int64) (*SpreadsheetDashboards, error) { + sds := &SpreadsheetDashboards{} + if err := c.Read(SpreadsheetDashboardModel, ids, nil, sds); err != nil { + return nil, err + } + return sds, nil +} + +// FindSpreadsheetDashboard finds spreadsheet.dashboard record by querying it with criteria. +func (c *Client) FindSpreadsheetDashboard(criteria *Criteria) (*SpreadsheetDashboard, error) { + sds := &SpreadsheetDashboards{} + if err := c.SearchRead(SpreadsheetDashboardModel, criteria, NewOptions().Limit(1), sds); err != nil { + return nil, err + } + return &((*sds)[0]), nil +} + +// FindSpreadsheetDashboards finds spreadsheet.dashboard records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSpreadsheetDashboards(criteria *Criteria, options *Options) (*SpreadsheetDashboards, error) { + sds := &SpreadsheetDashboards{} + if err := c.SearchRead(SpreadsheetDashboardModel, criteria, options, sds); err != nil { + return nil, err + } + return sds, nil +} + +// FindSpreadsheetDashboardIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSpreadsheetDashboardIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SpreadsheetDashboardModel, criteria, options) +} + +// FindSpreadsheetDashboardId finds record id by querying it with criteria. +func (c *Client) FindSpreadsheetDashboardId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SpreadsheetDashboardModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/spreadsheet_dashboard_group.go b/spreadsheet_dashboard_group.go new file mode 100644 index 0000000..852a2ac --- /dev/null +++ b/spreadsheet_dashboard_group.go @@ -0,0 +1,120 @@ +package odoo + +// SpreadsheetDashboardGroup represents spreadsheet.dashboard.group model. +type SpreadsheetDashboardGroup struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DashboardIds *Relation `xmlrpc:"dashboard_ids,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + PublishedDashboardIds *Relation `xmlrpc:"published_dashboard_ids,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SpreadsheetDashboardGroups represents array of spreadsheet.dashboard.group model. +type SpreadsheetDashboardGroups []SpreadsheetDashboardGroup + +// SpreadsheetDashboardGroupModel is the odoo model name. +const SpreadsheetDashboardGroupModel = "spreadsheet.dashboard.group" + +// Many2One convert SpreadsheetDashboardGroup to *Many2One. +func (sdg *SpreadsheetDashboardGroup) Many2One() *Many2One { + return NewMany2One(sdg.Id.Get(), "") +} + +// CreateSpreadsheetDashboardGroup creates a new spreadsheet.dashboard.group model and returns its id. +func (c *Client) CreateSpreadsheetDashboardGroup(sdg *SpreadsheetDashboardGroup) (int64, error) { + ids, err := c.CreateSpreadsheetDashboardGroups([]*SpreadsheetDashboardGroup{sdg}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSpreadsheetDashboardGroup creates a new spreadsheet.dashboard.group model and returns its id. +func (c *Client) CreateSpreadsheetDashboardGroups(sdgs []*SpreadsheetDashboardGroup) ([]int64, error) { + var vv []interface{} + for _, v := range sdgs { + vv = append(vv, v) + } + return c.Create(SpreadsheetDashboardGroupModel, vv, nil) +} + +// UpdateSpreadsheetDashboardGroup updates an existing spreadsheet.dashboard.group record. +func (c *Client) UpdateSpreadsheetDashboardGroup(sdg *SpreadsheetDashboardGroup) error { + return c.UpdateSpreadsheetDashboardGroups([]int64{sdg.Id.Get()}, sdg) +} + +// UpdateSpreadsheetDashboardGroups updates existing spreadsheet.dashboard.group records. +// All records (represented by ids) will be updated by sdg values. +func (c *Client) UpdateSpreadsheetDashboardGroups(ids []int64, sdg *SpreadsheetDashboardGroup) error { + return c.Update(SpreadsheetDashboardGroupModel, ids, sdg, nil) +} + +// DeleteSpreadsheetDashboardGroup deletes an existing spreadsheet.dashboard.group record. +func (c *Client) DeleteSpreadsheetDashboardGroup(id int64) error { + return c.DeleteSpreadsheetDashboardGroups([]int64{id}) +} + +// DeleteSpreadsheetDashboardGroups deletes existing spreadsheet.dashboard.group records. +func (c *Client) DeleteSpreadsheetDashboardGroups(ids []int64) error { + return c.Delete(SpreadsheetDashboardGroupModel, ids) +} + +// GetSpreadsheetDashboardGroup gets spreadsheet.dashboard.group existing record. +func (c *Client) GetSpreadsheetDashboardGroup(id int64) (*SpreadsheetDashboardGroup, error) { + sdgs, err := c.GetSpreadsheetDashboardGroups([]int64{id}) + if err != nil { + return nil, err + } + return &((*sdgs)[0]), nil +} + +// GetSpreadsheetDashboardGroups gets spreadsheet.dashboard.group existing records. +func (c *Client) GetSpreadsheetDashboardGroups(ids []int64) (*SpreadsheetDashboardGroups, error) { + sdgs := &SpreadsheetDashboardGroups{} + if err := c.Read(SpreadsheetDashboardGroupModel, ids, nil, sdgs); err != nil { + return nil, err + } + return sdgs, nil +} + +// FindSpreadsheetDashboardGroup finds spreadsheet.dashboard.group record by querying it with criteria. +func (c *Client) FindSpreadsheetDashboardGroup(criteria *Criteria) (*SpreadsheetDashboardGroup, error) { + sdgs := &SpreadsheetDashboardGroups{} + if err := c.SearchRead(SpreadsheetDashboardGroupModel, criteria, NewOptions().Limit(1), sdgs); err != nil { + return nil, err + } + return &((*sdgs)[0]), nil +} + +// FindSpreadsheetDashboardGroups finds spreadsheet.dashboard.group records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSpreadsheetDashboardGroups(criteria *Criteria, options *Options) (*SpreadsheetDashboardGroups, error) { + sdgs := &SpreadsheetDashboardGroups{} + if err := c.SearchRead(SpreadsheetDashboardGroupModel, criteria, options, sdgs); err != nil { + return nil, err + } + return sdgs, nil +} + +// FindSpreadsheetDashboardGroupIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSpreadsheetDashboardGroupIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SpreadsheetDashboardGroupModel, criteria, options) +} + +// FindSpreadsheetDashboardGroupId finds record id by querying it with criteria. +func (c *Client) FindSpreadsheetDashboardGroupId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SpreadsheetDashboardGroupModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/spreadsheet_dashboard_share.go b/spreadsheet_dashboard_share.go new file mode 100644 index 0000000..a05d907 --- /dev/null +++ b/spreadsheet_dashboard_share.go @@ -0,0 +1,125 @@ +package odoo + +// SpreadsheetDashboardShare represents spreadsheet.dashboard.share model. +type SpreadsheetDashboardShare struct { + AccessToken *String `xmlrpc:"access_token,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DashboardId *Many2One `xmlrpc:"dashboard_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ExcelExport *String `xmlrpc:"excel_export,omitempty"` + FullUrl *String `xmlrpc:"full_url,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + SpreadsheetBinaryData *String `xmlrpc:"spreadsheet_binary_data,omitempty"` + SpreadsheetData *String `xmlrpc:"spreadsheet_data,omitempty"` + SpreadsheetFileName *String `xmlrpc:"spreadsheet_file_name,omitempty"` + Thumbnail *String `xmlrpc:"thumbnail,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// SpreadsheetDashboardShares represents array of spreadsheet.dashboard.share model. +type SpreadsheetDashboardShares []SpreadsheetDashboardShare + +// SpreadsheetDashboardShareModel is the odoo model name. +const SpreadsheetDashboardShareModel = "spreadsheet.dashboard.share" + +// Many2One convert SpreadsheetDashboardShare to *Many2One. +func (sds *SpreadsheetDashboardShare) Many2One() *Many2One { + return NewMany2One(sds.Id.Get(), "") +} + +// CreateSpreadsheetDashboardShare creates a new spreadsheet.dashboard.share model and returns its id. +func (c *Client) CreateSpreadsheetDashboardShare(sds *SpreadsheetDashboardShare) (int64, error) { + ids, err := c.CreateSpreadsheetDashboardShares([]*SpreadsheetDashboardShare{sds}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateSpreadsheetDashboardShare creates a new spreadsheet.dashboard.share model and returns its id. +func (c *Client) CreateSpreadsheetDashboardShares(sdss []*SpreadsheetDashboardShare) ([]int64, error) { + var vv []interface{} + for _, v := range sdss { + vv = append(vv, v) + } + return c.Create(SpreadsheetDashboardShareModel, vv, nil) +} + +// UpdateSpreadsheetDashboardShare updates an existing spreadsheet.dashboard.share record. +func (c *Client) UpdateSpreadsheetDashboardShare(sds *SpreadsheetDashboardShare) error { + return c.UpdateSpreadsheetDashboardShares([]int64{sds.Id.Get()}, sds) +} + +// UpdateSpreadsheetDashboardShares updates existing spreadsheet.dashboard.share records. +// All records (represented by ids) will be updated by sds values. +func (c *Client) UpdateSpreadsheetDashboardShares(ids []int64, sds *SpreadsheetDashboardShare) error { + return c.Update(SpreadsheetDashboardShareModel, ids, sds, nil) +} + +// DeleteSpreadsheetDashboardShare deletes an existing spreadsheet.dashboard.share record. +func (c *Client) DeleteSpreadsheetDashboardShare(id int64) error { + return c.DeleteSpreadsheetDashboardShares([]int64{id}) +} + +// DeleteSpreadsheetDashboardShares deletes existing spreadsheet.dashboard.share records. +func (c *Client) DeleteSpreadsheetDashboardShares(ids []int64) error { + return c.Delete(SpreadsheetDashboardShareModel, ids) +} + +// GetSpreadsheetDashboardShare gets spreadsheet.dashboard.share existing record. +func (c *Client) GetSpreadsheetDashboardShare(id int64) (*SpreadsheetDashboardShare, error) { + sdss, err := c.GetSpreadsheetDashboardShares([]int64{id}) + if err != nil { + return nil, err + } + return &((*sdss)[0]), nil +} + +// GetSpreadsheetDashboardShares gets spreadsheet.dashboard.share existing records. +func (c *Client) GetSpreadsheetDashboardShares(ids []int64) (*SpreadsheetDashboardShares, error) { + sdss := &SpreadsheetDashboardShares{} + if err := c.Read(SpreadsheetDashboardShareModel, ids, nil, sdss); err != nil { + return nil, err + } + return sdss, nil +} + +// FindSpreadsheetDashboardShare finds spreadsheet.dashboard.share record by querying it with criteria. +func (c *Client) FindSpreadsheetDashboardShare(criteria *Criteria) (*SpreadsheetDashboardShare, error) { + sdss := &SpreadsheetDashboardShares{} + if err := c.SearchRead(SpreadsheetDashboardShareModel, criteria, NewOptions().Limit(1), sdss); err != nil { + return nil, err + } + return &((*sdss)[0]), nil +} + +// FindSpreadsheetDashboardShares finds spreadsheet.dashboard.share records by querying it +// and filtering it with criteria and options. +func (c *Client) FindSpreadsheetDashboardShares(criteria *Criteria, options *Options) (*SpreadsheetDashboardShares, error) { + sdss := &SpreadsheetDashboardShares{} + if err := c.SearchRead(SpreadsheetDashboardShareModel, criteria, options, sdss); err != nil { + return nil, err + } + return sdss, nil +} + +// FindSpreadsheetDashboardShareIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindSpreadsheetDashboardShareIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(SpreadsheetDashboardShareModel, criteria, options) +} + +// FindSpreadsheetDashboardShareId finds record id by querying it with criteria. +func (c *Client) FindSpreadsheetDashboardShareId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(SpreadsheetDashboardShareModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/timesheets_analysis_report.go b/timesheets_analysis_report.go new file mode 100644 index 0000000..93b51b5 --- /dev/null +++ b/timesheets_analysis_report.go @@ -0,0 +1,137 @@ +package odoo + +// TimesheetsAnalysisReport represents timesheets.analysis.report model. +type TimesheetsAnalysisReport struct { + Amount *Float `xmlrpc:"amount,omitempty"` + BillableTime *Float `xmlrpc:"billable_time,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + HasDepartmentManagerAccess *Bool `xmlrpc:"has_department_manager_access,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + ManagerId *Many2One `xmlrpc:"manager_id,omitempty"` + Margin *Float `xmlrpc:"margin,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MilestoneId *Many2One `xmlrpc:"milestone_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + NonBillableTime *Float `xmlrpc:"non_billable_time,omitempty"` + OrderId *Many2One `xmlrpc:"order_id,omitempty"` + ParentTaskId *Many2One `xmlrpc:"parent_task_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + SoLine *Many2One `xmlrpc:"so_line,omitempty"` + TaskId *Many2One `xmlrpc:"task_id,omitempty"` + TimesheetInvoiceId *Many2One `xmlrpc:"timesheet_invoice_id,omitempty"` + TimesheetInvoiceType *Selection `xmlrpc:"timesheet_invoice_type,omitempty"` + TimesheetRevenues *Float `xmlrpc:"timesheet_revenues,omitempty"` + UnitAmount *Float `xmlrpc:"unit_amount,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` +} + +// TimesheetsAnalysisReports represents array of timesheets.analysis.report model. +type TimesheetsAnalysisReports []TimesheetsAnalysisReport + +// TimesheetsAnalysisReportModel is the odoo model name. +const TimesheetsAnalysisReportModel = "timesheets.analysis.report" + +// Many2One convert TimesheetsAnalysisReport to *Many2One. +func (tar *TimesheetsAnalysisReport) Many2One() *Many2One { + return NewMany2One(tar.Id.Get(), "") +} + +// CreateTimesheetsAnalysisReport creates a new timesheets.analysis.report model and returns its id. +func (c *Client) CreateTimesheetsAnalysisReport(tar *TimesheetsAnalysisReport) (int64, error) { + ids, err := c.CreateTimesheetsAnalysisReports([]*TimesheetsAnalysisReport{tar}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateTimesheetsAnalysisReport creates a new timesheets.analysis.report model and returns its id. +func (c *Client) CreateTimesheetsAnalysisReports(tars []*TimesheetsAnalysisReport) ([]int64, error) { + var vv []interface{} + for _, v := range tars { + vv = append(vv, v) + } + return c.Create(TimesheetsAnalysisReportModel, vv, nil) +} + +// UpdateTimesheetsAnalysisReport updates an existing timesheets.analysis.report record. +func (c *Client) UpdateTimesheetsAnalysisReport(tar *TimesheetsAnalysisReport) error { + return c.UpdateTimesheetsAnalysisReports([]int64{tar.Id.Get()}, tar) +} + +// UpdateTimesheetsAnalysisReports updates existing timesheets.analysis.report records. +// All records (represented by ids) will be updated by tar values. +func (c *Client) UpdateTimesheetsAnalysisReports(ids []int64, tar *TimesheetsAnalysisReport) error { + return c.Update(TimesheetsAnalysisReportModel, ids, tar, nil) +} + +// DeleteTimesheetsAnalysisReport deletes an existing timesheets.analysis.report record. +func (c *Client) DeleteTimesheetsAnalysisReport(id int64) error { + return c.DeleteTimesheetsAnalysisReports([]int64{id}) +} + +// DeleteTimesheetsAnalysisReports deletes existing timesheets.analysis.report records. +func (c *Client) DeleteTimesheetsAnalysisReports(ids []int64) error { + return c.Delete(TimesheetsAnalysisReportModel, ids) +} + +// GetTimesheetsAnalysisReport gets timesheets.analysis.report existing record. +func (c *Client) GetTimesheetsAnalysisReport(id int64) (*TimesheetsAnalysisReport, error) { + tars, err := c.GetTimesheetsAnalysisReports([]int64{id}) + if err != nil { + return nil, err + } + return &((*tars)[0]), nil +} + +// GetTimesheetsAnalysisReports gets timesheets.analysis.report existing records. +func (c *Client) GetTimesheetsAnalysisReports(ids []int64) (*TimesheetsAnalysisReports, error) { + tars := &TimesheetsAnalysisReports{} + if err := c.Read(TimesheetsAnalysisReportModel, ids, nil, tars); err != nil { + return nil, err + } + return tars, nil +} + +// FindTimesheetsAnalysisReport finds timesheets.analysis.report record by querying it with criteria. +func (c *Client) FindTimesheetsAnalysisReport(criteria *Criteria) (*TimesheetsAnalysisReport, error) { + tars := &TimesheetsAnalysisReports{} + if err := c.SearchRead(TimesheetsAnalysisReportModel, criteria, NewOptions().Limit(1), tars); err != nil { + return nil, err + } + return &((*tars)[0]), nil +} + +// FindTimesheetsAnalysisReports finds timesheets.analysis.report records by querying it +// and filtering it with criteria and options. +func (c *Client) FindTimesheetsAnalysisReports(criteria *Criteria, options *Options) (*TimesheetsAnalysisReports, error) { + tars := &TimesheetsAnalysisReports{} + if err := c.SearchRead(TimesheetsAnalysisReportModel, criteria, options, tars); err != nil { + return nil, err + } + return tars, nil +} + +// FindTimesheetsAnalysisReportIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindTimesheetsAnalysisReportIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(TimesheetsAnalysisReportModel, criteria, options) +} + +// FindTimesheetsAnalysisReportId finds record id by querying it with criteria. +func (c *Client) FindTimesheetsAnalysisReportId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(TimesheetsAnalysisReportModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/timesheets_analysis_reporting.go b/timesheets_analysis_reporting.go new file mode 100644 index 0000000..649bfa8 --- /dev/null +++ b/timesheets_analysis_reporting.go @@ -0,0 +1,140 @@ +package odoo + +// TimesheetsAnalysisReporting represents timesheets.analysis.reporting model. +type TimesheetsAnalysisReporting struct { + Amount *Float `xmlrpc:"amount,omitempty"` + BillableTime *Float `xmlrpc:"billable_time,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + DepartmentId *Many2One `xmlrpc:"department_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + EmployeeId *Many2One `xmlrpc:"employee_id,omitempty"` + HasDepartmentManagerAccess *Bool `xmlrpc:"has_department_manager_access,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoiceDate *Time `xmlrpc:"invoice_date,omitempty"` + InvoiceDueDate *Time `xmlrpc:"invoice_due_date,omitempty"` + ManagerId *Many2One `xmlrpc:"manager_id,omitempty"` + MessagePartnerIds *Relation `xmlrpc:"message_partner_ids,omitempty"` + MilestoneId *Many2One `xmlrpc:"milestone_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + OrderId *Many2One `xmlrpc:"order_id,omitempty"` + ParentTaskId *Many2One `xmlrpc:"parent_task_id,omitempty"` + PartnerId *Many2One `xmlrpc:"partner_id,omitempty"` + PayRef *String `xmlrpc:"pay_ref,omitempty"` + PayState *String `xmlrpc:"pay_state,omitempty"` + ProjectId *Many2One `xmlrpc:"project_id,omitempty"` + SoLine *Many2One `xmlrpc:"so_line,omitempty"` + TaskId *Many2One `xmlrpc:"task_id,omitempty"` + TaskName *String `xmlrpc:"task_name,omitempty"` + TimesheetInvoiceId *Many2One `xmlrpc:"timesheet_invoice_id,omitempty"` + TimesheetInvoiceType *Selection `xmlrpc:"timesheet_invoice_type,omitempty"` + TimesheetRevenues *Float `xmlrpc:"timesheet_revenues,omitempty"` + UnitAmount *Float `xmlrpc:"unit_amount,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` +} + +// TimesheetsAnalysisReportings represents array of timesheets.analysis.reporting model. +type TimesheetsAnalysisReportings []TimesheetsAnalysisReporting + +// TimesheetsAnalysisReportingModel is the odoo model name. +const TimesheetsAnalysisReportingModel = "timesheets.analysis.reporting" + +// Many2One convert TimesheetsAnalysisReporting to *Many2One. +func (tar *TimesheetsAnalysisReporting) Many2One() *Many2One { + return NewMany2One(tar.Id.Get(), "") +} + +// CreateTimesheetsAnalysisReporting creates a new timesheets.analysis.reporting model and returns its id. +func (c *Client) CreateTimesheetsAnalysisReporting(tar *TimesheetsAnalysisReporting) (int64, error) { + ids, err := c.CreateTimesheetsAnalysisReportings([]*TimesheetsAnalysisReporting{tar}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateTimesheetsAnalysisReporting creates a new timesheets.analysis.reporting model and returns its id. +func (c *Client) CreateTimesheetsAnalysisReportings(tars []*TimesheetsAnalysisReporting) ([]int64, error) { + var vv []interface{} + for _, v := range tars { + vv = append(vv, v) + } + return c.Create(TimesheetsAnalysisReportingModel, vv, nil) +} + +// UpdateTimesheetsAnalysisReporting updates an existing timesheets.analysis.reporting record. +func (c *Client) UpdateTimesheetsAnalysisReporting(tar *TimesheetsAnalysisReporting) error { + return c.UpdateTimesheetsAnalysisReportings([]int64{tar.Id.Get()}, tar) +} + +// UpdateTimesheetsAnalysisReportings updates existing timesheets.analysis.reporting records. +// All records (represented by ids) will be updated by tar values. +func (c *Client) UpdateTimesheetsAnalysisReportings(ids []int64, tar *TimesheetsAnalysisReporting) error { + return c.Update(TimesheetsAnalysisReportingModel, ids, tar, nil) +} + +// DeleteTimesheetsAnalysisReporting deletes an existing timesheets.analysis.reporting record. +func (c *Client) DeleteTimesheetsAnalysisReporting(id int64) error { + return c.DeleteTimesheetsAnalysisReportings([]int64{id}) +} + +// DeleteTimesheetsAnalysisReportings deletes existing timesheets.analysis.reporting records. +func (c *Client) DeleteTimesheetsAnalysisReportings(ids []int64) error { + return c.Delete(TimesheetsAnalysisReportingModel, ids) +} + +// GetTimesheetsAnalysisReporting gets timesheets.analysis.reporting existing record. +func (c *Client) GetTimesheetsAnalysisReporting(id int64) (*TimesheetsAnalysisReporting, error) { + tars, err := c.GetTimesheetsAnalysisReportings([]int64{id}) + if err != nil { + return nil, err + } + return &((*tars)[0]), nil +} + +// GetTimesheetsAnalysisReportings gets timesheets.analysis.reporting existing records. +func (c *Client) GetTimesheetsAnalysisReportings(ids []int64) (*TimesheetsAnalysisReportings, error) { + tars := &TimesheetsAnalysisReportings{} + if err := c.Read(TimesheetsAnalysisReportingModel, ids, nil, tars); err != nil { + return nil, err + } + return tars, nil +} + +// FindTimesheetsAnalysisReporting finds timesheets.analysis.reporting record by querying it with criteria. +func (c *Client) FindTimesheetsAnalysisReporting(criteria *Criteria) (*TimesheetsAnalysisReporting, error) { + tars := &TimesheetsAnalysisReportings{} + if err := c.SearchRead(TimesheetsAnalysisReportingModel, criteria, NewOptions().Limit(1), tars); err != nil { + return nil, err + } + return &((*tars)[0]), nil +} + +// FindTimesheetsAnalysisReportings finds timesheets.analysis.reporting records by querying it +// and filtering it with criteria and options. +func (c *Client) FindTimesheetsAnalysisReportings(criteria *Criteria, options *Options) (*TimesheetsAnalysisReportings, error) { + tars := &TimesheetsAnalysisReportings{} + if err := c.SearchRead(TimesheetsAnalysisReportingModel, criteria, options, tars); err != nil { + return nil, err + } + return tars, nil +} + +// FindTimesheetsAnalysisReportingIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindTimesheetsAnalysisReportingIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(TimesheetsAnalysisReportingModel, criteria, options) +} + +// FindTimesheetsAnalysisReportingId finds record id by querying it with criteria. +func (c *Client) FindTimesheetsAnalysisReportingId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(TimesheetsAnalysisReportingModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/uom_category.go b/uom_category.go new file mode 100644 index 0000000..02149ed --- /dev/null +++ b/uom_category.go @@ -0,0 +1,119 @@ +package odoo + +// UomCategory represents uom.category model. +type UomCategory struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + ReferenceUomId *Many2One `xmlrpc:"reference_uom_id,omitempty"` + UomIds *Relation `xmlrpc:"uom_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// UomCategorys represents array of uom.category model. +type UomCategorys []UomCategory + +// UomCategoryModel is the odoo model name. +const UomCategoryModel = "uom.category" + +// Many2One convert UomCategory to *Many2One. +func (uc *UomCategory) Many2One() *Many2One { + return NewMany2One(uc.Id.Get(), "") +} + +// CreateUomCategory creates a new uom.category model and returns its id. +func (c *Client) CreateUomCategory(uc *UomCategory) (int64, error) { + ids, err := c.CreateUomCategorys([]*UomCategory{uc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateUomCategory creates a new uom.category model and returns its id. +func (c *Client) CreateUomCategorys(ucs []*UomCategory) ([]int64, error) { + var vv []interface{} + for _, v := range ucs { + vv = append(vv, v) + } + return c.Create(UomCategoryModel, vv, nil) +} + +// UpdateUomCategory updates an existing uom.category record. +func (c *Client) UpdateUomCategory(uc *UomCategory) error { + return c.UpdateUomCategorys([]int64{uc.Id.Get()}, uc) +} + +// UpdateUomCategorys updates existing uom.category records. +// All records (represented by ids) will be updated by uc values. +func (c *Client) UpdateUomCategorys(ids []int64, uc *UomCategory) error { + return c.Update(UomCategoryModel, ids, uc, nil) +} + +// DeleteUomCategory deletes an existing uom.category record. +func (c *Client) DeleteUomCategory(id int64) error { + return c.DeleteUomCategorys([]int64{id}) +} + +// DeleteUomCategorys deletes existing uom.category records. +func (c *Client) DeleteUomCategorys(ids []int64) error { + return c.Delete(UomCategoryModel, ids) +} + +// GetUomCategory gets uom.category existing record. +func (c *Client) GetUomCategory(id int64) (*UomCategory, error) { + ucs, err := c.GetUomCategorys([]int64{id}) + if err != nil { + return nil, err + } + return &((*ucs)[0]), nil +} + +// GetUomCategorys gets uom.category existing records. +func (c *Client) GetUomCategorys(ids []int64) (*UomCategorys, error) { + ucs := &UomCategorys{} + if err := c.Read(UomCategoryModel, ids, nil, ucs); err != nil { + return nil, err + } + return ucs, nil +} + +// FindUomCategory finds uom.category record by querying it with criteria. +func (c *Client) FindUomCategory(criteria *Criteria) (*UomCategory, error) { + ucs := &UomCategorys{} + if err := c.SearchRead(UomCategoryModel, criteria, NewOptions().Limit(1), ucs); err != nil { + return nil, err + } + return &((*ucs)[0]), nil +} + +// FindUomCategorys finds uom.category records by querying it +// and filtering it with criteria and options. +func (c *Client) FindUomCategorys(criteria *Criteria, options *Options) (*UomCategorys, error) { + ucs := &UomCategorys{} + if err := c.SearchRead(UomCategoryModel, criteria, options, ucs); err != nil { + return nil, err + } + return ucs, nil +} + +// FindUomCategoryIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindUomCategoryIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(UomCategoryModel, criteria, options) +} + +// FindUomCategoryId finds record id by querying it with criteria. +func (c *Client) FindUomCategoryId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(UomCategoryModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/uom_uom.go b/uom_uom.go new file mode 100644 index 0000000..d57f989 --- /dev/null +++ b/uom_uom.go @@ -0,0 +1,127 @@ +package odoo + +// UomUom represents uom.uom model. +type UomUom struct { + Active *Bool `xmlrpc:"active,omitempty"` + CategoryId *Many2One `xmlrpc:"category_id,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Factor *Float `xmlrpc:"factor,omitempty"` + FactorInv *Float `xmlrpc:"factor_inv,omitempty"` + FiscalCountryCodes *String `xmlrpc:"fiscal_country_codes,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Ratio *Float `xmlrpc:"ratio,omitempty"` + Rounding *Float `xmlrpc:"rounding,omitempty"` + TimesheetWidget *String `xmlrpc:"timesheet_widget,omitempty"` + UomType *Selection `xmlrpc:"uom_type,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// UomUoms represents array of uom.uom model. +type UomUoms []UomUom + +// UomUomModel is the odoo model name. +const UomUomModel = "uom.uom" + +// Many2One convert UomUom to *Many2One. +func (uu *UomUom) Many2One() *Many2One { + return NewMany2One(uu.Id.Get(), "") +} + +// CreateUomUom creates a new uom.uom model and returns its id. +func (c *Client) CreateUomUom(uu *UomUom) (int64, error) { + ids, err := c.CreateUomUoms([]*UomUom{uu}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateUomUom creates a new uom.uom model and returns its id. +func (c *Client) CreateUomUoms(uus []*UomUom) ([]int64, error) { + var vv []interface{} + for _, v := range uus { + vv = append(vv, v) + } + return c.Create(UomUomModel, vv, nil) +} + +// UpdateUomUom updates an existing uom.uom record. +func (c *Client) UpdateUomUom(uu *UomUom) error { + return c.UpdateUomUoms([]int64{uu.Id.Get()}, uu) +} + +// UpdateUomUoms updates existing uom.uom records. +// All records (represented by ids) will be updated by uu values. +func (c *Client) UpdateUomUoms(ids []int64, uu *UomUom) error { + return c.Update(UomUomModel, ids, uu, nil) +} + +// DeleteUomUom deletes an existing uom.uom record. +func (c *Client) DeleteUomUom(id int64) error { + return c.DeleteUomUoms([]int64{id}) +} + +// DeleteUomUoms deletes existing uom.uom records. +func (c *Client) DeleteUomUoms(ids []int64) error { + return c.Delete(UomUomModel, ids) +} + +// GetUomUom gets uom.uom existing record. +func (c *Client) GetUomUom(id int64) (*UomUom, error) { + uus, err := c.GetUomUoms([]int64{id}) + if err != nil { + return nil, err + } + return &((*uus)[0]), nil +} + +// GetUomUoms gets uom.uom existing records. +func (c *Client) GetUomUoms(ids []int64) (*UomUoms, error) { + uus := &UomUoms{} + if err := c.Read(UomUomModel, ids, nil, uus); err != nil { + return nil, err + } + return uus, nil +} + +// FindUomUom finds uom.uom record by querying it with criteria. +func (c *Client) FindUomUom(criteria *Criteria) (*UomUom, error) { + uus := &UomUoms{} + if err := c.SearchRead(UomUomModel, criteria, NewOptions().Limit(1), uus); err != nil { + return nil, err + } + return &((*uus)[0]), nil +} + +// FindUomUoms finds uom.uom records by querying it +// and filtering it with criteria and options. +func (c *Client) FindUomUoms(criteria *Criteria, options *Options) (*UomUoms, error) { + uus := &UomUoms{} + if err := c.SearchRead(UomUomModel, criteria, options, uus); err != nil { + return nil, err + } + return uus, nil +} + +// FindUomUomIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindUomUomIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(UomUomModel, criteria, options) +} + +// FindUomUomId finds record id by querying it with criteria. +func (c *Client) FindUomUomId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(UomUomModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/update_product_attribute_value.go b/update_product_attribute_value.go new file mode 100644 index 0000000..9178aae --- /dev/null +++ b/update_product_attribute_value.go @@ -0,0 +1,120 @@ +package odoo + +// UpdateProductAttributeValue represents update.product.attribute.value model. +type UpdateProductAttributeValue struct { + AttributeValueId *Many2One `xmlrpc:"attribute_value_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Message *String `xmlrpc:"message,omitempty"` + Mode *Selection `xmlrpc:"mode,omitempty"` + ProductCount *Int `xmlrpc:"product_count,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// UpdateProductAttributeValues represents array of update.product.attribute.value model. +type UpdateProductAttributeValues []UpdateProductAttributeValue + +// UpdateProductAttributeValueModel is the odoo model name. +const UpdateProductAttributeValueModel = "update.product.attribute.value" + +// Many2One convert UpdateProductAttributeValue to *Many2One. +func (upav *UpdateProductAttributeValue) Many2One() *Many2One { + return NewMany2One(upav.Id.Get(), "") +} + +// CreateUpdateProductAttributeValue creates a new update.product.attribute.value model and returns its id. +func (c *Client) CreateUpdateProductAttributeValue(upav *UpdateProductAttributeValue) (int64, error) { + ids, err := c.CreateUpdateProductAttributeValues([]*UpdateProductAttributeValue{upav}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateUpdateProductAttributeValue creates a new update.product.attribute.value model and returns its id. +func (c *Client) CreateUpdateProductAttributeValues(upavs []*UpdateProductAttributeValue) ([]int64, error) { + var vv []interface{} + for _, v := range upavs { + vv = append(vv, v) + } + return c.Create(UpdateProductAttributeValueModel, vv, nil) +} + +// UpdateUpdateProductAttributeValue updates an existing update.product.attribute.value record. +func (c *Client) UpdateUpdateProductAttributeValue(upav *UpdateProductAttributeValue) error { + return c.UpdateUpdateProductAttributeValues([]int64{upav.Id.Get()}, upav) +} + +// UpdateUpdateProductAttributeValues updates existing update.product.attribute.value records. +// All records (represented by ids) will be updated by upav values. +func (c *Client) UpdateUpdateProductAttributeValues(ids []int64, upav *UpdateProductAttributeValue) error { + return c.Update(UpdateProductAttributeValueModel, ids, upav, nil) +} + +// DeleteUpdateProductAttributeValue deletes an existing update.product.attribute.value record. +func (c *Client) DeleteUpdateProductAttributeValue(id int64) error { + return c.DeleteUpdateProductAttributeValues([]int64{id}) +} + +// DeleteUpdateProductAttributeValues deletes existing update.product.attribute.value records. +func (c *Client) DeleteUpdateProductAttributeValues(ids []int64) error { + return c.Delete(UpdateProductAttributeValueModel, ids) +} + +// GetUpdateProductAttributeValue gets update.product.attribute.value existing record. +func (c *Client) GetUpdateProductAttributeValue(id int64) (*UpdateProductAttributeValue, error) { + upavs, err := c.GetUpdateProductAttributeValues([]int64{id}) + if err != nil { + return nil, err + } + return &((*upavs)[0]), nil +} + +// GetUpdateProductAttributeValues gets update.product.attribute.value existing records. +func (c *Client) GetUpdateProductAttributeValues(ids []int64) (*UpdateProductAttributeValues, error) { + upavs := &UpdateProductAttributeValues{} + if err := c.Read(UpdateProductAttributeValueModel, ids, nil, upavs); err != nil { + return nil, err + } + return upavs, nil +} + +// FindUpdateProductAttributeValue finds update.product.attribute.value record by querying it with criteria. +func (c *Client) FindUpdateProductAttributeValue(criteria *Criteria) (*UpdateProductAttributeValue, error) { + upavs := &UpdateProductAttributeValues{} + if err := c.SearchRead(UpdateProductAttributeValueModel, criteria, NewOptions().Limit(1), upavs); err != nil { + return nil, err + } + return &((*upavs)[0]), nil +} + +// FindUpdateProductAttributeValues finds update.product.attribute.value records by querying it +// and filtering it with criteria and options. +func (c *Client) FindUpdateProductAttributeValues(criteria *Criteria, options *Options) (*UpdateProductAttributeValues, error) { + upavs := &UpdateProductAttributeValues{} + if err := c.SearchRead(UpdateProductAttributeValueModel, criteria, options, upavs); err != nil { + return nil, err + } + return upavs, nil +} + +// FindUpdateProductAttributeValueIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindUpdateProductAttributeValueIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(UpdateProductAttributeValueModel, criteria, options) +} + +// FindUpdateProductAttributeValueId finds record id by querying it with criteria. +func (c *Client) FindUpdateProductAttributeValueId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(UpdateProductAttributeValueModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/utm_campaign.go b/utm_campaign.go new file mode 100644 index 0000000..8cc160f --- /dev/null +++ b/utm_campaign.go @@ -0,0 +1,130 @@ +package odoo + +// UtmCampaign represents utm.campaign model. +type UtmCampaign struct { + Active *Bool `xmlrpc:"active,omitempty"` + Color *Int `xmlrpc:"color,omitempty"` + CompanyId *Many2One `xmlrpc:"company_id,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + CrmLeadCount *Int `xmlrpc:"crm_lead_count,omitempty"` + CurrencyId *Many2One `xmlrpc:"currency_id,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + InvoicedAmount *Int `xmlrpc:"invoiced_amount,omitempty"` + IsAutoCampaign *Bool `xmlrpc:"is_auto_campaign,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + QuotationCount *Int `xmlrpc:"quotation_count,omitempty"` + StageId *Many2One `xmlrpc:"stage_id,omitempty"` + TagIds *Relation `xmlrpc:"tag_ids,omitempty"` + Title *String `xmlrpc:"title,omitempty"` + UseLeads *Bool `xmlrpc:"use_leads,omitempty"` + UserId *Many2One `xmlrpc:"user_id,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// UtmCampaigns represents array of utm.campaign model. +type UtmCampaigns []UtmCampaign + +// UtmCampaignModel is the odoo model name. +const UtmCampaignModel = "utm.campaign" + +// Many2One convert UtmCampaign to *Many2One. +func (uc *UtmCampaign) Many2One() *Many2One { + return NewMany2One(uc.Id.Get(), "") +} + +// CreateUtmCampaign creates a new utm.campaign model and returns its id. +func (c *Client) CreateUtmCampaign(uc *UtmCampaign) (int64, error) { + ids, err := c.CreateUtmCampaigns([]*UtmCampaign{uc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateUtmCampaign creates a new utm.campaign model and returns its id. +func (c *Client) CreateUtmCampaigns(ucs []*UtmCampaign) ([]int64, error) { + var vv []interface{} + for _, v := range ucs { + vv = append(vv, v) + } + return c.Create(UtmCampaignModel, vv, nil) +} + +// UpdateUtmCampaign updates an existing utm.campaign record. +func (c *Client) UpdateUtmCampaign(uc *UtmCampaign) error { + return c.UpdateUtmCampaigns([]int64{uc.Id.Get()}, uc) +} + +// UpdateUtmCampaigns updates existing utm.campaign records. +// All records (represented by ids) will be updated by uc values. +func (c *Client) UpdateUtmCampaigns(ids []int64, uc *UtmCampaign) error { + return c.Update(UtmCampaignModel, ids, uc, nil) +} + +// DeleteUtmCampaign deletes an existing utm.campaign record. +func (c *Client) DeleteUtmCampaign(id int64) error { + return c.DeleteUtmCampaigns([]int64{id}) +} + +// DeleteUtmCampaigns deletes existing utm.campaign records. +func (c *Client) DeleteUtmCampaigns(ids []int64) error { + return c.Delete(UtmCampaignModel, ids) +} + +// GetUtmCampaign gets utm.campaign existing record. +func (c *Client) GetUtmCampaign(id int64) (*UtmCampaign, error) { + ucs, err := c.GetUtmCampaigns([]int64{id}) + if err != nil { + return nil, err + } + return &((*ucs)[0]), nil +} + +// GetUtmCampaigns gets utm.campaign existing records. +func (c *Client) GetUtmCampaigns(ids []int64) (*UtmCampaigns, error) { + ucs := &UtmCampaigns{} + if err := c.Read(UtmCampaignModel, ids, nil, ucs); err != nil { + return nil, err + } + return ucs, nil +} + +// FindUtmCampaign finds utm.campaign record by querying it with criteria. +func (c *Client) FindUtmCampaign(criteria *Criteria) (*UtmCampaign, error) { + ucs := &UtmCampaigns{} + if err := c.SearchRead(UtmCampaignModel, criteria, NewOptions().Limit(1), ucs); err != nil { + return nil, err + } + return &((*ucs)[0]), nil +} + +// FindUtmCampaigns finds utm.campaign records by querying it +// and filtering it with criteria and options. +func (c *Client) FindUtmCampaigns(criteria *Criteria, options *Options) (*UtmCampaigns, error) { + ucs := &UtmCampaigns{} + if err := c.SearchRead(UtmCampaignModel, criteria, options, ucs); err != nil { + return nil, err + } + return ucs, nil +} + +// FindUtmCampaignIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindUtmCampaignIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(UtmCampaignModel, criteria, options) +} + +// FindUtmCampaignId finds record id by querying it with criteria. +func (c *Client) FindUtmCampaignId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(UtmCampaignModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/utm_medium.go b/utm_medium.go new file mode 100644 index 0000000..249be55 --- /dev/null +++ b/utm_medium.go @@ -0,0 +1,118 @@ +package odoo + +// UtmMedium represents utm.medium model. +type UtmMedium struct { + Active *Bool `xmlrpc:"active,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// UtmMediums represents array of utm.medium model. +type UtmMediums []UtmMedium + +// UtmMediumModel is the odoo model name. +const UtmMediumModel = "utm.medium" + +// Many2One convert UtmMedium to *Many2One. +func (um *UtmMedium) Many2One() *Many2One { + return NewMany2One(um.Id.Get(), "") +} + +// CreateUtmMedium creates a new utm.medium model and returns its id. +func (c *Client) CreateUtmMedium(um *UtmMedium) (int64, error) { + ids, err := c.CreateUtmMediums([]*UtmMedium{um}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateUtmMedium creates a new utm.medium model and returns its id. +func (c *Client) CreateUtmMediums(ums []*UtmMedium) ([]int64, error) { + var vv []interface{} + for _, v := range ums { + vv = append(vv, v) + } + return c.Create(UtmMediumModel, vv, nil) +} + +// UpdateUtmMedium updates an existing utm.medium record. +func (c *Client) UpdateUtmMedium(um *UtmMedium) error { + return c.UpdateUtmMediums([]int64{um.Id.Get()}, um) +} + +// UpdateUtmMediums updates existing utm.medium records. +// All records (represented by ids) will be updated by um values. +func (c *Client) UpdateUtmMediums(ids []int64, um *UtmMedium) error { + return c.Update(UtmMediumModel, ids, um, nil) +} + +// DeleteUtmMedium deletes an existing utm.medium record. +func (c *Client) DeleteUtmMedium(id int64) error { + return c.DeleteUtmMediums([]int64{id}) +} + +// DeleteUtmMediums deletes existing utm.medium records. +func (c *Client) DeleteUtmMediums(ids []int64) error { + return c.Delete(UtmMediumModel, ids) +} + +// GetUtmMedium gets utm.medium existing record. +func (c *Client) GetUtmMedium(id int64) (*UtmMedium, error) { + ums, err := c.GetUtmMediums([]int64{id}) + if err != nil { + return nil, err + } + return &((*ums)[0]), nil +} + +// GetUtmMediums gets utm.medium existing records. +func (c *Client) GetUtmMediums(ids []int64) (*UtmMediums, error) { + ums := &UtmMediums{} + if err := c.Read(UtmMediumModel, ids, nil, ums); err != nil { + return nil, err + } + return ums, nil +} + +// FindUtmMedium finds utm.medium record by querying it with criteria. +func (c *Client) FindUtmMedium(criteria *Criteria) (*UtmMedium, error) { + ums := &UtmMediums{} + if err := c.SearchRead(UtmMediumModel, criteria, NewOptions().Limit(1), ums); err != nil { + return nil, err + } + return &((*ums)[0]), nil +} + +// FindUtmMediums finds utm.medium records by querying it +// and filtering it with criteria and options. +func (c *Client) FindUtmMediums(criteria *Criteria, options *Options) (*UtmMediums, error) { + ums := &UtmMediums{} + if err := c.SearchRead(UtmMediumModel, criteria, options, ums); err != nil { + return nil, err + } + return ums, nil +} + +// FindUtmMediumIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindUtmMediumIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(UtmMediumModel, criteria, options) +} + +// FindUtmMediumId finds record id by querying it with criteria. +func (c *Client) FindUtmMediumId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(UtmMediumModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/utm_source.go b/utm_source.go new file mode 100644 index 0000000..91bacfa --- /dev/null +++ b/utm_source.go @@ -0,0 +1,117 @@ +package odoo + +// UtmSource represents utm.source model. +type UtmSource struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// UtmSources represents array of utm.source model. +type UtmSources []UtmSource + +// UtmSourceModel is the odoo model name. +const UtmSourceModel = "utm.source" + +// Many2One convert UtmSource to *Many2One. +func (us *UtmSource) Many2One() *Many2One { + return NewMany2One(us.Id.Get(), "") +} + +// CreateUtmSource creates a new utm.source model and returns its id. +func (c *Client) CreateUtmSource(us *UtmSource) (int64, error) { + ids, err := c.CreateUtmSources([]*UtmSource{us}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateUtmSource creates a new utm.source model and returns its id. +func (c *Client) CreateUtmSources(uss []*UtmSource) ([]int64, error) { + var vv []interface{} + for _, v := range uss { + vv = append(vv, v) + } + return c.Create(UtmSourceModel, vv, nil) +} + +// UpdateUtmSource updates an existing utm.source record. +func (c *Client) UpdateUtmSource(us *UtmSource) error { + return c.UpdateUtmSources([]int64{us.Id.Get()}, us) +} + +// UpdateUtmSources updates existing utm.source records. +// All records (represented by ids) will be updated by us values. +func (c *Client) UpdateUtmSources(ids []int64, us *UtmSource) error { + return c.Update(UtmSourceModel, ids, us, nil) +} + +// DeleteUtmSource deletes an existing utm.source record. +func (c *Client) DeleteUtmSource(id int64) error { + return c.DeleteUtmSources([]int64{id}) +} + +// DeleteUtmSources deletes existing utm.source records. +func (c *Client) DeleteUtmSources(ids []int64) error { + return c.Delete(UtmSourceModel, ids) +} + +// GetUtmSource gets utm.source existing record. +func (c *Client) GetUtmSource(id int64) (*UtmSource, error) { + uss, err := c.GetUtmSources([]int64{id}) + if err != nil { + return nil, err + } + return &((*uss)[0]), nil +} + +// GetUtmSources gets utm.source existing records. +func (c *Client) GetUtmSources(ids []int64) (*UtmSources, error) { + uss := &UtmSources{} + if err := c.Read(UtmSourceModel, ids, nil, uss); err != nil { + return nil, err + } + return uss, nil +} + +// FindUtmSource finds utm.source record by querying it with criteria. +func (c *Client) FindUtmSource(criteria *Criteria) (*UtmSource, error) { + uss := &UtmSources{} + if err := c.SearchRead(UtmSourceModel, criteria, NewOptions().Limit(1), uss); err != nil { + return nil, err + } + return &((*uss)[0]), nil +} + +// FindUtmSources finds utm.source records by querying it +// and filtering it with criteria and options. +func (c *Client) FindUtmSources(criteria *Criteria, options *Options) (*UtmSources, error) { + uss := &UtmSources{} + if err := c.SearchRead(UtmSourceModel, criteria, options, uss); err != nil { + return nil, err + } + return uss, nil +} + +// FindUtmSourceIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindUtmSourceIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(UtmSourceModel, criteria, options) +} + +// FindUtmSourceId finds record id by querying it with criteria. +func (c *Client) FindUtmSourceId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(UtmSourceModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/utm_stage.go b/utm_stage.go new file mode 100644 index 0000000..c90c390 --- /dev/null +++ b/utm_stage.go @@ -0,0 +1,118 @@ +package odoo + +// UtmStage represents utm.stage model. +type UtmStage struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// UtmStages represents array of utm.stage model. +type UtmStages []UtmStage + +// UtmStageModel is the odoo model name. +const UtmStageModel = "utm.stage" + +// Many2One convert UtmStage to *Many2One. +func (us *UtmStage) Many2One() *Many2One { + return NewMany2One(us.Id.Get(), "") +} + +// CreateUtmStage creates a new utm.stage model and returns its id. +func (c *Client) CreateUtmStage(us *UtmStage) (int64, error) { + ids, err := c.CreateUtmStages([]*UtmStage{us}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateUtmStage creates a new utm.stage model and returns its id. +func (c *Client) CreateUtmStages(uss []*UtmStage) ([]int64, error) { + var vv []interface{} + for _, v := range uss { + vv = append(vv, v) + } + return c.Create(UtmStageModel, vv, nil) +} + +// UpdateUtmStage updates an existing utm.stage record. +func (c *Client) UpdateUtmStage(us *UtmStage) error { + return c.UpdateUtmStages([]int64{us.Id.Get()}, us) +} + +// UpdateUtmStages updates existing utm.stage records. +// All records (represented by ids) will be updated by us values. +func (c *Client) UpdateUtmStages(ids []int64, us *UtmStage) error { + return c.Update(UtmStageModel, ids, us, nil) +} + +// DeleteUtmStage deletes an existing utm.stage record. +func (c *Client) DeleteUtmStage(id int64) error { + return c.DeleteUtmStages([]int64{id}) +} + +// DeleteUtmStages deletes existing utm.stage records. +func (c *Client) DeleteUtmStages(ids []int64) error { + return c.Delete(UtmStageModel, ids) +} + +// GetUtmStage gets utm.stage existing record. +func (c *Client) GetUtmStage(id int64) (*UtmStage, error) { + uss, err := c.GetUtmStages([]int64{id}) + if err != nil { + return nil, err + } + return &((*uss)[0]), nil +} + +// GetUtmStages gets utm.stage existing records. +func (c *Client) GetUtmStages(ids []int64) (*UtmStages, error) { + uss := &UtmStages{} + if err := c.Read(UtmStageModel, ids, nil, uss); err != nil { + return nil, err + } + return uss, nil +} + +// FindUtmStage finds utm.stage record by querying it with criteria. +func (c *Client) FindUtmStage(criteria *Criteria) (*UtmStage, error) { + uss := &UtmStages{} + if err := c.SearchRead(UtmStageModel, criteria, NewOptions().Limit(1), uss); err != nil { + return nil, err + } + return &((*uss)[0]), nil +} + +// FindUtmStages finds utm.stage records by querying it +// and filtering it with criteria and options. +func (c *Client) FindUtmStages(criteria *Criteria, options *Options) (*UtmStages, error) { + uss := &UtmStages{} + if err := c.SearchRead(UtmStageModel, criteria, options, uss); err != nil { + return nil, err + } + return uss, nil +} + +// FindUtmStageIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindUtmStageIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(UtmStageModel, criteria, options) +} + +// FindUtmStageId finds record id by querying it with criteria. +func (c *Client) FindUtmStageId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(UtmStageModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/utm_tag.go b/utm_tag.go new file mode 100644 index 0000000..efd8be6 --- /dev/null +++ b/utm_tag.go @@ -0,0 +1,118 @@ +package odoo + +// UtmTag represents utm.tag model. +type UtmTag struct { + Color *Int `xmlrpc:"color,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// UtmTags represents array of utm.tag model. +type UtmTags []UtmTag + +// UtmTagModel is the odoo model name. +const UtmTagModel = "utm.tag" + +// Many2One convert UtmTag to *Many2One. +func (ut *UtmTag) Many2One() *Many2One { + return NewMany2One(ut.Id.Get(), "") +} + +// CreateUtmTag creates a new utm.tag model and returns its id. +func (c *Client) CreateUtmTag(ut *UtmTag) (int64, error) { + ids, err := c.CreateUtmTags([]*UtmTag{ut}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateUtmTag creates a new utm.tag model and returns its id. +func (c *Client) CreateUtmTags(uts []*UtmTag) ([]int64, error) { + var vv []interface{} + for _, v := range uts { + vv = append(vv, v) + } + return c.Create(UtmTagModel, vv, nil) +} + +// UpdateUtmTag updates an existing utm.tag record. +func (c *Client) UpdateUtmTag(ut *UtmTag) error { + return c.UpdateUtmTags([]int64{ut.Id.Get()}, ut) +} + +// UpdateUtmTags updates existing utm.tag records. +// All records (represented by ids) will be updated by ut values. +func (c *Client) UpdateUtmTags(ids []int64, ut *UtmTag) error { + return c.Update(UtmTagModel, ids, ut, nil) +} + +// DeleteUtmTag deletes an existing utm.tag record. +func (c *Client) DeleteUtmTag(id int64) error { + return c.DeleteUtmTags([]int64{id}) +} + +// DeleteUtmTags deletes existing utm.tag records. +func (c *Client) DeleteUtmTags(ids []int64) error { + return c.Delete(UtmTagModel, ids) +} + +// GetUtmTag gets utm.tag existing record. +func (c *Client) GetUtmTag(id int64) (*UtmTag, error) { + uts, err := c.GetUtmTags([]int64{id}) + if err != nil { + return nil, err + } + return &((*uts)[0]), nil +} + +// GetUtmTags gets utm.tag existing records. +func (c *Client) GetUtmTags(ids []int64) (*UtmTags, error) { + uts := &UtmTags{} + if err := c.Read(UtmTagModel, ids, nil, uts); err != nil { + return nil, err + } + return uts, nil +} + +// FindUtmTag finds utm.tag record by querying it with criteria. +func (c *Client) FindUtmTag(criteria *Criteria) (*UtmTag, error) { + uts := &UtmTags{} + if err := c.SearchRead(UtmTagModel, criteria, NewOptions().Limit(1), uts); err != nil { + return nil, err + } + return &((*uts)[0]), nil +} + +// FindUtmTags finds utm.tag records by querying it +// and filtering it with criteria and options. +func (c *Client) FindUtmTags(criteria *Criteria, options *Options) (*UtmTags, error) { + uts := &UtmTags{} + if err := c.SearchRead(UtmTagModel, criteria, options, uts); err != nil { + return nil, err + } + return uts, nil +} + +// FindUtmTagIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindUtmTagIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(UtmTagModel, criteria, options) +} + +// FindUtmTagId finds record id by querying it with criteria. +func (c *Client) FindUtmTagId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(UtmTagModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/validate_account_move.go b/validate_account_move.go new file mode 100644 index 0000000..074d685 --- /dev/null +++ b/validate_account_move.go @@ -0,0 +1,124 @@ +package odoo + +// ValidateAccountMove represents validate.account.move model. +type ValidateAccountMove struct { + AbnormalAmountPartnerIds *Relation `xmlrpc:"abnormal_amount_partner_ids,omitempty"` + AbnormalDatePartnerIds *Relation `xmlrpc:"abnormal_date_partner_ids,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayForcePost *Bool `xmlrpc:"display_force_post,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + ForcePost *Bool `xmlrpc:"force_post,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + IgnoreAbnormalAmount *Bool `xmlrpc:"ignore_abnormal_amount,omitempty"` + IgnoreAbnormalDate *Bool `xmlrpc:"ignore_abnormal_date,omitempty"` + IsEntries *Bool `xmlrpc:"is_entries,omitempty"` + MoveIds *Relation `xmlrpc:"move_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// ValidateAccountMoves represents array of validate.account.move model. +type ValidateAccountMoves []ValidateAccountMove + +// ValidateAccountMoveModel is the odoo model name. +const ValidateAccountMoveModel = "validate.account.move" + +// Many2One convert ValidateAccountMove to *Many2One. +func (vam *ValidateAccountMove) Many2One() *Many2One { + return NewMany2One(vam.Id.Get(), "") +} + +// CreateValidateAccountMove creates a new validate.account.move model and returns its id. +func (c *Client) CreateValidateAccountMove(vam *ValidateAccountMove) (int64, error) { + ids, err := c.CreateValidateAccountMoves([]*ValidateAccountMove{vam}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateValidateAccountMove creates a new validate.account.move model and returns its id. +func (c *Client) CreateValidateAccountMoves(vams []*ValidateAccountMove) ([]int64, error) { + var vv []interface{} + for _, v := range vams { + vv = append(vv, v) + } + return c.Create(ValidateAccountMoveModel, vv, nil) +} + +// UpdateValidateAccountMove updates an existing validate.account.move record. +func (c *Client) UpdateValidateAccountMove(vam *ValidateAccountMove) error { + return c.UpdateValidateAccountMoves([]int64{vam.Id.Get()}, vam) +} + +// UpdateValidateAccountMoves updates existing validate.account.move records. +// All records (represented by ids) will be updated by vam values. +func (c *Client) UpdateValidateAccountMoves(ids []int64, vam *ValidateAccountMove) error { + return c.Update(ValidateAccountMoveModel, ids, vam, nil) +} + +// DeleteValidateAccountMove deletes an existing validate.account.move record. +func (c *Client) DeleteValidateAccountMove(id int64) error { + return c.DeleteValidateAccountMoves([]int64{id}) +} + +// DeleteValidateAccountMoves deletes existing validate.account.move records. +func (c *Client) DeleteValidateAccountMoves(ids []int64) error { + return c.Delete(ValidateAccountMoveModel, ids) +} + +// GetValidateAccountMove gets validate.account.move existing record. +func (c *Client) GetValidateAccountMove(id int64) (*ValidateAccountMove, error) { + vams, err := c.GetValidateAccountMoves([]int64{id}) + if err != nil { + return nil, err + } + return &((*vams)[0]), nil +} + +// GetValidateAccountMoves gets validate.account.move existing records. +func (c *Client) GetValidateAccountMoves(ids []int64) (*ValidateAccountMoves, error) { + vams := &ValidateAccountMoves{} + if err := c.Read(ValidateAccountMoveModel, ids, nil, vams); err != nil { + return nil, err + } + return vams, nil +} + +// FindValidateAccountMove finds validate.account.move record by querying it with criteria. +func (c *Client) FindValidateAccountMove(criteria *Criteria) (*ValidateAccountMove, error) { + vams := &ValidateAccountMoves{} + if err := c.SearchRead(ValidateAccountMoveModel, criteria, NewOptions().Limit(1), vams); err != nil { + return nil, err + } + return &((*vams)[0]), nil +} + +// FindValidateAccountMoves finds validate.account.move records by querying it +// and filtering it with criteria and options. +func (c *Client) FindValidateAccountMoves(criteria *Criteria, options *Options) (*ValidateAccountMoves, error) { + vams := &ValidateAccountMoves{} + if err := c.SearchRead(ValidateAccountMoveModel, criteria, options, vams); err != nil { + return nil, err + } + return vams, nil +} + +// FindValidateAccountMoveIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindValidateAccountMoveIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(ValidateAccountMoveModel, criteria, options) +} + +// FindValidateAccountMoveId finds record id by querying it with criteria. +func (c *Client) FindValidateAccountMoveId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(ValidateAccountMoveModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/version.go b/version.go new file mode 100644 index 0000000..c5a735b --- /dev/null +++ b/version.go @@ -0,0 +1,9 @@ +package odoo + +// Version describes odoo instance version. +type Version struct { + ServerVersion *String `xmlrpc:"server_version"` + ServerVersionInfo interface{} `xmlrpc:"server_version_info"` + ServerSerie *String `xmlrpc:"server_serie"` + ProtocolVersion *Int `xmlrpc:"protocol_version"` +} diff --git a/web_editor_converter_test.go b/web_editor_converter_test.go new file mode 100644 index 0000000..57d2774 --- /dev/null +++ b/web_editor_converter_test.go @@ -0,0 +1,127 @@ +package odoo + +// WebEditorConverterTest represents web_editor.converter.test model. +type WebEditorConverterTest struct { + Binary *String `xmlrpc:"binary,omitempty"` + Char *String `xmlrpc:"char,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Date *Time `xmlrpc:"date,omitempty"` + Datetime *Time `xmlrpc:"datetime,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Float *Float `xmlrpc:"float,omitempty"` + Html *String `xmlrpc:"html,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Integer *Int `xmlrpc:"integer,omitempty"` + Many2One *Many2One `xmlrpc:"many2one,omitempty"` + Numeric *Float `xmlrpc:"numeric,omitempty"` + SelectionStr *Selection `xmlrpc:"selection_str,omitempty"` + Text *String `xmlrpc:"text,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// WebEditorConverterTests represents array of web_editor.converter.test model. +type WebEditorConverterTests []WebEditorConverterTest + +// WebEditorConverterTestModel is the odoo model name. +const WebEditorConverterTestModel = "web_editor.converter.test" + +// Many2One convert WebEditorConverterTest to *Many2One. +func (wct *WebEditorConverterTest) Many2One() *Many2One { + return NewMany2One(wct.Id.Get(), "") +} + +// CreateWebEditorConverterTest creates a new web_editor.converter.test model and returns its id. +func (c *Client) CreateWebEditorConverterTest(wct *WebEditorConverterTest) (int64, error) { + ids, err := c.CreateWebEditorConverterTests([]*WebEditorConverterTest{wct}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateWebEditorConverterTest creates a new web_editor.converter.test model and returns its id. +func (c *Client) CreateWebEditorConverterTests(wcts []*WebEditorConverterTest) ([]int64, error) { + var vv []interface{} + for _, v := range wcts { + vv = append(vv, v) + } + return c.Create(WebEditorConverterTestModel, vv, nil) +} + +// UpdateWebEditorConverterTest updates an existing web_editor.converter.test record. +func (c *Client) UpdateWebEditorConverterTest(wct *WebEditorConverterTest) error { + return c.UpdateWebEditorConverterTests([]int64{wct.Id.Get()}, wct) +} + +// UpdateWebEditorConverterTests updates existing web_editor.converter.test records. +// All records (represented by ids) will be updated by wct values. +func (c *Client) UpdateWebEditorConverterTests(ids []int64, wct *WebEditorConverterTest) error { + return c.Update(WebEditorConverterTestModel, ids, wct, nil) +} + +// DeleteWebEditorConverterTest deletes an existing web_editor.converter.test record. +func (c *Client) DeleteWebEditorConverterTest(id int64) error { + return c.DeleteWebEditorConverterTests([]int64{id}) +} + +// DeleteWebEditorConverterTests deletes existing web_editor.converter.test records. +func (c *Client) DeleteWebEditorConverterTests(ids []int64) error { + return c.Delete(WebEditorConverterTestModel, ids) +} + +// GetWebEditorConverterTest gets web_editor.converter.test existing record. +func (c *Client) GetWebEditorConverterTest(id int64) (*WebEditorConverterTest, error) { + wcts, err := c.GetWebEditorConverterTests([]int64{id}) + if err != nil { + return nil, err + } + return &((*wcts)[0]), nil +} + +// GetWebEditorConverterTests gets web_editor.converter.test existing records. +func (c *Client) GetWebEditorConverterTests(ids []int64) (*WebEditorConverterTests, error) { + wcts := &WebEditorConverterTests{} + if err := c.Read(WebEditorConverterTestModel, ids, nil, wcts); err != nil { + return nil, err + } + return wcts, nil +} + +// FindWebEditorConverterTest finds web_editor.converter.test record by querying it with criteria. +func (c *Client) FindWebEditorConverterTest(criteria *Criteria) (*WebEditorConverterTest, error) { + wcts := &WebEditorConverterTests{} + if err := c.SearchRead(WebEditorConverterTestModel, criteria, NewOptions().Limit(1), wcts); err != nil { + return nil, err + } + return &((*wcts)[0]), nil +} + +// FindWebEditorConverterTests finds web_editor.converter.test records by querying it +// and filtering it with criteria and options. +func (c *Client) FindWebEditorConverterTests(criteria *Criteria, options *Options) (*WebEditorConverterTests, error) { + wcts := &WebEditorConverterTests{} + if err := c.SearchRead(WebEditorConverterTestModel, criteria, options, wcts); err != nil { + return nil, err + } + return wcts, nil +} + +// FindWebEditorConverterTestIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindWebEditorConverterTestIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(WebEditorConverterTestModel, criteria, options) +} + +// FindWebEditorConverterTestId finds record id by querying it with criteria. +func (c *Client) FindWebEditorConverterTestId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(WebEditorConverterTestModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/web_editor_converter_test_sub.go b/web_editor_converter_test_sub.go new file mode 100644 index 0000000..cfd5b73 --- /dev/null +++ b/web_editor_converter_test_sub.go @@ -0,0 +1,117 @@ +package odoo + +// WebEditorConverterTestSub represents web_editor.converter.test.sub model. +type WebEditorConverterTestSub struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// WebEditorConverterTestSubs represents array of web_editor.converter.test.sub model. +type WebEditorConverterTestSubs []WebEditorConverterTestSub + +// WebEditorConverterTestSubModel is the odoo model name. +const WebEditorConverterTestSubModel = "web_editor.converter.test.sub" + +// Many2One convert WebEditorConverterTestSub to *Many2One. +func (wcts *WebEditorConverterTestSub) Many2One() *Many2One { + return NewMany2One(wcts.Id.Get(), "") +} + +// CreateWebEditorConverterTestSub creates a new web_editor.converter.test.sub model and returns its id. +func (c *Client) CreateWebEditorConverterTestSub(wcts *WebEditorConverterTestSub) (int64, error) { + ids, err := c.CreateWebEditorConverterTestSubs([]*WebEditorConverterTestSub{wcts}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateWebEditorConverterTestSub creates a new web_editor.converter.test.sub model and returns its id. +func (c *Client) CreateWebEditorConverterTestSubs(wctss []*WebEditorConverterTestSub) ([]int64, error) { + var vv []interface{} + for _, v := range wctss { + vv = append(vv, v) + } + return c.Create(WebEditorConverterTestSubModel, vv, nil) +} + +// UpdateWebEditorConverterTestSub updates an existing web_editor.converter.test.sub record. +func (c *Client) UpdateWebEditorConverterTestSub(wcts *WebEditorConverterTestSub) error { + return c.UpdateWebEditorConverterTestSubs([]int64{wcts.Id.Get()}, wcts) +} + +// UpdateWebEditorConverterTestSubs updates existing web_editor.converter.test.sub records. +// All records (represented by ids) will be updated by wcts values. +func (c *Client) UpdateWebEditorConverterTestSubs(ids []int64, wcts *WebEditorConverterTestSub) error { + return c.Update(WebEditorConverterTestSubModel, ids, wcts, nil) +} + +// DeleteWebEditorConverterTestSub deletes an existing web_editor.converter.test.sub record. +func (c *Client) DeleteWebEditorConverterTestSub(id int64) error { + return c.DeleteWebEditorConverterTestSubs([]int64{id}) +} + +// DeleteWebEditorConverterTestSubs deletes existing web_editor.converter.test.sub records. +func (c *Client) DeleteWebEditorConverterTestSubs(ids []int64) error { + return c.Delete(WebEditorConverterTestSubModel, ids) +} + +// GetWebEditorConverterTestSub gets web_editor.converter.test.sub existing record. +func (c *Client) GetWebEditorConverterTestSub(id int64) (*WebEditorConverterTestSub, error) { + wctss, err := c.GetWebEditorConverterTestSubs([]int64{id}) + if err != nil { + return nil, err + } + return &((*wctss)[0]), nil +} + +// GetWebEditorConverterTestSubs gets web_editor.converter.test.sub existing records. +func (c *Client) GetWebEditorConverterTestSubs(ids []int64) (*WebEditorConverterTestSubs, error) { + wctss := &WebEditorConverterTestSubs{} + if err := c.Read(WebEditorConverterTestSubModel, ids, nil, wctss); err != nil { + return nil, err + } + return wctss, nil +} + +// FindWebEditorConverterTestSub finds web_editor.converter.test.sub record by querying it with criteria. +func (c *Client) FindWebEditorConverterTestSub(criteria *Criteria) (*WebEditorConverterTestSub, error) { + wctss := &WebEditorConverterTestSubs{} + if err := c.SearchRead(WebEditorConverterTestSubModel, criteria, NewOptions().Limit(1), wctss); err != nil { + return nil, err + } + return &((*wctss)[0]), nil +} + +// FindWebEditorConverterTestSubs finds web_editor.converter.test.sub records by querying it +// and filtering it with criteria and options. +func (c *Client) FindWebEditorConverterTestSubs(criteria *Criteria, options *Options) (*WebEditorConverterTestSubs, error) { + wctss := &WebEditorConverterTestSubs{} + if err := c.SearchRead(WebEditorConverterTestSubModel, criteria, options, wctss); err != nil { + return nil, err + } + return wctss, nil +} + +// FindWebEditorConverterTestSubIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindWebEditorConverterTestSubIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(WebEditorConverterTestSubModel, criteria, options) +} + +// FindWebEditorConverterTestSubId finds record id by querying it with criteria. +func (c *Client) FindWebEditorConverterTestSubId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(WebEditorConverterTestSubModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/web_tour_tour.go b/web_tour_tour.go new file mode 100644 index 0000000..e0f0576 --- /dev/null +++ b/web_tour_tour.go @@ -0,0 +1,124 @@ +package odoo + +// WebTourTour represents web_tour.tour model. +type WebTourTour struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + Custom *Bool `xmlrpc:"custom,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + RainbowManMessage *String `xmlrpc:"rainbow_man_message,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + SharingUrl *String `xmlrpc:"sharing_url,omitempty"` + StepIds *Relation `xmlrpc:"step_ids,omitempty"` + Url *String `xmlrpc:"url,omitempty"` + UserConsumedIds *Relation `xmlrpc:"user_consumed_ids,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// WebTourTours represents array of web_tour.tour model. +type WebTourTours []WebTourTour + +// WebTourTourModel is the odoo model name. +const WebTourTourModel = "web_tour.tour" + +// Many2One convert WebTourTour to *Many2One. +func (wt *WebTourTour) Many2One() *Many2One { + return NewMany2One(wt.Id.Get(), "") +} + +// CreateWebTourTour creates a new web_tour.tour model and returns its id. +func (c *Client) CreateWebTourTour(wt *WebTourTour) (int64, error) { + ids, err := c.CreateWebTourTours([]*WebTourTour{wt}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateWebTourTour creates a new web_tour.tour model and returns its id. +func (c *Client) CreateWebTourTours(wts []*WebTourTour) ([]int64, error) { + var vv []interface{} + for _, v := range wts { + vv = append(vv, v) + } + return c.Create(WebTourTourModel, vv, nil) +} + +// UpdateWebTourTour updates an existing web_tour.tour record. +func (c *Client) UpdateWebTourTour(wt *WebTourTour) error { + return c.UpdateWebTourTours([]int64{wt.Id.Get()}, wt) +} + +// UpdateWebTourTours updates existing web_tour.tour records. +// All records (represented by ids) will be updated by wt values. +func (c *Client) UpdateWebTourTours(ids []int64, wt *WebTourTour) error { + return c.Update(WebTourTourModel, ids, wt, nil) +} + +// DeleteWebTourTour deletes an existing web_tour.tour record. +func (c *Client) DeleteWebTourTour(id int64) error { + return c.DeleteWebTourTours([]int64{id}) +} + +// DeleteWebTourTours deletes existing web_tour.tour records. +func (c *Client) DeleteWebTourTours(ids []int64) error { + return c.Delete(WebTourTourModel, ids) +} + +// GetWebTourTour gets web_tour.tour existing record. +func (c *Client) GetWebTourTour(id int64) (*WebTourTour, error) { + wts, err := c.GetWebTourTours([]int64{id}) + if err != nil { + return nil, err + } + return &((*wts)[0]), nil +} + +// GetWebTourTours gets web_tour.tour existing records. +func (c *Client) GetWebTourTours(ids []int64) (*WebTourTours, error) { + wts := &WebTourTours{} + if err := c.Read(WebTourTourModel, ids, nil, wts); err != nil { + return nil, err + } + return wts, nil +} + +// FindWebTourTour finds web_tour.tour record by querying it with criteria. +func (c *Client) FindWebTourTour(criteria *Criteria) (*WebTourTour, error) { + wts := &WebTourTours{} + if err := c.SearchRead(WebTourTourModel, criteria, NewOptions().Limit(1), wts); err != nil { + return nil, err + } + return &((*wts)[0]), nil +} + +// FindWebTourTours finds web_tour.tour records by querying it +// and filtering it with criteria and options. +func (c *Client) FindWebTourTours(criteria *Criteria, options *Options) (*WebTourTours, error) { + wts := &WebTourTours{} + if err := c.SearchRead(WebTourTourModel, criteria, options, wts); err != nil { + return nil, err + } + return wts, nil +} + +// FindWebTourTourIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindWebTourTourIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(WebTourTourModel, criteria, options) +} + +// FindWebTourTourId finds record id by querying it with criteria. +func (c *Client) FindWebTourTourId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(WebTourTourModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/web_tour_tour_step.go b/web_tour_tour_step.go new file mode 100644 index 0000000..c3f0ed2 --- /dev/null +++ b/web_tour_tour_step.go @@ -0,0 +1,121 @@ +package odoo + +// WebTourTourStep represents web_tour.tour.step model. +type WebTourTourStep struct { + Content *String `xmlrpc:"content,omitempty"` + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + Run *String `xmlrpc:"run,omitempty"` + Sequence *Int `xmlrpc:"sequence,omitempty"` + TourId *Many2One `xmlrpc:"tour_id,omitempty"` + Trigger *String `xmlrpc:"trigger,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// WebTourTourSteps represents array of web_tour.tour.step model. +type WebTourTourSteps []WebTourTourStep + +// WebTourTourStepModel is the odoo model name. +const WebTourTourStepModel = "web_tour.tour.step" + +// Many2One convert WebTourTourStep to *Many2One. +func (wts *WebTourTourStep) Many2One() *Many2One { + return NewMany2One(wts.Id.Get(), "") +} + +// CreateWebTourTourStep creates a new web_tour.tour.step model and returns its id. +func (c *Client) CreateWebTourTourStep(wts *WebTourTourStep) (int64, error) { + ids, err := c.CreateWebTourTourSteps([]*WebTourTourStep{wts}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateWebTourTourStep creates a new web_tour.tour.step model and returns its id. +func (c *Client) CreateWebTourTourSteps(wtss []*WebTourTourStep) ([]int64, error) { + var vv []interface{} + for _, v := range wtss { + vv = append(vv, v) + } + return c.Create(WebTourTourStepModel, vv, nil) +} + +// UpdateWebTourTourStep updates an existing web_tour.tour.step record. +func (c *Client) UpdateWebTourTourStep(wts *WebTourTourStep) error { + return c.UpdateWebTourTourSteps([]int64{wts.Id.Get()}, wts) +} + +// UpdateWebTourTourSteps updates existing web_tour.tour.step records. +// All records (represented by ids) will be updated by wts values. +func (c *Client) UpdateWebTourTourSteps(ids []int64, wts *WebTourTourStep) error { + return c.Update(WebTourTourStepModel, ids, wts, nil) +} + +// DeleteWebTourTourStep deletes an existing web_tour.tour.step record. +func (c *Client) DeleteWebTourTourStep(id int64) error { + return c.DeleteWebTourTourSteps([]int64{id}) +} + +// DeleteWebTourTourSteps deletes existing web_tour.tour.step records. +func (c *Client) DeleteWebTourTourSteps(ids []int64) error { + return c.Delete(WebTourTourStepModel, ids) +} + +// GetWebTourTourStep gets web_tour.tour.step existing record. +func (c *Client) GetWebTourTourStep(id int64) (*WebTourTourStep, error) { + wtss, err := c.GetWebTourTourSteps([]int64{id}) + if err != nil { + return nil, err + } + return &((*wtss)[0]), nil +} + +// GetWebTourTourSteps gets web_tour.tour.step existing records. +func (c *Client) GetWebTourTourSteps(ids []int64) (*WebTourTourSteps, error) { + wtss := &WebTourTourSteps{} + if err := c.Read(WebTourTourStepModel, ids, nil, wtss); err != nil { + return nil, err + } + return wtss, nil +} + +// FindWebTourTourStep finds web_tour.tour.step record by querying it with criteria. +func (c *Client) FindWebTourTourStep(criteria *Criteria) (*WebTourTourStep, error) { + wtss := &WebTourTourSteps{} + if err := c.SearchRead(WebTourTourStepModel, criteria, NewOptions().Limit(1), wtss); err != nil { + return nil, err + } + return &((*wtss)[0]), nil +} + +// FindWebTourTourSteps finds web_tour.tour.step records by querying it +// and filtering it with criteria and options. +func (c *Client) FindWebTourTourSteps(criteria *Criteria, options *Options) (*WebTourTourSteps, error) { + wtss := &WebTourTourSteps{} + if err := c.SearchRead(WebTourTourStepModel, criteria, options, wtss); err != nil { + return nil, err + } + return wtss, nil +} + +// FindWebTourTourStepIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindWebTourTourStepIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(WebTourTourStepModel, criteria, options) +} + +// FindWebTourTourStepId finds record id by querying it with criteria. +func (c *Client) FindWebTourTourStepId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(WebTourTourStepModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +} diff --git a/wizard_ir_model_menu_create.go b/wizard_ir_model_menu_create.go new file mode 100644 index 0000000..eec8003 --- /dev/null +++ b/wizard_ir_model_menu_create.go @@ -0,0 +1,118 @@ +package odoo + +// WizardIrModelMenuCreate represents wizard.ir.model.menu.create model. +type WizardIrModelMenuCreate struct { + CreateDate *Time `xmlrpc:"create_date,omitempty"` + CreateUid *Many2One `xmlrpc:"create_uid,omitempty"` + DisplayName *String `xmlrpc:"display_name,omitempty"` + Id *Int `xmlrpc:"id,omitempty"` + MenuId *Many2One `xmlrpc:"menu_id,omitempty"` + Name *String `xmlrpc:"name,omitempty"` + WriteDate *Time `xmlrpc:"write_date,omitempty"` + WriteUid *Many2One `xmlrpc:"write_uid,omitempty"` +} + +// WizardIrModelMenuCreates represents array of wizard.ir.model.menu.create model. +type WizardIrModelMenuCreates []WizardIrModelMenuCreate + +// WizardIrModelMenuCreateModel is the odoo model name. +const WizardIrModelMenuCreateModel = "wizard.ir.model.menu.create" + +// Many2One convert WizardIrModelMenuCreate to *Many2One. +func (wimmc *WizardIrModelMenuCreate) Many2One() *Many2One { + return NewMany2One(wimmc.Id.Get(), "") +} + +// CreateWizardIrModelMenuCreate creates a new wizard.ir.model.menu.create model and returns its id. +func (c *Client) CreateWizardIrModelMenuCreate(wimmc *WizardIrModelMenuCreate) (int64, error) { + ids, err := c.CreateWizardIrModelMenuCreates([]*WizardIrModelMenuCreate{wimmc}) + if err != nil { + return -1, err + } + if len(ids) == 0 { + return -1, nil + } + return ids[0], nil +} + +// CreateWizardIrModelMenuCreate creates a new wizard.ir.model.menu.create model and returns its id. +func (c *Client) CreateWizardIrModelMenuCreates(wimmcs []*WizardIrModelMenuCreate) ([]int64, error) { + var vv []interface{} + for _, v := range wimmcs { + vv = append(vv, v) + } + return c.Create(WizardIrModelMenuCreateModel, vv, nil) +} + +// UpdateWizardIrModelMenuCreate updates an existing wizard.ir.model.menu.create record. +func (c *Client) UpdateWizardIrModelMenuCreate(wimmc *WizardIrModelMenuCreate) error { + return c.UpdateWizardIrModelMenuCreates([]int64{wimmc.Id.Get()}, wimmc) +} + +// UpdateWizardIrModelMenuCreates updates existing wizard.ir.model.menu.create records. +// All records (represented by ids) will be updated by wimmc values. +func (c *Client) UpdateWizardIrModelMenuCreates(ids []int64, wimmc *WizardIrModelMenuCreate) error { + return c.Update(WizardIrModelMenuCreateModel, ids, wimmc, nil) +} + +// DeleteWizardIrModelMenuCreate deletes an existing wizard.ir.model.menu.create record. +func (c *Client) DeleteWizardIrModelMenuCreate(id int64) error { + return c.DeleteWizardIrModelMenuCreates([]int64{id}) +} + +// DeleteWizardIrModelMenuCreates deletes existing wizard.ir.model.menu.create records. +func (c *Client) DeleteWizardIrModelMenuCreates(ids []int64) error { + return c.Delete(WizardIrModelMenuCreateModel, ids) +} + +// GetWizardIrModelMenuCreate gets wizard.ir.model.menu.create existing record. +func (c *Client) GetWizardIrModelMenuCreate(id int64) (*WizardIrModelMenuCreate, error) { + wimmcs, err := c.GetWizardIrModelMenuCreates([]int64{id}) + if err != nil { + return nil, err + } + return &((*wimmcs)[0]), nil +} + +// GetWizardIrModelMenuCreates gets wizard.ir.model.menu.create existing records. +func (c *Client) GetWizardIrModelMenuCreates(ids []int64) (*WizardIrModelMenuCreates, error) { + wimmcs := &WizardIrModelMenuCreates{} + if err := c.Read(WizardIrModelMenuCreateModel, ids, nil, wimmcs); err != nil { + return nil, err + } + return wimmcs, nil +} + +// FindWizardIrModelMenuCreate finds wizard.ir.model.menu.create record by querying it with criteria. +func (c *Client) FindWizardIrModelMenuCreate(criteria *Criteria) (*WizardIrModelMenuCreate, error) { + wimmcs := &WizardIrModelMenuCreates{} + if err := c.SearchRead(WizardIrModelMenuCreateModel, criteria, NewOptions().Limit(1), wimmcs); err != nil { + return nil, err + } + return &((*wimmcs)[0]), nil +} + +// FindWizardIrModelMenuCreates finds wizard.ir.model.menu.create records by querying it +// and filtering it with criteria and options. +func (c *Client) FindWizardIrModelMenuCreates(criteria *Criteria, options *Options) (*WizardIrModelMenuCreates, error) { + wimmcs := &WizardIrModelMenuCreates{} + if err := c.SearchRead(WizardIrModelMenuCreateModel, criteria, options, wimmcs); err != nil { + return nil, err + } + return wimmcs, nil +} + +// FindWizardIrModelMenuCreateIds finds records ids by querying it +// and filtering it with criteria and options. +func (c *Client) FindWizardIrModelMenuCreateIds(criteria *Criteria, options *Options) ([]int64, error) { + return c.Search(WizardIrModelMenuCreateModel, criteria, options) +} + +// FindWizardIrModelMenuCreateId finds record id by querying it with criteria. +func (c *Client) FindWizardIrModelMenuCreateId(criteria *Criteria, options *Options) (int64, error) { + ids, err := c.Search(WizardIrModelMenuCreateModel, criteria, options) + if err != nil { + return -1, err + } + return ids[0], nil +}